diff --git a/.gitignore b/.gitignore index 9511e9ede2f..b2a905641ba 100644 --- a/.gitignore +++ b/.gitignore @@ -62,7 +62,6 @@ tools/cli/build/ awsapi/modules/* !.gitignore .classpath -.project .settings.xml .settings/ db.properties.override @@ -73,4 +72,5 @@ docs/tmp docs/publish docs/runbook/tmp docs/runbook/publish +.project Gemfile.lock diff --git a/INSTALL.md b/INSTALL.md index 61ebadfdc3d..a2137fdf69d 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -51,18 +51,21 @@ Apache CloudStack uses some ports, make sure at least those used by the manageme server are available and not blocked by any local firewall. Following ports are used by Apache CloudStack and its entities: - 8787: Apache CloudStack (Tomcat) debug socket - 9090, 8250: Apache CloudStack Management Server, User/Client API - 8096: User/Client to CloudStack Management Server (unauthenticated) - 3306: MySQL Server - 3922, 8250, 80/443, 111/2049, 53: Secondary Storage VM - 3922, 8250, 53: Console Proxy VM - 3922, 8250, 53: Virtual Router + 8080: API Server (authenticated), browser or CLI client to management server + 8096: API Server (unauthenticated), browser or CLI client to management server + 8787: Remote java debug debugging port, from IDE to management server + 9090: Management server to management server (cluster) + 7080: AWS API Server to which an AWS client can connect + 80/443: HTTP client to Secondary Storage VM (template download) + 111/2049: Secondary Storage to NFS server + 3922: Port used to ssh/scp into system vms (SSVM, CPVM, VR) + 8250: Agent (SSVM, CPVM, VR) to management server 22, 80, 443: XenServer, XAPI 22: KVM 443: vCenter - DNS: 53 - NFS: 111/2049 + 53: DNS + 111/2049: NFS + 3306: MySQL Server to which the management server connects ### Configuring MySQL Server @@ -92,8 +95,7 @@ For example, for master: Clean and build: - $ mvn clean - $ mvn install + $ mvn clean install -P systemvm,developer In case you want support for VMWare, SRX and other non-Apache (referred to as nonoss) compliant libs, you may download the following jar artifacts from respective vendors: @@ -111,9 +113,9 @@ Install them to ~/.m2 so maven can get them as dependencies: $ cd deps $ ./install-non-oss.sh -And build them with the nonoss flag: +To build with nonoss components, use the build command with the nonoss flag: - $ mvn install -Dnonoss + $ mvn clean install -P systemvm,developer -Dnonoss Clear old database (if any) and deploy the database schema: @@ -121,7 +123,7 @@ Clear old database (if any) and deploy the database schema: Export the following variable if you need to run and debug the management server: - $ export MAVEN_OPTS="-Xmx1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" + $ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n" Start the management server: diff --git a/LICENSE b/LICENSE index 714f6847ae8..5e29e2b12bc 100644 --- a/LICENSE +++ b/LICENSE @@ -180,7 +180,6 @@ Copyright (c) 2013 The Apache Software Foundation This distribution contains third party resources. - Within the . directory licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) @@ -209,10 +208,9 @@ Within the . directory CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + from Thomas Nagy http://code.google.com/p/waf/ - waf - + waf Within the awsapi directory licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) @@ -242,10 +240,9 @@ Within the awsapi directory CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + from Thomas Nagy http://code.google.com/p/waf/ - waf - + waf Within the console-proxy/js directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -270,10 +267,9 @@ Within the console-proxy/js directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from John Resig - jquery.js - + jquery.js Within the deps directory licensed under the BSD (2-clause) for XenServerJava http://www.opensource.org/licenses/BSD-2-Clause (as follows) @@ -304,28 +300,27 @@ Within the deps directory THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + from Citrix Systems, Inc http://www.citrix.com/ - XenServerJava http://community.citrix.com/cdn/xs/sdks/ - + XenServerJava from http://community.citrix.com/cdn/xs/sdks/ Within the patches/systemvm/debian/config/etc directory placed in the public domain + by Adiscon GmbH http://www.adiscon.com/ + rsyslog.conf by Simon Kelley - dnsmasq.conf - vpcdnsmasq.conf - + dnsmasq.conf + vpcdnsmasq.conf Within the patches/systemvm/debian/config/etc/apache2 directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2012 The Apache Software Foundation from The Apache Software Foundation http://www.apache.org/ - httpd.conf - ports.conf - sites-available/default - sites-available/default-ssl - vhostexample.conf - + httpd.conf + ports.conf + sites-available/default + sites-available/default-ssl + vhostexample.conf Within the patches/systemvm/debian/config/etc/ssh/ directory licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows) @@ -354,40 +349,95 @@ Within the patches/systemvm/debian/config/etc/ssh/ directory ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + from OpenSSH Project http://www.openssh.org/ - sshd_config - + sshd_config Within the patches/systemvm/debian/config/root/redundant_router directory placed in the public domain by The netfilter.org project http://www.netfilter.org/ - conntrackd.conf.templ - + conntrackd.conf.templ Within the scripts/storage/secondary directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2010-2011 OpenStack, LLC. from OpenStack, LLC http://www.openstack.org - swift - + swift Within the scripts/vm/hypervisor/xenserver directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2010-2011 OpenStack, LLC. from OpenStack, LLC http://www.openstack.org - swift + swift +Within the tools/appliance/definitions/systemvmtemplate directory + licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) + + Copyright (c) 2010-2012 Patrick Debois + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + from Patrick Debois http://www.jedi.be/blog/ + base.sh from https://github.com/jedi4ever/veewee + cleanup.sh from https://github.com/jedi4ever/veewee + definition.rb from https://github.com/jedi4ever/veewee + preseed.cfg from https://github.com/jedi4ever/veewee + zerodisk.sh from https://github.com/jedi4ever/veewee + +Within the tools/devcloud/src/deps/boxes/basebox-build directory + licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) + + Copyright (c) 2010-2012 Patrick Debois + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + from Patrick Debois http://www.jedi.be/blog/ + definition.rb from https://github.com/jedi4ever/veewee + preseed.cfg from https://github.com/jedi4ever/veewee Within the ui/lib directory placed in the public domain by Eric Meyer http://meyerweb.com/eric/ - reset.css + reset.css from http://meyerweb.com/eric/tools/css/reset/ licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2006 Google Inc. from Google Inc. http://google.com - excanvas.js http://code.google.com/p/explorercanvas/ + excanvas.js from http://code.google.com/p/explorercanvas/ licensed under the BSD (2-clause) http://www.opensource.org/licenses/BSD-2-Clause (as follows) @@ -417,9 +467,34 @@ Within the ui/lib directory ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + from George McGinley Smith - jquery.easing.js + jquery.easing.js + + licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) + + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + "Software"), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE + LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION + OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + from The Dojo Foundation http://dojofoundation.org/ + require.js from http://github.com/jrburke/requirejs licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -443,9 +518,9 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from John Resig - jquery.js + jquery.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -469,9 +544,9 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Jorn Zaefferer - jquery.validate.js + jquery.validate.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -495,9 +570,9 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Sebastian Tschan https://blueimp.net - jquery.md5.js + jquery.md5.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -521,10 +596,9 @@ Within the ui/lib directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Klaus Hartl http://stilbuero.de - jquery.cookies.js - + jquery.cookies.js Within the ui/lib/flot directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -549,18 +623,18 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from IOLA http://www.iola.dk/ - jquery.flot.crosshair.js - jquery.flot.fillbetween.js - jquery.flot.image.js - jquery.flot.js - jquery.flot.navigate.js - jquery.flot.resize.js - jquery.flot.selection.js - jquery.flot.stack.js - jquery.flot.symbol.js - jquery.flot.threshold.js + jquery.flot.crosshair.js + jquery.flot.fillbetween.js + jquery.flot.image.js + jquery.flot.js + jquery.flot.navigate.js + jquery.flot.resize.js + jquery.flot.selection.js + jquery.flot.stack.js + jquery.flot.symbol.js + jquery.flot.threshold.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -585,9 +659,9 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Brian Medendorp - jquery.pie.js + jquery.pie.js licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -610,10 +684,9 @@ Within the ui/lib/flot directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Ole Laursen - jquery.colorhelpers.js - + jquery.colorhelpers.js Within the ui/lib/jquery-ui directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -637,12 +710,11 @@ Within the ui/lib/jquery-ui directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from jQuery UI Developers http://jqueryui.com/about - css/jquery-ui.css - index.html - js/jquery-ui.js - + css/jquery-ui.css + index.html + js/jquery-ui.js Within the ui/lib/qunit directory licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) @@ -667,3581 +739,14 @@ Within the ui/lib/qunit directory LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - + from Jorn Zaefferer - qunit.css http://docs.jquery.com/QUnit - qunit.js http://docs.jquery.com/QUnit - + qunit.css from http://docs.jquery.com/QUnit + qunit.js from http://docs.jquery.com/QUnit Within the utils/src/com/cloud/utils/db directory licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) Copyright (c) 2004 Clinton Begin from Clinton Begin http://code.google.com/p/mybatis/ - ScriptRunner.java http://code.google.com/p/mybatis/ - - - -******************************************************************************** - -Binary or packaged versions of this software (including versions built from source) -contain third party resources (as listed below). - -Within the target/jar directory - placed in the public domain - by Distributed Computing Laboratory at Emory University http://creativecommons.org/licenses/publicdomain/ - cloud-backport-util-concurrent-3.0.jar - - licensed under the Apache License, Version 1.1 http://www.apache.org/licenses/LICENSE-1.1 (as follows) - - Copyright (c) 2012 The Apache Software Foundation - - /* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - */ - - from The Apache Software Foundation http://www.apache.org/ - cloud-commons-discovery.jar http://commons.apache.org/discovery/ - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2012 The Apache Software Foundation - from The Apache Software Foundation http://www.apache.org/ - cloud-axis.jar http://axis.apache.org/axis/ - cloud-cglib.jar http://cglib.sourceforge.net/ - cloud-commons-codec-1.5.jar http://commons.apache.org/codec/ - cloud-commons-collections-3.2.1.jar http://commons.apache.org/collections/ - cloud-commons-configuration-1.8.jar http://commons.apache.org/configuration/ - cloud-commons-dbcp-1.4.jar http://commons.apache.org/dbcp/ - cloud-commons-httpclient-3.1.jar http://hc.apache.org/httpclient-3.x/ - cloud-commons-lang-2.6.jar http://commons.apache.org/lang/ - cloud-commons-logging-1.1.1.jar http://commons.apache.org/logging/ - cloud-commons-pool-1.5.6.jar http://commons.apache.org/pool/ - cloud-log4j-extras.jar http://logging.apache.org/log4j/companions/extras/ - cloud-log4j.jar http://logging.apache.org/log4j/ - cloud-ws-commons-util-1.0.2.jar http://ws.apache.org/commons/util/ - cloud-xmlrpc-client-3.1.3.jar http://ws.apache.org/xmlrpc/client.html - cloud-xmlrpc-common-3.1.3.jar http://ws.apache.org/xmlrpc/xmlrpc-common/ - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2007-2010, The JASYPT team (http://www.jasypt.org) - from The JASYPT team http://www.jasypt.org - cloud-jasypt-1.9.jar http://www.jasypt.org - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2003-2007 Luck Consulting Pty Ltd - from Luck Consulting Pty Ltd http://gregluck.com/blog/about/ - cloud-ehcache.jar http://ehcache.org/ - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2009 Google Inc. - from Google Inc. http://google.com - cloud-google-gson-1.7.1.jar http://code.google.com/p/google-gson/ - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - - from Jetty Committers http://jetty.codehaus.org/jetty/ - jetty-6.1.26.jar http://repo1.maven.org/maven2/org/mortbay/jetty/jetty/6.1.26/jetty-6.1.26-sources.jar - jetty-util-6.1.26.jar http://repo1.maven.org/maven2/org/mortbay/jetty/jetty-util/6.1.26/jetty-util-6.1.26-sources.jar - - licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) - - Copyright (c) 2009, Caringo, Inc. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - from Caringo, Inc. http://www.caringo.com/ - CAStorSDK.jar http://www.castor.org/download.html - - licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) - - Copyright (c) 2002-2011 Atsuhiko Yamanaka, JCraft,Inc. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - from JCraft http://www.jcraft.com/ - cloud-jsch-0.1.42.jar http://www.jcraft.com/jsch/ - - licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) - - Copyright (c) 2007-2008 Trilead AG (http://www.trilead.com) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - from Trilead AG http://www.trilead.com - cloud-trilead-ssh2-build213.jar http://sourceforge.net/projects/orion-ssh2/ - - licensed under the Bouncy Castle adaptation of MIT X11 License http://www.bouncycastle.org/licence.html (as follows) - - - Please note: our license is an adaptation of the MIT X11 License and should be - read as such. - - LICENSE Copyright (c) 2000 - 2011 The Legion Of The Bouncy Castle - (http://www.bouncycastle.org) - - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - the Software, and to permit persons to whom the Software is furnished to do so, - subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from The Legion Of The Bouncy Castle http://www.bouncycastle.org - cloud-bcprov-jdk16-1.45.jar http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45-sources.jar - - licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows) - - Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. ¤ - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - - from Project GlassFish http://glassfish.java.net/ - cloud-ejb-api-3.0.jar http://repo1.maven.org/maven2/javax/ejb/ejb-api/3.0/ejb-api-3.0-sources.jar - cloud-jstl-1.2.jar http://jstl.java.net/ - - licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows) - - Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. ¤ - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - - from Oracle and/or its affiliates http://oracle.com - cloud-email.jar http://kenai.com/projects/javamail - - licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows) - - Copyright (c) IBM Corp 2006 - - Common Public License Version 1.0 (CPL) - - THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC - LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM - CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - - 1. DEFINITIONS - - "Contribution means: - - a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are - distributed by that particular Contributor. A Contribution 'originates' from a - Contributor if it was added to the Program by such Contributor itself or anyone - acting on such Contributor's behalf. Contributions do not include additions to - the Program which: (i) are separate modules of software distributed in - conjunction with the Program under their own license agreement, and (ii) are not - derivative works of the Program. - - "Contributor means any person or entity that distributes the Program. - - "Licensed Patents mean patent claims licensable by a Contributor which are - "necessarily infringed by the use or sale of its Contribution alone or when - "combined with the Program. - - "Program means the Contributions distributed in accordance with this Agreement. - - "Recipient means anyone who receives the Program under this Agreement, including - "all Contributors. - - 2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly perform, - distribute and sublicense the Contribution of such Contributor, if any, and such - derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed - Patents to make, use, sell, offer to sell, import and otherwise transfer the - Contribution of such Contributor, if any, in source code and object code form. - This patent license shall apply to the combination of the Contribution and the - Program if, at the time the Contribution is added by the Contributor, such - addition of the Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other combinations - which include the Contribution. No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the licenses to - its Contributions set forth herein, no assurances are provided by any - Contributor that the Program does not infringe the patent or other intellectual - property rights of any other entity. Each Contributor disclaims any liability to - Recipient for claims brought by any other entity based on infringement of - intellectual property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby assumes sole - responsibility to secure any other intellectual property rights needed, if any. - For example, if a third party patent license is required to allow Recipient to - distribute the Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient copyright - rights in its Contribution, if any, to grant the copyright license set forth in - this Agreement. - - 3. REQUIREMENTS - - A Contributor may choose to distribute the Program in object code form under its - own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and - conditions, express and implied, including warranties or conditions of title and - non-infringement, and implied warranties or conditions of merchantability and - fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are offered by - that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such Contributor, - and informs licensees how to obtain it in a reasonable manner on or through a - medium customarily used for software exchange. - - When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the Program. - - Contributors may not remove or alter any copyright notices contained within the - Program. - - Each Contributor must identify itself as the originator of its Contribution, if - any, in a manner that reasonably allows subsequent Recipients to identify the - originator of the Contribution. - - 4. COMMERCIAL DISTRIBUTION - - Commercial distributors of software may accept certain responsibilities with - respect to end users, business partners and the like. While this license is - intended to facilitate the commercial use of the Program, the Contributor who - includes the Program in a commercial product offering should do so in a manner - which does not create potential liability for other Contributors. Therefore, if - a Contributor includes the Program in a commercial product offering, such - Contributor ("Commercial Contributor") hereby agrees to defend and indemnify - every other Contributor ("Indemnified Contributor") against any losses, damages - and costs (collectively "Losses") arising from claims, lawsuits and other legal - actions brought by a third party against the Indemnified Contributor to the - extent caused by the acts or omissions of such Commercial Contributor in - connection with its distribution of the Program in a commercial product - offering. The obligations in this section do not apply to any claims or Losses - relating to any actual or alleged intellectual property infringement. In order - to qualify, an Indemnified Contributor must: a) promptly notify the Commercial - Contributor in writing of such claim, and b) allow the Commercial Contributor to - control, and cooperate with the Commercial Contributor in, the defense and any - related settlement negotiations. The Indemnified Contributor may participate in - any such claim at its own expense. - - For example, a Contributor might include the Program in a commercial product - offering, Product X. That Contributor is then a Commercial Contributor. If that - Commercial Contributor then makes performance claims, or offers warranties - related to Product X, those performance claims and warranties are such - Commercial Contributor's responsibility alone. Under this section, the - Commercial Contributor would have to defend claims against the other - Contributors related to those performance claims and warranties, and if a court - requires any other Contributor to pay any damages as a result, the Commercial - Contributor must pay those damages. - - 5. NO WARRANTY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR - IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, - NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each - Recipient is solely responsible for determining the appropriateness of using and - distributing the Program and assumes all risks associated with its exercise of - rights under this Agreement, including but not limited to the risks and costs of - program errors, compliance with applicable laws, damage to or loss of data, - programs or equipment, and unavailability or interruption of operations. - - 6. DISCLAIMER OF LIABILITY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY - CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST - PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS - GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 7. GENERAL - - If any provision of this Agreement is invalid or unenforceable under applicable - law, it shall not affect the validity or enforceability of the remainder of the - terms of this Agreement, and without further action by the parties hereto, such - provision shall be reformed to the minimum extent necessary to make such - provision valid and enforceable. - - If Recipient institutes patent litigation against a Contributor with respect to - a patent applicable to software (including a cross-claim or counterclaim in a - lawsuit), then any patent licenses granted by that Contributor to such Recipient - under this Agreement shall terminate as of the date such litigation is filed. In - addition, if Recipient institutes patent litigation against any entity - (including a cross-claim or counterclaim in a lawsuit) alleging that the Program - itself (excluding combinations of the Program with other software or hardware) - infringes such Recipient's patent(s), then such Recipient's rights granted under - Section 2(b) shall terminate as of the date such litigation is filed. - - All Recipient's rights under this Agreement shall terminate if it fails to - comply with any of the material terms or conditions of this Agreement and does - not cure such failure in a reasonable period of time after becoming aware of - such noncompliance. If all Recipient's rights under this Agreement terminate, - Recipient agrees to cease use and distribution of the Program as soon as - reasonably practicable. However, Recipient's obligations under this Agreement - and any licenses granted by Recipient relating to the Program shall continue and - survive. - - Everyone is permitted to copy and distribute copies of this Agreement, but in - order to avoid inconsistency the Agreement is copyrighted and may only be - modified in the following manner. The Agreement Steward reserves the right to - publish new versions (including revisions) of this Agreement from time to time. - No one other than the Agreement Steward has the right to modify this Agreement. - IBM is the initial Agreement Steward. IBM may assign the responsibility to serve - as the Agreement Steward to a suitable separate entity. Each new version of the - Agreement will be given a distinguishing version number. The Program (including - Contributions) may always be distributed subject to the version of the Agreement - under which it was received. In addition, after a new version of the Agreement - is published, Contributor may elect to distribute the Program (including its - Contributions) under the new version. Except as expressly stated in Sections - 2(a) and 2(b) above, Recipient receives no rights or licenses to the - intellectual property of any Contributor under this Agreement, whether - expressly, by implication, estoppel or otherwise. All rights in the Program not - expressly granted under this Agreement are reserved. - - This Agreement is governed by the laws of the State of New York and the - intellectual property laws of the United States of America. No party to this - Agreement will bring a legal action under this Agreement more than one year - after the cause of action arose. Each party waives its rights to a jury trial in - any resulting litigation. - - from IBM Corp http://www.ibm.com/ - cloud-wsdl4j-1.6.2.jar http://sourceforge.net/projects/wsdl4j/ - cloud-wsdl4j.jar http://sourceforge.net/projects/wsdl4j/ - - licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows) - - - Common Public License Version 1.0 (CPL) - - THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC - LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM - CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - - 1. DEFINITIONS - - "Contribution means: - - a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are - distributed by that particular Contributor. A Contribution 'originates' from a - Contributor if it was added to the Program by such Contributor itself or anyone - acting on such Contributor's behalf. Contributions do not include additions to - the Program which: (i) are separate modules of software distributed in - conjunction with the Program under their own license agreement, and (ii) are not - derivative works of the Program. - - "Contributor means any person or entity that distributes the Program. - - "Licensed Patents mean patent claims licensable by a Contributor which are - "necessarily infringed by the use or sale of its Contribution alone or when - "combined with the Program. - - "Program means the Contributions distributed in accordance with this Agreement. - - "Recipient means anyone who receives the Program under this Agreement, including - "all Contributors. - - 2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly perform, - distribute and sublicense the Contribution of such Contributor, if any, and such - derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed - Patents to make, use, sell, offer to sell, import and otherwise transfer the - Contribution of such Contributor, if any, in source code and object code form. - This patent license shall apply to the combination of the Contribution and the - Program if, at the time the Contribution is added by the Contributor, such - addition of the Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other combinations - which include the Contribution. No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the licenses to - its Contributions set forth herein, no assurances are provided by any - Contributor that the Program does not infringe the patent or other intellectual - property rights of any other entity. Each Contributor disclaims any liability to - Recipient for claims brought by any other entity based on infringement of - intellectual property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby assumes sole - responsibility to secure any other intellectual property rights needed, if any. - For example, if a third party patent license is required to allow Recipient to - distribute the Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient copyright - rights in its Contribution, if any, to grant the copyright license set forth in - this Agreement. - - 3. REQUIREMENTS - - A Contributor may choose to distribute the Program in object code form under its - own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and - conditions, express and implied, including warranties or conditions of title and - non-infringement, and implied warranties or conditions of merchantability and - fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are offered by - that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such Contributor, - and informs licensees how to obtain it in a reasonable manner on or through a - medium customarily used for software exchange. - - When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the Program. - - Contributors may not remove or alter any copyright notices contained within the - Program. - - Each Contributor must identify itself as the originator of its Contribution, if - any, in a manner that reasonably allows subsequent Recipients to identify the - originator of the Contribution. - - 4. COMMERCIAL DISTRIBUTION - - Commercial distributors of software may accept certain responsibilities with - respect to end users, business partners and the like. While this license is - intended to facilitate the commercial use of the Program, the Contributor who - includes the Program in a commercial product offering should do so in a manner - which does not create potential liability for other Contributors. Therefore, if - a Contributor includes the Program in a commercial product offering, such - Contributor ("Commercial Contributor") hereby agrees to defend and indemnify - every other Contributor ("Indemnified Contributor") against any losses, damages - and costs (collectively "Losses") arising from claims, lawsuits and other legal - actions brought by a third party against the Indemnified Contributor to the - extent caused by the acts or omissions of such Commercial Contributor in - connection with its distribution of the Program in a commercial product - offering. The obligations in this section do not apply to any claims or Losses - relating to any actual or alleged intellectual property infringement. In order - to qualify, an Indemnified Contributor must: a) promptly notify the Commercial - Contributor in writing of such claim, and b) allow the Commercial Contributor to - control, and cooperate with the Commercial Contributor in, the defense and any - related settlement negotiations. The Indemnified Contributor may participate in - any such claim at its own expense. - - For example, a Contributor might include the Program in a commercial product - offering, Product X. That Contributor is then a Commercial Contributor. If that - Commercial Contributor then makes performance claims, or offers warranties - related to Product X, those performance claims and warranties are such - Commercial Contributor's responsibility alone. Under this section, the - Commercial Contributor would have to defend claims against the other - Contributors related to those performance claims and warranties, and if a court - requires any other Contributor to pay any damages as a result, the Commercial - Contributor must pay those damages. - - 5. NO WARRANTY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR - IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, - NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each - Recipient is solely responsible for determining the appropriateness of using and - distributing the Program and assumes all risks associated with its exercise of - rights under this Agreement, including but not limited to the risks and costs of - program errors, compliance with applicable laws, damage to or loss of data, - programs or equipment, and unavailability or interruption of operations. - - 6. DISCLAIMER OF LIABILITY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY - CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST - PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS - GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 7. GENERAL - - If any provision of this Agreement is invalid or unenforceable under applicable - law, it shall not affect the validity or enforceability of the remainder of the - terms of this Agreement, and without further action by the parties hereto, such - provision shall be reformed to the minimum extent necessary to make such - provision valid and enforceable. - - If Recipient institutes patent litigation against a Contributor with respect to - a patent applicable to software (including a cross-claim or counterclaim in a - lawsuit), then any patent licenses granted by that Contributor to such Recipient - under this Agreement shall terminate as of the date such litigation is filed. In - addition, if Recipient institutes patent litigation against any entity - (including a cross-claim or counterclaim in a lawsuit) alleging that the Program - itself (excluding combinations of the Program with other software or hardware) - infringes such Recipient's patent(s), then such Recipient's rights granted under - Section 2(b) shall terminate as of the date such litigation is filed. - - All Recipient's rights under this Agreement shall terminate if it fails to - comply with any of the material terms or conditions of this Agreement and does - not cure such failure in a reasonable period of time after becoming aware of - such noncompliance. If all Recipient's rights under this Agreement terminate, - Recipient agrees to cease use and distribution of the Program as soon as - reasonably practicable. However, Recipient's obligations under this Agreement - and any licenses granted by Recipient relating to the Program shall continue and - survive. - - Everyone is permitted to copy and distribute copies of this Agreement, but in - order to avoid inconsistency the Agreement is copyrighted and may only be - modified in the following manner. The Agreement Steward reserves the right to - publish new versions (including revisions) of this Agreement from time to time. - No one other than the Agreement Steward has the right to modify this Agreement. - IBM is the initial Agreement Steward. IBM may assign the responsibility to serve - as the Agreement Steward to a suitable separate entity. Each new version of the - Agreement will be given a distinguishing version number. The Program (including - Contributions) may always be distributed subject to the version of the Agreement - under which it was received. In addition, after a new version of the Agreement - is published, Contributor may elect to distribute the Program (including its - Contributions) under the new version. Except as expressly stated in Sections - 2(a) and 2(b) above, Recipient receives no rights or licenses to the - intellectual property of any Contributor under this Agreement, whether - expressly, by implication, estoppel or otherwise. All rights in the Program not - expressly granted under this Agreement are reserved. - - This Agreement is governed by the laws of the State of New York and the - intellectual property laws of the United States of America. No party to this - Agreement will bring a legal action under this Agreement more than one year - after the cause of action arose. Each party waives its rights to a jury trial in - any resulting litigation. - - from JUnit Project http://www.junit.org/ - cloud-junit.jar http://kentbeck.github.com/junit/ - - licensed under the Eclipse Distribution License Version 1.0 http://www.eclipse.org/org/documents/edl-v10.php (as follows) - - Copyright (c) 2012 The Eclipse Foundation. - - Eclipse Distribution License Version 1.0 - - Copyright (c) 2007, Eclipse Foundation, Inc. and its licensors. - - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. Redistributions in binary form must - reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. Neither the name of the Eclipse Foundation, Inc. nor the names of - its contributors may be used to endorse or promote products derived from this - software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - from The Eclipse Foundation http://www.eclipse.org - cloud-javax.persistence-2.0.0.jar http://wiki.eclipse.org/EclipseLink/Release/2.0.0 - - licensed under the XStream BSD Style License https://fisheye.codehaus.org/browse/xstream/trunk/LICENSE.txt?hb=true (as follows) - - - (BSD Style License) - - Copyright (c) 2003-2006, Joe Walnes Copyright (c) 2006-2011, XStream Committers - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. Redistributions in binary form must - reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. - - Neither the name of XStream nor the names of its contributors may be used to - endorse or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - from XStream Committers http://xstream.codehaus.org/ - cloud-xstream-1.3.1.jar http://xstream.codehaus.org/repository.html - - -Within the deps/awsapi-lib directory - licensed under the ANTLR 2 License http://www.antlr2.org/license.html (as follows) - - - ANTLR 2 License - - We reserve no legal rights to the ANTLR--it is fully in the public domain. An - individual or company may do whatever they wish with source code distributed - with ANTLR or the code generated by ANTLR, including the incorporation of ANTLR, - or its output, into commerical software. We encourage users to develop software - with ANTLR. However, we do ask that credit is given to us for developing ANTLR. - By "credit", we mean that if you use ANTLR or incorporate any source code into - one of your programs (commercial product, research project, or otherwise) that - you acknowledge this fact somewhere in the documentation, research report, - etc... If you like ANTLR and have developed a nice tool with the output, please - mention that you developed it using ANTLR. In addition, we ask that the headers - remain intact in our source code. As long as these guidelines are kept, we - expect to continue enhancing this system and expect to make other tools - available as they are completed. - - from ANTLR Translator Generator Project http://www.antlr2.org/ - antlr-2.7.6.jar http://repo1.maven.org/maven2/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2004-2008 The Apache Software Foundation - from The Apache Software Foundation http://www.apache.org/ - XmlSchema-1.4.3.jar - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2004-2012 The Apache Software Foundation - from The Apache Software Foundation http://www.apache.org/ - apache-log4j-extras-1.0.jar http://logging.apache.org/log4j/companions/extras/ - axiom-api-1.2.8.jar http://ws.apache.org/axiom/source-repository.html - axiom-impl-1.2.8.jar http://ws.apache.org/axiom/source-repository.html - axis2-1.5.1.jar http://axis.apache.org/axis/ - axis2-adb-1.5.1.jar http://axis.apache.org/axis/ - axis2-ant-plugin-1.5.1.jar http://axis.apache.org/axis/ - axis2-codegen-1.4.1.jar http://axis.apache.org/axis/ - axis2-jaxbri-1.5.1.jar http://axis.apache.org/axis/ - axis2-jaxws-1.5.1.jar http://axis.apache.org/axis/ - axis2-jibx-1.5.1.jar http://axis.apache.org/axis/ - axis2-json-1.5.1.jar http://axis.apache.org/axis/ - axis2-kernel-1.5.1.jar http://axis.apache.org/axis/ - axis2-transport-http-1.5.1.jar http://axis.apache.org/axis/ - axis2-transport-local-1.5.1.jar http://axis.apache.org/axis/ - axis2-webapp-1.5.1.war http://axis.apache.org/axis/ - commons-codec-1.4.jar http://commons.apache.org/codec/ - commons-collections-3.1.jar http://commons.apache.org/collections/ - commons-fileupload-1.2.jar http://commons.apache.org/fileupload/ - commons-httpclient-3.1.jar http://hc.apache.org/httpclient-3.x/ - commons-io-1.4.jar http://commons.apache.org/io/ - commons-logging-1.1.1.jar http://commons.apache.org/logging/ - httpcore-4.0.jar http://hc.apache.org/httpcomponents-core-ga/ - log4j-1.2.15.jar http://logging.apache.org/log4j/ - neethi-2.0.4.jar http://svn.apache.org/viewvc/webservices/commons/tags/neethi/2.0.4/ - rampart-lib http://axis.apache.org/axis2/java/rampart/download/1.5/download.cgi - woden-api-1.0M8.jar http://svn.apache.org/viewvc/webservices/woden/tags/1.0M8_20080423/ - woden-impl-dom-1.0M8.jar http://svn.apache.org/viewvc/webservices/woden/tags/1.0M8_20080423/ - wss4j-1.5.8.jar http://ws.apache.org/wss4j/source-repository.html - xercesImpl.jar http://xerces.apache.org/xerces2-j/source-repository.html - xml-apis.jar http://repo1.maven.org/maven2/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04-sources.jar - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - Copyright (c) 2009 Google Inc. - from Google Inc. http://google.com - cloud-gson.jar http://code.google.com/p/google-gson/ - - licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above) - - from Json.simple Project http://code.google.com/p/json-simple/ - json_simple-1.1.jar http://code.google.com/p/json-simple/source/checkout - - licensed under the BSD (3-clause) http://www.opensource.org/licenses/BSD-3-Clause (as follows) - - Copyright (c) 2002-2011 Atsuhiko Yamanaka, JCraft,Inc. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - THE POSSIBILITY OF SUCH DAMAGE. - - from JCraft http://www.jcraft.com/ - jsch-0.1.42.jar http://www.jcraft.com/jsch/ - - licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows) - - Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. ¤ - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - - from Oracle and/or its affiliates http://oracle.com - jaxb-api-2.1.jar http://repo1.maven.org/maven2/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1-sources.jar - jaxb-impl-2.1.7.jar http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.1.7/jaxb-impl-2.1.7-sources.jar - jaxb-xjc-2.1.7.jar http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-xjc/2.1.7/jaxb-xjc-2.1.7-sources.jar - - licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows) - - Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. ¤ - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - - from Project GlassFish http://glassfish.java.net/ - jta-1.1.jar http://repo1.maven.org/maven2/javax/transaction/jta/1.1/jta-1.1-sources.jar - - licensed under the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 http://www.opensource.org/licenses/CDDL-1.0 (as follows) - - Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved. - - COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - - 1. Definitions. - - 1.1. "Contributor" means each individual or entity that - creates or contributes to the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the - Original Software, prior Modifications used by a - Contributor (if any), and the Modifications made by that - particular Contributor. - - 1.3. "Covered Software" means (a) the Original Software, or - (b) Modifications, or (c) the combination of files - containing Original Software with files containing - Modifications, in each case including portions thereof. - - 1.4. "Executable" means the Covered Software in any form - other than Source Code. - - 1.5. "Initial Developer" means the individual or entity - that first makes Original Software available under this - License. - - 1.6. "Larger Work" means a work which combines Covered - Software or portions thereof with code not governed by the - terms of this License. - - 1.7. "License" means this document. - - 1.8. "Licensable" means having the right to grant, to the - maximum extent possible, whether at the time of the initial - grant or subsequently acquired, any and all of the rights - conveyed herein. - - 1.9. "Modifications" means the Source Code and Executable - form of any of the following: - - A. Any file that results from an addition to, - deletion from or modification of the contents of a - file containing Original Software or previous - Modifications; - - B. Any new file that contains any part of the - Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made - available under the terms of this License. - - 1.10. "Original Software" means the Source Code and - Executable form of computer software code that is - originally released under this License. - - 1.11. "Patent Claims" means any patent claim(s), now owned - or hereafter acquired, including without limitation, - method, process, and apparatus claims, in any patent - Licensable by grantor. - - 1.12. "Source Code" means (a) the common form of computer - software code in which modifications are made and (b) - associated documentation included in or with such code. - - 1.13. "You" (or "Your") means an individual or a legal - entity exercising rights under, and complying with all of - the terms of, this License. For legal entities, "You" - includes any entity which controls, is controlled by, or is - under common control with You. For purposes of this - definition, "control" means (a) the power, direct or - indirect, to cause the direction or management of such - entity, whether by contract or otherwise, or (b) ownership - of more than fifty percent (50%) of the outstanding shares - or beneficial ownership of such entity. - - 2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, the - Initial Developer hereby grants You a world-wide, - royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Initial Developer, - to use, reproduce, modify, display, perform, - sublicense and distribute the Original Software (or - portions thereof), with or without Modifications, - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using or selling of Original Software, to make, have - made, use, practice, sell, and offer for sale, and/or - otherwise dispose of the Original Software (or - portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) - are effective on the date Initial Developer first - distributes or otherwise makes the Original Software - available to a third party under the terms of this - License. - - (d) Notwithstanding Section 2.1(b) above, no patent - license is granted: (1) for code that You delete from - the Original Software, or (2) for infringements - caused by: (i) the modification of the Original - Software, or (ii) the combination of the Original - Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and - subject to third party intellectual property claims, each - Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - (a) under intellectual property rights (other than - patent or trademark) Licensable by Contributor to - use, reproduce, modify, display, perform, sublicense - and distribute the Modifications created by such - Contributor (or portions thereof), either on an - unmodified basis, with other Modifications, as - Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, - using, or selling of Modifications made by that - Contributor either alone and/or in combination with - its Contributor Version (or portions of such - combination), to make, use, sell, offer for sale, - have made, and/or otherwise dispose of: (1) - Modifications made by that Contributor (or portions - thereof); and (2) the combination of Modifications - made by that Contributor with its Contributor Version - (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and - 2.2(b) are effective on the date Contributor first - distributes or otherwise makes the Modifications - available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent - license is granted: (1) for any code that Contributor - has deleted from the Contributor Version; (2) for - infringements caused by: (i) third party - modifications of Contributor Version, or (ii) the - combination of Modifications made by that Contributor - with other software (except as part of the - Contributor Version) or other devices; or (3) under - Patent Claims infringed by Covered Software in the - absence of Modifications made by that Contributor. - - 3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make - available in Executable form must also be made available in - Source Code form and that Source Code form must be - distributed only under the terms of this License. You must - include a copy of this License with every copy of the - Source Code form of the Covered Software You distribute or - otherwise make available. You must inform recipients of any - such Covered Software in Executable form as to how they can - obtain such Covered Software in Source Code form in a - reasonable manner on or through a medium customarily used - for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You - contribute are governed by the terms of this License. You - represent that You believe Your Modifications are Your - original creation(s) and/or You have sufficient rights to - grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications - that identifies You as the Contributor of the Modification. - You may not remove or alter any copyright, patent or - trademark notices contained within the Covered Software, or - any notices of licensing or any descriptive text giving - attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered - Software in Source Code form that alters or restricts the - applicable version of this License or the recipients' - rights hereunder. You may choose to offer, and to charge a - fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Software. - However, you may do so only on Your own behalf, and not on - behalf of the Initial Developer or any Contributor. You - must make it absolutely clear that any such warranty, - support, indemnity or liability obligation is offered by - You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred - by the Initial Developer or such Contributor as a result of - warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered - Software under the terms of this License or under the terms - of a license of Your choice, which may contain terms - different from this License, provided that You are in - compliance with the terms of this License and that the - license for the Executable form does not attempt to limit - or alter the recipient's rights in the Source Code form - from the rights set forth in this License. If You - distribute the Covered Software in Executable form under a - different license, You must make it absolutely clear that - any terms which differ from this License are offered by You - alone, not by the Initial Developer or Contributor. You - hereby agree to indemnify the Initial Developer and every - Contributor for any liability incurred by the Initial - Developer or such Contributor as a result of any such terms - You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software - with other code not governed by the terms of this License - and distribute the Larger Work as a single product. In such - a case, You must make sure the requirements of this License - are fulfilled for the Covered Software. - - 4. Versions of the License. - - 4.1. New Versions. - - Sun Microsystems, Inc. is the initial license steward and - may publish revised and/or new versions of this License - from time to time. Each version will be given a - distinguishing version number. Except as provided in - Section 4.3, no one other than the license steward has the - right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. If the Initial Developer includes a - notice in the Original Software prohibiting it from being - distributed or otherwise made available under any - subsequent version of the License, You must distribute and - make the Covered Software available under the terms of the - version of the License under which You originally received - the Covered Software. Otherwise, You may also choose to - use, distribute or otherwise make the Covered Software - available under the terms of any subsequent version of the - License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a - new license for Your Original Software, You may create and - use a modified version of this License if You: (a) rename - the license and remove any references to the name of the - license steward (except to note that the license differs - from this License); and (b) otherwise make it clear that - the license contains terms which differ from this License. - - 5. DISCLAIMER OF WARRANTY. - - COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" - BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, - INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED - SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR - PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND - PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY - COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE - INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF - ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF - WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS - DISCLAIMER. - - 6. TERMINATION. - - 6.1. This License and the rights granted hereunder will - terminate automatically if You fail to comply with terms - herein and fail to cure such breach within 30 days of - becoming aware of the breach. Provisions which, by their - nature, must remain in effect beyond the termination of - this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding - declaratory judgment actions) against Initial Developer or - a Contributor (the Initial Developer or Contributor against - whom You assert such claim is referred to as "Participant") - alleging that the Participant Software (meaning the - Contributor Version where the Participant is a Contributor - or the Original Software where the Participant is the - Initial Developer) directly or indirectly infringes any - patent, then any and all rights granted directly or - indirectly to You by such Participant, the Initial - Developer (if the Initial Developer is not the Participant) - and all Contributors under Sections 2.1 and/or 2.2 of this - License shall, upon 60 days notice from Participant - terminate prospectively and automatically at the expiration - of such 60 day notice period, unless if within such 60 day - period You withdraw Your claim with respect to the - Participant Software against such Participant either - unilaterally or pursuant to a written agreement with - Participant. - - 6.3. In the event of termination under Sections 6.1 or 6.2 - above, all end user licenses that have been validly granted - by You or any distributor hereunder prior to termination - (excluding licenses granted to You by any distributor) - shall survive termination. - - 7. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE - INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF - COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE - LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR - CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT - LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK - STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL - INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT - APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO - NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR - CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT - APPLY TO YOU. - - 8. U.S. GOVERNMENT END USERS. - - The Covered Software is a "commercial item," as that term is - defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial - computer software" (as that term is defined at 48 C.F.R. ¤ - 252.227-7014(a)(1)) and "commercial computer software - documentation" as such terms are used in 48 C.F.R. 12.212 (Sept. - 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 - through 227.7202-4 (June 1995), all U.S. Government End Users - acquire Covered Software with only those rights set forth herein. - This U.S. Government Rights clause is in lieu of, and supersedes, - any other FAR, DFAR, or other clause or provision that addresses - Government rights in computer software under this License. - - 9. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the - extent necessary to make it enforceable. This License shall be - governed by the law of the jurisdiction specified in a notice - contained within the Original Software (except to the extent - applicable law, if any, provides otherwise), excluding such - jurisdiction's conflict-of-law provisions. Any litigation - relating to this License shall be subject to the jurisdiction of - the courts located in the jurisdiction and venue specified in a - notice contained within the Original Software, with the losing - party responsible for costs, including, without limitation, court - costs and reasonable attorneys' fees and expenses. The - application of the United Nations Convention on Contracts for the - International Sale of Goods is expressly excluded. Any law or - regulation which provides that the language of a contract shall - be construed against the drafter shall not apply to this License. - You agree that You alone are responsible for compliance with the - United States export administration regulations (and the export - control laws and regulation of any other countries) when You use, - distribute or otherwise make available any Covered Software. - - 10. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or - indirectly, out of its utilization of rights under this License - and You agree to work with Initial Developer and Contributors to - distribute such responsibility on an equitable basis. Nothing - herein is intended or shall be deemed to constitute any admission - of liability. - - from Oracle and/or its affiliates http://oracle.com - mail-1.4.jar http://kenai.com/projects/javamail - - licensed under the Common Public License - v 1.0 http://opensource.org/licenses/cpl1.0 (as follows) - - - Common Public License Version 1.0 (CPL) - - THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC - LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM - CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - - 1. DEFINITIONS - - "Contribution means: - - a) in the case of the initial Contributor, the initial code and documentation - distributed under this Agreement, and - - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are - distributed by that particular Contributor. A Contribution 'originates' from a - Contributor if it was added to the Program by such Contributor itself or anyone - acting on such Contributor's behalf. Contributions do not include additions to - the Program which: (i) are separate modules of software distributed in - conjunction with the Program under their own license agreement, and (ii) are not - derivative works of the Program. - - "Contributor means any person or entity that distributes the Program. - - "Licensed Patents mean patent claims licensable by a Contributor which are - "necessarily infringed by the use or sale of its Contribution alone or when - "combined with the Program. - - "Program means the Contributions distributed in accordance with this Agreement. - - "Recipient means anyone who receives the Program under this Agreement, including - "all Contributors. - - 2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free copyright license to - reproduce, prepare derivative works of, publicly display, publicly perform, - distribute and sublicense the Contribution of such Contributor, if any, and such - derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants - Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed - Patents to make, use, sell, offer to sell, import and otherwise transfer the - Contribution of such Contributor, if any, in source code and object code form. - This patent license shall apply to the combination of the Contribution and the - Program if, at the time the Contribution is added by the Contributor, such - addition of the Contribution causes such combination to be covered by the - Licensed Patents. The patent license shall not apply to any other combinations - which include the Contribution. No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the licenses to - its Contributions set forth herein, no assurances are provided by any - Contributor that the Program does not infringe the patent or other intellectual - property rights of any other entity. Each Contributor disclaims any liability to - Recipient for claims brought by any other entity based on infringement of - intellectual property rights or otherwise. As a condition to exercising the - rights and licenses granted hereunder, each Recipient hereby assumes sole - responsibility to secure any other intellectual property rights needed, if any. - For example, if a third party patent license is required to allow Recipient to - distribute the Program, it is Recipient's responsibility to acquire that license - before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient copyright - rights in its Contribution, if any, to grant the copyright license set forth in - this Agreement. - - 3. REQUIREMENTS - - A Contributor may choose to distribute the Program in object code form under its - own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and - conditions, express and implied, including warranties or conditions of title and - non-infringement, and implied warranties or conditions of merchantability and - fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for - damages, including direct, indirect, special, incidental and consequential - damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are offered by - that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such Contributor, - and informs licensees how to obtain it in a reasonable manner on or through a - medium customarily used for software exchange. - - When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the Program. - - Contributors may not remove or alter any copyright notices contained within the - Program. - - Each Contributor must identify itself as the originator of its Contribution, if - any, in a manner that reasonably allows subsequent Recipients to identify the - originator of the Contribution. - - 4. COMMERCIAL DISTRIBUTION - - Commercial distributors of software may accept certain responsibilities with - respect to end users, business partners and the like. While this license is - intended to facilitate the commercial use of the Program, the Contributor who - includes the Program in a commercial product offering should do so in a manner - which does not create potential liability for other Contributors. Therefore, if - a Contributor includes the Program in a commercial product offering, such - Contributor ("Commercial Contributor") hereby agrees to defend and indemnify - every other Contributor ("Indemnified Contributor") against any losses, damages - and costs (collectively "Losses") arising from claims, lawsuits and other legal - actions brought by a third party against the Indemnified Contributor to the - extent caused by the acts or omissions of such Commercial Contributor in - connection with its distribution of the Program in a commercial product - offering. The obligations in this section do not apply to any claims or Losses - relating to any actual or alleged intellectual property infringement. In order - to qualify, an Indemnified Contributor must: a) promptly notify the Commercial - Contributor in writing of such claim, and b) allow the Commercial Contributor to - control, and cooperate with the Commercial Contributor in, the defense and any - related settlement negotiations. The Indemnified Contributor may participate in - any such claim at its own expense. - - For example, a Contributor might include the Program in a commercial product - offering, Product X. That Contributor is then a Commercial Contributor. If that - Commercial Contributor then makes performance claims, or offers warranties - related to Product X, those performance claims and warranties are such - Commercial Contributor's responsibility alone. Under this section, the - Commercial Contributor would have to defend claims against the other - Contributors related to those performance claims and warranties, and if a court - requires any other Contributor to pay any damages as a result, the Commercial - Contributor must pay those damages. - - 5. NO WARRANTY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR - IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, - NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each - Recipient is solely responsible for determining the appropriateness of using and - distributing the Program and assumes all risks associated with its exercise of - rights under this Agreement, including but not limited to the risks and costs of - program errors, compliance with applicable laws, damage to or loss of data, - programs or equipment, and unavailability or interruption of operations. - - 6. DISCLAIMER OF LIABILITY - - EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY - CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST - PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS - GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - 7. GENERAL - - If any provision of this Agreement is invalid or unenforceable under applicable - law, it shall not affect the validity or enforceability of the remainder of the - terms of this Agreement, and without further action by the parties hereto, such - provision shall be reformed to the minimum extent necessary to make such - provision valid and enforceable. - - If Recipient institutes patent litigation against a Contributor with respect to - a patent applicable to software (including a cross-claim or counterclaim in a - lawsuit), then any patent licenses granted by that Contributor to such Recipient - under this Agreement shall terminate as of the date such litigation is filed. In - addition, if Recipient institutes patent litigation against any entity - (including a cross-claim or counterclaim in a lawsuit) alleging that the Program - itself (excluding combinations of the Program with other software or hardware) - infringes such Recipient's patent(s), then such Recipient's rights granted under - Section 2(b) shall terminate as of the date such litigation is filed. - - All Recipient's rights under this Agreement shall terminate if it fails to - comply with any of the material terms or conditions of this Agreement and does - not cure such failure in a reasonable period of time after becoming aware of - such noncompliance. If all Recipient's rights under this Agreement terminate, - Recipient agrees to cease use and distribution of the Program as soon as - reasonably practicable. However, Recipient's obligations under this Agreement - and any licenses granted by Recipient relating to the Program shall continue and - survive. - - Everyone is permitted to copy and distribute copies of this Agreement, but in - order to avoid inconsistency the Agreement is copyrighted and may only be - modified in the following manner. The Agreement Steward reserves the right to - publish new versions (including revisions) of this Agreement from time to time. - No one other than the Agreement Steward has the right to modify this Agreement. - IBM is the initial Agreement Steward. IBM may assign the responsibility to serve - as the Agreement Steward to a suitable separate entity. Each new version of the - Agreement will be given a distinguishing version number. The Program (including - Contributions) may always be distributed subject to the version of the Agreement - under which it was received. In addition, after a new version of the Agreement - is published, Contributor may elect to distribute the Program (including its - Contributions) under the new version. Except as expressly stated in Sections - 2(a) and 2(b) above, Recipient receives no rights or licenses to the - intellectual property of any Contributor under this Agreement, whether - expressly, by implication, estoppel or otherwise. All rights in the Program not - expressly granted under this Agreement are reserved. - - This Agreement is governed by the laws of the State of New York and the - intellectual property laws of the United States of America. No party to this - Agreement will bring a legal action under this Agreement more than one year - after the cause of action arose. Each party waives its rights to a jury trial in - any resulting litigation. - - from JUnit Project http://www.junit.org/ - junit-4.8.1.jar http://kentbeck.github.com/junit/ - - licensed under the Dom4J License http://dom4j.cvs.sourceforge.net/viewvc/dom4j/dom4j/LICENSE.txt (as follows) - - - Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved. - - Redistribution and use of this software and associated documentation - ("Software"), with or without modification, are permitted provided - that the following conditions are met: - - 1. Redistributions of source code must retain copyright - statements and notices. Redistributions must also contain a - copy of this document. - - 2. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - - 3. The name "DOM4J" must not be used to endorse or promote - products derived from this Software without prior written - permission of MetaStuff, Ltd. For written permission, - please contact dom4j-info@metastuff.com. - - 4. Products derived from this Software may not be called "DOM4J" - nor may "DOM4J" appear in their names without prior written - permission of MetaStuff, Ltd. DOM4J is a registered - trademark of MetaStuff, Ltd. - - 5. Due credit should be given to the DOM4J Project - - http://www.dom4j.org - - THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS - ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT - NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL - METASTUFF, LTD. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OF THE POSSIBILITY OF SUCH DAMAGE. - - from DOM4J Project http://dom4j.sourceforge.net/ - dom4j-1.6.1.jar http://dom4j.sourceforge.net/source-repository.html - - licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) - - Copyright (c) 2004-2011 QOS.ch - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - from QOS.ch http://www.qos.ch/ - slf4j-api-1.5.11.jar https://github.com/qos-ch/slf4j - slf4j-jdk14-1.5.11.jar https://github.com/qos-ch/slf4j - - licensed under the Mozilla Public License, Version 1.0 http://www.mozilla.org/MPL/1.1/ (as follows) - - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - - 1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - - 2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - - 3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - - 4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - - 5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - - 6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - - 7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - - 8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - - 9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - - 10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - - 11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - - 12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - - 13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - - EXHIBIT A -Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is Javassist. - - The Initial Developer of the Original Code is Shigeru Chiba. - Portions created by Shigeru Chiba are Copyright (C) - 1999-2008 Shigeru Chiba. All Rights Reserved. - - Contributor(s): . - - Alternatively, the contents of this file may be used under the terms - of the GNU Lesser General Public License Version 2.1 or later license (the "[LGPL] License"), in which case the - provisions of [LGPL] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [LGPL] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [LGPL] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [LGPL] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - - - from Shigeru Chiba http://www.csg.ci.i.u-tokyo.ac.jp/~chiba/javassist/ - javassist-3.9.0.GA.jar http://sourceforge.net/projects/jboss/files/Javassist/ + ScriptRunner.java from http://code.google.com/p/mybatis/ diff --git a/NOTICE b/NOTICE index e310584e78a..d36048aabda 100644 --- a/NOTICE +++ b/NOTICE @@ -6,30 +6,7 @@ - Source code distribution if this software contains third party resources requiring - the following notices: - - - For - jquery.md5.js - - - jQuery MD5 Plugin 1.2.1 - https://github.com/blueimp/jQuery-MD5 - - Copyright 2010, Sebastian Tschan - https://blueimp.net - - Licensed under the MIT license: - http://creativecommons.org/licenses/MIT/ - - Based on - A JavaScript implementation of the RSA Data Security, Inc. MD5 Message - Digest Algorithm, as defined in RFC 1321. - Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 - Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet - Distributed under the BSD License - See http://pajhome.org.uk/crypt/md5 for more info. + This distribution contains third party resources requiring the following notices: For @@ -66,6 +43,28 @@ Date: Thu May 12 15:04:36 2011 -0400 + For + jquery.md5.js + + + jQuery MD5 Plugin 1.2.1 + https://github.com/blueimp/jQuery-MD5 + + Copyright 2010, Sebastian Tschan + https://blueimp.net + + Licensed under the MIT license: + http://creativecommons.org/licenses/MIT/ + + Based on + A JavaScript implementation of the RSA Data Security, Inc. MD5 Message + Digest Algorithm, as defined in RFC 1321. + Version 2.2 Copyright (C) Paul Johnston 1999 - 2009 + Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet + Distributed under the BSD License + See http://pajhome.org.uk/crypt/md5 for more info. + + For jquery.colorhelpers.js @@ -77,619 +76,3 @@ Inspiration from jQuery color animation plugin by John Resig. Released under the MIT license by Ole Laursen, October 2009. - - -******************************************************************************** - - Binary or packaged versions of this software (including versions built from source) - contains third party resources requiring the following notices: - - For - cloud-ejb-api-3.0.jar - cloud-email.jar - cloud-jstl-1.2.jar - jaxb-api-2.1.jar - jaxb-impl-2.1.7.jar - jaxb-xjc-2.1.7.jar - jta-1.1.jar - mail-1.4.jar - - - NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE - (CDDL) - - The code released under the CDDL shall be governed by the laws of the State of - California (excluding conflict-of-law provisions). Any litigation relating to - this License shall be subject to the jurisdiction of the Federal Courts of the - Northern District of California and the state courts of the State of California, - with venue lying in Santa Clara County, California. - - - For - cloud-javax.persistence-2.0.0.jar - - - EclipseLink 2.0.0 - - Dec 10th, 2009 - - About - - The EclipseLink project's goal is to provide a complete persistence framework - that is both comprehensive and universal. It will run in any Java environment - and read and write objects to virtually any type of data source, including - relational databases, and XML. EclipseLink will focus on providing leading edge - support, including advanced feature extensions, for the dominant persistence - standards for each target data source; Java Persistence API (JPA) for relational - databases, Java API for XML Binding (JAXB) for XML, Service Data Objects (SDO), - and Database Web services (DBWS). - - For tips on getting started with EclipseLink, please see the following - resources: - - EclipseLink 2.0.0 Release Notes Documentation Examples and How To License - - The Eclipse Foundation makes available all content in this plug-in ("Content"). - Unless otherwise indicated below, the Content is provided to you under the terms - and conditions of the Eclipse Public License Version 1.0 ("EPL") and Eclipse - Distribution License Version 1.0 ("EDL"). A copy of the EPL is available at - http://www.eclipse.org/legal/epl-v10.html and a copy of the EDL is available at - http://www.eclipse.org/org/documents/edl-v10.php. For purposes of the EPL, - "Program" will mean the Content. - - If you did not receive this Content directly from the Eclipse Foundation, the - Content is being redistributed by another party ("Redistributor") and different - terms and conditions may apply to your use of any object code in the Content. - Check the Redistributor's license that was provided with the Content. If no such - license exists, contact the Redistributor. Unless otherwise indicated below, the - terms and conditions of the EPL and EDL still apply to any source code in the - Content and such source code may be obtained at http://www.eclipse.org. - - Third Party Content - - The Content includes items that have been sourced from third parties as set out - below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor's license for terms and conditions of use. - - Foundation Dependencies ASM EclipseLink JPA ANTLR Java Persistence API (JPA) 1.0 - - EJB 3.0 Java Persistence API (JPA) 2.0 EARLY ACCESS EclipseLink MOXy Java - Architecture for XML Binding (JAXB) Java Mail Java Activation Framework - Streaming API for XML (StAX) EclipseLink SDO Service Data Objects (SDO) - Utilities Java Connector Xerces WSDL4J 1.6.2 ASM v1.5.3 - - The EclipseLink Project includes ASM for the purpose of byte code weaving. The - AMS library is re-packaged within the source of the project - (org.persistence.eclipse.internal.libraries.asm.*) to avoid version collisions - with other usage of ASM. A custom patch has been added to the ASM 1.5.3 source - to handle an issue with other usages. This fix has also been contributed back to - the ASM project for inclusion in later projects. - - The source code is available within the project's subversion repository. The - binaries are distributed within the eclipselink.jar and in the - org.eclipse.persistence.asm_2.0.0.v*.jar bundle. - - http://asm.objectweb.org/license.html - - Copyright (c) 2000-2005 INRIA, France Telecom, All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: - - Redistributions of source code must retain the above copyright notice, this list - of conditions and the following disclaimer. Redistributions in binary form must - reproduce the above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided with the - distribution. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from this - software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY - THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THEIMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE DISCLAIMED. IN NO EVENT - SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OFSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE)ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - OFTHE POSSIBILITY OF SUCH DAMAGE. - - ANTLR v3.0 - - The ANTLR library (license) is included within EclipseLink Project to enable - parsing of the Java Persistence Query language (JP QL). The ANTLR library is re- - packaged within the project in the - org.eclipse.persistence.internal.libraries.antlr.* packages. - - The source is available with the project's subversion repository. The binaries - are distributed within the eclipselink.jar and in the - org.eclipse.persistence.antlr_2.0.0.v*.jar bundle. - - Java Architecture for XML Binding (JAXB) v2.0.5 - - The JAXB libraries distributed under CDDL v1.0 are included within the - EclipseLink Project to enable the MOXY component's implementation of JAXB. - - JAXB Libraries: - - /jlib/moxy/javax.xml.bind_2.1.12.v20090708-1500.jar /jlib/moxy/jaxb-impl.jar - /jlib/moxy/jaxb.xjc.jar Java Persistence (JPA) 1.0 - EJB 3.0 - - The Java Persistence API, included with EJB 3.0, is available for download from - the ejb-api directory in the glassfish CVS repository.It is distributed under - CDDLv1.0 . The jar is being shipped as an OSGi bundle and is required for - compilation of some container based fuctionality. - - Java Persistence (JPA) 2.0. - - EclipseLink is the Java Persistence (JPA) 2.0 Reference Implementation (JSR - 317). The JPA 2.0 specification API is included in EclipseLink under the EPL and - EDL licenses. - - Java Mail v1.4 - - The Java Mail library (mail.jar) is distributed with the JAXB v2.0.5 under CDDL - v1.0 and is included within the EclipseLink Project distribution to support Web - Services attachment handling in the MOXy component. It is only required when - using Java SE 5 (Java Mail is included in Java SE 6). - - Java Activation Framework v1.1 - - The Java Activation Framework (activation.jar) is distributed with the JAXB - v2.0.5 under CDDL v1.0 and is included within the EclipseLink Project - distribution to support Web Services attachment handling in the MOXy component. - It is only required when using Java SE 5 (The Java Activation Framework is - included in Java SE 6). - - Streaming API for XML (StAX) v1.0 - - The Streaming API for XML (StAX) library (jsr173_1.0_api.jar) is distributed - with the JAXB v2.0.5 under CDDL v1.0 and is included within the EclipseLink - Project distribution as an optional XML processing approach in the MOXy - component. - - Service Data Objects (SDO) v2.1.1 - - The Service Data Objects (SDO) API is distributed under a CDDLv1.0 and custom - license. It provides the standard API implemented by the EclipseLink Project's - SDO component. - - Java Connector v1.5 - - The JCA 1.5 API is available for download from the connector-api directory in - the glassfish CVS repository. It is distributed under CDDLv1.0 . - - This jar is being shipped and required by the Workbench only. When using - EclipseLink in a container where JCA integration is required that container will - provide the necessary API libraries. - - Xerces v2.9.0 - - Xerces 2.9.0 is available from the Xerces home page. It is distributed under - Apache 2.0. - - This jar is shipped for the Workbench's use only in the reading and writing of - XML configuration files. - - WSDL4j v1.6.2 - - WSDL4J 1.6.2 is available for download from the wsdl4j project. It distributed - under CPLv1.0 . - - This jar is being shipped as a OSGi bundle and is only required for the DBWS - Builder utility. - - - For - cloud-commons-logging-1.1.1.jar - commons-logging-1.1.1.jar - - - // ------------------------------------------------------------------ - // NOTICE file corresponding to the section 4d of The Apache License, - // Version 2.0, in this case for Commons Logging - // ------------------------------------------------------------------ - - Commons Logging - Copyright 2001-2007 The Apache Software Foundation - - This product includes/uses software(s) developed by 'an unknown organization' - - Unnamed - avalon-framework:avalon-framework:jar:4.1.3 - - Unnamed - log4j:log4j:jar:1.2.12 - - Unnamed - logkit:logkit:jar:1.0.1 - - - For - neethi-2.0.4.jar - - - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache AXIOM distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - Portions Copyright 2006 International Business Machines Corp. - - Please read the different LICENSE files present in the licenses directory of - this distribution. - - - For - cloud-jasypt-1.9.jar - - - Copyright (c) 2007-2010, The JASYPT team (http://www.jasypt.org) - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - --------------------------------- - - - - This distribution includes cryptographic software. The country in - which you currently reside may have restrictions on the import, - possession, use, and/or re-export to another country, of - encryption software. BEFORE using any encryption software, please - check your country's laws, regulations and policies concerning the - import, possession, or use, and re-export of encryption software, to - see if this is permitted. See http://www.wassenaar.org/ for more - information. - - The U.S. Government Department of Commerce, Bureau of Industry and - Security (BIS), has classified this software as Export Commodity - Control Number (ECCN) 5D002.C.1, which includes information security - software using or performing cryptographic functions with asymmetric - algorithms. The form and manner of this distribution makes it - eligible for export under the License Exception ENC Technology - Software Unrestricted (TSU) exception (see the BIS Export - Administration Regulations, Section 740.13) for both object code and - source code. - - The following provides more details on the cryptographic software - used (note that this software is not included in the distribution): - - * The PBE Encryption facilities require the Java Cryptography - extensions: http://java.sun.com/javase/technologies/security/. - - --------------------------------- - - Distributions of this software may include software developed by - The Apache Software Foundation (http://www.apache.org/). - - --------------------------------- - - - ICU License - ICU 1.8.1 and later - - COPYRIGHT AND PERMISSION NOTICE - - Copyright (c) 1995-2006 International Business Machines - Corporation and others - - All rights reserved. - - Permission is hereby granted, free of charge, to any - person obtaining a copy of this software and associated - documentation files (the "Software"), to deal in the - Software without restriction, including without limitation - the rights to use, copy, modify, merge, publish, - distribute, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, - provided that the above copyright notice(s) and this - permission notice appear in all copies of the Software and - that both the above copyright notice(s) and this - permission notice appear in supporting documentation. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY - KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE - WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR - PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO - EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN - THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL - INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES - WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE - USE OR PERFORMANCE OF THIS SOFTWARE. - - Except as contained in this notice, the name of a copyright - holder shall not be used in advertising or otherwise to - promote the sale, use or other dealings in this Software - without prior written authorization of the copyright holder. - - - For - XmlSchema-1.4.3.jar - - - Portions Copyright 2006 International Business Machines Corp. - - - For - cloud-trilead-ssh2-build213.jar - - - Trilead SSH-2 for Java includes code that was written by Dr. Christian Plattner - during his PhD at ETH Zurich. The license states the following: - - Copyright (c) 2005 - 2006 Swiss Federal Institute of Technology (ETH Zurich), - Department of Computer Science (http://www.inf.ethz.ch), - Christian Plattner. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - a.) Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - b.) Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - c.) Neither the name of ETH Zurich nor the names of its contributors may - be used to endorse or promote products derived from this software - without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - - The Java implementations of the AES, Blowfish and 3DES ciphers have been - taken (and slightly modified) from the cryptography package released by - "The Legion Of The Bouncy Castle". - - Their license states the following: - - Copyright (c) 2000 - 2004 The Legion Of The Bouncy Castle - (http://www.bouncycastle.org) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - - - For - axis2-1.5.1.jar - axis2-adb-1.5.1.jar - axis2-ant-plugin-1.5.1.jar - axis2-codegen-1.4.1.jar - axis2-jaxbri-1.5.1.jar - axis2-jaxws-1.5.1.jar - axis2-jibx-1.5.1.jar - axis2-json-1.5.1.jar - axis2-kernel-1.5.1.jar - axis2-transport-http-1.5.1.jar - axis2-transport-local-1.5.1.jar - axis2-webapp-1.5.1.war - cloud-axis.jar - - - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Axis2 distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - Portions Copyright 2006 International Business Machines Corp. - Portions Copyright 2005-2007 WSO2, Inc. - - This product also includes schemas and specification developed by: - - the W3C consortium (http://www.w3c.org) - - This product also includes WS-* schemas developed by International - Business Machines Corporation, Microsoft Corporation, BEA Systems, - TIBCO Software, SAP AG, Sonic Software, and VeriSign - - This product also includes a WSDL developed by salesforce.com - - Copyright 1999-2006 salesforce.com, inc. - - Portions of the included xmlbeans library were originally based on the following: - - software copyright (c) 2000-2003, BEA Systems, . - - Please read the different LICENSE files present in the lib directory of - this distribution. - - - For - xml-apis.jar - - - ========================================================================= - == NOTICE file corresponding to section 4(d) of the Apache License, == - == Version 2.0, in this case for the Apache xml-commons xml-apis == - == distribution. == - ========================================================================= - - Apache XML Commons XML APIs - Copyright 2006 The Apache Software Foundation. - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - Portions of this software were originally based on the following: - - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. - - software copyright (c) 1999, Sun Microsystems., http://www.sun.com. - - software copyright (c) 2000 World Wide Web Consortium, http://www.w3.org - - - For - cloud-commons-codec-1.5.jar - commons-codec-1.4.jar - - - Apache Commons Codec - Copyright 2002-2011 The Apache Software Foundation - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - -------------------------------------------------------------------------------- - src/test/org/apache/commons/codec/language/DoubleMetaphoneTest.java contains - test data from http://aspell.sourceforge.net/test/batch0.tab. - - Copyright (C) 2002 Kevin Atkinson (kevina@gnu.org). Verbatim copying - and distribution of this entire article is permitted in any medium, - provided this notice is preserved. - -------------------------------------------------------------------------------- - - - For - rampart-lib - - - Apache Rampart - Copyright 2010 The Apache Software Foundation - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - Please read the different LICENSE files present in the lib directory of - this distribution. - - - For - xercesImpl.jar - - - ========================================================================= - == NOTICE file corresponding to section 4(d) of the Apache License, == - == Version 2.0, in this case for the Apache Xerces Java distribution. == - ========================================================================= - - Apache Xerces Java - Copyright 1999-2012 The Apache Software Foundation - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - Portions of this software were originally based on the following: - - software copyright (c) 1999, IBM Corporation., http://www.ibm.com. - - software copyright (c) 1999, Sun Microsystems., http://www.sun.com. - - voluntary contributions made by Paul Eng on behalf of the - Apache Software Foundation that were originally developed at iClick, Inc., - software copyright (c) 1999. - - - For - woden-api-1.0M8.jar - woden-impl-dom-1.0M8.jar - - - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Woden distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - This product also includes software developed by : - - - IBM Corporation (http://www.ibm.com), - WSDL4J was the initial code contribution for the Apache Woden - project and some of the WSDL4J design and code has been reused. - - The W3C Consortium (http://www.w3c.org), - Common W3C XML Schema and DTD files are packaged with Apache Woden. - - Please read the different LICENSE files present in the root directory of - this distribution. - - - For - axiom-api-1.2.8.jar - axiom-impl-1.2.8.jar - - - Axiom includes software from other projects, as follows: - - This software includes the Woodstox High-performance XML processor - http://woodstox.codehaus.org/ - licensed under the Apache License, Version 2.0 - - This software includes the Jaxen XPath library - http://jaxen.codehaus.org/ - licensed under the following BSD 3 Clause license: - - ================================================================================ - Copyright 2003-2006 The Werken Company. All Rights Reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the Jaxen Project nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS - IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER - OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - ================================================================================ - - - For - wss4j-1.5.8.jar - - - Apache WebServices - WSS4J - Copyright 2004-2011 The Apache Software Foundation - - This product includes software developed at - The Apache Software Foundation (http://www.apache.org/). - - This product includes software Copyright University of Southampton IT - Innovation Centre, 2006 (http://www.it-innovation.soton.ac.uk). diff --git a/agent/conf/agent.properties b/agent/conf/agent.properties index 27572b53653..74cfd1c21d6 100644 --- a/agent/conf/agent.properties +++ b/agent/conf/agent.properties @@ -69,3 +69,14 @@ domr.scripts.dir=scripts/network/domr/kvm # set the vm migrate speed, by default, it will try to guess the speed of the guest network # In MegaBytes per second #vm.migrate.speed=0 + +# set the type of bridge used on the hypervisor, this defines what commands the resource +# will use to setup networking. Currently supported NATIVE, OPENVSWITCH +#network.bridge.type=native + +# set the driver used to plug and unplug nics from the bridges +# a sensible default will be selected based on the network.bridge.type but can +# be overridden here. +# native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver +# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver +#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver \ No newline at end of file diff --git a/agent/pom.xml b/agent/pom.xml index 810f33fc572..a3d071b1c6a 100644 --- a/agent/pom.xml +++ b/agent/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT diff --git a/agent/src/com/cloud/agent/AgentShell.java b/agent/src/com/cloud/agent/AgentShell.java index e3d1063e6b8..e736978a7a8 100644 --- a/agent/src/com/cloud/agent/AgentShell.java +++ b/agent/src/com/cloud/agent/AgentShell.java @@ -48,15 +48,13 @@ import com.cloud.agent.dao.StorageComponent; import com.cloud.agent.dao.impl.PropertiesStorage; import com.cloud.host.Host; import com.cloud.resource.ServerResource; +import com.cloud.utils.LogUtils; import com.cloud.utils.NumbersUtil; import com.cloud.utils.ProcessUtil; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.backoff.BackoffAlgorithm; import com.cloud.utils.backoff.impl.ConstantTimeBackoff; -import com.cloud.utils.component.Adapters; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; -import com.cloud.utils.net.MacAddress; import com.cloud.utils.script.Script; public class AgentShell implements IAgentShell { @@ -146,6 +144,7 @@ public class AgentShell implements IAgentShell { return _guid; } + @Override public Map getCmdLineProperties() { return _cmdLineProperties; } @@ -378,8 +377,6 @@ public class AgentShell implements IAgentShell { public void init(String[] args) throws ConfigurationException { - final ComponentLocator locator = ComponentLocator.getLocator("agent"); - final Class c = this.getClass(); _version = c.getPackage().getImplementationVersion(); if (_version == null) { @@ -396,12 +393,9 @@ public class AgentShell implements IAgentShell { s_logger.debug("Found property: " + property); } - _storage = locator.getManager(StorageComponent.class); - if (_storage == null) { - s_logger.info("Defaulting to using properties file for storage"); - _storage = new PropertiesStorage(); - _storage.configure("Storage", new HashMap()); - } + s_logger.info("Defaulting to using properties file for storage"); + _storage = new PropertiesStorage(); + _storage.configure("Storage", new HashMap()); // merge with properties from command line to let resource access // command line parameters @@ -410,22 +404,9 @@ public class AgentShell implements IAgentShell { _properties.put(cmdLineProp.getKey(), cmdLineProp.getValue()); } - final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class); - final Enumeration en = adapters.enumeration(); - while (en.hasMoreElements()) { - _backoff = (BackoffAlgorithm) en.nextElement(); - break; - } - if (en.hasMoreElements()) { - s_logger.info("More than one backoff algorithm specified. Using the first one "); - } - - if (_backoff == null) { - s_logger.info("Defaulting to the constant time backoff algorithm"); - _backoff = new ConstantTimeBackoff(); - _backoff.configure("ConstantTimeBackoff", - new HashMap()); - } + s_logger.info("Defaulting to the constant time backoff algorithm"); + _backoff = new ConstantTimeBackoff(); + _backoff.configure("ConstantTimeBackoff", new HashMap()); } private void launchAgent() throws ConfigurationException { @@ -469,6 +450,7 @@ public class AgentShell implements IAgentShell { openPortWithIptables(port); _consoleProxyMain = new Thread(new Runnable() { + @Override public void run() { try { Class consoleProxyClazz = Class.forName("com.cloud.consoleproxy.ConsoleProxy"); @@ -522,7 +504,7 @@ public class AgentShell implements IAgentShell { } catch (final SecurityException e) { throw new ConfigurationException( "Security excetion when loading resource: " + name - + " due to: " + e.toString()); + + " due to: " + e.toString()); } catch (final NoSuchMethodException e) { throw new ConfigurationException( "Method not found excetion when loading resource: " @@ -534,7 +516,7 @@ public class AgentShell implements IAgentShell { } catch (final InstantiationException e) { throw new ConfigurationException( "Instantiation excetion when loading resource: " + name - + " due to: " + e.toString()); + + " due to: " + e.toString()); } catch (final IllegalAccessException e) { throw new ConfigurationException( "Illegal access exception when loading resource: " @@ -630,6 +612,8 @@ public class AgentShell implements IAgentShell { public static void main(String[] args) { try { + LogUtils.initLog4j("log4j-cloud.xml"); + AgentShell shell = new AgentShell(); shell.init(args); shell.start(); diff --git a/agent/src/com/cloud/agent/VmmAgentShell.java b/agent/src/com/cloud/agent/VmmAgentShell.java index ef2ef0f3279..190d1168284 100644 --- a/agent/src/com/cloud/agent/VmmAgentShell.java +++ b/agent/src/com/cloud/agent/VmmAgentShell.java @@ -23,7 +23,6 @@ import java.io.IOException; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Enumeration; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -41,19 +40,15 @@ import com.cloud.agent.dao.impl.PropertiesStorage; import com.cloud.agent.transport.Request; import com.cloud.resource.ServerResource; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.ProcessUtil; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.backoff.BackoffAlgorithm; import com.cloud.utils.backoff.impl.ConstantTimeBackoff; -import com.cloud.utils.component.Adapters; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.MacAddress; import com.cloud.utils.nio.HandlerFactory; import com.cloud.utils.nio.Link; import com.cloud.utils.nio.NioServer; import com.cloud.utils.nio.Task; -import com.cloud.utils.nio.Task.Type; /** * Implementation of agent shell to run the agents on System Center Virtual Machine manager @@ -61,7 +56,7 @@ import com.cloud.utils.nio.Task.Type; public class VmmAgentShell implements IAgentShell, HandlerFactory { - private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName()); + private static final Logger s_logger = Logger.getLogger(VmmAgentShell.class.getName()); private final Properties _properties = new Properties(); private final Map _cmdLineProperties = new HashMap(); private StorageComponent _storage; @@ -76,112 +71,112 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { private int _proxyPort; private int _workers; private String _guid; - static private NioServer _connection; - static private int _listenerPort=9000; + static private NioServer _connection; + static private int _listenerPort=9000; private int _nextAgentId = 1; private volatile boolean _exit = false; private int _pingRetries; - private Thread _consoleProxyMain = null; + private final Thread _consoleProxyMain = null; private final List _agents = new ArrayList(); public VmmAgentShell() { } - + @Override public Properties getProperties() { - return _properties; + return _properties; } - + @Override public BackoffAlgorithm getBackoffAlgorithm() { - return _backoff; + return _backoff; } - + @Override public int getPingRetries() { - return _pingRetries; + return _pingRetries; } - + @Override public String getZone() { - return _zone; + return _zone; } - + @Override public String getPod() { - return _pod; + return _pod; } - + @Override public String getHost() { - return _host; + return _host; } - + @Override public String getPrivateIp() { - return _privateIp; + return _privateIp; } - + @Override public int getPort() { - return _port; + return _port; } - + @Override public int getProxyPort() { - return _proxyPort; + return _proxyPort; } - + @Override public int getWorkers() { - return _workers; + return _workers; } - + @Override public String getGuid() { - return _guid; + return _guid; } - @Override - public void upgradeAgent(String url) { - // TODO Auto-generated method stub - - } + @Override + public void upgradeAgent(String url) { + // TODO Auto-generated method stub - @Override + } + + @Override public String getVersion() { - return _version; + return _version; } - @Override - public Map getCmdLineProperties() { - // TODO Auto-generated method stub - return _cmdLineProperties; - } - - public String getProperty(String prefix, String name) { - if(prefix != null) - return _properties.getProperty(prefix + "." + name); - - return _properties.getProperty(name); + @Override + public Map getCmdLineProperties() { + // TODO Auto-generated method stub + return _cmdLineProperties; } - - @Override - public String getPersistentProperty(String prefix, String name) { - if(prefix != null) - return _storage.get(prefix + "." + name); - return _storage.get(name); - } - @Override - public void setPersistentProperty(String prefix, String name, String value) { - if(prefix != null) - _storage.persist(prefix + "." + name, value); - else - _storage.persist(name, value); - } + public String getProperty(String prefix, String name) { + if(prefix != null) + return _properties.getProperty(prefix + "." + name); - private void loadProperties() throws ConfigurationException { + return _properties.getProperty(name); + } + + @Override + public String getPersistentProperty(String prefix, String name) { + if(prefix != null) + return _storage.get(prefix + "." + name); + return _storage.get(name); + } + + @Override + public void setPersistentProperty(String prefix, String name, String value) { + if(prefix != null) + _storage.persist(prefix + "." + name, value); + else + _storage.persist(name, value); + } + + private void loadProperties() throws ConfigurationException { final File file = PropertiesUtil.findConfigFile("agent.properties"); if (file == null) { throw new ConfigurationException("Unable to find agent.properties."); @@ -197,7 +192,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { throw new CloudRuntimeException("IOException in reading " + file.getAbsolutePath(), ex); } } - + protected boolean parseCommand(final String[] args) throws ConfigurationException { String host = null; String workers = null; @@ -211,7 +206,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { System.out.println("Invalid Parameter: " + args[i]); continue; } - + // save command line properties _cmdLineProperties.put(tokens[0], tokens[1]); @@ -222,14 +217,14 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { } else if (tokens[0].equalsIgnoreCase("host")) { host = tokens[1]; } else if(tokens[0].equalsIgnoreCase("zone")) { - zone = tokens[1]; + zone = tokens[1]; } else if(tokens[0].equalsIgnoreCase("pod")) { - pod = tokens[1]; + pod = tokens[1]; } else if(tokens[0].equalsIgnoreCase("guid")) { - guid = tokens[1]; - } else if(tokens[0].equalsIgnoreCase("eth1ip")) { - _privateIp = tokens[1]; - } + guid = tokens[1]; + } else if(tokens[0].equalsIgnoreCase("eth1ip")) { + _privateIp = tokens[1]; + } } if (port == null) { @@ -237,7 +232,7 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { } _port = NumbersUtil.parseInt(port, 8250); - + _proxyPort = NumbersUtil.parseInt(getProperty(null, "consoleproxy.httpListenPort"), 443); if (workers == null) { @@ -254,42 +249,42 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { host = "localhost"; } _host = host; - + if(zone != null) - _zone = zone; + _zone = zone; else - _zone = getProperty(null, "zone"); + _zone = getProperty(null, "zone"); if (_zone == null || (_zone.startsWith("@") && _zone.endsWith("@"))) { - _zone = "default"; + _zone = "default"; } if(pod != null) - _pod = pod; + _pod = pod; else - _pod = getProperty(null, "pod"); + _pod = getProperty(null, "pod"); if (_pod == null || (_pod.startsWith("@") && _pod.endsWith("@"))) { - _pod = "default"; + _pod = "default"; } if (_host == null || (_host.startsWith("@") && _host.endsWith("@"))) { throw new ConfigurationException("Host is not configured correctly: " + _host); } - + final String retries = getProperty(null, "ping.retries"); _pingRetries = NumbersUtil.parseInt(retries, 5); String value = getProperty(null, "developer"); boolean developer = Boolean.parseBoolean(value); - + if(guid != null) - _guid = guid; + _guid = guid; else - _guid = getProperty(null, "guid"); + _guid = getProperty(null, "guid"); if (_guid == null) { - if (!developer) { - throw new ConfigurationException("Unable to find the guid"); - } - _guid = MacAddress.getMacAddress().toString(":"); + if (!developer) { + throw new ConfigurationException("Unable to find the guid"); + } + _guid = MacAddress.getMacAddress().toString(":"); } return true; @@ -303,63 +298,46 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { } s_logger.trace("Launching agent based on type=" + typeInfo); } - + private void launchAgent() throws ConfigurationException { String resourceClassNames = getProperty(null, "resource"); s_logger.trace("resource=" + resourceClassNames); if(resourceClassNames != null) { - launchAgentFromClassInfo(resourceClassNames); - return; + launchAgentFromClassInfo(resourceClassNames); + return; } - + launchAgentFromTypeInfo(); } - + private void init(String[] args) throws ConfigurationException{ - - final ComponentLocator locator = ComponentLocator.getLocator("agent"); - + final Class c = this.getClass(); _version = c.getPackage().getImplementationVersion(); if (_version == null) { throw new CloudRuntimeException("Unable to find the implementation version of this agent"); } s_logger.info("Implementation Version is " + _version); - + parseCommand(args); - - _storage = locator.getManager(StorageComponent.class); - if (_storage == null) { - s_logger.info("Defaulting to using properties file for storage"); - _storage = new PropertiesStorage(); - _storage.configure("Storage", new HashMap()); - } + + s_logger.info("Defaulting to using properties file for storage"); + _storage = new PropertiesStorage(); + _storage.configure("Storage", new HashMap()); // merge with properties from command line to let resource access command line parameters for(Map.Entry cmdLineProp : getCmdLineProperties().entrySet()) { - _properties.put(cmdLineProp.getKey(), cmdLineProp.getValue()); - } - - final Adapters adapters = locator.getAdapters(BackoffAlgorithm.class); - final Enumeration en = adapters.enumeration(); - while (en.hasMoreElements()) { - _backoff = (BackoffAlgorithm)en.nextElement(); - break; - } - if (en.hasMoreElements()) { - s_logger.info("More than one backoff algorithm specified. Using the first one "); + _properties.put(cmdLineProp.getKey(), cmdLineProp.getValue()); } - if (_backoff == null) { - s_logger.info("Defaulting to the constant time backoff algorithm"); - _backoff = new ConstantTimeBackoff(); - _backoff.configure("ConstantTimeBackoff", new HashMap()); - } + s_logger.info("Defaulting to the constant time backoff algorithm"); + _backoff = new ConstantTimeBackoff(); + _backoff.configure("ConstantTimeBackoff", new HashMap()); } private void launchAgentFromClassInfo(String resourceClassNames) throws ConfigurationException { - String[] names = resourceClassNames.split("\\|"); - for(String name: names) { + String[] names = resourceClassNames.split("\\|"); + for(String name: names) { Class impl; try { impl = Class.forName(name); @@ -368,41 +346,41 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { ServerResource resource = (ServerResource)constructor.newInstance(); launchAgent(getNextAgentId(), resource); } catch (final ClassNotFoundException e) { - throw new ConfigurationException("Resource class not found: " + name); + throw new ConfigurationException("Resource class not found: " + name); } catch (final SecurityException e) { - throw new ConfigurationException("Security excetion when loading resource: " + name); + throw new ConfigurationException("Security excetion when loading resource: " + name); } catch (final NoSuchMethodException e) { - throw new ConfigurationException("Method not found excetion when loading resource: " + name); + throw new ConfigurationException("Method not found excetion when loading resource: " + name); } catch (final IllegalArgumentException e) { - throw new ConfigurationException("Illegal argument excetion when loading resource: " + name); + throw new ConfigurationException("Illegal argument excetion when loading resource: " + name); } catch (final InstantiationException e) { - throw new ConfigurationException("Instantiation excetion when loading resource: " + name); + throw new ConfigurationException("Instantiation excetion when loading resource: " + name); } catch (final IllegalAccessException e) { - throw new ConfigurationException("Illegal access exception when loading resource: " + name); + throw new ConfigurationException("Illegal access exception when loading resource: " + name); } catch (final InvocationTargetException e) { - throw new ConfigurationException("Invocation target exception when loading resource: " + name); + throw new ConfigurationException("Invocation target exception when loading resource: " + name); } - } + } } private void launchAgent(int localAgentId, ServerResource resource) throws ConfigurationException { - // we don't track agent after it is launched for now - Agent agent = new Agent(this, localAgentId, resource); - _agents.add(agent); - agent.start(); + // we don't track agent after it is launched for now + Agent agent = new Agent(this, localAgentId, resource); + _agents.add(agent); + agent.start(); } public synchronized int getNextAgentId() { - return _nextAgentId++; + return _nextAgentId++; } - - private void run(String[] args) { - - try { + + private void run(String[] args) { + + try { System.setProperty("java.net.preferIPv4Stack","true"); - loadProperties(); - init(args); - + loadProperties(); + init(args); + String instance = getProperty(null, "instance"); if (instance == null) { instance = ""; @@ -413,22 +391,22 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { // TODO need to do this check. For Agentshell running on windows needs different approach //final String run = "agent." + instance + "pid"; //s_logger.debug("Checking to see if " + run + "exists."); - //ProcessUtil.pidCheck(run); - - + //ProcessUtil.pidCheck(run); + + // TODO: For Hyper-V agent.properties need to be revamped to support multiple agents // corresponding to multiple clusters but running on a SCVMM host - + // read the persistent storage and launch the agents - //launchAgent(); + //launchAgent(); // FIXME get rid of this approach of agent listening for boot strap commands from the management server - // now listen for bootstrap request from the management server and launch agents - _connection = new NioServer("VmmAgentShell", _listenerPort, 1, this); - _connection.start(); - s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server"); - while(_connection.isRunning()); + // now listen for bootstrap request from the management server and launch agents + _connection = new NioServer("VmmAgentShell", _listenerPort, 1, this); + _connection.start(); + s_logger.info("SCVMM agent is listening on port " +_listenerPort + " for bootstrap command from management server"); + while(_connection.isRunning()); } catch(final ConfigurationException e) { s_logger.error("Unable to start agent: " + e.getMessage()); System.out.println("Unable to start agent: " + e.getMessage()); @@ -438,89 +416,89 @@ public class VmmAgentShell implements IAgentShell, HandlerFactory { System.out.println("Unable to start agent: " + e.getMessage()); System.exit(ExitStatus.Error.value()); } - } + } - @Override - public Task create(com.cloud.utils.nio.Task.Type type, Link link, - byte[] data) { - return new AgentBootStrapHandler(type, link, data); - } + @Override + public Task create(com.cloud.utils.nio.Task.Type type, Link link, + byte[] data) { + return new AgentBootStrapHandler(type, link, data); + } - public void stop() { - _exit = true; - if(_consoleProxyMain != null) { - _consoleProxyMain.interrupt(); - } - } - - public static void main(String[] args) { - - VmmAgentShell shell = new VmmAgentShell(); - Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell)); - shell.run(args); - } + public void stop() { + _exit = true; + if(_consoleProxyMain != null) { + _consoleProxyMain.interrupt(); + } + } - // class to handle the bootstrap command from the management server - private class AgentBootStrapHandler extends Task { + public static void main(String[] args) { - public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) { - super(type, link, data); - } + VmmAgentShell shell = new VmmAgentShell(); + Runtime.getRuntime().addShutdownHook(new ShutdownThread(shell)); + shell.run(args); + } - @Override - protected void doTask(Task task) throws Exception { - final Type type = task.getType(); - s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler"); - if (type == Task.Type.DATA) - { - final byte[] data = task.getData(); - final Request request = Request.parse(data); - final Command cmd = request.getCommand(); - - if (cmd instanceof StartupVMMAgentCommand) { + // class to handle the bootstrap command from the management server + private class AgentBootStrapHandler extends Task { - StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd; + public AgentBootStrapHandler(Task.Type type, Link link, byte[] data) { + super(type, link, data); + } - _zone = Long.toString(vmmCmd.getDataCenter()); - _cmdLineProperties.put("zone", _zone); + @Override + protected void doTask(Task task) throws Exception { + final Type type = task.getType(); + s_logger.info("recieved task of type "+ type.toString() +" to handle in BootStrapTakHandler"); + if (type == Task.Type.DATA) + { + final byte[] data = task.getData(); + final Request request = Request.parse(data); + final Command cmd = request.getCommand(); - _pod = Long.toString(vmmCmd.getPod()); - _cmdLineProperties.put("pod", _pod); + if (cmd instanceof StartupVMMAgentCommand) { - _cluster = vmmCmd.getClusterName(); - _cmdLineProperties.put("cluster", _cluster); + StartupVMMAgentCommand vmmCmd = (StartupVMMAgentCommand) cmd; - _guid = vmmCmd.getGuid(); - _cmdLineProperties.put("guid", _guid); + _zone = Long.toString(vmmCmd.getDataCenter()); + _cmdLineProperties.put("zone", _zone); - _host = vmmCmd.getManagementServerIP(); - _port = NumbersUtil.parseInt(vmmCmd.getport(), 8250); + _pod = Long.toString(vmmCmd.getPod()); + _cmdLineProperties.put("pod", _pod); - s_logger.info("Recieved boot strap command from management server with parameters " + - " Zone:"+ _zone + " "+ - " Cluster:"+ _cluster + " "+ - " pod:"+_pod + " "+ - " host:"+ _host +" "+ - " port:"+_port); + _cluster = vmmCmd.getClusterName(); + _cmdLineProperties.put("cluster", _cluster); - launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource"); - - // TODO: persist the info in agent.properties for agent restarts - } - } - } - } + _guid = vmmCmd.getGuid(); + _cmdLineProperties.put("guid", _guid); + + _host = vmmCmd.getManagementServerIP(); + _port = NumbersUtil.parseInt(vmmCmd.getport(), 8250); + + s_logger.info("Recieved boot strap command from management server with parameters " + + " Zone:"+ _zone + " "+ + " Cluster:"+ _cluster + " "+ + " pod:"+_pod + " "+ + " host:"+ _host +" "+ + " port:"+_port); + + launchAgentFromClassInfo("com.cloud.hypervisor.hyperv.resource.HypervResource"); + + // TODO: persist the info in agent.properties for agent restarts + } + } + } + } private static class ShutdownThread extends Thread { - VmmAgentShell _shell; + VmmAgentShell _shell; public ShutdownThread(VmmAgentShell shell) { this._shell = shell; } - + @Override public void run() { _shell.stop(); } } - + } \ No newline at end of file diff --git a/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java b/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java deleted file mode 100755 index 058aefa9252..00000000000 --- a/agent/src/com/cloud/agent/configuration/AgentComponentLibraryBase.java +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. -package com.cloud.agent.configuration; - -import java.util.List; -import java.util.Map; - -import com.cloud.utils.component.Adapter; -import com.cloud.utils.component.ComponentLibraryBase; -import com.cloud.utils.component.ComponentLocator.ComponentInfo; -import com.cloud.utils.component.Manager; -import com.cloud.utils.component.PluggableService; -import com.cloud.utils.db.GenericDao; - -public class AgentComponentLibraryBase extends ComponentLibraryBase { - @Override - public Map>> getDaos() { - return null; - } - - @Override - public Map> getManagers() { - if (_managers.size() == 0) { - populateManagers(); - } - return _managers; - } - - @Override - public Map>> getAdapters() { - if (_adapters.size() == 0) { - populateAdapters(); - } - return _adapters; - } - - @Override - public Map, Class> getFactories() { - return null; - } - - protected void populateManagers() { - // addManager("StackMaidManager", StackMaidManagerImpl.class); - } - - protected void populateAdapters() { - - } - - protected void populateServices() { - - } - - @Override - public Map> getPluggableServices() { - if (_pluggableServices.size() == 0) { - populateServices(); - } - return _pluggableServices; - } - -} diff --git a/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java b/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java index b94ae83fdc2..2bf26f48642 100755 --- a/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java +++ b/agent/src/com/cloud/agent/dao/impl/PropertiesStorage.java @@ -127,4 +127,34 @@ public class PropertiesStorage implements StorageComponent { return true; } + @Override + public void setName(String name) { + // TODO Auto-generated method stub + + } + + @Override + public void setConfigParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public Map getConfigParams() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getRunLevel() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setRunLevel(int level) { + // TODO Auto-generated method stub + + } + } diff --git a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java b/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java index 11ea824902b..73a994e8bd9 100644 --- a/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java +++ b/agent/src/com/cloud/agent/dhcp/FakeDhcpSnooper.java @@ -139,4 +139,34 @@ public class FakeDhcpSnooper implements DhcpSnooper { return null; } + @Override + public void setName(String name) { + // TODO Auto-generated method stub + + } + + @Override + public void setConfigParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public Map getConfigParams() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getRunLevel() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setRunLevel(int level) { + // TODO Auto-generated method stub + + } + } diff --git a/agent/src/com/cloud/agent/resource/DummyResource.java b/agent/src/com/cloud/agent/resource/DummyResource.java index 573f639b06d..37a8b3d67e7 100755 --- a/agent/src/com/cloud/agent/resource/DummyResource.java +++ b/agent/src/com/cloud/agent/resource/DummyResource.java @@ -224,4 +224,34 @@ public class DummyResource implements ServerResource { public void setAgentControl(IAgentControl agentControl) { _agentControl = agentControl; } + + @Override + public void setName(String name) { + // TODO Auto-generated method stub + + } + + @Override + public void setConfigParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public Map getConfigParams() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getRunLevel() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void setRunLevel(int level) { + // TODO Auto-generated method stub + + } } diff --git a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java index 48f507900d6..8a3a271c4f4 100644 --- a/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java +++ b/agent/src/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java @@ -77,7 +77,7 @@ import com.google.gson.Gson; * server. * */ -public class ConsoleProxyResource extends ServerResourceBase implements +public abstract class ConsoleProxyResource extends ServerResourceBase implements ServerResource { static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class); diff --git a/agent/test/com/cloud/agent/TestAgentShell.java b/agent/test/com/cloud/agent/TestAgentShell.java index d7210acbef3..b0f748067d0 100644 --- a/agent/test/com/cloud/agent/TestAgentShell.java +++ b/agent/test/com/cloud/agent/TestAgentShell.java @@ -19,24 +19,23 @@ package com.cloud.agent; import java.io.File; import java.io.IOException; +import junit.framework.TestCase; + import org.apache.log4j.Logger; -import com.cloud.agent.AgentShell; -import com.cloud.utils.testcase.Log4jEnabledTestCase; - -public class TestAgentShell extends Log4jEnabledTestCase { +public class TestAgentShell extends TestCase { protected final static Logger s_logger = Logger.getLogger(TestAgentShell.class); - + public void testWget() { File file = null; try { file = File.createTempFile("wget", ".html"); - AgentShell.wget("http://www.google.com/", file); - + AgentShell.wget("http://www.apache.org/", file); + if (s_logger.isDebugEnabled()) { s_logger.debug("file saved to " + file.getAbsolutePath()); } - + } catch (final IOException e) { s_logger.warn("Exception while downloading agent update package, ", e); } diff --git a/api/pom.xml b/api/pom.xml index 7461c67aaa2..8ca258f12e3 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java new file mode 100644 index 00000000000..f9fb1642b3f --- /dev/null +++ b/api/src/com/cloud/agent/api/CreateVMSnapshotAnswer.java @@ -0,0 +1,62 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; + +public class CreateVMSnapshotAnswer extends Answer { + + private List volumeTOs; + private VMSnapshotTO vmSnapshotTo; + + + public List getVolumeTOs() { + return volumeTOs; + } + + public void setVolumeTOs(List volumeTOs) { + this.volumeTOs = volumeTOs; + } + + public VMSnapshotTO getVmSnapshotTo() { + return vmSnapshotTo; + } + + public void setVmSnapshotTo(VMSnapshotTO vmSnapshotTo) { + this.vmSnapshotTo = vmSnapshotTo; + } + + public CreateVMSnapshotAnswer() { + + } + + public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, boolean success, + String result) { + super(cmd, success, result); + } + + public CreateVMSnapshotAnswer(CreateVMSnapshotCommand cmd, + VMSnapshotTO vmSnapshotTo, List volumeTOs) { + super(cmd, true, ""); + this.vmSnapshotTo = vmSnapshotTo; + this.volumeTOs = volumeTOs; + } + +} diff --git a/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java new file mode 100644 index 00000000000..478987d993b --- /dev/null +++ b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; +import com.cloud.vm.VirtualMachine; + +public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand { + + public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType, VirtualMachine.State vmState) { + super(vmName, snapshot, volumeTOs, guestOSType); + this.vmState = vmState; + } + + private VirtualMachine.State vmState; + + + public VirtualMachine.State getVmState() { + return vmState; + } + + public void setVmState(VirtualMachine.State vmState) { + this.vmState = vmState; + } + +} diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java index a19d34436f7..fbf6121f543 100644 --- a/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java +++ b/api/src/com/cloud/agent/api/CreateVolumeFromSnapshotCommand.java @@ -18,6 +18,7 @@ package com.cloud.agent.api; import com.cloud.storage.StoragePool; + /** * This currently assumes that both primary and secondary storage are mounted on the XenServer. */ diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java new file mode 100644 index 00000000000..ed3bc62ccba --- /dev/null +++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotAnswer.java @@ -0,0 +1,54 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api; + +import com.cloud.agent.api.to.VolumeTO; + +public class CreateVolumeFromVMSnapshotAnswer extends Answer { + private String path; + private VolumeTO volumeTo; + + public VolumeTO getVolumeTo() { + return volumeTo; + } + + public CreateVolumeFromVMSnapshotAnswer( + CreateVolumeFromVMSnapshotCommand cmd, VolumeTO volumeTo) { + super(cmd, true, ""); + this.volumeTo = volumeTo; + } + + public String getPath() { + return path; + } + + protected CreateVolumeFromVMSnapshotAnswer() { + + } + + public CreateVolumeFromVMSnapshotAnswer( + CreateVolumeFromVMSnapshotCommand cmd, String path) { + super(cmd, true, ""); + this.path = path; + } + + public CreateVolumeFromVMSnapshotAnswer( + CreateVolumeFromVMSnapshotCommand cmd, boolean result, String string) { + super(cmd, result, string); + } +} diff --git a/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java new file mode 100644 index 00000000000..634e15c9f04 --- /dev/null +++ b/api/src/com/cloud/agent/api/CreateVolumeFromVMSnapshotCommand.java @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.vm.DiskProfile; + +public class CreateVolumeFromVMSnapshotCommand extends Command { + + protected String path; + protected String name; + protected Boolean fullClone; + protected String storagePoolUuid; + private StorageFilerTO pool; + private DiskProfile diskProfile; + private Long volumeId; + + public DiskProfile getDskch() { + return diskProfile; + } + + public String getPath() { + return path; + } + + public Long getVolumeId() { + return volumeId; + } + + protected CreateVolumeFromVMSnapshotCommand() { + + } + + public CreateVolumeFromVMSnapshotCommand(String path, String name, + Boolean fullClone, String storagePoolUuid) { + this.path = path; + this.name = name; + this.fullClone = fullClone; + this.storagePoolUuid = storagePoolUuid; + } + + public CreateVolumeFromVMSnapshotCommand(String path, String name, + Boolean fullClone, String storagePoolUuid, StorageFilerTO pool, + DiskProfile diskProfile, Long volumeId) { + this.path = path; + this.name = name; + this.fullClone = fullClone; + this.storagePoolUuid = storagePoolUuid; + this.pool = pool; + this.diskProfile = diskProfile; + this.volumeId = volumeId; + } + + @Override + public boolean executeInSequence() { + return false; + } + + public String getName() { + return name; + } + + public Boolean getFullClone() { + return fullClone; + } + + public String getStoragePoolUuid() { + return storagePoolUuid; + } + + public StorageFilerTO getPool() { + return pool; + } +} diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java new file mode 100644 index 00000000000..8f4ecad3d80 --- /dev/null +++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java @@ -0,0 +1,49 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; + +public class DeleteVMSnapshotAnswer extends Answer { + private List volumeTOs; + + public DeleteVMSnapshotAnswer() { + } + + public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result, + String message) { + super(cmd, result, message); + } + + public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, + List volumeTOs) { + super(cmd, true, ""); + this.volumeTOs = volumeTOs; + } + + public List getVolumeTOs() { + return volumeTOs; + } + + public void setVolumeTOs(List volumeTOs) { + this.volumeTOs = volumeTOs; + } + + +} diff --git a/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java new file mode 100644 index 00000000000..c213448bf9c --- /dev/null +++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotCommand.java @@ -0,0 +1,28 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; + + +public class DeleteVMSnapshotCommand extends VMSnapshotBaseCommand { + public DeleteVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) { + super( vmName, snapshot, volumeTOs, guestOSType); + } +} diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java new file mode 100644 index 00000000000..848ffc0ebf8 --- /dev/null +++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotAnswer.java @@ -0,0 +1,63 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; +import com.cloud.vm.VirtualMachine; + +public class RevertToVMSnapshotAnswer extends Answer { + + private List volumeTOs; + private VirtualMachine.State vmState; + + public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, boolean result, + String message) { + super(cmd, result, message); + } + + public RevertToVMSnapshotAnswer() { + super(); + } + + public RevertToVMSnapshotAnswer(RevertToVMSnapshotCommand cmd, + List volumeTOs, + VirtualMachine.State vmState) { + super(cmd, true, ""); + this.volumeTOs = volumeTOs; + this.vmState = vmState; + } + + public VirtualMachine.State getVmState() { + return vmState; + } + + public List getVolumeTOs() { + return volumeTOs; + } + + public void setVolumeTOs(List volumeTOs) { + this.volumeTOs = volumeTOs; + } + + public void setVmState(VirtualMachine.State vmState) { + this.vmState = vmState; + } + +} diff --git a/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java new file mode 100644 index 00000000000..429a186e0dc --- /dev/null +++ b/api/src/com/cloud/agent/api/RevertToVMSnapshotCommand.java @@ -0,0 +1,29 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; + +public class RevertToVMSnapshotCommand extends VMSnapshotBaseCommand { + + public RevertToVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) { + super(vmName, snapshot, volumeTOs, guestOSType); + } + +} diff --git a/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java new file mode 100755 index 00000000000..e938de73f0b --- /dev/null +++ b/api/src/com/cloud/agent/api/ScheduleHostScanTaskCommand.java @@ -0,0 +1,32 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +/* + * This is used to schedule an explicit host scan in MS peers. Currently used during + * add host operation so that correct MS can take host ownership. On receiving the + * command the scan is scheduled immediately. + */ +public class ScheduleHostScanTaskCommand extends Command { + public ScheduleHostScanTaskCommand() { + } + + @Override + public boolean executeInSequence() { + return false; // standalone command and can be executed independent of other commands + } +} diff --git a/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java new file mode 100644 index 00000000000..2120f2f73b1 --- /dev/null +++ b/api/src/com/cloud/agent/api/VMSnapshotBaseCommand.java @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.agent.api; + +import java.util.List; + +import com.cloud.agent.api.to.VolumeTO; + +public class VMSnapshotBaseCommand extends Command{ + protected List volumeTOs; + protected VMSnapshotTO target; + protected String vmName; + protected String guestOSType; + + + public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List volumeTOs, String guestOSType) { + this.vmName = vmName; + this.target = snapshot; + this.volumeTOs = volumeTOs; + this.guestOSType = guestOSType; + } + + public List getVolumeTOs() { + return volumeTOs; + } + + public void setVolumeTOs(List volumeTOs) { + this.volumeTOs = volumeTOs; + } + + public VMSnapshotTO getTarget() { + return target; + } + + public void setTarget(VMSnapshotTO target) { + this.target = target; + } + + public String getVmName() { + return vmName; + } + + public void setVmName(String vmName) { + this.vmName = vmName; + } + + @Override + public boolean executeInSequence() { + return false; + } + + public String getGuestOSType() { + return guestOSType; + } + + public void setGuestOSType(String guestOSType) { + this.guestOSType = guestOSType; + } +} diff --git a/api/src/com/cloud/agent/api/VMSnapshotTO.java b/api/src/com/cloud/agent/api/VMSnapshotTO.java new file mode 100644 index 00000000000..c7b42d25bc9 --- /dev/null +++ b/api/src/com/cloud/agent/api/VMSnapshotTO.java @@ -0,0 +1,90 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +import com.cloud.vm.snapshot.VMSnapshot; + +public class VMSnapshotTO { + private Long id; + private String snapshotName; + private VMSnapshot.Type type; + private Long createTime; + private Boolean current; + private String description; + private VMSnapshotTO parent; + + public Long getId() { + return id; + } + public void setId(Long id) { + this.id = id; + } + public VMSnapshotTO(Long id, String snapshotName, + VMSnapshot.Type type, Long createTime, + String description, Boolean current, VMSnapshotTO parent) { + super(); + this.id = id; + this.snapshotName = snapshotName; + this.type = type; + this.createTime = createTime; + this.current = current; + this.description = description; + this.parent = parent; + } + public VMSnapshotTO() { + + } + public String getDescription() { + return description; + } + public void setDescription(String description) { + this.description = description; + } + public Boolean getCurrent() { + return current; + } + public void setCurrent(Boolean current) { + this.current = current; + } + public Long getCreateTime() { + return createTime; + } + public void setCreateTime(Long createTime) { + this.createTime = createTime; + } + + public VMSnapshot.Type getType() { + return type; + } + public void setType(VMSnapshot.Type type) { + this.type = type; + } + + public String getSnapshotName() { + return snapshotName; + } + public void setSnapshotName(String snapshotName) { + this.snapshotName = snapshotName; + } + public VMSnapshotTO getParent() { + return parent; + } + public void setParent(VMSnapshotTO parent) { + this.parent = parent; + } + +} diff --git a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java b/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java index c5af38eb724..3befc2f6bd1 100644 --- a/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java +++ b/api/src/com/cloud/agent/api/proxy/StartConsoleProxyAgentHttpHandlerCommand.java @@ -17,8 +17,8 @@ package com.cloud.agent.api.proxy; import com.cloud.agent.api.Command; -import com.cloud.agent.api.LogLevel.Log4jLevel; import com.cloud.agent.api.LogLevel; +import com.cloud.agent.api.LogLevel.Log4jLevel; public class StartConsoleProxyAgentHttpHandlerCommand extends Command { @LogLevel(Log4jLevel.Off) diff --git a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java index 5c2cd582d4c..f0ce70e9a80 100644 --- a/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java +++ b/api/src/com/cloud/agent/api/routing/DhcpEntryCommand.java @@ -28,7 +28,9 @@ public class DhcpEntryCommand extends NetworkElementCommand { String defaultRouter; String staticRoutes; String defaultDns; - + String vmIp6Address; + String ip6Gateway; + String duid; protected DhcpEntryCommand() { @@ -39,14 +41,15 @@ public class DhcpEntryCommand extends NetworkElementCommand { return true; } - public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName) { + public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address) { this.vmMac = vmMac; this.vmIpAddress = vmIpAddress; this.vmName = vmName; + this.vmIp6Address = vmIp6Address; } - public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String dns, String gateway) { - this(vmMac, vmIpAddress, vmName); + public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) { + this(vmMac, vmIpAddress, vmName, vmIp6Address); this.dns = dns; this.gateway = gateway; } @@ -102,4 +105,28 @@ public class DhcpEntryCommand extends NetworkElementCommand { public void setDefaultDns(String defaultDns) { this.defaultDns = defaultDns; } + + public String getIp6Gateway() { + return ip6Gateway; + } + + public void setIp6Gateway(String ip6Gateway) { + this.ip6Gateway = ip6Gateway; + } + + public String getDuid() { + return duid; + } + + public void setDuid(String duid) { + this.duid = duid; + } + + public String getVmIp6Address() { + return vmIp6Address; + } + + public void setVmIp6Address(String ip6Address) { + this.vmIp6Address = ip6Address; + } } diff --git a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java index c80179a0560..d928e0c5b2b 100755 --- a/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java +++ b/api/src/com/cloud/agent/api/storage/CreateEntityDownloadURLCommand.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.agent.api.storage; -import com.cloud.agent.api.Command; public class CreateEntityDownloadURLCommand extends AbstractDownloadCommand { diff --git a/api/src/com/cloud/agent/api/storage/DownloadCommand.java b/api/src/com/cloud/agent/api/storage/DownloadCommand.java index efb5ecb5256..c6ffe45a9ef 100644 --- a/api/src/com/cloud/agent/api/storage/DownloadCommand.java +++ b/api/src/com/cloud/agent/api/storage/DownloadCommand.java @@ -18,11 +18,12 @@ package com.cloud.agent.api.storage; import java.net.URI; -import com.cloud.storage.Volume; -import com.cloud.storage.Storage.ImageFormat; -import com.cloud.template.VirtualMachineTemplate; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Volume; +import com.cloud.template.VirtualMachineTemplate; + public class DownloadCommand extends AbstractDownloadCommand implements InternalIdentity { public static class PasswordAuth { diff --git a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java index 06e95fe4265..a4e2e255001 100644 --- a/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java +++ b/api/src/com/cloud/agent/api/storage/ListTemplateAnswer.java @@ -19,7 +19,6 @@ package com.cloud.agent.api.storage; import java.util.Map; import com.cloud.agent.api.Answer; - import com.cloud.storage.template.TemplateInfo; public class ListTemplateAnswer extends Answer { diff --git a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java index a2776c2af46..63c5b621c6e 100755 --- a/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java +++ b/api/src/com/cloud/agent/api/storage/ListVolumeCommand.java @@ -16,9 +16,6 @@ // under the License. package com.cloud.agent.api.storage; -import com.cloud.agent.api.LogLevel; -import com.cloud.agent.api.LogLevel.Log4jLevel; -import com.cloud.agent.api.to.SwiftTO; public class ListVolumeCommand extends StorageCommand { diff --git a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java index b450041597f..8d955bb1c63 100644 --- a/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java +++ b/api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java @@ -16,8 +16,8 @@ // under the License. package com.cloud.agent.api.storage; -import com.cloud.storage.Storage.ImageFormat; import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StoragePool; /** diff --git a/core/src/com/cloud/resource/DiskPreparer.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java similarity index 58% rename from core/src/com/cloud/resource/DiskPreparer.java rename to api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java index 77b8f7c1b7f..3434b985aaa 100644 --- a/core/src/com/cloud/resource/DiskPreparer.java +++ b/api/src/com/cloud/agent/api/storage/ResizeVolumeAnswer.java @@ -14,29 +14,27 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.resource; +package com.cloud.agent.api.storage; -import com.cloud.storage.VolumeVO; -import com.cloud.template.VirtualMachineTemplate.BootloaderType; -import com.cloud.utils.component.Adapter; +import com.cloud.agent.api.Answer; -/** - * DiskMounter mounts and unmounts disk for VMs - * to consume. - * - */ -public interface DiskPreparer extends Adapter { - /** - * Mounts a volumeVO and returns a path. - * - * @param vol - * @return - */ - public String mount(String vmName, VolumeVO vol, BootloaderType type); - - /** - * Unmounts - */ - public boolean unmount(String path); +public class ResizeVolumeAnswer extends Answer { + private long newSize; + protected ResizeVolumeAnswer() { + + } + + public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details, long newSize) { + super(cmd, result, details); + this.newSize = newSize; + } + + public ResizeVolumeAnswer(ResizeVolumeCommand cmd, boolean result, String details) { + super(cmd, result, details); + } + + public long getNewSize() { + return newSize; + } } diff --git a/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java new file mode 100644 index 00000000000..82d3ae7b4bb --- /dev/null +++ b/api/src/com/cloud/agent/api/storage/ResizeVolumeCommand.java @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api.storage; + +import com.cloud.agent.api.Command; +import com.cloud.agent.api.to.StorageFilerTO; + +public class ResizeVolumeCommand extends Command { + private String path; + private StorageFilerTO pool; + private String vmInstance; + private Long newSize; + private Long currentSize; + private boolean shrinkOk; + + protected ResizeVolumeCommand() { + + } + + public ResizeVolumeCommand(String path, + StorageFilerTO pool, + Long currentSize, + Long newSize, + boolean shrinkOk, + String vmInstance) + { + this.path = path; + this.pool = pool; + this.vmInstance = vmInstance; + this.currentSize = currentSize; + this.newSize = newSize; + this.shrinkOk = shrinkOk; + } + + public String getPath() { + return path; + } + + public String getPoolUuid() { + return pool.getUuid(); + } + + public StorageFilerTO getPool() { + return pool; + } + + public long getNewSize() { + return newSize; + } + + public long getCurrentSize() { + return currentSize; + } + + public boolean getShrinkOk() { + return shrinkOk; + } + + public String getInstanceName() { + return vmInstance; + } + + /** + * {@inheritDoc} + */ + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/api/src/com/cloud/agent/api/storage/UploadCommand.java b/api/src/com/cloud/agent/api/storage/UploadCommand.java index 2a7c60a51ff..473bd5b75ac 100644 --- a/api/src/com/cloud/agent/api/storage/UploadCommand.java +++ b/api/src/com/cloud/agent/api/storage/UploadCommand.java @@ -16,11 +16,12 @@ // under the License. package com.cloud.agent.api.storage; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.agent.api.storage.DownloadCommand.PasswordAuth; import com.cloud.agent.api.to.TemplateTO; import com.cloud.storage.Upload.Type; import com.cloud.template.VirtualMachineTemplate; -import org.apache.cloudstack.api.InternalIdentity; public class UploadCommand extends AbstractUploadCommand implements InternalIdentity { diff --git a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java index 95ac57c3867..7f779365c9e 100644 --- a/api/src/com/cloud/agent/api/to/FirewallRuleTO.java +++ b/api/src/com/cloud/agent/api/to/FirewallRuleTO.java @@ -19,10 +19,11 @@ package com.cloud.agent.api.to; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.FirewallRule.State; import com.cloud.utils.net.NetUtils; -import org.apache.cloudstack.api.InternalIdentity; /** * FirewallRuleTO transfers a port range for an ip to be opened. @@ -50,7 +51,7 @@ public class FirewallRuleTO implements InternalIdentity { FirewallRule.Purpose purpose; private Integer icmpType; private Integer icmpCode; - + private FirewallRule.TrafficType trafficType; protected FirewallRuleTO() { } @@ -85,6 +86,7 @@ public class FirewallRuleTO implements InternalIdentity { this.sourceCidrList = sourceCidr; this.icmpType = icmpType; this.icmpCode = icmpCode; + this.trafficType = null; } public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp) { this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode()); @@ -94,6 +96,23 @@ public class FirewallRuleTO implements InternalIdentity { this(rule.getId(),null, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, rule.getPurpose(),rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode()); } + public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose) { + this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode()); + } + + public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType) { + this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), rule.getState()==State.Revoke, rule.getState()==State.Active, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode()); + this.trafficType = trafficType; + } + + public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, boolean revokeState, boolean alreadyAdded) { + this(rule.getId(),srcVlanTag, srcIp, rule.getProtocol(), rule.getSourcePortStart(), rule.getSourcePortEnd(), revokeState, alreadyAdded, purpose,rule.getSourceCidrList(),rule.getIcmpType(),rule.getIcmpCode()); + } + + public FirewallRule.TrafficType getTrafficType(){ + return trafficType; + } + public long getId() { return id; } diff --git a/api/src/com/cloud/agent/api/to/NetworkACLTO.java b/api/src/com/cloud/agent/api/to/NetworkACLTO.java index 9b1a6296b08..8818e13de4a 100644 --- a/api/src/com/cloud/agent/api/to/NetworkACLTO.java +++ b/api/src/com/cloud/agent/api/to/NetworkACLTO.java @@ -20,10 +20,11 @@ package com.cloud.agent.api.to; import java.util.ArrayList; import java.util.List; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.FirewallRule.TrafficType; import com.cloud.utils.net.NetUtils; -import org.apache.cloudstack.api.InternalIdentity; public class NetworkACLTO implements InternalIdentity { diff --git a/api/src/com/cloud/agent/api/to/S3TO.java b/api/src/com/cloud/agent/api/to/S3TO.java index 879df229c31..d556cb6d05d 100644 --- a/api/src/com/cloud/agent/api/to/S3TO.java +++ b/api/src/com/cloud/agent/api/to/S3TO.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.agent.api.to; -import com.cloud.utils.S3Utils; - import java.util.Date; +import com.cloud.utils.S3Utils; + public final class S3TO implements S3Utils.ClientOptions { private Long id; diff --git a/api/src/com/cloud/agent/api/to/TemplateTO.java b/api/src/com/cloud/agent/api/to/TemplateTO.java index d77b80551f4..45fa57bf35e 100644 --- a/api/src/com/cloud/agent/api/to/TemplateTO.java +++ b/api/src/com/cloud/agent/api/to/TemplateTO.java @@ -16,9 +16,10 @@ // under the License. package com.cloud.agent.api.to; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.storage.Storage.ImageFormat; import com.cloud.template.VirtualMachineTemplate; -import org.apache.cloudstack.api.InternalIdentity; public class TemplateTO implements InternalIdentity { private long id; diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java index 8f3f0eb39d6..bdd636e727b 100644 --- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java +++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java @@ -28,7 +28,8 @@ public class VirtualMachineTO { private BootloaderType bootloader; Type type; int cpus; - Integer speed; + Integer minSpeed; + Integer maxSpeed; long minRam; long maxRam; String hostName; @@ -47,12 +48,13 @@ public class VirtualMachineTO { VolumeTO[] disks; NicTO[] nics; - public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) { + public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) { this.id = id; this.name = instanceName; this.type = type; this.cpus = cpus; - this.speed = speed; + this.minSpeed = minSpeed; + this.maxSpeed = maxSpeed; this.minRam = minRam; this.maxRam = maxRam; this.bootloader = bootloader; @@ -101,10 +103,13 @@ public class VirtualMachineTO { this.cpus = cpus; } - public Integer getSpeed() { - return speed; + public Integer getMinSpeed() { + return minSpeed; } + public Integer getMaxSpeed() { + return maxSpeed; + } public boolean getLimitCpuUse() { return limitCpuUse; } diff --git a/api/src/com/cloud/agent/api/to/VolumeTO.java b/api/src/com/cloud/agent/api/to/VolumeTO.java index ff739c58f80..4cbe82b357b 100644 --- a/api/src/com/cloud/agent/api/to/VolumeTO.java +++ b/api/src/com/cloud/agent/api/to/VolumeTO.java @@ -16,10 +16,11 @@ // under the License. package com.cloud.agent.api.to; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StoragePool; import com.cloud.storage.Volume; -import org.apache.cloudstack.api.InternalIdentity; public class VolumeTO implements InternalIdentity { protected VolumeTO() { @@ -123,6 +124,10 @@ public class VolumeTO implements InternalIdentity { public String getOsType() { return guestOsType; } + + public void setPath(String path){ + this.path = path; + } @Override public String toString() { diff --git a/api/src/com/cloud/alert/Alert.java b/api/src/com/cloud/alert/Alert.java index defd15490e5..050f97f2ef3 100644 --- a/api/src/com/cloud/alert/Alert.java +++ b/api/src/com/cloud/alert/Alert.java @@ -16,11 +16,11 @@ // under the License. package com.cloud.alert; +import java.util.Date; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.Date; - public interface Alert extends Identity, InternalIdentity { short getType(); String getSubject(); diff --git a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java index 263f023b3e5..2b63c64425d 100644 --- a/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java +++ b/api/src/com/cloud/api/commands/CreatePrivateNetworkCmd.java @@ -16,14 +16,17 @@ // under the License. package com.cloud.api.commands; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.NetworkResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -145,17 +148,17 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd { } catch (InsufficientCapacityException ex){ s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } if (result != null) { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a Private network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a Private network"); } } @@ -167,7 +170,7 @@ public class CreatePrivateNetworkCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private network"); } } diff --git a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java index 80269075744..829283e8b9f 100644 --- a/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java +++ b/api/src/com/cloud/api/commands/DestroyConsoleProxyCmd.java @@ -16,11 +16,14 @@ // under the License. package com.cloud.api.commands; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -84,7 +87,7 @@ public class DestroyConsoleProxyCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy console proxy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy console proxy"); } } } diff --git a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java index 709da6af30c..3efd4c5abba 100644 --- a/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java +++ b/api/src/com/cloud/api/commands/ListRecurringSnapshotScheduleCmd.java @@ -19,12 +19,12 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SnapshotScheduleResponse; + import com.cloud.storage.snapshot.SnapshotSchedule; //@APICommand(description="Lists recurring snapshot schedule", responseObject=SnapshotScheduleResponse.class) diff --git a/api/src/com/cloud/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java index 48a060719c6..e63fcece525 100644 --- a/api/src/com/cloud/configuration/ConfigurationService.java +++ b/api/src/com/cloud/configuration/ConfigurationService.java @@ -20,24 +20,27 @@ import java.util.List; import javax.naming.NamingException; +import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; +import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd; import org.apache.cloudstack.api.command.admin.ldap.LDAPRemoveCmd; import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd; +import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd; +import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd; +import org.apache.cloudstack.api.command.admin.offering.CreateDiskOfferingCmd; import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd; -import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd; -import org.apache.cloudstack.api.command.admin.offering.*; +import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd; +import org.apache.cloudstack.api.command.admin.offering.DeleteServiceOfferingCmd; +import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd; +import org.apache.cloudstack.api.command.admin.offering.UpdateServiceOfferingCmd; import org.apache.cloudstack.api.command.admin.pod.DeletePodCmd; +import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd; +import org.apache.cloudstack.api.command.admin.vlan.CreateVlanIpRangeCmd; import org.apache.cloudstack.api.command.admin.vlan.DeleteVlanIpRangeCmd; import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd; -import org.apache.cloudstack.api.command.admin.offering.DeleteDiskOfferingCmd; -import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; -import org.apache.cloudstack.api.command.admin.ldap.LDAPConfigCmd; -import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; -import org.apache.cloudstack.api.command.admin.network.UpdateNetworkOfferingCmd; -import org.apache.cloudstack.api.command.admin.pod.UpdatePodCmd; -import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; -import org.apache.cloudstack.api.command.admin.offering.UpdateDiskOfferingCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; +import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; + import com.cloud.dc.DataCenter; import com.cloud.dc.Pod; import com.cloud.dc.Vlan; @@ -261,6 +264,8 @@ public interface ConfigurationService { boolean removeLDAP(LDAPRemoveCmd cmd); + LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd); + /** * @param offering * @return diff --git a/api/src/com/cloud/configuration/Resource.java b/api/src/com/cloud/configuration/Resource.java index 7f551d6b52c..7614c8a4b43 100644 --- a/api/src/com/cloud/configuration/Resource.java +++ b/api/src/com/cloud/configuration/Resource.java @@ -28,7 +28,9 @@ public interface Resource { template("template", 4, ResourceOwnerType.Account, ResourceOwnerType.Domain), project("project", 5, ResourceOwnerType.Account, ResourceOwnerType.Domain), network("network", 6, ResourceOwnerType.Account, ResourceOwnerType.Domain), - vpc("vpc", 7, ResourceOwnerType.Account, ResourceOwnerType.Domain); + vpc("vpc", 7, ResourceOwnerType.Account, ResourceOwnerType.Domain), + cpu("cpu", 8, ResourceOwnerType.Account, ResourceOwnerType.Domain), + memory("memory", 9, ResourceOwnerType.Account, ResourceOwnerType.Domain); private String name; private ResourceOwnerType[] supportedOwners; diff --git a/api/src/com/cloud/dao/EntityManager.java b/api/src/com/cloud/dao/EntityManager.java index 4e4b9c293b5..8e6a438d011 100644 --- a/api/src/com/cloud/dao/EntityManager.java +++ b/api/src/com/cloud/dao/EntityManager.java @@ -38,6 +38,16 @@ public interface EntityManager { */ public T findById(Class entityType, K id); + /** + * Finds an entity by its id including removed. + * @param class of the entity you're trying to find. + * @param class of the id that the entity uses. + * @param entityType Type of the entity. + * @param id id value + * @return T if found; null if not. + */ + public T findByIdIncludingRemoved(Class entityType, K id); + /** * Finds a unique entity by uuid string * @param entity class @@ -47,6 +57,15 @@ public interface EntityManager { */ public T findByUuid(Class entityType, String uuid); + /** + * Finds a unique entity by uuid string + * @param entity class + * @param entityType type of entity you're looking for. + * @param uuid the unique id + * @return T if found, null if not. + */ + public T findByUuidIncludingRemoved(Class entityType, String uuid); + /** * Finds an entity by external id which is always String * @param entity class diff --git a/api/src/com/cloud/dc/DataCenter.java b/api/src/com/cloud/dc/DataCenter.java index 946e9ccb5bd..5f32988da50 100644 --- a/api/src/com/cloud/dc/DataCenter.java +++ b/api/src/com/cloud/dc/DataCenter.java @@ -18,11 +18,12 @@ package com.cloud.dc; import java.util.Map; -import com.cloud.org.Grouping; import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.org.Grouping; + /** * */ @@ -36,6 +37,10 @@ public interface DataCenter extends InfrastructureEntity, Grouping, Identity, In String getDns2(); + String getIp6Dns1(); + + String getIp6Dns2(); + String getGuestNetworkCidr(); String getName(); diff --git a/api/src/com/cloud/dc/Pod.java b/api/src/com/cloud/dc/Pod.java index 9da5b7e7836..1cbab36f3bd 100644 --- a/api/src/com/cloud/dc/Pod.java +++ b/api/src/com/cloud/dc/Pod.java @@ -16,11 +16,12 @@ // under the License. package com.cloud.dc; -import com.cloud.org.Grouping; import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.org.Grouping; + /** * Represents one pod in the cloud stack. * diff --git a/api/src/com/cloud/dc/Vlan.java b/api/src/com/cloud/dc/Vlan.java index 0f629ef3cbf..790195f9f3c 100644 --- a/api/src/com/cloud/dc/Vlan.java +++ b/api/src/com/cloud/dc/Vlan.java @@ -44,4 +44,9 @@ public interface Vlan extends InfrastructureEntity, InternalIdentity, Identity { public Long getPhysicalNetworkId(); + public String getIp6Gateway(); + + public String getIp6Cidr(); + + public String getIp6Range(); } diff --git a/api/src/com/cloud/domain/Domain.java b/api/src/com/cloud/domain/Domain.java index cfed519ada9..f8277c2cd28 100644 --- a/api/src/com/cloud/domain/Domain.java +++ b/api/src/com/cloud/domain/Domain.java @@ -18,10 +18,11 @@ package com.cloud.domain; import java.util.Date; -import com.cloud.user.OwnedBy; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.user.OwnedBy; + /** * Domain defines the Domain object. */ @@ -58,4 +59,8 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity { void setState(State state); String getNetworkDomain(); + + public String getUuid(); + + int getRegionId(); } diff --git a/api/src/com/cloud/event/EventCategory.java b/api/src/com/cloud/event/EventCategory.java new file mode 100644 index 00000000000..cee6529b550 --- /dev/null +++ b/api/src/com/cloud/event/EventCategory.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package com.cloud.event; + +import java.util.ArrayList; +import java.util.List; + +public class EventCategory { + private static List eventCategories = new ArrayList(); + private String eventCategoryName; + + public EventCategory(String categoryName) { + this.eventCategoryName = categoryName; + eventCategories.add(this); + } + + public String getName() { + return eventCategoryName; + } + + public static List listAllEventCategories() { + return eventCategories; + } + + public static EventCategory getEventCategory(String categoryName) { + for (EventCategory category : eventCategories) { + if (category.getName().equalsIgnoreCase(categoryName)) { + return category; + } + } + return null; + } + + public static final EventCategory ACTION_EVENT = new EventCategory("ActionEvent"); + public static final EventCategory ALERT_EVENT = new EventCategory("AlertEvent"); + public static final EventCategory USAGE_EVENT = new EventCategory("UsageEvent"); + public static final EventCategory RESOURCE_STATE_CHANGE_EVENT = new EventCategory("ResourceStateEvent"); +} diff --git a/api/src/com/cloud/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java index 8c622252d17..0087edca743 100755 --- a/api/src/com/cloud/event/EventTypes.java +++ b/api/src/com/cloud/event/EventTypes.java @@ -16,7 +16,41 @@ // under the License. package com.cloud.event; +import com.cloud.configuration.Configuration; +import com.cloud.dc.DataCenter; +import com.cloud.dc.Pod; +import com.cloud.dc.StorageNetworkIpRange; +import com.cloud.dc.Vlan; +import com.cloud.domain.Domain; +import com.cloud.host.Host; +import com.cloud.network.*; +import com.cloud.network.as.*; +import com.cloud.network.router.VirtualRouter; +import com.cloud.network.rules.LoadBalancer; +import com.cloud.network.rules.StaticNat; +import com.cloud.network.security.SecurityGroup; +import com.cloud.network.vpc.PrivateGateway; +import com.cloud.network.vpc.StaticRoute; +import com.cloud.network.vpc.Vpc; +import com.cloud.offering.DiskOffering; +import com.cloud.offering.NetworkOffering; +import com.cloud.offering.ServiceOffering; +import com.cloud.projects.Project; +import com.cloud.storage.Snapshot; +import com.cloud.storage.Volume; +import com.cloud.template.VirtualMachineTemplate; +import com.cloud.user.Account; +import com.cloud.user.User; +import com.cloud.vm.VirtualMachine; + +import java.util.HashMap; +import java.util.Map; + public class EventTypes { + + //map of Event and corresponding entity for which Event is applicable + private static Map entityEventDetails = null; + // VM Events public static final String EVENT_VM_CREATE = "VM.CREATE"; public static final String EVENT_VM_DESTROY = "VM.DESTROY"; @@ -26,6 +60,7 @@ public class EventTypes { public static final String EVENT_VM_UPDATE = "VM.UPDATE"; public static final String EVENT_VM_UPGRADE = "VM.UPGRADE"; public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD"; + public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY"; public static final String EVENT_VM_MIGRATE = "VM.MIGRATE"; public static final String EVENT_VM_MOVE = "VM.MOVE"; public static final String EVENT_VM_RESTORE = "VM.RESTORE"; @@ -63,6 +98,11 @@ public class EventTypes { public static final String EVENT_FIREWALL_OPEN = "FIREWALL.OPEN"; public static final String EVENT_FIREWALL_CLOSE = "FIREWALL.CLOSE"; + //NIC Events + public static final String EVENT_NIC_CREATE = "NIC.CREATE"; + public static final String EVENT_NIC_DELETE = "NIC.DELETE"; + public static final String EVENT_NIC_UPDATE = "NIC.UPDATE"; + // Load Balancers public static final String EVENT_ASSIGN_TO_LOAD_BALANCER_RULE = "LB.ASSIGN.TO.RULE"; public static final String EVENT_REMOVE_FROM_LOAD_BALANCER_RULE = "LB.REMOVE.FROM.RULE"; @@ -108,6 +148,7 @@ public class EventTypes { public static final String EVENT_VOLUME_EXTRACT = "VOLUME.EXTRACT"; public static final String EVENT_VOLUME_UPLOAD = "VOLUME.UPLOAD"; public static final String EVENT_VOLUME_MIGRATE = "VOLUME.MIGRATE"; + public static final String EVENT_VOLUME_RESIZE = "VOLUME.RESIZE"; // Domains public static final String EVENT_DOMAIN_CREATE = "DOMAIN.CREATE"; @@ -290,6 +331,11 @@ public class EventTypes { // tag related events public static final String EVENT_TAGS_CREATE = "CREATE_TAGS"; public static final String EVENT_TAGS_DELETE = "DELETE_TAGS"; + + // vm snapshot events + public static final String EVENT_VM_SNAPSHOT_CREATE = "VMSNAPSHOT.CREATE"; + public static final String EVENT_VM_SNAPSHOT_DELETE = "VMSNAPSHOT.DELETE"; + public static final String EVENT_VM_SNAPSHOT_REVERT = "VMSNAPSHOT.REVERTTO"; // external network device events public static final String EVENT_EXTERNAL_NVP_CONTROLLER_ADD = "PHYSICAL.NVPCONTROLLER.ADD"; @@ -312,4 +358,323 @@ public class EventTypes { public static final String EVENT_AUTOSCALEVMGROUP_UPDATE = "AUTOSCALEVMGROUP.UPDATE"; public static final String EVENT_AUTOSCALEVMGROUP_ENABLE = "AUTOSCALEVMGROUP.ENABLE"; public static final String EVENT_AUTOSCALEVMGROUP_DISABLE = "AUTOSCALEVMGROUP.DISABLE"; + + + public static final String EVENT_BAREMETAL_DHCP_SERVER_ADD = "PHYSICAL.DHCP.ADD"; + public static final String EVENT_BAREMETAL_DHCP_SERVER_DELETE = "PHYSICAL.DHCP.DELETE"; + public static final String EVENT_BAREMETAL_PXE_SERVER_ADD = "PHYSICAL.PXE.ADD"; + public static final String EVENT_BAREMETAL_PXE_SERVER_DELETE = "PHYSICAL.PXE.DELETE"; + + static { + + // TODO: need a way to force author adding event types to declare the entity details as well, with out braking + // current ActionEvent annotation semantics + + entityEventDetails = new HashMap(); + + entityEventDetails.put(EVENT_VM_CREATE, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_DESTROY, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_START, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_STOP, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_REBOOT, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_UPDATE, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_UPGRADE, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_RESETPASSWORD, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_MIGRATE, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_MOVE, VirtualMachine.class.getName()); + entityEventDetails.put(EVENT_VM_RESTORE, VirtualMachine.class.getName()); + + entityEventDetails.put(EVENT_ROUTER_CREATE, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_DESTROY, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_START, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_STOP, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_REBOOT, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_HA, VirtualRouter.class.getName()); + entityEventDetails.put(EVENT_ROUTER_UPGRADE, VirtualRouter.class.getName()); + + entityEventDetails.put(EVENT_PROXY_CREATE, "ConsoleProxy"); + entityEventDetails.put(EVENT_PROXY_DESTROY, "ConsoleProxy"); + entityEventDetails.put(EVENT_PROXY_START, "ConsoleProxy"); + entityEventDetails.put(EVENT_PROXY_STOP, "ConsoleProxy"); + entityEventDetails.put(EVENT_PROXY_REBOOT, "ConsoleProxy"); + entityEventDetails.put(EVENT_ROUTER_HA, "ConsoleProxy"); + entityEventDetails.put(EVENT_PROXY_HA, "ConsoleProxy"); + + entityEventDetails.put(EVENT_VNC_CONNECT, "VNC"); + entityEventDetails.put(EVENT_VNC_DISCONNECT, "VNC"); + + // Network Events + entityEventDetails.put(EVENT_NETWORK_CREATE, Network.class.getName()); + entityEventDetails.put(EVENT_NETWORK_DELETE, Network.class.getName()); + entityEventDetails.put(EVENT_NETWORK_UPDATE, Network.class.getName()); + entityEventDetails.put(EVENT_NETWORK_RESTART, Network.class.getName()); + entityEventDetails.put(EVENT_NET_IP_ASSIGN, PublicIpAddress.class.getName()); + entityEventDetails.put(EVENT_NET_IP_RELEASE, PublicIpAddress.class.getName()); + entityEventDetails.put(EVENT_NET_RULE_ADD, Network.class.getName()); + entityEventDetails.put(EVENT_NET_RULE_DELETE, Network.class.getName()); + entityEventDetails.put(EVENT_NET_RULE_MODIFY, Network.class.getName()); + entityEventDetails.put(EVENT_FIREWALL_OPEN, Network.class.getName()); + entityEventDetails.put(EVENT_FIREWALL_CLOSE, Network.class.getName()); + + // Load Balancers + entityEventDetails.put(EVENT_ASSIGN_TO_LOAD_BALANCER_RULE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_REMOVE_FROM_LOAD_BALANCER_RULE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_LOAD_BALANCER_CREATE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_LOAD_BALANCER_DELETE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_CREATE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_LB_STICKINESSPOLICY_DELETE, LoadBalancer.class.getName()); + entityEventDetails.put(EVENT_LOAD_BALANCER_UPDATE, LoadBalancer.class.getName()); + + // Account events + entityEventDetails.put(EVENT_ACCOUNT_DISABLE, Account.class.getName()); + entityEventDetails.put(EVENT_ACCOUNT_CREATE, Account.class.getName()); + entityEventDetails.put(EVENT_ACCOUNT_DELETE, Account.class.getName()); + entityEventDetails.put(EVENT_ACCOUNT_MARK_DEFAULT_ZONE, Account.class.getName()); + + // UserVO Events + entityEventDetails.put(EVENT_USER_LOGIN, User.class.getName()); + entityEventDetails.put(EVENT_USER_LOGOUT, User.class.getName()); + entityEventDetails.put(EVENT_USER_CREATE, User.class.getName()); + entityEventDetails.put(EVENT_USER_DELETE, User.class.getName()); + entityEventDetails.put(EVENT_USER_DISABLE, User.class.getName()); + entityEventDetails.put(EVENT_USER_UPDATE, User.class.getName()); + entityEventDetails.put(EVENT_USER_ENABLE, User.class.getName()); + entityEventDetails.put(EVENT_USER_LOCK, User.class.getName()); + + // Template Events + entityEventDetails.put(EVENT_TEMPLATE_CREATE, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_DELETE, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_UPDATE, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_START, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_SUCCESS, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_DOWNLOAD_FAILED, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_COPY, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_EXTRACT, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_UPLOAD, VirtualMachineTemplate.class.getName()); + entityEventDetails.put(EVENT_TEMPLATE_CLEANUP, VirtualMachineTemplate.class.getName()); + + // Volume Events + entityEventDetails.put(EVENT_VOLUME_CREATE, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_DELETE, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_ATTACH, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_DETACH, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_EXTRACT, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_UPLOAD, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_MIGRATE, Volume.class.getName()); + entityEventDetails.put(EVENT_VOLUME_RESIZE, Volume.class.getName()); + + // Domains + entityEventDetails.put(EVENT_DOMAIN_CREATE, Domain.class.getName()); + entityEventDetails.put(EVENT_DOMAIN_DELETE, Domain.class.getName()); + entityEventDetails.put(EVENT_DOMAIN_UPDATE, Domain.class.getName()); + + // Snapshots + entityEventDetails.put(EVENT_SNAPSHOT_CREATE, Snapshot.class.getName()); + entityEventDetails.put(EVENT_SNAPSHOT_DELETE, Snapshot.class.getName()); + entityEventDetails.put(EVENT_SNAPSHOT_POLICY_CREATE, Snapshot.class.getName()); + entityEventDetails.put(EVENT_SNAPSHOT_POLICY_UPDATE, Snapshot.class.getName()); + entityEventDetails.put(EVENT_SNAPSHOT_POLICY_DELETE, Snapshot.class.getName()); + + // ISO + entityEventDetails.put(EVENT_ISO_CREATE, "Iso"); + entityEventDetails.put(EVENT_ISO_DELETE, "Iso"); + entityEventDetails.put(EVENT_ISO_COPY, "Iso"); + entityEventDetails.put(EVENT_ISO_ATTACH, "Iso"); + entityEventDetails.put(EVENT_ISO_DETACH, "Iso"); + entityEventDetails.put(EVENT_ISO_EXTRACT, "Iso"); + entityEventDetails.put(EVENT_ISO_UPLOAD, "Iso"); + + // SSVM + entityEventDetails.put(EVENT_SSVM_CREATE, "SecondaryStorageVm"); + entityEventDetails.put(EVENT_SSVM_DESTROY, "SecondaryStorageVm"); + entityEventDetails.put(EVENT_SSVM_START, "SecondaryStorageVm"); + entityEventDetails.put(EVENT_SSVM_STOP, "SecondaryStorageVm"); + entityEventDetails.put(EVENT_SSVM_REBOOT, "SecondaryStorageVm"); + entityEventDetails.put(EVENT_SSVM_HA, "SecondaryStorageVm"); + + // Service Offerings + entityEventDetails.put(EVENT_SERVICE_OFFERING_CREATE, ServiceOffering.class.getName()); + entityEventDetails.put(EVENT_SERVICE_OFFERING_EDIT, ServiceOffering.class.getName()); + entityEventDetails.put(EVENT_SERVICE_OFFERING_DELETE, ServiceOffering.class.getName()); + + // Disk Offerings + entityEventDetails.put(EVENT_DISK_OFFERING_CREATE, DiskOffering.class.getName()); + entityEventDetails.put(EVENT_DISK_OFFERING_EDIT, DiskOffering.class.getName()); + entityEventDetails.put(EVENT_DISK_OFFERING_DELETE, DiskOffering.class.getName()); + + // Network offerings + entityEventDetails.put(EVENT_NETWORK_OFFERING_CREATE, NetworkOffering.class.getName()); + entityEventDetails.put(EVENT_NETWORK_OFFERING_ASSIGN, NetworkOffering.class.getName()); + entityEventDetails.put(EVENT_NETWORK_OFFERING_EDIT, NetworkOffering.class.getName()); + entityEventDetails.put(EVENT_NETWORK_OFFERING_REMOVE, NetworkOffering.class.getName()); + entityEventDetails.put(EVENT_NETWORK_OFFERING_DELETE, NetworkOffering.class.getName()); + + // Pods + entityEventDetails.put(EVENT_POD_CREATE, Pod.class.getName()); + entityEventDetails.put(EVENT_POD_EDIT, Pod.class.getName()); + entityEventDetails.put(EVENT_POD_DELETE, Pod.class.getName()); + + // Zones + entityEventDetails.put(EVENT_ZONE_CREATE, DataCenter.class.getName()); + entityEventDetails.put(EVENT_ZONE_EDIT, DataCenter.class.getName()); + entityEventDetails.put(EVENT_ZONE_DELETE, DataCenter.class.getName()); + + // VLANs/IP ranges + entityEventDetails.put(EVENT_VLAN_IP_RANGE_CREATE, Vlan.class.getName()); + entityEventDetails.put(EVENT_VLAN_IP_RANGE_DELETE,Vlan.class.getName()); + + entityEventDetails.put(EVENT_STORAGE_IP_RANGE_CREATE, StorageNetworkIpRange.class.getName()); + entityEventDetails.put(EVENT_STORAGE_IP_RANGE_DELETE, StorageNetworkIpRange.class.getName()); + entityEventDetails.put(EVENT_STORAGE_IP_RANGE_UPDATE, StorageNetworkIpRange.class.getName()); + + // Configuration Table + entityEventDetails.put(EVENT_CONFIGURATION_VALUE_EDIT, Configuration.class.getName()); + + // Security Groups + entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_INGRESS, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_INGRESS, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_AUTHORIZE_EGRESS, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_REVOKE_EGRESS, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_CREATE, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_DELETE, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_ASSIGN, SecurityGroup.class.getName()); + entityEventDetails.put(EVENT_SECURITY_GROUP_REMOVE, SecurityGroup.class.getName()); + + // Host + entityEventDetails.put(EVENT_HOST_RECONNECT, Host.class.getName()); + + // Maintenance + entityEventDetails.put(EVENT_MAINTENANCE_CANCEL, Host.class.getName()); + entityEventDetails.put(EVENT_MAINTENANCE_CANCEL_PRIMARY_STORAGE, Host.class.getName()); + entityEventDetails.put(EVENT_MAINTENANCE_PREPARE, Host.class.getName()); + entityEventDetails.put(EVENT_MAINTENANCE_PREPARE_PRIMARY_STORAGE, Host.class.getName()); + + // VPN + entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_CREATE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_REMOTE_ACCESS_VPN_DESTROY, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_VPN_USER_ADD, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_VPN_USER_REMOVE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_CREATE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_GATEWAY_DELETE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_CREATE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_DELETE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CUSTOMER_GATEWAY_UPDATE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_CREATE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_DELETE, RemoteAccessVpn.class.getName()); + entityEventDetails.put(EVENT_S2S_VPN_CONNECTION_RESET, RemoteAccessVpn.class.getName()); + + // Custom certificates + entityEventDetails.put(EVENT_UPLOAD_CUSTOM_CERTIFICATE, "Certificate"); + + // OneToOnenat + entityEventDetails.put(EVENT_ENABLE_STATIC_NAT, StaticNat.class.getName()); + entityEventDetails.put(EVENT_DISABLE_STATIC_NAT, StaticNat.class.getName()); + + entityEventDetails.put(EVENT_ZONE_VLAN_ASSIGN,Vlan.class.getName()); + entityEventDetails.put(EVENT_ZONE_VLAN_RELEASE,Vlan.class.getName()); + + // Projects + entityEventDetails.put(EVENT_PROJECT_CREATE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_UPDATE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_DELETE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_ACTIVATE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_SUSPEND, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_ACCOUNT_ADD, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_INVITATION_UPDATE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_INVITATION_REMOVE, Project.class.getName()); + entityEventDetails.put(EVENT_PROJECT_ACCOUNT_REMOVE, Project.class.getName()); + + // Network as a Service + entityEventDetails.put(EVENT_NETWORK_ELEMENT_CONFIGURE,Network.class.getName()); + + // Physical Network Events + entityEventDetails.put(EVENT_PHYSICAL_NETWORK_CREATE, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_PHYSICAL_NETWORK_DELETE, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_PHYSICAL_NETWORK_UPDATE, PhysicalNetwork.class.getName()); + + // Physical Network Service Provider Events + entityEventDetails.put(EVENT_SERVICE_PROVIDER_CREATE, PhysicalNetworkServiceProvider.class.getName()); + entityEventDetails.put(EVENT_SERVICE_PROVIDER_DELETE, PhysicalNetworkServiceProvider.class.getName()); + entityEventDetails.put(EVENT_SERVICE_PROVIDER_UPDATE, PhysicalNetworkServiceProvider.class.getName()); + + // Physical Network TrafficType Events + entityEventDetails.put(EVENT_TRAFFIC_TYPE_CREATE, PhysicalNetworkTrafficType.class.getName()); + entityEventDetails.put(EVENT_TRAFFIC_TYPE_DELETE, PhysicalNetworkTrafficType.class.getName()); + entityEventDetails.put(EVENT_TRAFFIC_TYPE_UPDATE, PhysicalNetworkTrafficType.class.getName()); + + // external network device events + entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_ADD, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_DELETE, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_EXTERNAL_LB_DEVICE_CONFIGURE, PhysicalNetwork.class.getName()); + + // external switch management device events (E.g.: Cisco Nexus 1000v Virtual Supervisor Module. + entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ADD, "Nexus1000v"); + entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE, "Nexus1000v"); + entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_CONFIGURE, "Nexus1000v"); + entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, "Nexus1000v"); + entityEventDetails.put(EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, "Nexus1000v"); + + + entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_ADD, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_DELETE, PhysicalNetwork.class.getName()); + entityEventDetails.put(EVENT_EXTERNAL_FIREWALL_DEVICE_CONFIGURE, PhysicalNetwork.class.getName()); + + // VPC + entityEventDetails.put(EVENT_VPC_CREATE, Vpc.class.getName()); + entityEventDetails.put(EVENT_VPC_UPDATE, Vpc.class.getName()); + entityEventDetails.put(EVENT_VPC_DELETE, Vpc.class.getName()); + entityEventDetails.put(EVENT_VPC_RESTART, Vpc.class.getName()); + + // VPC offerings + entityEventDetails.put(EVENT_VPC_OFFERING_CREATE, Vpc.class.getName()); + entityEventDetails.put(EVENT_VPC_OFFERING_UPDATE, Vpc.class.getName()); + entityEventDetails.put(EVENT_VPC_OFFERING_DELETE, Vpc.class.getName()); + + // Private gateway + entityEventDetails.put(EVENT_PRIVATE_GATEWAY_CREATE, PrivateGateway.class.getName()); + entityEventDetails.put(EVENT_PRIVATE_GATEWAY_DELETE, PrivateGateway.class.getName()); + + // Static routes + entityEventDetails.put(EVENT_STATIC_ROUTE_CREATE, StaticRoute.class.getName()); + entityEventDetails.put(EVENT_STATIC_ROUTE_DELETE, StaticRoute.class.getName()); + + // tag related events + entityEventDetails.put(EVENT_TAGS_CREATE, "Tag"); + entityEventDetails.put(EVENT_TAGS_DELETE, "tag"); + + // external network device events + entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_ADD, "NvpController"); + entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_DELETE, "NvpController"); + entityEventDetails.put(EVENT_EXTERNAL_NVP_CONTROLLER_CONFIGURE, "NvpController"); + + // AutoScale + entityEventDetails.put(EVENT_COUNTER_CREATE, AutoScaleCounter.class.getName()); + entityEventDetails.put(EVENT_COUNTER_DELETE, AutoScaleCounter.class.getName()); + entityEventDetails.put(EVENT_CONDITION_CREATE, Condition.class.getName()); + entityEventDetails.put(EVENT_CONDITION_DELETE, Condition.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEPOLICY_CREATE, AutoScalePolicy.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEPOLICY_UPDATE, AutoScalePolicy.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEPOLICY_DELETE, AutoScalePolicy.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_CREATE, AutoScaleVmProfile.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_DELETE, AutoScaleVmProfile.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMPROFILE_UPDATE, AutoScaleVmProfile.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_CREATE, AutoScaleVmGroup.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DELETE, AutoScaleVmGroup.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_UPDATE, AutoScaleVmGroup.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_ENABLE, AutoScaleVmGroup.class.getName()); + entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName()); + } + + public static String getEntityForEvent (String eventName) { + String entityClassName = entityEventDetails.get(eventName); + if (entityClassName == null || entityClassName.isEmpty()) { + return null; + } + int index = entityClassName.lastIndexOf("."); + String entityName = entityClassName; + if (index != -1) { + entityName = entityClassName.substring(index+1); + } + return entityName; + } } diff --git a/api/src/com/cloud/exception/CloudException.java b/api/src/com/cloud/exception/CloudException.java index 036cb1b8adc..0b71ce89a92 100644 --- a/api/src/com/cloud/exception/CloudException.java +++ b/api/src/com/cloud/exception/CloudException.java @@ -17,6 +17,7 @@ package com.cloud.exception; import java.util.ArrayList; + import com.cloud.utils.exception.CSExceptionErrorCode; /** @@ -54,7 +55,6 @@ public class CloudException extends Exception { return; } - public ArrayList getIdProxyList() { return idList; } diff --git a/api/src/com/cloud/exception/PermissionDeniedException.java b/api/src/com/cloud/exception/PermissionDeniedException.java index 638b762d4c4..b95d49b662a 100644 --- a/api/src/com/cloud/exception/PermissionDeniedException.java +++ b/api/src/com/cloud/exception/PermissionDeniedException.java @@ -19,6 +19,7 @@ package com.cloud.exception; import java.util.List; import org.apache.cloudstack.acl.ControlledEntity; + import com.cloud.user.Account; import com.cloud.utils.SerialVersionUID; import com.cloud.utils.exception.CloudRuntimeException; diff --git a/api/src/com/cloud/exception/RequestLimitException.java b/api/src/com/cloud/exception/RequestLimitException.java new file mode 100644 index 00000000000..ebaac802649 --- /dev/null +++ b/api/src/com/cloud/exception/RequestLimitException.java @@ -0,0 +1,42 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.exception; + +import com.cloud.utils.SerialVersionUID; +import com.cloud.utils.exception.CloudRuntimeException; + +/** + * Exception thrown if number of requests is over api rate limit set. + * + */ +public class RequestLimitException extends CloudRuntimeException { + + private static final long serialVersionUID = SerialVersionUID.AccountLimitException; + + protected RequestLimitException() { + super(); + } + + public RequestLimitException(String msg) { + super(msg); + } + + public RequestLimitException(String msg, Throwable cause) { + super(msg, cause); + } + +} diff --git a/api/src/com/cloud/host/Host.java b/api/src/com/cloud/host/Host.java index bd26f81c8c2..17b0ba86f7f 100755 --- a/api/src/com/cloud/host/Host.java +++ b/api/src/com/cloud/host/Host.java @@ -18,11 +18,12 @@ package com.cloud.host; import java.util.Date; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.resource.ResourceState; import com.cloud.utils.fsm.StateObject; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; /** @@ -39,6 +40,8 @@ public interface Host extends StateObject, Identity, InternalIdentity { ExternalLoadBalancer(false), ExternalVirtualSwitchSupervisor(false), PxeServer(false), + BaremetalPxe(false), + BaremetalDhcp(false), TrafficMonitor(false), ExternalDhcp(false), diff --git a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java index efb8a6a208b..aff81b0018d 100644 --- a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java +++ b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java @@ -16,10 +16,11 @@ // under the License. package com.cloud.hypervisor; -import com.cloud.hypervisor.Hypervisor.HypervisorType; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.hypervisor.Hypervisor.HypervisorType; + /** * HypervisorCapability represents one particular hypervisor version's capabilities. @@ -45,4 +46,10 @@ public interface HypervisorCapabilities extends Identity, InternalIdentity{ * @return the max. data volumes per VM supported by hypervisor */ Integer getMaxDataVolumesLimit(); + + /** + * @return the max. hosts per cluster supported by hypervisor + */ + Integer getMaxHostsPerCluster(); + } diff --git a/api/src/com/cloud/network/IpAddress.java b/api/src/com/cloud/network/IpAddress.java index 0ac7f500e2c..47df4d6523b 100644 --- a/api/src/com/cloud/network/IpAddress.java +++ b/api/src/com/cloud/network/IpAddress.java @@ -19,10 +19,11 @@ package com.cloud.network; import java.util.Date; import org.apache.cloudstack.acl.ControlledEntity; -import com.cloud.utils.net.Ip; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.utils.net.Ip; + /** * * - Allocated = null diff --git a/api/src/com/cloud/network/Network.java b/api/src/com/cloud/network/Network.java index 09d3a6a82bf..fa36d27806b 100644 --- a/api/src/com/cloud/network/Network.java +++ b/api/src/com/cloud/network/Network.java @@ -16,24 +16,36 @@ // under the License. package com.cloud.network; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; + import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.Mode; import com.cloud.network.Networks.TrafficType; -import com.cloud.utils.fsm.FiniteState; -import com.cloud.utils.fsm.StateMachine; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.Networks.Mode; +import com.cloud.network.Networks.TrafficType; +import com.cloud.utils.fsm.StateMachine2; +import com.cloud.utils.fsm.StateObject; + +import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; import java.net.URI; import java.util.ArrayList; import java.util.List; -import java.util.Set; /** * owned by an account. */ -public interface Network extends ControlledEntity, InternalIdentity, Identity { +public interface Network extends ControlledEntity, StateObject, InternalIdentity, Identity { public enum GuestType { Shared, @@ -48,7 +60,7 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification); public static final Service Gateway = new Service("Gateway"); public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols, - Capability.MultipleIps, Capability.TrafficStatistics); + Capability.MultipleIps, Capability.TrafficStatistics, Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols); public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols, Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods, Capability.ElasticLb); @@ -123,10 +135,12 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false); public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false); public static final Provider None = new Provider("None", false); - public static final Provider NiciraNvp = new Provider("NiciraNvp", true); + // NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking + public static final Provider NiciraNvp = new Provider("NiciraNvp", false); public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", true); + public static final Provider VPCNetscaler = new Provider("VPCNetscaler", true); public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true); - + private String name; private boolean isExternal; @@ -174,6 +188,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { public static final Capability ElasticLb = new Capability("ElasticLb"); public static final Capability AutoScaleCounters = new Capability("AutoScaleCounters"); public static final Capability InlineMode = new Capability("InlineMode"); + public static final Capability SupportedTrafficDirection = new Capability("SupportedTrafficDirection"); + public static final Capability SupportedEgressProtocols = new Capability("SupportedEgressProtocols"); private String name; @@ -203,7 +219,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { OperationFailed; } - enum State implements FiniteState { + public enum State { + Allocated("Indicates the network configuration is in allocated but not setup"), Setup("Indicates the network configuration is setup"), Implementing("Indicates the network configuration is being implemented"), @@ -211,39 +228,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { Shutdown("Indicates the network configuration is being destroyed"), Destroy("Indicates that the network is destroyed"); + protected static final StateMachine2 s_fsm = new StateMachine2(); - @Override - public StateMachine getStateMachine() { - return s_fsm; - } - - @Override - public State getNextState(Event event) { - return s_fsm.getNextState(this, event); - } - - @Override - public List getFromStates(Event event) { - return s_fsm.getFromStates(this, event); - } - - @Override - public Set getPossibleEvents() { - return s_fsm.getPossibleEvents(this); - } - - String _description; - - @Override - public String getDescription() { - return _description; - } - - private State(String description) { - _description = description; - } - - private static StateMachine s_fsm = new StateMachine(); static { s_fsm.addTransition(State.Allocated, Event.ImplementNetwork, State.Implementing); s_fsm.addTransition(State.Implementing, Event.OperationSucceeded, State.Implemented); @@ -252,8 +238,43 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated); s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented); } + + public static StateMachine2 getStateMachine() { + return s_fsm; + } + + String _description; + private State(String description) { + _description = description; + } } + public class IpAddresses { + private String ip4Address; + private String ip6Address; + + public IpAddresses(String ip4Address, String ip6Address) { + this.setIp4Address(ip4Address); + this.setIp6Address(ip6Address); + } + + public String getIp4Address() { + return ip4Address; + } + + public void setIp4Address(String ip4Address) { + this.ip4Address = ip4Address; + } + + public String getIp6Address() { + return ip6Address; + } + + public void setIp6Address(String ip6Address) { + this.ip6Address = ip6Address; + } + } + String getName(); Mode getMode(); @@ -264,8 +285,21 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { String getGateway(); + // "cidr" is the Cloudstack managed address space, all CloudStack managed vms get IP address from "cidr", + // In general "cidr" also serves as the network CIDR + // But in case IP reservation is configured for a Guest network, "networkcidr" is the Effective network CIDR for that network, + // "cidr" will still continue to be the effective address space for CloudStack managed vms in that Guest network String getCidr(); + // "networkcidr" is the network CIDR of the guest network which uses IP reservation. + // It is the summation of "cidr" and the reservedIPrange(the address space used for non CloudStack purposes). + // For networks not configured with IP reservation, "networkcidr" is always null + String getNetworkCidr(); + + String getIp6Gateway(); + + String getIp6Cidr(); + long getDataCenterId(); long getNetworkOfferingId(); @@ -288,6 +322,8 @@ public interface Network extends ControlledEntity, InternalIdentity, Identity { void setPhysicalNetworkId(Long physicalNetworkId); + public void setTrafficType(TrafficType type); + ACLType getAclType(); boolean isRestartRequired(); diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java new file mode 100644 index 00000000000..9731a61667d --- /dev/null +++ b/api/src/com/cloud/network/NetworkModel.java @@ -0,0 +1,260 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.network; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import com.cloud.dc.Vlan; +import com.cloud.exception.InsufficientAddressCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.element.NetworkElement; +import com.cloud.network.element.UserDataServiceProvider; +import com.cloud.offering.NetworkOffering; +import com.cloud.user.Account; +import com.cloud.vm.Nic; +import com.cloud.vm.NicProfile; +import com.cloud.vm.VirtualMachine; + + +/** + * The NetworkModel presents a read-only view into the Network data such as L2 networks, + * Nics, PublicIps, NetworkOfferings, traffic labels, physical networks and the like + * The idea is that only the orchestration core should be able to modify the data, while other + * participants in the orchestration can use this interface to query the data. + */ +public interface NetworkModel { + + /** + * Lists IP addresses that belong to VirtualNetwork VLANs + * + * @param accountId + * - account that the IP address should belong to + * @param associatedNetworkId + * TODO + * @param sourceNat + * - (optional) true if the IP address should be a source NAT address + * @return - list of IP addresses + */ + List listPublicIpsAssignedToGuestNtwk(long accountId, long associatedNetworkId, Boolean sourceNat); + + List getSystemAccountNetworkOfferings(String... offeringNames); + + List getNics(long vmId); + + String getNextAvailableMacAddressInNetwork(long networkConfigurationId) throws InsufficientAddressCapacityException; + + PublicIpAddress getPublicIpAddress(long ipAddressId); + + List listPodVlans(long podId); + + List listNetworksUsedByVm(long vmId, boolean isSystem); + + Nic getNicInNetwork(long vmId, long networkId); + + List getNicsForTraffic(long vmId, TrafficType type); + + Network getDefaultNetworkForVm(long vmId); + + Nic getDefaultNic(long vmId); + + UserDataServiceProvider getUserDataUpdateProvider(Network network); + + boolean networkIsConfiguredForExternalNetworking(long zoneId, long networkId); + + Map getNetworkServiceCapabilities(long networkId, Service service); + + boolean areServicesSupportedByNetworkOffering(long networkOfferingId, Service... services); + + Network getNetworkWithSecurityGroupEnabled(Long zoneId); + + String getIpOfNetworkElementInVirtualNetwork(long accountId, long dataCenterId); + + List listNetworksForAccount(long accountId, long zoneId, Network.GuestType type); + + List listAllNetworksInAllZonesByType(Network.GuestType type); + + String getGlobalGuestDomainSuffix(); + + String getStartIpAddress(long networkId); + + String getIpInNetwork(long vmId, long networkId); + + String getIpInNetworkIncludingRemoved(long vmId, long networkId); + + Long getPodIdForVlan(long vlanDbId); + + List listNetworkOfferingsForUpgrade(long networkId); + + boolean isSecurityGroupSupportedInNetwork(Network network); + + boolean isProviderSupportServiceInNetwork(long networkId, Service service, Provider provider); + + boolean isProviderEnabledInPhysicalNetwork(long physicalNetowrkId, String providerName); + + String getNetworkTag(HypervisorType hType, Network network); + + List getElementServices(Provider provider); + + boolean canElementEnableIndividualServices(Provider provider); + + boolean areServicesSupportedInNetwork(long networkId, Service... services); + + boolean isNetworkSystem(Network network); + + Map getNetworkOfferingServiceCapabilities(NetworkOffering offering, Service service); + + Long getPhysicalNetworkId(Network network); + + boolean getAllowSubdomainAccessGlobal(); + + boolean isProviderForNetwork(Provider provider, long networkId); + + boolean isProviderForNetworkOffering(Provider provider, long networkOfferingId); + + void canProviderSupportServices(Map> providersMap); + + List getPhysicalNetworkInfo(long dcId, HypervisorType hypervisorType); + + boolean canAddDefaultSecurityGroup(); + + List listNetworkOfferingServices(long networkOfferingId); + + boolean areServicesEnabledInZone(long zoneId, NetworkOffering offering, List services); + + Map> getIpToServices(List publicIps, boolean rulesRevoked, + boolean includingFirewall); + + Map> getProviderToIpList(Network network, Map> ipToServices); + + boolean checkIpForService(IpAddress ip, Service service, Long networkId); + + void checkCapabilityForProvider(Set providers, Service service, Capability cap, String capValue); + + Provider getDefaultUniqueProviderForService(String serviceName); + + void checkNetworkPermissions(Account owner, Network network); + + String getDefaultManagementTrafficLabel(long zoneId, HypervisorType hypervisorType); + + String getDefaultStorageTrafficLabel(long zoneId, HypervisorType hypervisorType); + + String getDefaultPublicTrafficLabel(long dcId, HypervisorType vmware); + + String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware); + + /** + * @param providerName + * @return + */ + NetworkElement getElementImplementingProvider(String providerName); + + /** + * @param accountId + * @param zoneId + * @return + */ + String getAccountNetworkDomain(long accountId, long zoneId); + + /** + * @return + */ + String getDefaultNetworkDomain(); + + /** + * @param ntwkOffId + * @return + */ + List getNtwkOffDistinctProviders(long ntwkOffId); + + /** + * @param accountId + * @param dcId + * @param sourceNat + * @return + */ + List listPublicIpsAssignedToAccount(long accountId, long dcId, Boolean sourceNat); + + /** + * @param zoneId + * @param trafficType + * @return + */ + List getPhysicalNtwksSupportingTrafficType(long zoneId, TrafficType trafficType); + + /** + * @param guestNic + * @return + */ + boolean isPrivateGateway(Nic guestNic); + + Map> getNetworkCapabilities(long networkId); + + Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType); + + Long getDedicatedNetworkDomain(long networkId); + + Map> getNetworkOfferingServiceProvidersMap(long networkOfferingId); + + List listSupportedNetworkServiceProviders(String serviceName); + + List listNetworksByVpc(long vpcId); + + boolean canUseForDeploy(Network network); + + Network getExclusiveGuestNetwork(long zoneId); + + long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType); + + Integer getNetworkRate(long networkId, Long vmId); + + boolean isVmPartOfNetwork(long vmId, long ntwkId); + + PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType); + + Network getNetwork(long networkId); + + IpAddress getIp(long sourceIpAddressId); + + boolean isNetworkAvailableInDomain(long networkId, long domainId); + + NicProfile getNicProfile(VirtualMachine vm, long networkId, String broadcastUri); + + Set getAvailableIps(Network network, String requestedIp); + + String getDomainNetworkDomain(long domainId, long zoneId); + + PublicIpAddress getSourceNatIpAddressForGuestNetwork(Account owner, Network guestNetwork); + + boolean isNetworkInlineMode(Network network); + + boolean isIP6AddressAvailableInNetwork(long networkId); + + boolean isIP6AddressAvailableInVlan(long vlanId); + + void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException; + + void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException; +} \ No newline at end of file diff --git a/api/src/com/cloud/network/NetworkProfile.java b/api/src/com/cloud/network/NetworkProfile.java index b5c463de375..2f56645139c 100644 --- a/api/src/com/cloud/network/NetworkProfile.java +++ b/api/src/com/cloud/network/NetworkProfile.java @@ -21,7 +21,6 @@ import java.net.URI; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.Mode; import com.cloud.network.Networks.TrafficType; -import org.apache.cloudstack.api.InternalIdentity; public class NetworkProfile implements Network { private long id; @@ -39,6 +38,9 @@ public class NetworkProfile implements Network { private TrafficType trafficType; private String gateway; private String cidr; + private String networkCidr; + private String ip6Gateway; + private String ip6Cidr; private long networkOfferingId; private long related; private String displayText; @@ -64,6 +66,9 @@ public class NetworkProfile implements Network { this.trafficType = network.getTrafficType(); this.gateway = network.getGateway(); this.cidr = network.getCidr(); + this.networkCidr = network.getNetworkCidr(); + this.ip6Gateway = network.getIp6Gateway(); + this.ip6Cidr = network.getIp6Cidr(); this.networkOfferingId = network.getNetworkOfferingId(); this.related = network.getRelated(); this.displayText = network.getDisplayText(); @@ -159,6 +164,11 @@ public class NetworkProfile implements Network { return cidr; } + @Override + public String getNetworkCidr() { + return networkCidr; + } + @Override public long getNetworkOfferingId() { return networkOfferingId; @@ -226,4 +236,18 @@ public class NetworkProfile implements Network { return vpcId; } + @Override + public void setTrafficType(TrafficType type) { + this.trafficType = type; + } + + @Override + public String getIp6Gateway() { + return ip6Gateway; + } + + @Override + public String getIp6Cidr() { + return ip6Cidr; + } } diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java index b3332a345b3..95bcc42b17a 100755 --- a/api/src/com/cloud/network/NetworkService.java +++ b/api/src/com/cloud/network/NetworkService.java @@ -17,26 +17,28 @@ package com.cloud.network; import java.util.List; -import java.util.Map; -import java.util.Set; import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd; -import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd; import org.apache.cloudstack.api.command.user.network.ListNetworksCmd; +import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.Network.Capability; -import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Networks.TrafficType; import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.utils.Pair; +/** + * The NetworkService interface is the "public" api to entities that make requests to the orchestration engine + * Such entities are usually the admin and end-user API. + * + */ public interface NetworkService { List getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner); @@ -64,24 +66,10 @@ public interface NetworkService { IpAddress getIp(long id); - NetworkProfile convertNetworkToNetworkProfile(long networkId); - - Map> getNetworkCapabilities(long networkId); - - boolean isNetworkAvailableInDomain(long networkId, long domainId); - - Long getDedicatedNetworkDomain(long networkId); - Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser, - String domainSuffix, Long networkOfferingId, Boolean changeCidr); + String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr); - Integer getNetworkRate(long networkId, Long vmId); - - Network getSystemNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType); - - Map> getNetworkOfferingServiceProvidersMap(long networkOfferingId); - - PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, + PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed, List isolationMethods, String broadcastDomainRange, Long domainId, List tags, String name); Pair, Integer> searchPhysicalNetworks(Long id, Long zoneId, String keyword, @@ -94,8 +82,6 @@ public interface NetworkService { List listNetworkServices(String providerName); - List listSupportedNetworkServiceProviders(String serviceName); - PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId, List enabledServices); @@ -127,17 +113,14 @@ public interface NetworkService { Pair, Integer> listTrafficTypes(Long physicalNetworkId); - PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType); Network getExclusiveGuestNetwork(long zoneId); List> listTrafficTypeImplementor(ListTrafficTypeImplementorsCmd cmd); List getIsolatedNetworksWithSourceNATOwnedByAccountInZone(long zoneId, Account owner); - - List listNetworksByVpc(long vpcId); - - boolean isVmPartOfNetwork(long vmId, long ntwkId); + + /** * @param networkId @@ -170,9 +153,5 @@ public interface NetworkService { Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan, String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException; - /** - * @param network - * @return - */ - boolean canUseForDeploy(Network network); + } diff --git a/api/src/com/cloud/network/NetworkUsageService.java b/api/src/com/cloud/network/NetworkUsageService.java new file mode 100644 index 00000000000..1cfea24d05a --- /dev/null +++ b/api/src/com/cloud/network/NetworkUsageService.java @@ -0,0 +1,37 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network; + +import java.util.List; + +import com.cloud.host.Host; + +import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd; +import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficMonitorCmd; +import org.apache.cloudstack.api.command.admin.usage.ListTrafficMonitorsCmd; +import org.apache.cloudstack.api.response.TrafficMonitorResponse; +import com.cloud.utils.component.Manager; + +public interface NetworkUsageService extends Manager { + + Host addTrafficMonitor(AddTrafficMonitorCmd cmd); + + boolean deleteTrafficMonitor(DeleteTrafficMonitorCmd cmd); + + List listTrafficMonitors(ListTrafficMonitorsCmd cmd); + +} diff --git a/api/src/com/cloud/network/Networks.java b/api/src/com/cloud/network/Networks.java index b15661910b4..e3d21584ad8 100755 --- a/api/src/com/cloud/network/Networks.java +++ b/api/src/com/cloud/network/Networks.java @@ -48,7 +48,7 @@ public class Networks { public enum AddressFormat { Ip4, Ip6, - Mixed + DualStack } /** diff --git a/api/src/com/cloud/network/PhysicalNetwork.java b/api/src/com/cloud/network/PhysicalNetwork.java index a495092879e..343a2b14e33 100644 --- a/api/src/com/cloud/network/PhysicalNetwork.java +++ b/api/src/com/cloud/network/PhysicalNetwork.java @@ -16,11 +16,11 @@ // under the License. package com.cloud.network; +import java.util.List; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.List; - /** * */ @@ -35,7 +35,8 @@ public interface PhysicalNetwork extends Identity, InternalIdentity { VLAN, L3, GRE, - STT; + STT, + VNS; } public enum BroadcastDomainRange { diff --git a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java index 0a433dcbc05..d67c3c7b1ee 100644 --- a/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java +++ b/api/src/com/cloud/network/PhysicalNetworkServiceProvider.java @@ -18,9 +18,10 @@ package com.cloud.network; import java.util.List; -import com.cloud.network.Network.Service; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.Network.Service; + /** * */ diff --git a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java index 62400e80a9e..a385b533af8 100644 --- a/api/src/com/cloud/network/PhysicalNetworkTrafficType.java +++ b/api/src/com/cloud/network/PhysicalNetworkTrafficType.java @@ -16,10 +16,11 @@ // under the License. package com.cloud.network; -import com.cloud.network.Networks.TrafficType; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.Networks.TrafficType; + /** * */ diff --git a/api/src/com/cloud/network/PublicIpAddress.java b/api/src/com/cloud/network/PublicIpAddress.java index 21dae54202a..d81e9c1ee6c 100644 --- a/api/src/com/cloud/network/PublicIpAddress.java +++ b/api/src/com/cloud/network/PublicIpAddress.java @@ -17,9 +17,10 @@ package com.cloud.network; import org.apache.cloudstack.acl.ControlledEntity; -import com.cloud.dc.Vlan; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.dc.Vlan; + /** */ public interface PublicIpAddress extends ControlledEntity, IpAddress, Vlan, InternalIdentity { diff --git a/api/src/com/cloud/network/StorageNetworkService.java b/api/src/com/cloud/network/StorageNetworkService.java index 1bda247179c..5aae0ca9688 100755 --- a/api/src/com/cloud/network/StorageNetworkService.java +++ b/api/src/com/cloud/network/StorageNetworkService.java @@ -19,11 +19,12 @@ package com.cloud.network; import java.sql.SQLException; import java.util.List; -import org.apache.cloudstack.api.command.admin.network.*; -import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd; -import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd; -import com.cloud.dc.StorageNetworkIpRange; import org.apache.cloudstack.api.command.admin.network.CreateStorageNetworkIpRangeCmd; +import org.apache.cloudstack.api.command.admin.network.DeleteStorageNetworkIpRangeCmd; +import org.apache.cloudstack.api.command.admin.network.ListStorageNetworkIpRangeCmd; +import org.apache.cloudstack.api.command.admin.network.UpdateStorageNetworkIpRangeCmd; + +import com.cloud.dc.StorageNetworkIpRange; public interface StorageNetworkService { StorageNetworkIpRange createIpRange(CreateStorageNetworkIpRangeCmd cmd) throws SQLException; diff --git a/api/src/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/com/cloud/network/VirtualNetworkApplianceService.java index 7b553b29a7f..250ecb24e91 100644 --- a/api/src/com/cloud/network/VirtualNetworkApplianceService.java +++ b/api/src/com/cloud/network/VirtualNetworkApplianceService.java @@ -17,6 +17,7 @@ package com.cloud.network; import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; diff --git a/api/src/com/cloud/network/as/AutoScaleService.java b/api/src/com/cloud/network/as/AutoScaleService.java index daa8d191366..32d693d7b8a 100644 --- a/api/src/com/cloud/network/as/AutoScaleService.java +++ b/api/src/com/cloud/network/as/AutoScaleService.java @@ -19,11 +19,19 @@ package com.cloud.network.as; import java.util.List; import org.apache.cloudstack.api.command.admin.autoscale.CreateCounterCmd; -import org.apache.cloudstack.api.command.user.autoscale.*; import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScalePolicyCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmGroupCmd; import org.apache.cloudstack.api.command.user.autoscale.CreateAutoScaleVmProfileCmd; +import org.apache.cloudstack.api.command.user.autoscale.CreateConditionCmd; import org.apache.cloudstack.api.command.user.autoscale.ListAutoScalePoliciesCmd; +import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmGroupsCmd; +import org.apache.cloudstack.api.command.user.autoscale.ListAutoScaleVmProfilesCmd; +import org.apache.cloudstack.api.command.user.autoscale.ListConditionsCmd; +import org.apache.cloudstack.api.command.user.autoscale.ListCountersCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScalePolicyCmd; import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmGroupCmd; +import org.apache.cloudstack.api.command.user.autoscale.UpdateAutoScaleVmProfileCmd; + import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; diff --git a/api/src/com/cloud/network/as/AutoScaleVmProfile.java b/api/src/com/cloud/network/as/AutoScaleVmProfile.java index 3be5a3e8124..9c6a0f2f45a 100644 --- a/api/src/com/cloud/network/as/AutoScaleVmProfile.java +++ b/api/src/com/cloud/network/as/AutoScaleVmProfile.java @@ -20,9 +20,10 @@ package com.cloud.network.as; import java.util.List; import org.apache.cloudstack.acl.ControlledEntity; -import com.cloud.utils.Pair; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.utils.Pair; + /** * AutoScaleVmProfile */ diff --git a/api/src/com/cloud/network/element/IpDeployer.java b/api/src/com/cloud/network/element/IpDeployer.java index 55b21abe9ab..c92d3e3cf2d 100644 --- a/api/src/com/cloud/network/element/IpDeployer.java +++ b/api/src/com/cloud/network/element/IpDeployer.java @@ -24,8 +24,9 @@ import com.cloud.network.Network; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.PublicIpAddress; +import com.cloud.utils.component.Adapter; -public interface IpDeployer { +public interface IpDeployer extends Adapter{ /** * Apply ip addresses to this network * @param network diff --git a/api/src/com/cloud/network/element/NetworkElement.java b/api/src/com/cloud/network/element/NetworkElement.java index 1ddd60b27de..d89c2a3c403 100644 --- a/api/src/com/cloud/network/element/NetworkElement.java +++ b/api/src/com/cloud/network/element/NetworkElement.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.network.element; -import java.util.List; import java.util.Map; import java.util.Set; @@ -45,19 +44,19 @@ public interface NetworkElement extends Adapter { Map> getCapabilities(); /** - * NOTE: + * NOTE: * NetworkElement -> Network.Provider is a one-to-one mapping. While adding a new NetworkElement, one must add a new Provider name to Network.Provider. */ Provider getProvider(); /** - * Implement the network configuration as specified. + * Implement the network configuration as specified. * @param config fully specified network configuration. * @param offering network offering that originated the network configuration. * @return true if network configuration is now usable; false if not; null if not handled by this element. * @throws InsufficientNetworkCapacityException TODO */ - boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) + boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; /** @@ -72,8 +71,8 @@ public interface NetworkElement extends Adapter { * @throws ResourceUnavailableException * @throws InsufficientNetworkCapacityException */ - boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, - DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, + boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException; /** @@ -86,7 +85,7 @@ public interface NetworkElement extends Adapter { * @throws ConcurrentOperationException * @throws ResourceUnavailableException */ - boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, + boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException; /** @@ -98,7 +97,7 @@ public interface NetworkElement extends Adapter { * @throws ConcurrentOperationException * @throws ResourceUnavailableException */ - boolean shutdown(Network network, ReservationContext context, boolean cleanup) + boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException; /** @@ -125,11 +124,11 @@ public interface NetworkElement extends Adapter { * @throws ConcurrentOperationException * @throws ResourceUnavailableException */ - boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) + boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException; /** - * This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false. + * This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false. * @return true/false */ boolean canEnableIndividualServices(); diff --git a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java index 4625d22f6a5..4950ed92cab 100644 --- a/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java +++ b/api/src/com/cloud/network/element/RemoteAccessVPNServiceProvider.java @@ -22,8 +22,9 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Network; import com.cloud.network.RemoteAccessVpn; import com.cloud.network.VpnUser; +import com.cloud.utils.component.Adapter; -public interface RemoteAccessVPNServiceProvider extends NetworkElement, IpDeployingRequester { +public interface RemoteAccessVPNServiceProvider extends Adapter { String[] applyVpnUsers(RemoteAccessVpn vpn, List users) throws ResourceUnavailableException; boolean startVpn(Network network, RemoteAccessVpn vpn) throws ResourceUnavailableException; diff --git a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java index a61273a8159..dd451324a72 100644 --- a/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java +++ b/api/src/com/cloud/network/element/Site2SiteVpnServiceProvider.java @@ -17,10 +17,10 @@ package com.cloud.network.element; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.Network; import com.cloud.network.Site2SiteVpnConnection; +import com.cloud.utils.component.Adapter; -public interface Site2SiteVpnServiceProvider extends NetworkElement { +public interface Site2SiteVpnServiceProvider extends Adapter { boolean startSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException; boolean stopSite2SiteVpn(Site2SiteVpnConnection conn) throws ResourceUnavailableException; diff --git a/api/src/com/cloud/network/element/UserDataServiceProvider.java b/api/src/com/cloud/network/element/UserDataServiceProvider.java index 321ccc7d456..d9ddf9329ff 100644 --- a/api/src/com/cloud/network/element/UserDataServiceProvider.java +++ b/api/src/com/cloud/network/element/UserDataServiceProvider.java @@ -30,4 +30,5 @@ public interface UserDataServiceProvider extends NetworkElement { public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException; boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException; boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException; + boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException; } diff --git a/api/src/com/cloud/network/element/VirtualRouterElementService.java b/api/src/com/cloud/network/element/VirtualRouterElementService.java index 3ba2045cfd6..ea971b89c5d 100644 --- a/api/src/com/cloud/network/element/VirtualRouterElementService.java +++ b/api/src/com/cloud/network/element/VirtualRouterElementService.java @@ -20,6 +20,7 @@ import java.util.List; import org.apache.cloudstack.api.command.admin.router.ConfigureVirtualRouterElementCmd; import org.apache.cloudstack.api.command.admin.router.ListVirtualRouterElementsCmd; + import com.cloud.network.VirtualRouterProvider; import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType; import com.cloud.utils.component.PluggableService; diff --git a/api/src/com/cloud/network/element/VpcProvider.java b/api/src/com/cloud/network/element/VpcProvider.java index 482fe6245a7..81b1cf321db 100644 --- a/api/src/com/cloud/network/element/VpcProvider.java +++ b/api/src/com/cloud/network/element/VpcProvider.java @@ -27,7 +27,6 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.vpc.PrivateGateway; import com.cloud.network.vpc.StaticRouteProfile; import com.cloud.network.vpc.Vpc; -import com.cloud.network.vpc.VpcGateway; import com.cloud.vm.ReservationContext; public interface VpcProvider extends NetworkElement{ diff --git a/api/src/com/cloud/network/firewall/FirewallService.java b/api/src/com/cloud/network/firewall/FirewallService.java index 3858499b2bb..179e9f7ae22 100644 --- a/api/src/com/cloud/network/firewall/FirewallService.java +++ b/api/src/com/cloud/network/firewall/FirewallService.java @@ -20,6 +20,7 @@ package com.cloud.network.firewall; import java.util.List; import org.apache.cloudstack.api.command.user.firewall.ListFirewallRulesCmd; + import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; @@ -27,7 +28,8 @@ import com.cloud.user.Account; import com.cloud.utils.Pair; public interface FirewallService { - FirewallRule createFirewallRule(FirewallRule rule) throws NetworkRuleConflictException; + FirewallRule createIngressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException; + FirewallRule createEgressFirewallRule(FirewallRule rule) throws NetworkRuleConflictException; Pair, Integer> listFirewallRules(ListFirewallRulesCmd cmd); @@ -40,7 +42,8 @@ public interface FirewallService { */ boolean revokeFirewallRule(long ruleId, boolean apply); - boolean applyFirewallRules(long ipId, Account caller) throws ResourceUnavailableException; + boolean applyEgressFirewallRules (FirewallRule rule, Account caller) throws ResourceUnavailableException; + boolean applyIngressFirewallRules(long Ipid , Account caller) throws ResourceUnavailableException; FirewallRule getFirewallRule(long ruleId); diff --git a/api/src/com/cloud/network/firewall/NetworkACLService.java b/api/src/com/cloud/network/firewall/NetworkACLService.java index a1fb02cb71f..97de496f64f 100644 --- a/api/src/com/cloud/network/firewall/NetworkACLService.java +++ b/api/src/com/cloud/network/firewall/NetworkACLService.java @@ -20,6 +20,7 @@ package com.cloud.network.firewall; import java.util.List; import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd; + import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.rules.FirewallRule; diff --git a/api/src/com/cloud/network/lb/LoadBalancingRule.java b/api/src/com/cloud/network/lb/LoadBalancingRule.java index b68b9cbddd4..fb1d988a4de 100644 --- a/api/src/com/cloud/network/lb/LoadBalancingRule.java +++ b/api/src/com/cloud/network/lb/LoadBalancingRule.java @@ -26,7 +26,6 @@ import com.cloud.network.as.Counter; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.LoadBalancer; import com.cloud.utils.Pair; -import org.apache.cloudstack.api.InternalIdentity; public class LoadBalancingRule implements FirewallRule, LoadBalancer { private LoadBalancer lb; diff --git a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java index 4081f6efc2c..3743aae4bf8 100644 --- a/api/src/com/cloud/network/lb/LoadBalancingRulesService.java +++ b/api/src/com/cloud/network/lb/LoadBalancingRulesService.java @@ -18,9 +18,13 @@ package com.cloud.network.lb; import java.util.List; -import org.apache.cloudstack.api.command.user.loadbalancer.*; import org.apache.cloudstack.api.command.user.loadbalancer.CreateLBStickinessPolicyCmd; +import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd; +import org.apache.cloudstack.api.command.user.loadbalancer.ListLBStickinessPoliciesCmd; +import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRuleInstancesCmd; +import org.apache.cloudstack.api.command.user.loadbalancer.ListLoadBalancerRulesCmd; import org.apache.cloudstack.api.command.user.loadbalancer.UpdateLoadBalancerRuleCmd; + import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; diff --git a/api/src/com/cloud/network/rules/LbStickinessMethod.java b/api/src/com/cloud/network/rules/LbStickinessMethod.java index c71b19e3a86..1e5a55e6cc5 100644 --- a/api/src/com/cloud/network/rules/LbStickinessMethod.java +++ b/api/src/com/cloud/network/rules/LbStickinessMethod.java @@ -16,8 +16,9 @@ // under the License. package com.cloud.network.rules; -import java.util.List; import java.util.ArrayList; +import java.util.List; + import com.google.gson.annotations.SerializedName; diff --git a/api/src/com/cloud/network/rules/RulesService.java b/api/src/com/cloud/network/rules/RulesService.java index 80c96d558c4..921a86e865f 100644 --- a/api/src/com/cloud/network/rules/RulesService.java +++ b/api/src/com/cloud/network/rules/RulesService.java @@ -19,6 +19,7 @@ package com.cloud.network.rules; import java.util.List; import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd; + import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; diff --git a/api/src/com/cloud/network/rules/StickinessPolicy.java b/api/src/com/cloud/network/rules/StickinessPolicy.java index e23ff828f74..da487546669 100644 --- a/api/src/com/cloud/network/rules/StickinessPolicy.java +++ b/api/src/com/cloud/network/rules/StickinessPolicy.java @@ -18,10 +18,11 @@ package com.cloud.network.rules; import java.util.List; -import com.cloud.utils.Pair; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.utils.Pair; + /** */ public interface StickinessPolicy extends InternalIdentity, Identity { diff --git a/api/src/com/cloud/network/security/SecurityGroupRules.java b/api/src/com/cloud/network/security/SecurityGroupRules.java index 0b575e10d56..d255e46fde5 100644 --- a/api/src/com/cloud/network/security/SecurityGroupRules.java +++ b/api/src/com/cloud/network/security/SecurityGroupRules.java @@ -15,9 +15,10 @@ // specific language governing permissions and limitations // under the License. package com.cloud.network.security; -import com.cloud.network.security.SecurityRule.SecurityRuleType; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.security.SecurityRule.SecurityRuleType; + public interface SecurityGroupRules extends InternalIdentity { String getName(); diff --git a/api/src/com/cloud/network/security/SecurityGroupService.java b/api/src/com/cloud/network/security/SecurityGroupService.java index 741f179db50..c6480323780 100644 --- a/api/src/com/cloud/network/security/SecurityGroupService.java +++ b/api/src/com/cloud/network/security/SecurityGroupService.java @@ -18,7 +18,12 @@ package com.cloud.network.security; import java.util.List; -import org.apache.cloudstack.api.command.user.securitygroup.*; +import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupEgressCmd; +import org.apache.cloudstack.api.command.user.securitygroup.AuthorizeSecurityGroupIngressCmd; +import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupCmd; +import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd; +import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd; +import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; diff --git a/api/src/com/cloud/network/security/SecurityRule.java b/api/src/com/cloud/network/security/SecurityRule.java index bd4192d614c..350b52dbb20 100644 --- a/api/src/com/cloud/network/security/SecurityRule.java +++ b/api/src/com/cloud/network/security/SecurityRule.java @@ -16,10 +16,11 @@ // under the License. package com.cloud.network.security; -import com.cloud.async.AsyncInstanceCreateStatus; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.async.AsyncInstanceCreateStatus; + public interface SecurityRule extends Identity, InternalIdentity { public static class SecurityRuleType { diff --git a/api/src/com/cloud/network/vpc/StaticRouteProfile.java b/api/src/com/cloud/network/vpc/StaticRouteProfile.java index 656355590f3..54aa6e4dd2d 100644 --- a/api/src/com/cloud/network/vpc/StaticRouteProfile.java +++ b/api/src/com/cloud/network/vpc/StaticRouteProfile.java @@ -16,7 +16,6 @@ // under the License. package com.cloud.network.vpc; -import org.apache.cloudstack.api.InternalIdentity; public class StaticRouteProfile implements StaticRoute { private long id; diff --git a/api/src/com/cloud/network/vpc/Vpc.java b/api/src/com/cloud/network/vpc/Vpc.java index 9365e56dd82..c07077f7b7e 100644 --- a/api/src/com/cloud/network/vpc/Vpc.java +++ b/api/src/com/cloud/network/vpc/Vpc.java @@ -17,10 +17,11 @@ package com.cloud.network.vpc; import org.apache.cloudstack.acl.ControlledEntity; -import com.cloud.network.Network; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.Network; + public interface Vpc extends ControlledEntity, Identity, InternalIdentity { public enum State { Enabled, diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java index 68e062c7d79..9bf1beea5f0 100644 --- a/api/src/com/cloud/network/vpc/VpcService.java +++ b/api/src/com/cloud/network/vpc/VpcService.java @@ -22,6 +22,7 @@ import java.util.Set; import org.apache.cloudstack.api.command.user.vpc.ListPrivateGatewaysCmd; import org.apache.cloudstack.api.command.user.vpc.ListStaticRoutesCmd; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientCapacityException; @@ -40,7 +41,7 @@ public interface VpcService { public VpcOffering getVpcOffering(long vpcOfferingId); - public VpcOffering createVpcOffering(String name, String displayText, List supportedServices); + public VpcOffering createVpcOffering(String name, String displayText, List supportedServices, Map> serviceProviders); public Vpc getVpc(long vpcId); @@ -245,5 +246,5 @@ public interface VpcService { InsufficientAddressCapacityException, ConcurrentOperationException; public Network updateVpcGuestNetwork(long networkId, String name, String displayText, Account callerAccount, - User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr); + User callerUser, String domainSuffix, Long ntwkOffId, Boolean changeCidr, String guestVmCidr); } diff --git a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java index 81599a0c3c9..bfd2c892ca1 100644 --- a/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java +++ b/api/src/com/cloud/network/vpn/RemoteAccessVpnService.java @@ -18,8 +18,9 @@ package com.cloud.network.vpn; import java.util.List; -import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd; import org.apache.cloudstack.api.command.user.vpn.ListRemoteAccessVpnsCmd; +import org.apache.cloudstack.api.command.user.vpn.ListVpnUsersCmd; + import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.RemoteAccessVpn; diff --git a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java index 7ac567774d8..d90e3a99783 100644 --- a/api/src/com/cloud/network/vpn/Site2SiteVpnService.java +++ b/api/src/com/cloud/network/vpn/Site2SiteVpnService.java @@ -18,7 +18,6 @@ package com.cloud.network.vpn; import java.util.List; -import org.apache.cloudstack.api.command.user.vpn.*; import org.apache.cloudstack.api.command.user.vpn.CreateVpnConnectionCmd; import org.apache.cloudstack.api.command.user.vpn.CreateVpnCustomerGatewayCmd; import org.apache.cloudstack.api.command.user.vpn.CreateVpnGatewayCmd; @@ -26,9 +25,11 @@ import org.apache.cloudstack.api.command.user.vpn.DeleteVpnConnectionCmd; import org.apache.cloudstack.api.command.user.vpn.DeleteVpnCustomerGatewayCmd; import org.apache.cloudstack.api.command.user.vpn.DeleteVpnGatewayCmd; import org.apache.cloudstack.api.command.user.vpn.ListVpnConnectionsCmd; +import org.apache.cloudstack.api.command.user.vpn.ListVpnCustomerGatewaysCmd; import org.apache.cloudstack.api.command.user.vpn.ListVpnGatewaysCmd; import org.apache.cloudstack.api.command.user.vpn.ResetVpnConnectionCmd; import org.apache.cloudstack.api.command.user.vpn.UpdateVpnCustomerGatewayCmd; + import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Site2SiteCustomerGateway; diff --git a/api/src/com/cloud/offering/DiskOffering.java b/api/src/com/cloud/offering/DiskOffering.java index 9a48f4bb655..dd77c70abd9 100644 --- a/api/src/com/cloud/offering/DiskOffering.java +++ b/api/src/com/cloud/offering/DiskOffering.java @@ -16,12 +16,12 @@ // under the License. package com.cloud.offering; +import java.util.Date; + import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.Date; - /** * Represents a disk offering that specifies what the end user needs in * the disk offering. diff --git a/api/src/com/cloud/offering/NetworkOffering.java b/api/src/com/cloud/offering/NetworkOffering.java index f2c4de520a1..8cb82996036 100644 --- a/api/src/com/cloud/offering/NetworkOffering.java +++ b/api/src/com/cloud/offering/NetworkOffering.java @@ -16,12 +16,13 @@ // under the License. package com.cloud.offering; -import com.cloud.network.Network.GuestType; -import com.cloud.network.Networks.TrafficType; import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Networks.TrafficType; + /** * Describes network offering * @@ -110,4 +111,7 @@ public interface NetworkOffering extends InfrastructureEntity, InternalIdentity, boolean getSpecifyIpRanges(); boolean isInline(); + + boolean getIsPersistent(); + } diff --git a/api/src/com/cloud/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java index b13346cfb83..d6c215f42f0 100755 --- a/api/src/com/cloud/offering/ServiceOffering.java +++ b/api/src/com/cloud/offering/ServiceOffering.java @@ -16,12 +16,12 @@ // under the License. package com.cloud.offering; +import java.util.Date; + import org.apache.cloudstack.acl.InfrastructureEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.Date; - /** * offered. */ @@ -77,6 +77,11 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity, */ boolean getLimitCpuUse(); + /** + * @return Does this service plan support Volatile VM that is, discard VM's root disk and create a new one on reboot? + */ + boolean getVolatileVm(); + /** * @return the rate in megabits per sec to which a VM's network interface is throttled to */ diff --git a/api/src/com/cloud/org/Cluster.java b/api/src/com/cloud/org/Cluster.java index cb72a70b817..d14f86bcbb0 100644 --- a/api/src/com/cloud/org/Cluster.java +++ b/api/src/com/cloud/org/Cluster.java @@ -16,11 +16,12 @@ // under the License. package com.cloud.org; -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.org.Managed.ManagedState; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Managed.ManagedState; + public interface Cluster extends Grouping, InternalIdentity, Identity { public static enum ClusterType { CloudManaged, diff --git a/api/src/com/cloud/projects/Project.java b/api/src/com/cloud/projects/Project.java index 78d52574f28..9240930c2bf 100644 --- a/api/src/com/cloud/projects/Project.java +++ b/api/src/com/cloud/projects/Project.java @@ -19,9 +19,10 @@ package com.cloud.projects; import java.util.Date; import org.apache.cloudstack.api.Identity; -import com.cloud.domain.PartOf; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.domain.PartOf; + public interface Project extends PartOf, Identity, InternalIdentity { public enum State { Active, Disabled, Suspended diff --git a/api/src/com/cloud/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java index b9db8e734d9..08e2585d1a7 100755 --- a/api/src/com/cloud/resource/ResourceService.java +++ b/api/src/com/cloud/resource/ResourceService.java @@ -20,12 +20,18 @@ import java.util.List; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.apache.cloudstack.api.command.admin.cluster.DeleteClusterCmd; -import org.apache.cloudstack.api.command.admin.host.*; +import org.apache.cloudstack.api.command.admin.host.AddHostCmd; +import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd; +import org.apache.cloudstack.api.command.admin.host.CancelMaintenanceCmd; +import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd; +import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd; +import org.apache.cloudstack.api.command.admin.host.UpdateHostCmd; +import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd; import org.apache.cloudstack.api.command.admin.storage.AddS3Cmd; import org.apache.cloudstack.api.command.admin.storage.ListS3sCmd; import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd; import org.apache.cloudstack.api.command.admin.swift.ListSwiftsCmd; -import org.apache.cloudstack.api.command.admin.host.PrepareForMaintenanceCmd; + import com.cloud.exception.DiscoveryException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceInUseException; @@ -34,8 +40,8 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.org.Cluster; import com.cloud.storage.S3; import com.cloud.storage.Swift; +import com.cloud.utils.Pair; import com.cloud.utils.fsm.NoTransitionException; -import org.apache.cloudstack.api.command.admin.host.ReconnectHostCmd; public interface ResourceService { /** @@ -65,7 +71,7 @@ public interface ResourceService { boolean deleteCluster(DeleteClusterCmd cmd); - Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate); + Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate,Float memoryOvercommitRatio, Float cpuOvercommitRatio); List discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; @@ -97,7 +103,7 @@ public interface ResourceService { List getSupportedHypervisorTypes(long zoneId, boolean forVirtualRouter, Long podId); - List listSwifts(ListSwiftsCmd cmd); + Pair, Integer> listSwifts(ListSwiftsCmd cmd); List listS3s(ListS3sCmd cmd); diff --git a/api/src/com/cloud/server/ManagementService.java b/api/src/com/cloud/server/ManagementService.java index fb8af1a5b4b..1736da3778c 100755 --- a/api/src/com/cloud/server/ManagementService.java +++ b/api/src/com/cloud/server/ManagementService.java @@ -22,42 +22,42 @@ import java.util.List; import java.util.Map; import java.util.Set; -import com.cloud.alert.Alert; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd; +import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd; +import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd; +import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd; import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd; import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd; import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd; -import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd; -import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; -import org.apache.cloudstack.api.command.admin.systemvm.*; +import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd; +import org.apache.cloudstack.api.command.admin.systemvm.DestroySystemVmCmd; +import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd; +import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd; +import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd; +import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd; import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd; import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd; import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd; +import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd; import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd; +import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; +import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd; import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd; import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; -import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd; -import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd; -import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd; -import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd; -import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd; -import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd; -import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd; -import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; +import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd; -import org.apache.cloudstack.api.command.admin.systemvm.ListSystemVMsCmd; -import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd; -import org.apache.cloudstack.api.command.admin.systemvm.RebootSystemVmCmd; import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd; -import org.apache.cloudstack.api.command.admin.systemvm.StopSystemVmCmd; -import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd; +import org.apache.cloudstack.api.command.user.template.ListTemplatesCmd; +import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd; +import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd; import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd; -import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd; -import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd; +import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd; +import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd; +import com.cloud.alert.Alert; import com.cloud.capacity.Capacity; import com.cloud.configuration.Configuration; import com.cloud.dc.DataCenter; @@ -77,7 +77,6 @@ import com.cloud.offering.ServiceOffering; import com.cloud.org.Cluster; import com.cloud.storage.GuestOS; import com.cloud.storage.GuestOsCategory; -import com.cloud.storage.StoragePool; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.SSHKeyPair; import com.cloud.utils.Pair; @@ -92,16 +91,6 @@ import com.cloud.vm.VirtualMachine.Type; public interface ManagementService { static final String Name = "management-server"; - /** - * Retrieves the list of data centers with search criteria. Currently the only search criteria is "available" zones - * for the - * account that invokes the API. By specifying available=true all zones which the account can access. By specifying - * available=false the zones where the account has virtual machine instances will be returned. - * - * @return a list of DataCenters - */ - List listDataCenters(ListZonesByCmd cmd); - /** * returns the a map of the names/values in the configuraton table * @@ -109,13 +98,6 @@ public interface ManagementService { */ Pair, Integer> searchForConfigurations(ListCfgsByCmd c); - /** - * Searches for Service Offerings by the specified search criteria Can search by: "name" - * - * @param cmd - * @return List of ServiceOfferings - */ - List searchForServiceOfferings(ListServiceOfferingsCmd cmd); /** * Searches for Clusters by the specified search criteria @@ -140,6 +122,14 @@ public interface ManagementService { */ Pair, Integer> searchForPods(ListPodsByCmd cmd); + /** + * Searches for servers by the specified search criteria Can search by: "name", "type", "state", "dataCenterId", + * "podId" + * + * @param cmd + * @return List of Hosts + */ + Pair, Integer> searchForServers(ListHostsCmd cmd); /** * Creates a new template @@ -234,15 +224,6 @@ public interface ManagementService { */ Set> listTemplates(ListTemplatesCmd cmd); - /** - * Search for disk offerings based on search criteria - * - * @param cmd - * the command containing the criteria to use for searching for disk offerings - * @return a list of disk offerings that match the given criteria - */ - List searchForDiskOfferings(ListDiskOfferingsCmd cmd); - /** * List system VMs by the given search criteria @@ -384,7 +365,7 @@ public interface ManagementService { * @return Pair, List> List of all Hosts in VM's cluster and list of Hosts with * enough capacity */ - Pair, List> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize); + Pair, Integer>, List> listHostsForMigrationOfVM(Long vmId, Long startIndex, Long pageSize); String[] listEventTypes(); diff --git a/api/src/com/cloud/server/ResourceTag.java b/api/src/com/cloud/server/ResourceTag.java index 5ec9f0171cc..ee56748640c 100644 --- a/api/src/com/cloud/server/ResourceTag.java +++ b/api/src/com/cloud/server/ResourceTag.java @@ -37,7 +37,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit Project, Vpc, NetworkACL, - StaticRoute + StaticRoute, + VMSnapshot } /** diff --git a/api/src/com/cloud/storage/S3.java b/api/src/com/cloud/storage/S3.java index 708e280ca5b..0c58a902923 100644 --- a/api/src/com/cloud/storage/S3.java +++ b/api/src/com/cloud/storage/S3.java @@ -18,11 +18,12 @@ */ package com.cloud.storage; -import com.cloud.agent.api.to.S3TO; +import java.util.Date; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.Date; +import com.cloud.agent.api.to.S3TO; public interface S3 extends InternalIdentity, Identity { diff --git a/api/src/com/cloud/storage/Snapshot.java b/api/src/com/cloud/storage/Snapshot.java index 99bdee6bea9..f71265cd230 100644 --- a/api/src/com/cloud/storage/Snapshot.java +++ b/api/src/com/cloud/storage/Snapshot.java @@ -18,12 +18,13 @@ package com.cloud.storage; import java.util.Date; -import org.apache.cloudstack.acl.ControlledEntity; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.fsm.StateObject; +import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -public interface Snapshot extends ControlledEntity, Identity, InternalIdentity { +public interface Snapshot extends ControlledEntity, Identity, InternalIdentity, StateObject { public enum Type { MANUAL, RECURRING, @@ -42,6 +43,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity { return max; } + @Override public String toString() { return this.name(); } @@ -51,7 +53,8 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity { } } - public enum Status { + public enum State { + Allocated, Creating, CreatedOnPrimary, BackingUp, @@ -67,6 +70,15 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity { } } + enum Event { + CreateRequested, + OperationNotPerformed, + BackupToSecondary, + BackedupToSecondary, + OperationSucceeded, + OperationFailed + } + public static final long MANUAL_POLICY_ID = 0L; long getAccountId(); @@ -79,9 +91,9 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity { Date getCreated(); - Type getType(); + Type getRecurringType(); - Status getStatus(); + State getState(); HypervisorType getHypervisorType(); diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java index 3334da54ec0..091eef182cc 100644 --- a/api/src/com/cloud/storage/StoragePool.java +++ b/api/src/com/cloud/storage/StoragePool.java @@ -18,10 +18,11 @@ package com.cloud.storage; import java.util.Date; -import com.cloud.storage.Storage.StoragePoolType; import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.storage.Storage.StoragePoolType; + public interface StoragePool extends Identity, InternalIdentity { /** @@ -94,4 +95,11 @@ public interface StoragePool extends Identity, InternalIdentity { int getPort(); Long getPodId(); + + /** + * @return + */ + Long getStorageProviderId(); + + boolean isInMaintenance(); } diff --git a/api/src/com/cloud/storage/StoragePoolStatus.java b/api/src/com/cloud/storage/StoragePoolStatus.java index 0c949614412..a35f706d702 100644 --- a/api/src/com/cloud/storage/StoragePoolStatus.java +++ b/api/src/com/cloud/storage/StoragePoolStatus.java @@ -17,10 +17,6 @@ package com.cloud.storage; public enum StoragePoolStatus { - Up, - PrepareForMaintenance, - ErrorInMaintenance, - CancelMaintenance, - Maintenance, - Removed; + Initial, Initialized, Creating, Attaching, Up, PrepareForMaintenance, + ErrorInMaintenance, CancelMaintenance, Maintenance, Removed; } diff --git a/api/src/com/cloud/storage/StorageService.java b/api/src/com/cloud/storage/StorageService.java index ff8ec13e33b..63c5023ee91 100644 --- a/api/src/com/cloud/storage/StorageService.java +++ b/api/src/com/cloud/storage/StorageService.java @@ -18,18 +18,14 @@ package com.cloud.storage; import java.net.UnknownHostException; -import org.apache.cloudstack.api.command.admin.storage.*; import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; +import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; +import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd; import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd; -import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd; -import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd; -import com.cloud.exception.ConcurrentOperationException; + import com.cloud.exception.InsufficientCapacityException; -import com.cloud.exception.PermissionDeniedException; -import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.user.Account; public interface StorageService{ /** @@ -48,28 +44,6 @@ public interface StorageService{ StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, UnknownHostException, ResourceUnavailableException; - /** - * Creates the database object for a volume based on the given criteria - * - * @param cmd - * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, - * name) - * @return the volume object - * @throws PermissionDeniedException - */ - Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException; - - /** - * Creates the volume based on the given criteria - * - * @param cmd - * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, - * name) - * @return the volume object - */ - Volume createVolume(CreateVolumeCmd cmd); - - /** * Delete the storage pool * @@ -108,19 +82,4 @@ public interface StorageService{ public StoragePool updateStoragePool(UpdateStoragePoolCmd cmd) throws IllegalArgumentException; public StoragePool getStoragePool(long id); - - Volume migrateVolume(Long volumeId, Long storagePoolId) throws ConcurrentOperationException; - - - /** - * Uploads the volume to secondary storage - * - * @param UploadVolumeCmd cmd - * - * @return Volume object - */ - Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException; - - boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException; - } diff --git a/api/src/com/cloud/storage/Swift.java b/api/src/com/cloud/storage/Swift.java index 9cd3a34cd59..028e96e48b8 100644 --- a/api/src/com/cloud/storage/Swift.java +++ b/api/src/com/cloud/storage/Swift.java @@ -16,9 +16,10 @@ // under the License. package com.cloud.storage; -import com.cloud.agent.api.to.SwiftTO; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.agent.api.to.SwiftTO; + public interface Swift extends InternalIdentity { public long getId(); diff --git a/api/src/com/cloud/storage/Upload.java b/api/src/com/cloud/storage/Upload.java index a20faf1dc34..ac3836caf55 100755 --- a/api/src/com/cloud/storage/Upload.java +++ b/api/src/com/cloud/storage/Upload.java @@ -16,11 +16,11 @@ // under the License. package com.cloud.storage; +import java.util.Date; + import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.InternalIdentity; -import java.util.Date; - public interface Upload extends InternalIdentity, Identity { public static enum Status { diff --git a/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java index 97baa4b29c4..d40eafe7a15 100644 --- a/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java +++ b/api/src/com/cloud/storage/VMTemplateStorageResourceAssoc.java @@ -16,14 +16,13 @@ // under the License. package com.cloud.storage; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; - import java.util.Date; +import org.apache.cloudstack.api.InternalIdentity; + public interface VMTemplateStorageResourceAssoc extends InternalIdentity { public static enum Status { - UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS + UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED } String getInstallPath(); diff --git a/api/src/com/cloud/storage/Volume.java b/api/src/com/cloud/storage/Volume.java index bfbd816d911..4903594f0af 100755 --- a/api/src/com/cloud/storage/Volume.java +++ b/api/src/com/cloud/storage/Volume.java @@ -19,11 +19,12 @@ package com.cloud.storage; import java.util.Date; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.template.BasedOn; import com.cloud.utils.fsm.StateMachine2; import com.cloud.utils.fsm.StateObject; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; public interface Volume extends ControlledEntity, Identity, InternalIdentity, BasedOn, StateObject { enum Type { @@ -36,9 +37,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba Ready("The volume is ready to be used."), Migrating("The volume is migrating to other storage pool"), Snapshotting("There is a snapshot created on this volume, not backed up to secondary storage yet"), + Resizing("The volume is being resized"), Expunging("The volume is being expunging"), - Destroy("The volume is destroyed, and can't be recovered."), - UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage"); + Expunged("The volume is being expunging"), + Destroy("The volume is destroyed, and can't be recovered."), + Destroying("The volume is destroying, and can't be recovered."), + UploadOp ("The volume upload operation is in progress or in short the volume is on secondary storage"), + Uploading("volume is uploading"), + Uploaded("volume is uploaded"); String _description; @@ -62,14 +68,20 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba s_fsm.addTransition(Creating, Event.OperationFailed, Allocated); s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready); s_fsm.addTransition(Creating, Event.DestroyRequested, Destroy); - s_fsm.addTransition(Creating, Event.CreateRequested, Creating); + s_fsm.addTransition(Creating, Event.CreateRequested, Creating); + s_fsm.addTransition(Ready, Event.ResizeRequested, Resizing); + s_fsm.addTransition(Resizing, Event.OperationSucceeded, Ready); + s_fsm.addTransition(Resizing, Event.OperationFailed, Ready); s_fsm.addTransition(Allocated, Event.UploadRequested, UploadOp); - s_fsm.addTransition(UploadOp, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage + s_fsm.addTransition(Uploaded, Event.CopyRequested, Creating);// CopyRequested for volume from sec to primary storage s_fsm.addTransition(Creating, Event.CopySucceeded, Ready); - s_fsm.addTransition(Creating, Event.CopyFailed, UploadOp);// Copying volume from sec to primary failed. + s_fsm.addTransition(Creating, Event.CopyFailed, Uploaded);// Copying volume from sec to primary failed. s_fsm.addTransition(UploadOp, Event.DestroyRequested, Destroy); s_fsm.addTransition(Ready, Event.DestroyRequested, Destroy); s_fsm.addTransition(Destroy, Event.ExpungingRequested, Expunging); + s_fsm.addTransition(Expunging, Event.ExpungingRequested, Expunging); + s_fsm.addTransition(Expunging, Event.OperationSucceeded, Expunged); + s_fsm.addTransition(Expunging, Event.OperationFailed, Expunging); s_fsm.addTransition(Ready, Event.SnapshotRequested, Snapshotting); s_fsm.addTransition(Snapshotting, Event.OperationSucceeded, Ready); s_fsm.addTransition(Snapshotting, Event.OperationFailed, Ready); @@ -77,6 +89,9 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba s_fsm.addTransition(Migrating, Event.OperationSucceeded, Ready); s_fsm.addTransition(Migrating, Event.OperationFailed, Ready); s_fsm.addTransition(Destroy, Event.OperationSucceeded, Destroy); + s_fsm.addTransition(UploadOp, Event.OperationSucceeded, Uploaded); + s_fsm.addTransition(UploadOp, Event.OperationFailed, Allocated); + s_fsm.addTransition(Uploaded, Event.DestroyRequested, Destroy); } } @@ -92,7 +107,8 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba MigrationRequested, SnapshotRequested, DestroyRequested, - ExpungingRequested; + ExpungingRequested, + ResizeRequested; } /** @@ -103,7 +119,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba /** * @return total size of the partition */ - long getSize(); + Long getSize(); /** * @return the vm instance id @@ -147,4 +163,14 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba public void incrUpdatedCount(); public Date getUpdated(); + + /** + * @return + */ + String getReservationId(); + + /** + * @param reserv + */ + void setReservationId(String reserv); } diff --git a/api/src/com/cloud/storage/VolumeApiService.java b/api/src/com/cloud/storage/VolumeApiService.java new file mode 100644 index 00000000000..8517988dfc6 --- /dev/null +++ b/api/src/com/cloud/storage/VolumeApiService.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package com.cloud.storage; + +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.user.Account; + +public interface VolumeApiService { + /** + * Creates the database object for a volume based on the given criteria + * + * @param cmd + * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, + * name) + * @return the volume object + * @throws PermissionDeniedException + */ + Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException; + + /** + * Creates the volume based on the given criteria + * + * @param cmd + * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot, + * name) + * @return the volume object + */ + Volume createVolume(CreateVolumeCmd cmd); + + + /** + * Resizes the volume based on the given criteria + * + * @param cmd + * the API command wrapping the criteria + * @return the volume object + */ + Volume resizeVolume(ResizeVolumeCmd cmd); + + Volume migrateVolume(MigrateVolumeCmd cmd) throws ConcurrentOperationException; + + /** + * Uploads the volume to secondary storage + * + * @param UploadVolumeCmd cmd + * + * @return Volume object + */ + Volume uploadVolume(UploadVolumeCmd cmd) throws ResourceAllocationException; + + boolean deleteVolume(long volumeId, Account caller) throws ConcurrentOperationException; + + Volume attachVolumeToVM(AttachVolumeCmd command); + + Volume detachVolumeFromVM(DetachVolumeCmd cmmd); +} diff --git a/api/src/com/cloud/storage/snapshot/SnapshotService.java b/api/src/com/cloud/storage/snapshot/SnapshotService.java index 79041c47b69..b5325f52080 100644 --- a/api/src/com/cloud/storage/snapshot/SnapshotService.java +++ b/api/src/com/cloud/storage/snapshot/SnapshotService.java @@ -19,10 +19,11 @@ package com.cloud.storage.snapshot; import java.util.List; import org.apache.cloudstack.api.command.user.snapshot.CreateSnapshotPolicyCmd; -import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd; import org.apache.cloudstack.api.command.user.snapshot.DeleteSnapshotPoliciesCmd; -import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd; import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd; +import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd; + +import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd; import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceAllocationException; import com.cloud.storage.Snapshot; @@ -82,7 +83,7 @@ public interface SnapshotService { * the command that specifies the volume criteria * @return list of snapshot policies */ - List listPoliciesforVolume(ListSnapshotPoliciesCmd cmd); + Pair, Integer> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd); boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd); diff --git a/api/src/com/cloud/template/TemplateService.java b/api/src/com/cloud/template/TemplateService.java index 93e8a2576b6..7e831fb0055 100755 --- a/api/src/com/cloud/template/TemplateService.java +++ b/api/src/com/cloud/template/TemplateService.java @@ -24,13 +24,17 @@ import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd; import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd; import org.apache.cloudstack.api.command.user.iso.ExtractIsoCmd; import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd; -import org.apache.cloudstack.api.command.user.template.*; import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd; +import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd; +import org.apache.cloudstack.api.command.user.template.DeleteTemplateCmd; import org.apache.cloudstack.api.command.user.template.ExtractTemplateCmd; import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd; + import com.cloud.exception.InternalErrorException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.StorageUnavailableException; +import com.cloud.user.Account; +import com.cloud.utils.exception.CloudRuntimeException; public interface TemplateService { @@ -86,4 +90,11 @@ public interface TemplateService { List listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd); boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd); + + VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd, + Account templateOwner) throws ResourceAllocationException; + + VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command) + throws CloudRuntimeException; + } diff --git a/api/src/com/cloud/template/VirtualMachineTemplate.java b/api/src/com/cloud/template/VirtualMachineTemplate.java index 274b7b63843..cdfe8d38dc5 100755 --- a/api/src/com/cloud/template/VirtualMachineTemplate.java +++ b/api/src/com/cloud/template/VirtualMachineTemplate.java @@ -20,11 +20,12 @@ import java.util.Date; import java.util.Map; import org.apache.cloudstack.acl.ControlledEntity; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.TemplateType; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity { @@ -89,6 +90,5 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte Long getSourceTemplateId(); String getTemplateTag(); - Map getDetails(); } diff --git a/api/src/com/cloud/user/Account.java b/api/src/com/cloud/user/Account.java index a5b3e87156d..e65e017c266 100755 --- a/api/src/com/cloud/user/Account.java +++ b/api/src/com/cloud/user/Account.java @@ -62,5 +62,8 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity { public String getNetworkDomain(); public Long getDefaultZoneId(); - + + public int getRegionId(); + + public String getUuid(); } diff --git a/api/src/com/cloud/user/AccountService.java b/api/src/com/cloud/user/AccountService.java index 9f5f4d225e0..8026891c5fa 100755 --- a/api/src/com/cloud/user/AccountService.java +++ b/api/src/com/cloud/user/AccountService.java @@ -22,16 +22,15 @@ import java.util.Map; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.acl.RoleType; import org.apache.cloudstack.acl.SecurityChecker.AccessType; - +import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd; import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd; import org.apache.cloudstack.api.command.admin.user.RegisterCmd; import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd; -import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd; + +import org.apache.cloudstack.api.command.admin.user.RegisterCmd; import com.cloud.domain.Domain; -import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.PermissionDeniedException; -import com.cloud.exception.ResourceUnavailableException; import com.cloud.utils.Pair; public interface AccountService { @@ -63,35 +62,7 @@ public interface AccountService { * @return the user if created successfully, null otherwise */ UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain, - Map details); - - /** - * Deletes a user by userId - * - * @param accountId - * - id of the account do delete - * - * @return true if delete was successful, false otherwise - */ - boolean deleteUserAccount(long accountId); - - /** - * Disables a user by userId - * - * @param userId - * - the userId - * @return UserAccount object - */ - UserAccount disableUser(long userId); - - /** - * Enables a user - * - * @param userId - * - the userId - * @return UserAccount object - */ - UserAccount enableUser(long userId); + Map details, String accountUUID, String userUUID, Integer regionId); /** * Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses @@ -102,71 +73,11 @@ public interface AccountService { */ UserAccount lockUser(long userId); - /** - * Update a user by userId - * - * @param userId - * @return UserAccount object - */ - UserAccount updateUser(UpdateUserCmd cmd); - - /** - * Disables an account by accountName and domainId - * - * @param accountName - * TODO - * @param domainId - * TODO - * @param accountId - * @param disabled - * account if success - * @return true if disable was successful, false otherwise - */ - Account disableAccount(String accountName, Long domainId, Long accountId) throws ConcurrentOperationException, ResourceUnavailableException; - - /** - * Enables an account by accountId - * - * @param accountName - * - the enableAccount command defining the accountId to be deleted. - * @param domainId - * TODO - * @param accountId - * @return account object - */ - Account enableAccount(String accountName, Long domainId, Long accountId); - - /** - * Locks an account by accountId. A locked account cannot access the API, but will still have running VMs/IP - * addresses - * allocated/etc. - * - * @param accountName - * - the LockAccount command defining the accountId to be locked. - * @param domainId - * TODO - * @param accountId - * @return account object - */ - Account lockAccount(String accountName, Long domainId, Long accountId); - - /** - * Updates an account name - * - * @param cmd - * - the parameter containing accountId - * @return updated account object - */ - - Account updateAccount(UpdateAccountCmd cmd); - Account getSystemAccount(); User getSystemUser(); - User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId); - - boolean deleteUser(DeleteUserCmd deleteUserCmd); + User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, Integer regionId); boolean isAdmin(short accountType); diff --git a/api/src/com/cloud/user/DomainService.java b/api/src/com/cloud/user/DomainService.java index cd20060b710..1a9635499f1 100644 --- a/api/src/com/cloud/user/DomainService.java +++ b/api/src/com/cloud/user/DomainService.java @@ -20,13 +20,14 @@ import java.util.List; import org.apache.cloudstack.api.command.admin.domain.ListDomainChildrenCmd; import org.apache.cloudstack.api.command.admin.domain.ListDomainsCmd; + import com.cloud.domain.Domain; import com.cloud.exception.PermissionDeniedException; import com.cloud.utils.Pair; public interface DomainService { - Domain createDomain(String name, Long parentId, String networkDomain); + Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID, Integer regionId); Domain getDomain(long id); @@ -40,12 +41,19 @@ public interface DomainService { */ boolean isChildDomain(Long parentId, Long childId); - boolean deleteDomain(long domainId, Boolean cleanup); - Pair, Integer> searchForDomains(ListDomainsCmd cmd) throws PermissionDeniedException; Pair, Integer> searchForDomainChildren(ListDomainChildrenCmd cmd) throws PermissionDeniedException; + /** + * find the domain by its path + * + * @param domainPath + * the path to use to lookup a domain + * @return domainVO the domain with the matching path, or null if no domain with the given path exists + */ + Domain findDomainByPath(String domainPath); + } diff --git a/api/src/com/cloud/user/User.java b/api/src/com/cloud/user/User.java index 36a7c6543b0..7d80c435e3d 100644 --- a/api/src/com/cloud/user/User.java +++ b/api/src/com/cloud/user/User.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.user; -import org.apache.cloudstack.api.InternalIdentity; - import java.util.Date; +import org.apache.cloudstack.api.InternalIdentity; + public interface User extends OwnedBy, InternalIdentity { public static final long UID_SYSTEM = 1; @@ -73,4 +73,5 @@ public interface User extends OwnedBy, InternalIdentity { boolean isRegistered(); + public int getRegionId(); } diff --git a/api/src/com/cloud/user/UserAccount.java b/api/src/com/cloud/user/UserAccount.java index c09b5c0fac5..0cb0f697a5c 100644 --- a/api/src/com/cloud/user/UserAccount.java +++ b/api/src/com/cloud/user/UserAccount.java @@ -16,10 +16,10 @@ // under the License. package com.cloud.user; -import org.apache.cloudstack.api.InternalIdentity; - import java.util.Date; +import org.apache.cloudstack.api.InternalIdentity; + public interface UserAccount extends InternalIdentity { long getId(); diff --git a/api/src/com/cloud/user/UserContext.java b/api/src/com/cloud/user/UserContext.java index 539e11812af..bcb33b5edeb 100644 --- a/api/src/com/cloud/user/UserContext.java +++ b/api/src/com/cloud/user/UserContext.java @@ -16,14 +16,11 @@ // under the License. package com.cloud.user; -import com.cloud.server.ManagementService; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.ComponentContext; +import javax.inject.Inject; public class UserContext { - private static ThreadLocal s_currentContext = new ThreadLocal(); - private static final ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - private static final AccountService _accountMgr = locator.getManager(AccountService.class); private long userId; private String sessionId; @@ -31,10 +28,9 @@ public class UserContext { private long startEventId = 0; private long accountId; private String eventDetails; - private boolean apiServer; - private static UserContext s_adminContext = new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false); + @Inject private AccountService _accountMgr = null; public UserContext() { } @@ -51,6 +47,9 @@ public class UserContext { } public User getCallerUser() { + if (_accountMgr == null) { + _accountMgr = ComponentContext.getComponent(AccountService.class); + } return _accountMgr.getActiveUser(userId); } @@ -90,10 +89,10 @@ public class UserContext { // however, there are many places that run background jobs assume the system context. // // If there is a security concern, all entry points from user (including the front end that takes HTTP -// request in and + // request in and // the core async-job manager that runs commands from user) have explicitly setup the UserContext. // - return s_adminContext; + return UserContextInitializer.getInstance().getAdminContext(); } return context; } diff --git a/api/src/com/cloud/user/UserContextInitializer.java b/api/src/com/cloud/user/UserContextInitializer.java new file mode 100644 index 00000000000..a54596373eb --- /dev/null +++ b/api/src/com/cloud/user/UserContextInitializer.java @@ -0,0 +1,40 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.user; + +import javax.inject.Inject; + +import org.springframework.stereotype.Component; + +@Component +public class UserContextInitializer { + @Inject private AccountService _accountMgr; + + private static UserContextInitializer s_instance; + + public UserContextInitializer() { + s_instance = this; + } + + public static UserContextInitializer getInstance() { + return s_instance; + } + + public UserContext getAdminContext() { + return new UserContext(_accountMgr.getSystemUser().getId(), _accountMgr.getSystemAccount(), null, false); + } +} diff --git a/api/src/com/cloud/uservm/UserVm.java b/api/src/com/cloud/uservm/UserVm.java index a587666bc8b..b1d1712d9cf 100755 --- a/api/src/com/cloud/uservm/UserVm.java +++ b/api/src/com/cloud/uservm/UserVm.java @@ -17,6 +17,7 @@ package com.cloud.uservm; import org.apache.cloudstack.acl.ControlledEntity; + import com.cloud.vm.VirtualMachine; /** diff --git a/api/src/com/cloud/vm/DiskProfile.java b/api/src/com/cloud/vm/DiskProfile.java index bb74d848342..e34a3340e9e 100644 --- a/api/src/com/cloud/vm/DiskProfile.java +++ b/api/src/com/cloud/vm/DiskProfile.java @@ -34,6 +34,7 @@ public class DiskProfile { private long diskOfferingId; private Long templateId; private long volumeId; + private String path; private HypervisorType hyperType; @@ -56,6 +57,10 @@ public class DiskProfile { this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isCustomized(), null); this.hyperType = hyperType; } + + public DiskProfile(DiskProfile dp) { + + } /** * @return size of the disk requested in bytes. @@ -137,4 +142,16 @@ public class DiskProfile { public HypervisorType getHypersorType() { return this.hyperType; } + + public void setPath(String path) { + this.path = path; + } + + public String getPath() { + return this.path; + } + + public void setSize(long size) { + this.size = size; + } } diff --git a/api/src/com/cloud/vm/Nic.java b/api/src/com/cloud/vm/Nic.java index 84c0034b430..9d21130327a 100644 --- a/api/src/com/cloud/vm/Nic.java +++ b/api/src/com/cloud/vm/Nic.java @@ -21,12 +21,13 @@ import java.util.Date; import java.util.List; import java.util.Set; +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.network.Networks.AddressFormat; import com.cloud.network.Networks.Mode; import com.cloud.utils.fsm.FiniteState; import com.cloud.utils.fsm.StateMachine; -import org.apache.cloudstack.api.Identity; -import org.apache.cloudstack.api.InternalIdentity; /** * Nic represents one nic on the VM. @@ -144,4 +145,10 @@ public interface Nic extends Identity, InternalIdentity { VirtualMachine.Type getVmType(); AddressFormat getAddressFormat(); + + String getIp6Gateway(); + + String getIp6Cidr(); + + String getIp6Address(); } diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java index 32e3f212e99..5970ccd24ee 100644 --- a/api/src/com/cloud/vm/NicProfile.java +++ b/api/src/com/cloud/vm/NicProfile.java @@ -18,13 +18,14 @@ package com.cloud.vm; import java.net.URI; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.network.Network; import com.cloud.network.Networks.AddressFormat; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.Mode; import com.cloud.network.Networks.TrafficType; import com.cloud.vm.Nic.ReservationStrategy; -import org.apache.cloudstack.api.InternalIdentity; public class NicProfile implements InternalIdentity { long id; @@ -37,6 +38,8 @@ public class NicProfile implements InternalIdentity { TrafficType trafficType; String ip4Address; String ip6Address; + String ip6Gateway; + String ip6Cidr; String macAddress; URI isolationUri; String netmask; @@ -47,10 +50,13 @@ public class NicProfile implements InternalIdentity { Integer deviceId; String dns1; String dns2; + String ip6Dns1; + String ip6Dns2; Integer networkRate; boolean isSecurityGroupEnabled; String name; - String requestedIp; + String requestedIpv4; + String requestedIpv6; public String getDns1() { return dns1; @@ -218,7 +224,7 @@ public class NicProfile implements InternalIdentity { this.trafficType = network.getTrafficType(); this.ip4Address = nic.getIp4Address(); this.format = nic.getAddressFormat(); - this.ip6Address = null; + this.ip6Address = nic.getIp6Address(); this.macAddress = nic.getMacAddress(); this.reservationId = nic.getReservationId(); this.strategy = nic.getReservationStrategy(); @@ -230,6 +236,8 @@ public class NicProfile implements InternalIdentity { this.isSecurityGroupEnabled = isSecurityGroupEnabled; this.vmId = nic.getInstanceId(); this.name = name; + this.ip6Cidr = nic.getIp6Cidr(); + this.ip6Gateway = nic.getIp6Gateway(); if (networkRate != null) { this.networkRate = networkRate; @@ -245,8 +253,9 @@ public class NicProfile implements InternalIdentity { this.strategy = strategy; } - public NicProfile(String requestedIp) { - this.requestedIp = requestedIp; + public NicProfile(String requestedIpv4, String requestedIpv6) { + this.requestedIpv4 = requestedIpv4; + this.requestedIpv6 = requestedIpv6; } public NicProfile() { @@ -272,8 +281,8 @@ public class NicProfile implements InternalIdentity { this.isSecurityGroupEnabled = enabled; } - public String getRequestedIp() { - return requestedIp; + public String getRequestedIpv4() { + return requestedIpv4; } public void deallocate() { @@ -301,4 +310,44 @@ public class NicProfile implements InternalIdentity { append(reservationId).append("-").append(ip4Address).append("-").append(broadcastUri).toString(); } + public String getIp6Gateway() { + return ip6Gateway; + } + + public void setIp6Gateway(String ip6Gateway) { + this.ip6Gateway = ip6Gateway; + } + + public String getIp6Cidr() { + return ip6Cidr; + } + + public void setIp6Cidr(String ip6Cidr) { + this.ip6Cidr = ip6Cidr; + } + + public String getRequestedIpv6() { + return requestedIpv6; + } + + public void setRequestedIpv6(String requestedIpv6) { + this.requestedIpv6 = requestedIpv6; + } + + public String getIp6Dns1() { + return ip6Dns1; + } + + public void setIp6Dns1(String ip6Dns1) { + this.ip6Dns1 = ip6Dns1; + } + + public String getIp6Dns2() { + return ip6Dns2; + } + + public void setIp6Dns2(String ip6Dns2) { + this.ip6Dns2 = ip6Dns2; + } + } diff --git a/api/src/com/cloud/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java index b1ebe10596d..ea89eda89d2 100755 --- a/api/src/com/cloud/vm/UserVmService.java +++ b/api/src/com/cloud/vm/UserVmService.java @@ -22,19 +22,23 @@ import java.util.Map; import javax.naming.InsufficientResourcesException; import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd; -import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd; -import org.apache.cloudstack.api.command.user.vm.*; -import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; -import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd; -import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd; +import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd; +import org.apache.cloudstack.api.command.user.vm.AddNicToVMCmd; import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; import org.apache.cloudstack.api.command.user.vm.DestroyVMCmd; -import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd; import org.apache.cloudstack.api.command.user.vm.RebootVMCmd; -import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd; +import org.apache.cloudstack.api.command.user.vm.RemoveNicFromVMCmd; import org.apache.cloudstack.api.command.user.vm.ResetVMPasswordCmd; +import org.apache.cloudstack.api.command.user.vm.ResetVMSSHKeyCmd; import org.apache.cloudstack.api.command.user.vm.RestoreVMCmd; +import org.apache.cloudstack.api.command.user.vm.StartVMCmd; +import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd; +import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd; import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; +import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd; +import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd; +import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd; +import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd; import com.cloud.dc.DataCenter; import com.cloud.exception.ConcurrentOperationException; @@ -46,6 +50,7 @@ import com.cloud.exception.StorageUnavailableException; import com.cloud.exception.VirtualMachineMigrationException; import com.cloud.host.Host; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network.IpAddresses; import com.cloud.offering.ServiceOffering; import com.cloud.storage.StoragePool; import com.cloud.storage.Volume; @@ -89,22 +94,13 @@ public interface UserVmService { UserVm resetVMPassword(ResetVMPasswordCmd cmd, String password) throws ResourceUnavailableException, InsufficientCapacityException; /** - * Attaches the specified volume to the specified VM + * Resets the SSH Key of a virtual machine. * * @param cmd - * - the command specifying volumeId and vmId - * @return the Volume object if attach worked successfully. + * - the command specifying vmId, Keypair name + * @return the VM if reset worked successfully, null otherwise */ - Volume attachVolumeToVM(AttachVolumeCmd cmd); - - /** - * Detaches the specified volume from the VM it is currently attached to. - * - * @param cmd - * - the command specifying volumeId - * @return the Volume object if detach worked successfully. - */ - Volume detachVolumeFromVM(DetachVolumeCmd cmmd); + UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException; UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException; @@ -113,30 +109,29 @@ public interface UserVmService { UserVm updateVirtualMachine(UpdateVMCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException; + /** + * Adds a NIC on the given network to the virtual machine + * @param cmd the command object that defines the vm and the given network + * @return the vm object if successful, null otherwise + */ + UserVm addNicToVirtualMachine(AddNicToVMCmd cmd); + + /** + * Removes a NIC on the given network from the virtual machine + * @param cmd the command object that defines the vm and the given network + * @return the vm object if successful, null otherwise + */ + UserVm removeNicFromVirtualMachine(RemoveNicFromVMCmd cmd); + + /** + * Updates default Nic to the given network for given virtual machine + * @param cmd the command object that defines the vm and the given network + * @return the vm object if successful, null otherwise + */ + UserVm updateDefaultNicForVirtualMachine(UpdateDefaultNicForVMCmd cmd); + UserVm recoverVirtualMachine(RecoverVMCmd cmd) throws ResourceAllocationException; - /** - * Create a template database record in preparation for creating a private template. - * - * @param cmd - * the command object that defines the name, display text, snapshot/volume, bits, public/private, etc. - * for the - * private template - * @param templateOwner - * TODO - * @return the vm template object if successful, null otherwise - * @throws ResourceAllocationException - */ - VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd, Account templateOwner) throws ResourceAllocationException; - - /** - * Creates a private template from a snapshot of a VM - * - * @param cmd - * - the command specifying snapshotId, name, description - * @return a template if successfully created, null otherwise - */ - VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd cmd); /** * Creates a Basic Zone User VM in the database and returns the VM to the caller. @@ -197,7 +192,7 @@ public interface UserVmService { * @throws InsufficientResourcesException */ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List securityGroupIdList, Account owner, String hostName, - String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, String defaultIp, String keyboard) + String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIp, String keyboard) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; /** @@ -244,7 +239,7 @@ public interface UserVmService { * - name of the ssh key pair used to login to the virtual machine * @param requestedIps * TODO - * @param defaultIp + * @param defaultIps * TODO * @param accountName * - an optional account for the virtual machine. Must be used with domainId @@ -262,8 +257,8 @@ public interface UserVmService { * @throws InsufficientResourcesException */ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, List securityGroupIdList, - Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, - String defaultIp, String keyboard) + Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, + IpAddresses defaultIps, String keyboard) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; /** @@ -308,8 +303,7 @@ public interface UserVmService { * - name of the ssh key pair used to login to the virtual machine * @param requestedIps * TODO - * @param defaultIp - * TODO + * @param defaultIps TODO * @param accountName * - an optional account for the virtual machine. Must be used with domainId * @param domainId @@ -326,7 +320,7 @@ public interface UserVmService { * @throws InsufficientResourcesException */ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List networkIdList, Account owner, String hostName, - String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, String defaultIp, String keyboard) + String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, String userData, String sshKeyPair, Map requestedIps, IpAddresses defaultIps, String keyboard) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException; /** diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java index cd305795478..4300dd548c1 100755 --- a/api/src/com/cloud/vm/VirtualMachine.java +++ b/api/src/com/cloud/vm/VirtualMachine.java @@ -21,14 +21,15 @@ import java.util.Map; import org.apache.cloudstack.acl.ControlledEntity; import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.fsm.StateMachine2; import com.cloud.utils.fsm.StateObject; -import org.apache.cloudstack.api.InternalIdentity; /** * VirtualMachine describes the properties held by a virtual machine - * + * */ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject { @@ -111,7 +112,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging); s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging); } - + public static boolean isVmStarted(State oldState, Event e, State newState) { if (oldState == State.Starting && newState == State.Running) { return true; @@ -173,7 +174,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I OperationFailedToError, OperationRetry, AgentReportShutdowned, - AgentReportMigrated + AgentReportMigrated, + RevertRequested, + SnapshotRequested }; public enum Type { @@ -239,9 +242,11 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I */ public long getTemplateId(); + + /** * returns the guest OS ID - * + * * @return guestOSId */ public long getGuestOSId(); @@ -254,7 +259,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I /** * @return data center id. */ - public long getDataCenterIdToDeployIn(); + public long getDataCenterId(); /** * @return id of the host it was assigned last time. @@ -280,6 +285,8 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I public Date getCreated(); public long getServiceOfferingId(); + + public Long getDiskOfferingId(); Type getType(); @@ -287,5 +294,4 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I public Map getDetails(); - boolean canPlugNics(); } diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java index 0fab4436807..33a9171e732 100644 --- a/api/src/com/cloud/vm/VirtualMachineProfile.java +++ b/api/src/com/cloud/vm/VirtualMachineProfile.java @@ -136,4 +136,10 @@ public interface VirtualMachineProfile { BootloaderType getBootLoaderType(); Map getParameters(); + + Float getCpuOvercommitRatio(); + + Float getMemoryOvercommitRatio(); + + } diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/com/cloud/vm/snapshot/VMSnapshot.java new file mode 100644 index 00000000000..f0ee7ee7e8a --- /dev/null +++ b/api/src/com/cloud/vm/snapshot/VMSnapshot.java @@ -0,0 +1,110 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.vm.snapshot; + +import java.util.Date; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import org.apache.cloudstack.acl.ControlledEntity; +import com.cloud.utils.fsm.StateMachine2; +import com.cloud.utils.fsm.StateObject; + +public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity,StateObject { + + enum State { + Allocated("The VM snapshot is allocated but has not been created yet."), + Creating("The VM snapshot is being created."), + Ready("The VM snapshot is ready to be used."), + Reverting("The VM snapshot is being used to revert"), + Expunging("The volume is being expunging"), + Removed("The volume is destroyed, and can't be recovered."), + Error ("The volume is in error state, and can't be recovered"); + + String _description; + + private State(String description) { + _description = description; + } + + public static StateMachine2 getStateMachine() { + return s_fsm; + } + + public String getDescription() { + return _description; + } + + private final static StateMachine2 s_fsm = new StateMachine2(); + static { + s_fsm.addTransition(Allocated, Event.CreateRequested, Creating); + s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready); + s_fsm.addTransition(Creating, Event.OperationFailed, Error); + s_fsm.addTransition(Ready, Event.RevertRequested, Reverting); + s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready); + s_fsm.addTransition(Reverting, Event.OperationFailed, Ready); + s_fsm.addTransition(Ready, Event.ExpungeRequested, Expunging); + s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging); + s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging); + s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed); + } + } + + enum Type{ + Disk, DiskAndMemory + } + + enum Event { + CreateRequested, + OperationFailed, + OperationSucceeded, + RevertRequested, + ExpungeRequested, + } + + long getId(); + + public String getName(); + + public Long getVmId(); + + public State getState(); + + public Date getCreated(); + + public String getDescription(); + + public String getDisplayName(); + + public Long getParent(); + + public Boolean getCurrent(); + + public Type getType(); + + public long getUpdatedCount(); + + public void incrUpdatedCount(); + + public Date getUpdated(); + + public Date getRemoved(); + + public long getAccountId(); +} diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java new file mode 100644 index 00000000000..83f86bc90db --- /dev/null +++ b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java @@ -0,0 +1,48 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package com.cloud.vm.snapshot; + +import java.util.List; + +import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InsufficientServerCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.uservm.UserVm; +import com.cloud.vm.VirtualMachine; + +public interface VMSnapshotService { + + List listVMSnapshots(ListVMSnapshotCmd cmd); + + VMSnapshot getVMSnapshotById(Long id); + + VMSnapshot creatVMSnapshot(Long vmId, Long vmSnapshotId); + + VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory) + throws ResourceAllocationException; + + boolean deleteVMSnapshot(Long vmSnapshotId); + + UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException; + + VirtualMachine getVMBySnapshotId(Long id); +} diff --git a/api/src/org/apache/cloudstack/acl/APIChecker.java b/api/src/org/apache/cloudstack/acl/APIChecker.java index 0d0dfd1be4e..2e2b73ba782 100644 --- a/api/src/org/apache/cloudstack/acl/APIChecker.java +++ b/api/src/org/apache/cloudstack/acl/APIChecker.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.acl; import com.cloud.exception.PermissionDeniedException; +import com.cloud.exception.RequestLimitException; import com.cloud.user.User; import com.cloud.utils.component.Adapter; @@ -26,5 +27,5 @@ public interface APIChecker extends Adapter { // If true, apiChecker has checked the operation // If false, apiChecker is unable to handle the operation or not implemented // On exception, checkAccess failed don't allow - boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException; + boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException, RequestLimitException; } diff --git a/api/src/org/apache/cloudstack/acl/APILimitChecker.java b/api/src/org/apache/cloudstack/acl/APILimitChecker.java new file mode 100644 index 00000000000..110742c059d --- /dev/null +++ b/api/src/org/apache/cloudstack/acl/APILimitChecker.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.acl; + +import org.apache.cloudstack.api.ServerApiException; + +import com.cloud.user.Account; +import com.cloud.utils.component.Adapter; + +/** + * APILimitChecker checks if we should block an API request based on pre-set account based api limit. + */ +public interface APILimitChecker extends Adapter { + // Interface for checking if the account is over its api limit + void checkLimit(Account account) throws ServerApiException; +} diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java old mode 100644 new mode 100755 index a4cb8695d35..4d6099bb863 --- a/api/src/org/apache/cloudstack/api/ApiConstants.java +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java @@ -16,7 +16,6 @@ // under the License. package org.apache.cloudstack.api; -import org.omg.CORBA.PUBLIC_MEMBER; public class ApiConstants { public static final String ACCOUNT = "account"; @@ -38,6 +37,7 @@ public class ApiConstants { public static final String DOMAIN_SUFFIX = "domainsuffix"; public static final String DNS_SEARCH_ORDER = "dnssearchorder"; public static final String CIDR = "cidr"; + public static final String IP6_CIDR = "ip6cidr"; public static final String CIDR_LIST = "cidrlist"; public static final String CLEANUP = "cleanup"; public static final String CLUSTER_ID = "clusterid"; @@ -46,6 +46,7 @@ public class ApiConstants { public static final String COMPONENT = "component"; public static final String CPU_NUMBER = "cpunumber"; public static final String CPU_SPEED = "cpuspeed"; + public static final String CPU_OVERCOMMIT_RATIO="cpuovercommitratio"; public static final String CREATED = "created"; public static final String CUSTOMIZED = "customized"; public static final String DESCRIPTION = "description"; @@ -58,12 +59,15 @@ public class ApiConstants { public static final String DISPLAY_TEXT = "displaytext"; public static final String DNS1 = "dns1"; public static final String DNS2 = "dns2"; + public static final String IP6_DNS1 = "ip6dns1"; + public static final String IP6_DNS2 = "ip6dns2"; public static final String DOMAIN = "domain"; public static final String DOMAIN_ID = "domainid"; public static final String DURATION = "duration"; public static final String EMAIL = "email"; public static final String END_DATE = "enddate"; public static final String END_IP = "endip"; + public static final String END_IPV6 = "endipv6"; public static final String END_PORT = "endport"; public static final String ENTRY_TIME = "entrytime"; public static final String FETCH_LATEST = "fetchlatest"; @@ -73,6 +77,7 @@ public class ApiConstants { public static final String FORMAT = "format"; public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork"; public static final String GATEWAY = "gateway"; + public static final String IP6_GATEWAY = "ip6gateway"; public static final String GROUP = "group"; public static final String GROUP_ID = "groupid"; public static final String GUEST_CIDR_ADDRESS = "guestcidraddress"; @@ -90,6 +95,7 @@ public class ApiConstants { public static final String INTERNAL_DNS2 = "internaldns2"; public static final String INTERVAL_TYPE = "intervaltype"; public static final String IP_ADDRESS = "ipaddress"; + public static final String IP6_ADDRESS = "ip6address"; public static final String IP_ADDRESS_ID = "ipaddressid"; public static final String IS_ASYNC = "isasync"; public static final String IP_AVAILABLE = "ipavailable"; @@ -99,6 +105,7 @@ public class ApiConstants { public static final String IS_EXTRACTABLE = "isextractable"; public static final String IS_FEATURED = "isfeatured"; public static final String IS_PUBLIC = "ispublic"; + public static final String IS_PERSISTENT = "ispersistent"; public static final String IS_READY = "isready"; public static final String IS_RECURSIVE = "isrecursive"; public static final String ISO_FILTER = "isofilter"; @@ -115,6 +122,7 @@ public class ApiConstants { public static final String MAX = "max"; public static final String MAX_SNAPS = "maxsnaps"; public static final String MEMORY = "memory"; + public static final String MEMORY_OVERCOMMIT_RATIO="memoryovercommitratio"; public static final String MODE = "mode"; public static final String NAME = "name"; public static final String METHOD_NAME = "methodname"; @@ -181,6 +189,7 @@ public class ApiConstants { public static final String SOURCE_ZONE_ID = "sourcezoneid"; public static final String START_DATE = "startdate"; public static final String START_IP = "startip"; + public static final String START_IPV6 = "startipv6"; public static final String START_PORT = "startport"; public static final String STATE = "state"; public static final String STATUS = "status"; @@ -213,6 +222,7 @@ public class ApiConstants { public static final String VM_LIMIT = "vmlimit"; public static final String VM_TOTAL = "vmtotal"; public static final String VNET = "vnet"; + public static final String IS_VOLATILE = "isvolatile"; public static final String VOLUME_ID = "volumeid"; public static final String ZONE_ID = "zoneid"; public static final String ZONE_NAME = "zonename"; @@ -224,6 +234,7 @@ public class ApiConstants { public static final String NETWORK_OFFERING_ID = "networkofferingid"; public static final String NETWORK_IDS = "networkids"; public static final String NETWORK_ID = "networkid"; + public static final String NIC_ID = "nicid"; public static final String SPECIFY_VLAN = "specifyvlan"; public static final String IS_DEFAULT = "isdefault"; public static final String IS_SYSTEM = "issystem"; @@ -368,6 +379,9 @@ public class ApiConstants { public static final String VSM_CONFIG_STATE = "vsmconfigstate"; public static final String VSM_DEVICE_STATE = "vsmdevicestate"; public static final String ADD_VSM_FLAG = "addvsmflag"; + public static final String END_POINT = "endpoint"; + public static final String REGION_ID = "regionid"; + public static final String IS_PROPAGATE = "ispropagate"; public static final String VPC_OFF_ID = "vpcofferingid"; public static final String NETWORK = "network"; public static final String VPC_ID = "vpcid"; @@ -387,6 +401,7 @@ public class ApiConstants { public static final String ESP_LIFETIME = "esplifetime"; public static final String DPD = "dpd"; public static final String FOR_VPC = "forvpc"; + public static final String SHRINK_OK = "shrinkok"; public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid"; public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid"; public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename"; @@ -426,8 +441,19 @@ public class ApiConstants { public static final String CONDITION_IDS = "conditionids"; public static final String COUNTERPARAM_LIST = "counterparam"; public static final String AUTOSCALE_USER_ID = "autoscaleuserid"; + public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername"; + public static final String UCS_DN = "ucsdn"; + public static final String VM_SNAPSHOT_DESCRIPTION = "description"; + public static final String VM_SNAPSHOT_DISPLAYNAME = "name"; + public static final String VM_SNAPSHOT_ID = "vmsnapshotid"; + public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids"; + public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory"; + public static final String IMAGE_STORE_UUID = "imagestoreuuid"; + public static final String GUEST_VM_CIDR = "guestvmcidr"; + public static final String NETWORK_CIDR = "networkcidr"; + public static final String RESERVED_IP_RANGE = "reservediprange"; public static final String ASA_INSIDE_PORT_PROFILE = "insideportprofile"; - + public enum HostDetails { all, capacity, events, stats, min; } diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java.orig b/api/src/org/apache/cloudstack/api/ApiConstants.java.orig new file mode 100644 index 00000000000..3801506ffaa --- /dev/null +++ b/api/src/org/apache/cloudstack/api/ApiConstants.java.orig @@ -0,0 +1,468 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api; + + +public class ApiConstants { + public static final String ACCOUNT = "account"; + public static final String ACCOUNTS = "accounts"; + public static final String ACCOUNT_TYPE = "accounttype"; + public static final String ACCOUNT_ID = "accountid"; + public static final String ALGORITHM = "algorithm"; + public static final String ALLOCATED_ONLY = "allocatedonly"; + public static final String API_KEY = "userapikey"; + public static final String APPLIED = "applied"; + public static final String AVAILABLE = "available"; + public static final String BITS = "bits"; + public static final String BOOTABLE = "bootable"; + public static final String BIND_DN = "binddn"; + public static final String BIND_PASSWORD = "bindpass"; + public static final String CATEGORY = "category"; + public static final String CERTIFICATE = "certificate"; + public static final String PRIVATE_KEY = "privatekey"; + public static final String DOMAIN_SUFFIX = "domainsuffix"; + public static final String DNS_SEARCH_ORDER = "dnssearchorder"; + public static final String CIDR = "cidr"; + public static final String IP6_CIDR = "ip6cidr"; + public static final String CIDR_LIST = "cidrlist"; + public static final String CLEANUP = "cleanup"; + public static final String CLUSTER_ID = "clusterid"; + public static final String CLUSTER_NAME = "clustername"; + public static final String CLUSTER_TYPE = "clustertype"; + public static final String COMPONENT = "component"; + public static final String CPU_NUMBER = "cpunumber"; + public static final String CPU_SPEED = "cpuspeed"; + public static final String CREATED = "created"; + public static final String CUSTOMIZED = "customized"; + public static final String DESCRIPTION = "description"; + public static final String DESTINATION_ZONE_ID = "destzoneid"; + public static final String DETAILS = "details"; + public static final String DEVICE_ID = "deviceid"; + public static final String DISK_OFFERING_ID = "diskofferingid"; + public static final String DISK_SIZE = "disksize"; + public static final String DISPLAY_NAME = "displayname"; + public static final String DISPLAY_TEXT = "displaytext"; + public static final String DNS1 = "dns1"; + public static final String DNS2 = "dns2"; + public static final String DOMAIN = "domain"; + public static final String DOMAIN_ID = "domainid"; + public static final String DURATION = "duration"; + public static final String EMAIL = "email"; + public static final String END_DATE = "enddate"; + public static final String END_IP = "endip"; + public static final String END_IPV6 = "endipv6"; + public static final String END_PORT = "endport"; + public static final String ENTRY_TIME = "entrytime"; + public static final String FETCH_LATEST = "fetchlatest"; + public static final String FIRSTNAME = "firstname"; + public static final String FORCED = "forced"; + public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage"; + public static final String FORMAT = "format"; + public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork"; + public static final String GATEWAY = "gateway"; + public static final String IP6_GATEWAY = "ip6gateway"; + public static final String GROUP = "group"; + public static final String GROUP_ID = "groupid"; + public static final String GUEST_CIDR_ADDRESS = "guestcidraddress"; + public static final String HA_ENABLE = "haenable"; + public static final String HOST_ID = "hostid"; + public static final String HOST_NAME = "hostname"; + public static final String HYPERVISOR = "hypervisor"; + public static final String INLINE = "inline"; + public static final String INSTANCE = "instance"; + public static final String ICMP_CODE = "icmpcode"; + public static final String ICMP_TYPE = "icmptype"; + public static final String ID = "id"; + public static final String IDS = "ids"; + public static final String INTERNAL_DNS1 = "internaldns1"; + public static final String INTERNAL_DNS2 = "internaldns2"; + public static final String INTERVAL_TYPE = "intervaltype"; + public static final String IP_ADDRESS = "ipaddress"; + public static final String IP6_ADDRESS = "ip6address"; + public static final String IP_ADDRESS_ID = "ipaddressid"; + public static final String IS_ASYNC = "isasync"; + public static final String IP_AVAILABLE = "ipavailable"; + public static final String IP_LIMIT = "iplimit"; + public static final String IP_TOTAL = "iptotal"; + public static final String IS_CLEANUP_REQUIRED = "iscleanuprequired"; + public static final String IS_EXTRACTABLE = "isextractable"; + public static final String IS_FEATURED = "isfeatured"; + public static final String IS_PUBLIC = "ispublic"; + public static final String IS_PERSISTENT = "ispersistent"; + public static final String IS_READY = "isready"; + public static final String IS_RECURSIVE = "isrecursive"; + public static final String ISO_FILTER = "isofilter"; + public static final String ISO_GUEST_OS_NONE = "None"; + public static final String JOB_ID = "jobid"; + public static final String JOB_STATUS = "jobstatus"; + public static final String LASTNAME = "lastname"; + public static final String LEVEL = "level"; + public static final String LENGTH = "length"; + public static final String LIMIT_CPU_USE = "limitcpuuse"; + public static final String LOCK = "lock"; + public static final String LUN = "lun"; + public static final String LBID = "lbruleid"; + public static final String MAX = "max"; + public static final String MAX_SNAPS = "maxsnaps"; + public static final String MEMORY = "memory"; + public static final String MODE = "mode"; + public static final String NAME = "name"; + public static final String METHOD_NAME = "methodname"; + public static final String NETWORK_DOMAIN = "networkdomain"; + public static final String NETMASK = "netmask"; + public static final String NEW_NAME = "newname"; + public static final String NUM_RETRIES = "numretries"; + public static final String OFFER_HA = "offerha"; + public static final String IS_SYSTEM_OFFERING = "issystem"; + public static final String IS_DEFAULT_USE = "defaultuse"; + public static final String OP = "op"; + public static final String OS_CATEGORY_ID = "oscategoryid"; + public static final String OS_TYPE_ID = "ostypeid"; + public static final String PARAMS = "params"; + public static final String PARENT_DOMAIN_ID = "parentdomainid"; + public static final String PASSWORD = "password"; + public static final String NEW_PASSWORD = "new_password"; + public static final String PASSWORD_ENABLED = "passwordenabled"; + public static final String SSHKEY_ENABLED = "sshkeyenabled"; + public static final String PATH = "path"; + public static final String POD_ID = "podid"; + public static final String POD_IDS = "podids"; + public static final String POLICY_ID = "policyid"; + public static final String PORT = "port"; + public static final String PORTAL = "portal"; + public static final String PORT_FORWARDING_SERVICE_ID = "portforwardingserviceid"; + public static final String PRIVATE_INTERFACE = "privateinterface"; + public static final String PRIVATE_IP = "privateip"; + public static final String PRIVATE_PORT = "privateport"; + public static final String PRIVATE_START_PORT = "privateport"; + public static final String PRIVATE_END_PORT = "privateendport"; + public static final String PRIVATE_ZONE = "privatezone"; + public static final String PROTOCOL = "protocol"; + public static final String PUBLIC_INTERFACE = "publicinterface"; + public static final String PUBLIC_IP_ID = "publicipid"; + public static final String PUBLIC_IP = "publicip"; + public static final String PUBLIC_PORT = "publicport"; + public static final String PUBLIC_START_PORT = "publicport"; + public static final String PUBLIC_END_PORT = "publicendport"; + public static final String PUBLIC_ZONE = "publiczone"; + public static final String RECEIVED_BYTES = "receivedbytes"; + public static final String REQUIRES_HVM = "requireshvm"; + public static final String RESOURCE_TYPE = "resourcetype"; + public static final String RESPONSE = "response"; + public static final String QUERY_FILTER = "queryfilter"; + public static final String SCHEDULE = "schedule"; + public static final String SCOPE = "scope"; + public static final String SECRET_KEY = "usersecretkey"; + public static final String SINCE = "since"; + public static final String KEY = "key"; + public static final String SEARCH_BASE = "searchbase"; + public static final String SECURITY_GROUP_IDS = "securitygroupids"; + public static final String SECURITY_GROUP_NAMES = "securitygroupnames"; + public static final String SECURITY_GROUP_NAME = "securitygroupname"; + public static final String SECURITY_GROUP_ID = "securitygroupid"; + public static final String SENT = "sent"; + public static final String SENT_BYTES = "sentbytes"; + public static final String SERVICE_OFFERING_ID = "serviceofferingid"; + public static final String SHOW_CAPACITIES = "showcapacities"; + public static final String SIZE = "size"; + public static final String SNAPSHOT_ID = "snapshotid"; + public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid"; + public static final String SNAPSHOT_TYPE = "snapshottype"; + public static final String SOURCE_ZONE_ID = "sourcezoneid"; + public static final String START_DATE = "startdate"; + public static final String START_IP = "startip"; + public static final String START_IPV6 = "startipv6"; + public static final String START_PORT = "startport"; + public static final String STATE = "state"; + public static final String STATUS = "status"; + public static final String STORAGE_TYPE = "storagetype"; + public static final String SYSTEM_VM_TYPE = "systemvmtype"; + public static final String TAGS = "tags"; + public static final String TARGET_IQN = "targetiqn"; + public static final String TEMPLATE_FILTER = "templatefilter"; + public static final String TEMPLATE_ID = "templateid"; + public static final String ISO_ID = "isoid"; + public static final String TIMEOUT = "timeout"; + public static final String TIMEZONE = "timezone"; + public static final String TYPE = "type"; + public static final String TRUST_STORE = "truststore"; + public static final String TRUST_STORE_PASSWORD = "truststorepass"; + public static final String URL = "url"; + public static final String USAGE_INTERFACE = "usageinterface"; + public static final String USER_DATA = "userdata"; + public static final String USER_ID = "userid"; + public static final String USE_SSL = "ssl"; + public static final String USERNAME = "username"; + public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist"; + public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork"; + public static final String VALUE = "value"; + public static final String VIRTUAL_MACHINE_ID = "virtualmachineid"; + public static final String VIRTUAL_MACHINE_IDS = "virtualmachineids"; + public static final String VLAN = "vlan"; + public static final String VLAN_ID = "vlanid"; + public static final String VM_AVAILABLE = "vmavailable"; + public static final String VM_LIMIT = "vmlimit"; + public static final String VM_TOTAL = "vmtotal"; + public static final String VNET = "vnet"; + public static final String VOLUME_ID = "volumeid"; + public static final String ZONE_ID = "zoneid"; + public static final String ZONE_NAME = "zonename"; + public static final String NETWORK_TYPE = "networktype"; + public static final String PAGE = "page"; + public static final String PAGE_SIZE = "pagesize"; + public static final String COUNT = "count"; + public static final String TRAFFIC_TYPE = "traffictype"; + public static final String NETWORK_OFFERING_ID = "networkofferingid"; + public static final String NETWORK_IDS = "networkids"; + public static final String NETWORK_ID = "networkid"; + public static final String NIC_ID = "nicid"; + public static final String SPECIFY_VLAN = "specifyvlan"; + public static final String IS_DEFAULT = "isdefault"; + public static final String IS_SYSTEM = "issystem"; + public static final String AVAILABILITY = "availability"; + public static final String NETWORKRATE = "networkrate"; + public static final String HOST_TAGS = "hosttags"; + public static final String SSH_KEYPAIR = "keypair"; + public static final String HOST_CPU_CAPACITY = "hostcpucapacity"; + public static final String HOST_CPU_NUM = "hostcpunum"; + public static final String HOST_MEM_CAPACITY = "hostmemcapacity"; + public static final String HOST_MAC = "hostmac"; + public static final String HOST_TAG = "hosttag"; + public static final String PXE_SERVER_TYPE = "pxeservertype"; + public static final String LINMIN_USERNAME = "linminusername"; + public static final String LINMIN_PASSWORD = "linminpassword"; + public static final String LINMIN_APID = "linminapid"; + public static final String DHCP_SERVER_TYPE = "dhcpservertype"; + public static final String LINK_LOCAL_IP = "linklocalip"; + public static final String LINK_LOCAL_MAC_ADDRESS = "linklocalmacaddress"; + public static final String LINK_LOCAL_MAC_NETMASK = "linklocalnetmask"; + public static final String LINK_LOCAL_NETWORK_ID = "linklocalnetworkid"; + public static final String PRIVATE_MAC_ADDRESS = "privatemacaddress"; + public static final String PRIVATE_NETMASK = "privatenetmask"; + public static final String PRIVATE_NETWORK_ID = "privatenetworkid"; + public static final String ALLOCATION_STATE = "allocationstate"; + public static final String MANAGED_STATE = "managedstate"; + public static final String STORAGE_ID = "storageid"; + public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip"; + public static final String PING_DIR = "pingdir"; + public static final String TFTP_DIR = "tftpdir"; + public static final String PING_CIFS_USERNAME = "pingcifsusername"; + public static final String PING_CIFS_PASSWORD = "pingcifspassword"; + public static final String CHECKSUM = "checksum"; + public static final String NETWORK_DEVICE_TYPE = "networkdevicetype"; + public static final String NETWORK_DEVICE_PARAMETER_LIST = "networkdeviceparameterlist"; + public static final String ZONE_TOKEN = "zonetoken"; + public static final String DHCP_PROVIDER = "dhcpprovider"; + public static final String RESULT = "success"; + public static final String LUN_ID = "lunId"; + public static final String IQN = "iqn"; + public static final String AGGREGATE_NAME = "aggregatename"; + public static final String POOL_NAME = "poolname"; + public static final String VOLUME_NAME = "volumename"; + public static final String SNAPSHOT_POLICY = "snapshotpolicy"; + public static final String SNAPSHOT_RESERVATION = "snapshotreservation"; + public static final String IP_NETWORK_LIST = "iptonetworklist"; + public static final String PARAM_LIST = "param"; + public static final String FOR_LOAD_BALANCING = "forloadbalancing"; + public static final String KEYBOARD = "keyboard"; + public static final String OPEN_FIREWALL = "openfirewall"; + public static final String TEMPLATE_TAG = "templatetag"; + public static final String HYPERVISOR_VERSION = "hypervisorversion"; + public static final String MAX_GUESTS_LIMIT = "maxguestslimit"; + public static final String PROJECT_ID = "projectid"; + public static final String PROJECT_IDS = "projectids"; + public static final String PROJECT = "project"; + public static final String ROLE = "role"; + public static final String USER = "user"; + public static final String ACTIVE_ONLY = "activeonly"; + public static final String TOKEN = "token"; + public static final String ACCEPT = "accept"; + public static final String SORT_KEY = "sortkey"; + public static final String ACCOUNT_DETAILS = "accountdetails"; + public static final String SERVICE_PROVIDER_LIST = "serviceproviderlist"; + public static final String SERVICE_CAPABILITY_LIST = "servicecapabilitylist"; + public static final String CAN_CHOOSE_SERVICE_CAPABILITY = "canchooseservicecapability"; + public static final String PROVIDER = "provider"; + public static final String NETWORK_SPEED = "networkspeed"; + public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange"; + public static final String ISOLATION_METHODS = "isolationmethods"; + public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid"; + public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid"; + public static final String ENABLED = "enabled"; + public static final String SERVICE_NAME = "servicename"; + public static final String DHCP_RANGE = "dhcprange"; + public static final String UUID = "uuid"; + public static final String SECURITY_GROUP_EANBLED = "securitygroupenabled"; + public static final String LOCAL_STORAGE_ENABLED = "localstorageenabled"; + public static final String GUEST_IP_TYPE = "guestiptype"; + public static final String XEN_NETWORK_LABEL = "xennetworklabel"; + public static final String KVM_NETWORK_LABEL = "kvmnetworklabel"; + public static final String VMWARE_NETWORK_LABEL = "vmwarenetworklabel"; + public static final String NETWORK_SERVICE_PROVIDER_ID = "nspid"; + public static final String SERVICE_LIST = "servicelist"; + public static final String CAN_ENABLE_INDIVIDUAL_SERVICE = "canenableindividualservice"; + public static final String SUPPORTED_SERVICES = "supportedservices"; + public static final String NSP_ID = "nspid"; + public static final String ACL_TYPE = "acltype"; + public static final String SUBDOMAIN_ACCESS = "subdomainaccess"; + public static final String LOAD_BALANCER_DEVICE_ID = "lbdeviceid"; + public static final String LOAD_BALANCER_DEVICE_NAME = "lbdevicename"; + public static final String LOAD_BALANCER_DEVICE_STATE = "lbdevicestate"; + public static final String LOAD_BALANCER_DEVICE_CAPACITY = "lbdevicecapacity"; + public static final String LOAD_BALANCER_DEVICE_DEDICATED = "lbdevicededicated"; + public static final String FIREWALL_DEVICE_ID = "fwdeviceid"; + public static final String FIREWALL_DEVICE_NAME = "fwdevicename"; + public static final String FIREWALL_DEVICE_STATE = "fwdevicestate"; + public static final String FIREWALL_DEVICE_CAPACITY = "fwdevicecapacity"; + public static final String FIREWALL_DEVICE_DEDICATED = "fwdevicededicated"; + public static final String SERVICE = "service"; + public static final String ASSOCIATED_NETWORK_ID = "associatednetworkid"; + public static final String ASSOCIATED_NETWORK_NAME = "associatednetworkname"; + public static final String SOURCE_NAT_SUPPORTED = "sourcenatsupported"; + public static final String RESOURCE_STATE = "resourcestate"; + public static final String PROJECT_INVITE_REQUIRED = "projectinviterequired"; + public static final String REQUIRED = "required"; + public static final String RESTART_REQUIRED = "restartrequired"; + public static final String ALLOW_USER_CREATE_PROJECTS = "allowusercreateprojects"; + public static final String CONSERVE_MODE = "conservemode"; + public static final String TRAFFIC_TYPE_IMPLEMENTOR = "traffictypeimplementor"; + public static final String KEYWORD = "keyword"; + public static final String LIST_ALL = "listall"; + public static final String SPECIFY_IP_RANGES = "specifyipranges"; + public static final String IS_SOURCE_NAT = "issourcenat"; + public static final String IS_STATIC_NAT = "isstaticnat"; + public static final String SORT_BY = "sortby"; + public static final String CHANGE_CIDR = "changecidr"; + public static final String PURPOSE = "purpose"; + public static final String IS_TAGGED = "istagged"; + public static final String INSTANCE_NAME = "instancename"; + public static final String START_VM = "startvm"; + public static final String HA_HOST = "hahost"; + public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize"; + public static final String DEFAULT_ZONE_ID = "defaultzoneid"; + public static final String GUID = "guid"; + + public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid"; + public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename"; + public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate"; + // Would we need to have a capacity field for Cisco N1KV VSM? Max hosts managed by it perhaps? May remove this later. + public static final String EXTERNAL_SWITCH_MGMT_DEVICE_CAPACITY = "vsmdevicecapacity"; + public static final String CISCO_NEXUS_VSM_NAME = "vsmname"; + public static final String VSM_USERNAME = "vsmusername"; + public static final String VSM_PASSWORD = "vsmpassword"; + public static final String VSM_IPADDRESS = "vsmipaddress"; + public static final String VSM_MGMT_VLAN_ID = "vsmmgmtvlanid"; + public static final String VSM_PKT_VLAN_ID = "vsmpktvlanid"; + public static final String VSM_CTRL_VLAN_ID = "vsmctrlvlanid"; + public static final String VSM_STORAGE_VLAN_ID = "vsmstoragevlanid"; + public static final String VSM_DOMAIN_ID = "vsmdomainid"; + public static final String VSM_CONFIG_MODE = "vsmconfigmode"; + public static final String VSM_CONFIG_STATE = "vsmconfigstate"; + public static final String VSM_DEVICE_STATE = "vsmdevicestate"; + public static final String ADD_VSM_FLAG = "addvsmflag"; + public static final String END_POINT = "endpoint"; + public static final String REGION_ID = "regionid"; + public static final String IS_PROPAGATE = "ispropagate"; + public static final String VPC_OFF_ID = "vpcofferingid"; + public static final String NETWORK = "network"; + public static final String VPC_ID = "vpcid"; + public static final String GATEWAY_ID = "gatewayid"; + public static final String CAN_USE_FOR_DEPLOY = "canusefordeploy"; + public static final String RESOURCE_IDS = "resourceids"; + public static final String RESOURCE_ID = "resourceid"; + public static final String CUSTOMER = "customer"; + public static final String S2S_VPN_GATEWAY_ID = "s2svpngatewayid"; + public static final String S2S_CUSTOMER_GATEWAY_ID = "s2scustomergatewayid"; + public static final String IPSEC_PSK = "ipsecpsk"; + public static final String GUEST_IP = "guestip"; + public static final String REMOVED = "removed"; + public static final String IKE_POLICY = "ikepolicy"; + public static final String ESP_POLICY = "esppolicy"; + public static final String IKE_LIFETIME = "ikelifetime"; + public static final String ESP_LIFETIME = "esplifetime"; + public static final String DPD = "dpd"; + public static final String FOR_VPC = "forvpc"; + public static final String SHRINK_OK = "shrinkok"; + public static final String NICIRA_NVP_DEVICE_ID = "nvpdeviceid"; + public static final String NICIRA_NVP_TRANSPORT_ZONE_UUID = "transportzoneuuid"; + public static final String NICIRA_NVP_DEVICE_NAME = "niciradevicename"; + public static final String NICIRA_NVP_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid"; + public static final String S3_ACCESS_KEY = "accesskey"; + public static final String S3_SECRET_KEY = "secretkey"; + public static final String S3_END_POINT = "endpoint"; + public static final String S3_BUCKET_NAME = "bucket"; + public static final String S3_HTTPS_FLAG = "usehttps"; + public static final String S3_CONNECTION_TIMEOUT = "connectiontimeout"; + public static final String S3_MAX_ERROR_RETRY = "maxerrorretry"; + public static final String S3_SOCKET_TIMEOUT = "sockettimeout"; + public static final String INCL_ZONES = "includezones"; + public static final String EXCL_ZONES = "excludezones"; + public static final String SOURCE = "source"; + public static final String COUNTER_ID = "counterid"; + public static final String AGGR_OPERATOR = "aggroperator"; + public static final String AGGR_FUNCTION = "aggrfunction"; + public static final String AGGR_VALUE = "aggrvalue"; + public static final String THRESHOLD = "threshold"; + public static final String RELATIONAL_OPERATOR = "relationaloperator"; + public static final String OTHER_DEPLOY_PARAMS = "otherdeployparams"; + public static final String MIN_MEMBERS = "minmembers"; + public static final String MAX_MEMBERS = "maxmembers"; + public static final String AUTOSCALE_VM_DESTROY_TIME = "destroyvmgraceperiod"; + public static final String VMPROFILE_ID = "vmprofileid"; + public static final String VMGROUP_ID = "vmgroupid"; + public static final String CS_URL = "csurl"; + public static final String SCALEUP_POLICY_IDS = "scaleuppolicyids"; + public static final String SCALEDOWN_POLICY_IDS = "scaledownpolicyids"; + public static final String SCALEUP_POLICIES = "scaleuppolicies"; + public static final String SCALEDOWN_POLICIES = "scaledownpolicies"; + public static final String INTERVAL = "interval"; + public static final String QUIETTIME = "quiettime"; + public static final String ACTION = "action"; + public static final String CONDITION_ID = "conditionid"; + public static final String CONDITION_IDS = "conditionids"; + public static final String COUNTERPARAM_LIST = "counterparam"; + public static final String AUTOSCALE_USER_ID = "autoscaleuserid"; + public static final String BAREMETAL_DISCOVER_NAME = "baremetaldiscovername"; +<<<<<<< HEAD + public static final String UCS_DN = "ucsdn"; +======= + public static final String VM_SNAPSHOT_DESCRIPTION = "description"; + public static final String VM_SNAPSHOT_DISPLAYNAME = "name"; + public static final String VM_SNAPSHOT_ID = "vmsnapshotid"; + public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids"; + public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory"; +>>>>>>> CLOUDSTACK-684 Support VM Snapshot + + public enum HostDetails { + all, capacity, events, stats, min; + } + + public enum VMDetails { + all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min; + } + + public enum LDAPParams { + hostname, port, usessl, queryfilter, searchbase, dn, passwd, truststore, truststorepass; + + @Override + public String toString() { + return "ldap." + name(); + } + } + + +} diff --git a/api/src/org/apache/cloudstack/api/ApiErrorCode.java b/api/src/org/apache/cloudstack/api/ApiErrorCode.java new file mode 100644 index 00000000000..69bd0284cef --- /dev/null +++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api; + +/** + * Enum class for various API error code used in CloudStack + * + */ +public enum ApiErrorCode { + + MALFORMED_PARAMETER_ERROR(430), + PARAM_ERROR(431), + UNSUPPORTED_ACTION_ERROR(432), + API_LIMIT_EXCEED(429), + + INTERNAL_ERROR(530), + ACCOUNT_ERROR(531), + ACCOUNT_RESOURCE_LIMIT_ERROR(532), + INSUFFICIENT_CAPACITY_ERROR(533), + RESOURCE_UNAVAILABLE_ERROR(534), + RESOURCE_ALLOCATION_ERROR(535), + RESOURCE_IN_USE_ERROR(536), + NETWORK_RULE_CONFLICT_ERROR(537); + + private int httpCode; + + private ApiErrorCode(int httpStatusCode){ + httpCode = httpStatusCode; + } + + public int getHttpCode() { + return httpCode; + } + + public void setHttpCode(int httpCode) { + this.httpCode = httpCode; + } + + public String toString(){ + return String.valueOf(this.httpCode); + } + + +} diff --git a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java index fd67ed89675..97edb4c7c64 100644 --- a/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseAsyncCmd.java @@ -17,6 +17,7 @@ package org.apache.cloudstack.api; import org.apache.cloudstack.api.response.AsyncJobResponse; + import com.cloud.async.AsyncJob; import com.cloud.user.User; import com.cloud.user.UserContext; diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java index 3399784d2a2..816b6deed77 100644 --- a/api/src/org/apache/cloudstack/api/BaseCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseCmd.java @@ -25,7 +25,11 @@ import java.util.List; import java.util.Map; import java.util.regex.Pattern; +import javax.inject.Inject; + import org.apache.cloudstack.query.QueryService; +import org.apache.cloudstack.region.RegionService; +import org.apache.cloudstack.usage.UsageService; import org.apache.log4j.Logger; import com.cloud.configuration.ConfigurationService; @@ -40,6 +44,7 @@ import com.cloud.exception.PermissionDeniedException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.NetworkService; +import com.cloud.network.NetworkUsageService; import com.cloud.network.StorageNetworkService; import com.cloud.network.VpcVirtualNetworkApplianceService; import com.cloud.network.as.AutoScaleService; @@ -57,6 +62,7 @@ import com.cloud.resource.ResourceService; import com.cloud.server.ManagementService; import com.cloud.server.TaggedResourceService; import com.cloud.storage.StorageService; +import com.cloud.storage.VolumeApiService; import com.cloud.storage.snapshot.SnapshotService; import com.cloud.template.TemplateService; import com.cloud.user.Account; @@ -64,9 +70,8 @@ import com.cloud.user.AccountService; import com.cloud.user.DomainService; import com.cloud.user.ResourceLimitService; import com.cloud.utils.Pair; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.vm.BareMetalVmService; import com.cloud.vm.UserVmService; +import com.cloud.vm.snapshot.VMSnapshotService; public abstract class BaseCmd { private static final Logger s_logger = Logger.getLogger(BaseCmd.class.getName()); @@ -81,23 +86,6 @@ public abstract class BaseCmd { BOOLEAN, DATE, FLOAT, INTEGER, SHORT, LIST, LONG, OBJECT, MAP, STRING, TZDATE, UUID } - // FIXME: Extract these out into a separate file - // Client error codes - public static final int MALFORMED_PARAMETER_ERROR = 430; - public static final int PARAM_ERROR = 431; - public static final int UNSUPPORTED_ACTION_ERROR = 432; - public static final int PAGE_LIMIT_EXCEED = 433; - - // Server error codes - public static final int INTERNAL_ERROR = 530; - public static final int ACCOUNT_ERROR = 531; - public static final int ACCOUNT_RESOURCE_LIMIT_ERROR = 532; - public static final int INSUFFICIENT_CAPACITY_ERROR = 533; - public static final int RESOURCE_UNAVAILABLE_ERROR = 534; - public static final int RESOURCE_ALLOCATION_ERROR = 534; - public static final int RESOURCE_IN_USE_ERROR = 536; - public static final int NETWORK_RULE_CONFLICT_ERROR = 537; - public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd"); public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+"); @@ -109,75 +97,46 @@ public abstract class BaseCmd { @Parameter(name = "response", type = CommandType.STRING) private String responseType; - public static ComponentLocator s_locator; - public static ConfigurationService _configService; - public static AccountService _accountService; - public static UserVmService _userVmService; - public static ManagementService _mgr; - public static StorageService _storageService; - public static ResourceService _resourceService; - public static NetworkService _networkService; - public static TemplateService _templateService; - public static SecurityGroupService _securityGroupService; - public static SnapshotService _snapshotService; - public static ConsoleProxyService _consoleProxyService; - public static VpcVirtualNetworkApplianceService _routerService; - public static ResponseGenerator _responseGenerator; - public static EntityManager _entityMgr; - public static RulesService _rulesService; - public static AutoScaleService _autoScaleService; - public static LoadBalancingRulesService _lbService; - public static RemoteAccessVpnService _ravService; - public static BareMetalVmService _bareMetalVmService; - public static ProjectService _projectService; - public static FirewallService _firewallService; - public static DomainService _domainService; - public static ResourceLimitService _resourceLimitService; - public static IdentityService _identityService; - public static StorageNetworkService _storageNetworkService; - public static TaggedResourceService _taggedResourceService; - public static VpcService _vpcService; - public static NetworkACLService _networkACLService; - public static Site2SiteVpnService _s2sVpnService; + @Inject public ConfigurationService _configService; + @Inject public AccountService _accountService; + @Inject public UserVmService _userVmService; + @Inject public ManagementService _mgr; + @Inject public StorageService _storageService; + @Inject public VolumeApiService _volumeService; + @Inject public ResourceService _resourceService; + @Inject public NetworkService _networkService; + @Inject public TemplateService _templateService; + @Inject public SecurityGroupService _securityGroupService; + @Inject public SnapshotService _snapshotService; + @Inject public ConsoleProxyService _consoleProxyService; + @Inject public VpcVirtualNetworkApplianceService _routerService; + @Inject public ResponseGenerator _responseGenerator; + @Inject public EntityManager _entityMgr; + @Inject public RulesService _rulesService; + @Inject public AutoScaleService _autoScaleService; + @Inject public LoadBalancingRulesService _lbService; + @Inject public RemoteAccessVpnService _ravService; + @Inject public ProjectService _projectService; + @Inject public FirewallService _firewallService; + @Inject public DomainService _domainService; + @Inject public ResourceLimitService _resourceLimitService; + @Inject public IdentityService _identityService; + @Inject public StorageNetworkService _storageNetworkService; + @Inject public TaggedResourceService _taggedResourceService; + @Inject public VpcService _vpcService; + @Inject public NetworkACLService _networkACLService; + @Inject public Site2SiteVpnService _s2sVpnService; - public static QueryService _queryService; - - public static void setComponents(ResponseGenerator generator) { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - _mgr = (ManagementService) ComponentLocator.getComponent(ManagementService.Name); - _accountService = locator.getManager(AccountService.class); - _configService = locator.getManager(ConfigurationService.class); - _userVmService = locator.getManager(UserVmService.class); - _storageService = locator.getManager(StorageService.class); - _resourceService = locator.getManager(ResourceService.class); - _networkService = locator.getManager(NetworkService.class); - _templateService = locator.getManager(TemplateService.class); - _securityGroupService = locator.getManager(SecurityGroupService.class); - _snapshotService = locator.getManager(SnapshotService.class); - _consoleProxyService = locator.getManager(ConsoleProxyService.class); - _routerService = locator.getManager(VpcVirtualNetworkApplianceService.class); - _entityMgr = locator.getManager(EntityManager.class); - _rulesService = locator.getManager(RulesService.class); - _lbService = locator.getManager(LoadBalancingRulesService.class); - _autoScaleService = locator.getManager(AutoScaleService.class); - _ravService = locator.getManager(RemoteAccessVpnService.class); - _responseGenerator = generator; - _bareMetalVmService = locator.getManager(BareMetalVmService.class); - _projectService = locator.getManager(ProjectService.class); - _firewallService = locator.getManager(FirewallService.class); - _domainService = locator.getManager(DomainService.class); - _resourceLimitService = locator.getManager(ResourceLimitService.class); - _identityService = locator.getManager(IdentityService.class); - _storageNetworkService = locator.getManager(StorageNetworkService.class); - _taggedResourceService = locator.getManager(TaggedResourceService.class); - _vpcService = locator.getManager(VpcService.class); - _networkACLService = locator.getManager(NetworkACLService.class); - _s2sVpnService = locator.getManager(Site2SiteVpnService.class); - _queryService = locator.getManager(QueryService.class); - } + @Inject public QueryService _queryService; + @Inject public UsageService _usageService; + @Inject public NetworkUsageService _networkUsageService; + @Inject public VMSnapshotService _vmSnapshotService; public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException; + public void configure() { + } + public String getResponseType() { if (responseType == null) { return RESPONSE_TYPE_XML; @@ -194,7 +153,7 @@ public abstract class BaseCmd { /** * For commands the API framework needs to know the owner of the object being acted upon. This method is * used to determine that information. - * + * * @return the id of the account that owns the object being acted upon */ public abstract long getEntityOwnerId(); @@ -230,7 +189,7 @@ public abstract class BaseCmd { int arrayStartIndex = key.indexOf('['); int arrayStartLastIndex = key.lastIndexOf('['); if (arrayStartIndex != arrayStartLastIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); } @@ -239,7 +198,7 @@ public abstract class BaseCmd { int arrayEndLastIndex = key.lastIndexOf(']'); if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) { // malformed parameter - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); } @@ -247,7 +206,7 @@ public abstract class BaseCmd { int fieldIndex = key.indexOf('.'); String fieldName = null; if (fieldIndex < arrayEndIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); } else { fieldName = key.substring(fieldIndex + 1); @@ -272,7 +231,7 @@ public abstract class BaseCmd { } if (!parsedIndex) { - throw new ServerApiException(MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key + "; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup"); } @@ -306,14 +265,14 @@ public abstract class BaseCmd { StringBuffer sb = new StringBuffer(); if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { // JSON response - sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},"); + sb.append("{ \"" + getCommandName() + "\" : { " + "\"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},"); sb.append("\"errorcode\" : \"" + apiException.getErrorCode() + "\", \"description\" : \"" + apiException.getDescription() + "\" } }"); } else { sb.append(""); sb.append("<" + getCommandName() + ">"); sb.append("" + apiException.getErrorCode() + ""); sb.append("" + escapeXml(apiException.getDescription()) + ""); - sb.append(""); + sb.append(""); } return sb.toString(); } @@ -324,10 +283,10 @@ public abstract class BaseCmd { // set up the return value with the name of the response if (RESPONSE_TYPE_JSON.equalsIgnoreCase(responseType)) { - prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloudstack-version\":\"" + _mgr.getVersion() + "\"},"); + prefixSb.append("{ \"" + getCommandName() + "\" : { \"@attributes\":{\"cloud-stack-version\":\"" + _mgr.getVersion() + "\"},"); } else { prefixSb.append(""); - prefixSb.append("<" + getCommandName() + " cloudstack-version=\"" + _mgr.getVersion() + "\">"); + prefixSb.append("<" + getCommandName() + " cloud-stack-version=\"" + _mgr.getVersion() + "\">"); } int i = 0; @@ -507,7 +466,7 @@ public abstract class BaseCmd { if (!enabledOnly || account.getState() == Account.State.enabled) { return account.getId(); } else { - throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active"); + throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() + " as it's no longer active"); } } else { // idList is not used anywhere, so removed it now @@ -524,7 +483,7 @@ public abstract class BaseCmd { return project.getProjectAccountId(); } else { PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() + " as it's no longer active"); - ex.addProxyObject(project, projectId, "projectId"); + ex.addProxyObject(project, projectId, "projectId"); throw ex; } } else { diff --git a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java index 038da63ec4c..0586117f0c6 100644 --- a/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java @@ -18,7 +18,7 @@ package org.apache.cloudstack.api; public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd { - @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by account. Must be used with the domainId parameter.") + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.") private String accountName; public String getAccountName() { diff --git a/api/src/org/apache/cloudstack/api/BaseListCmd.java b/api/src/org/apache/cloudstack/api/BaseListCmd.java index 58e83f70929..bc0b2b8f3b5 100644 --- a/api/src/org/apache/cloudstack/api/BaseListCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListCmd.java @@ -42,6 +42,9 @@ public abstract class BaseListCmd extends BaseCmd { // ///////////////// Accessors /////////////////////// // /////////////////////////////////////////////////// + public BaseListCmd() { + } + public String getKeyword() { return keyword; } @@ -62,10 +65,14 @@ public abstract class BaseListCmd extends BaseCmd { return pageSize; } - public static void configure() { - if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) { - MAX_PAGESIZE = _configService.getDefaultPageSize(); - } + public void configure() { + if(MAX_PAGESIZE == null) { + if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) { + MAX_PAGESIZE = _configService.getDefaultPageSize(); + } else { + MAX_PAGESIZE = PAGESIZE_UNLIMITED; + } + } } @Override diff --git a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java index cde2d948686..47aa6791943 100644 --- a/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java @@ -18,9 +18,9 @@ package org.apache.cloudstack.api; import java.util.List; +import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; import com.cloud.user.UserContext; diff --git a/api/src/org/apache/cloudstack/api/BaseResponse.java b/api/src/org/apache/cloudstack/api/BaseResponse.java index 01f1be3253b..187ad9456bc 100644 --- a/api/src/org/apache/cloudstack/api/BaseResponse.java +++ b/api/src/org/apache/cloudstack/api/BaseResponse.java @@ -16,8 +16,6 @@ // under the License. package org.apache.cloudstack.api; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.ResponseObject; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java old mode 100755 new mode 100644 index dd6ae007ab9..6fd97731189 --- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java @@ -21,10 +21,6 @@ import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.Parameter; - public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName()); diff --git a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java old mode 100755 new mode 100644 index aacc6efa2e0..5cd4881e207 --- a/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java @@ -19,10 +19,10 @@ package org.apache.cloudstack.api; import java.util.List; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.exception.InvalidParameterValueException; public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd { @@ -119,7 +119,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template/iso permissions"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions"); } } } diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java index 63df4dc5532..267238af37b 100644 --- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java +++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java @@ -60,10 +60,12 @@ import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ProviderResponse; +import org.apache.cloudstack.api.response.RegionResponse; import org.apache.cloudstack.api.response.RemoteAccessVpnResponse; import org.apache.cloudstack.api.response.ResourceCountResponse; import org.apache.cloudstack.api.response.ResourceLimitResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; +import org.apache.cloudstack.api.response.S3Response; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.ServiceResponse; @@ -81,9 +83,12 @@ import org.apache.cloudstack.api.response.SystemVmInstanceResponse; import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.TrafficMonitorResponse; import org.apache.cloudstack.api.response.TrafficTypeResponse; +import org.apache.cloudstack.api.response.UsageRecordResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VMSnapshotResponse; import org.apache.cloudstack.api.response.VirtualRouterProviderResponse; import org.apache.cloudstack.api.response.VlanIpRangeResponse; import org.apache.cloudstack.api.response.VolumeResponse; @@ -91,8 +96,8 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.VpnUsersResponse; import org.apache.cloudstack.api.response.ZoneResponse; - -import org.apache.cloudstack.api.response.S3Response; +import org.apache.cloudstack.region.Region; +import org.apache.cloudstack.usage.Usage; import com.cloud.async.AsyncJob; import com.cloud.capacity.Capacity; @@ -159,6 +164,7 @@ import com.cloud.user.UserAccount; import com.cloud.uservm.UserVm; import com.cloud.vm.InstanceGroup; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.snapshot.VMSnapshot; public interface ResponseGenerator { UserResponse createUserResponse(UserAccount user); @@ -314,6 +320,8 @@ public interface ResponseGenerator { StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result); + RegionResponse createRegionResponse(Region region); + /** * @param resourceTag * @param keyValueOnly TODO @@ -372,4 +380,9 @@ public interface ResponseGenerator { GuestOSResponse createGuestOSResponse(GuestOS os); SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched); + + UsageRecordResponse createUsageResponse(Usage usageRecord); + + TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor); + VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot); } diff --git a/api/src/org/apache/cloudstack/api/ServerApiException.java b/api/src/org/apache/cloudstack/api/ServerApiException.java index 1f57b74745d..4b0fae58548 100644 --- a/api/src/org/apache/cloudstack/api/ServerApiException.java +++ b/api/src/org/apache/cloudstack/api/ServerApiException.java @@ -15,28 +15,60 @@ // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api; +import java.util.ArrayList; + +import com.cloud.exception.CloudException; +import com.cloud.utils.exception.CSExceptionErrorCode; import com.cloud.utils.exception.CloudRuntimeException; @SuppressWarnings("serial") public class ServerApiException extends CloudRuntimeException { - private int _errorCode; + private ApiErrorCode _errorCode; private String _description; public ServerApiException() { - _errorCode = 0; + _errorCode = ApiErrorCode.INTERNAL_ERROR; _description = null; + setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName())); } - public ServerApiException(int errorCode, String description) { + public ServerApiException(ApiErrorCode errorCode, String description) { _errorCode = errorCode; _description = description; + setCSErrorCode(CSExceptionErrorCode.getCSErrCode(ServerApiException.class.getName())); } - public int getErrorCode() { + // wrap a specific CloudRuntimeException to a ServerApiException + public ServerApiException(ApiErrorCode errorCode, String description, Throwable cause){ + super(description, cause); + _errorCode = errorCode; + _description = description; + if (cause instanceof CloudRuntimeException) { + CloudRuntimeException rt = (CloudRuntimeException) cause; + ArrayList idList = rt.getIdProxyList(); + if (idList != null) { + for (int i = 0; i < idList.size(); i++) { + addProxyObject(idList.get(i)); + } + } + setCSErrorCode(rt.getCSErrorCode()); + } else if (cause instanceof CloudException) { + CloudException rt = (CloudException) cause; + ArrayList idList = rt.getIdProxyList(); + if (idList != null) { + for (int i = 0; i < idList.size(); i++) { + addProxyObject(idList.get(i)); + } + } + setCSErrorCode(rt.getCSErrorCode()); + } + } + + public ApiErrorCode getErrorCode() { return _errorCode; } - public void setErrorCode(int errorCode) { + public void setErrorCode(ApiErrorCode errorCode) { _errorCode = errorCode; } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java index f93787b7bc5..b0f73d1d8f8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java @@ -19,13 +19,17 @@ package org.apache.cloudstack.api.command.admin.account; import java.util.Collection; import java.util.Map; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.UserAccount; import com.cloud.user.UserContext; @@ -74,6 +78,19 @@ public class CreateAccountCmd extends BaseCmd { @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters") private Map details; + //@Parameter(name = ApiConstants.REGION_DETAILS, type = CommandType.MAP, description = "details for account used to store region specific parameters") + //private Map regionDetails; + + @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from another Region") + private String accountUUID; + + @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region") + private String userUUID; + + @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the account") + private Integer regionId; + + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -128,6 +145,18 @@ public class CreateAccountCmd extends BaseCmd { return params; } + public String getAccountUUID() { + return accountUUID; + } + + public String getUserUUID() { + return userUUID; + } + + public Integer getRegionId() { + return regionId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -145,13 +174,14 @@ public class CreateAccountCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId()); - UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails()); + UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails(), + getAccountUUID(), getUserUUID(), getRegionId()); if (userAccount != null) { AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user account"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java index a1d9b6419cb..959d7ce985b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java @@ -16,12 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.admin.account; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -41,14 +48,24 @@ public class DeleteAccountCmd extends BaseAsyncCmd { required=true, description="Account id") private Long id; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// + public Long getId() { return id; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -86,12 +103,13 @@ public class DeleteAccountCmd extends BaseAsyncCmd { @Override public void execute(){ UserContext.current().setEventDetails("Account Id: "+getId()); - boolean result = _accountService.deleteUserAccount(getId()); + + boolean result = _regionService.deleteUserAccount(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user account and all corresponding users"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user account and all corresponding users"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java index f0a5e7078b7..60e9fd5aa60 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java @@ -16,12 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.admin.account; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; @@ -52,6 +58,11 @@ public class DisableAccountCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account") private Boolean lockRequested; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -68,6 +79,14 @@ public class DisableAccountCmd extends BaseAsyncCmd { return domainId; } + public Boolean getIsPropagate() { + return isPropagate; + } + + public Boolean getLockRequested() { + return lockRequested; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -105,17 +124,13 @@ public class DisableAccountCmd extends BaseAsyncCmd { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException{ UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId()); - Account result = null; - if(lockRequested) - result = _accountService.lockAccount(getAccountName(), getDomainId(), getId()); - else - result = _accountService.disableAccount(getAccountName(), getDomainId(), getId()); + Account result = _regionService.disableAccount(this); if (result != null){ AccountResponse response = _responseGenerator.createAccountResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" ); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account" ); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java index 4aa1e4fc1b9..9a92f789132 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java @@ -16,15 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.admin.account; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; import com.cloud.user.Account; @@ -47,6 +50,11 @@ public class EnableAccountCmd extends BaseCmd { description="Enables specified account in this domain.") private Long domainId; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -63,6 +71,10 @@ public class EnableAccountCmd extends BaseCmd { return domainId; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -89,13 +101,13 @@ public class EnableAccountCmd extends BaseCmd { @Override public void execute(){ - Account result = _accountService.enableAccount(getAccountName(), getDomainId(), getId()); + Account result = _regionService.enableAccount(this); if (result != null){ AccountResponse response = _responseGenerator.createAccountResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java index 34e9e53b84d..f4aa3afa8f5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java @@ -16,14 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.admin.account; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.log4j.Logger; import com.cloud.user.Account; @@ -84,7 +83,7 @@ public class LockAccountCmd extends BaseCmd { // response.setResponseName(getCommandName()); // this.setResponseObject(response); // } else { -// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock account"); +// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock account"); // } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java index f1340464d6b..6fad48bf66e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java @@ -19,15 +19,18 @@ package org.apache.cloudstack.api.command.admin.account; import java.util.Collection; import java.util.Map; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; import com.cloud.user.Account; @@ -60,6 +63,11 @@ public class UpdateAccountCmd extends BaseCmd{ @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters") private Map details; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -94,6 +102,10 @@ public class UpdateAccountCmd extends BaseCmd{ return params; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -119,13 +131,13 @@ public class UpdateAccountCmd extends BaseCmd{ @Override public void execute(){ - Account result = _accountService.updateAccount(this); + Account result = _regionService.updateAccount(this); if (result != null){ AccountResponse response = _responseGenerator.createAccountResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update account"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java index a119d0f44bf..98ffc51f7a0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java @@ -17,15 +17,15 @@ package org.apache.cloudstack.api.command.admin.autoscale; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.CounterResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.Counter; @@ -86,7 +86,7 @@ public class CreateCounterCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Counter with name " + getName()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java index 9304eeb7b93..35d99bbc985 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java @@ -17,16 +17,16 @@ package org.apache.cloudstack.api.command.admin.autoscale; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.CounterResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceInUseException; @@ -56,7 +56,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd { result = _autoScaleService.deleteCounter(getId()); } catch (ResourceInUseException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage()); } if (result) { @@ -64,7 +64,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete counter with Id: " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete counter."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter."); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java index 28bf72ddba7..7b1cd067eb1 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java @@ -20,14 +20,21 @@ package org.apache.cloudstack.api.command.admin.cluster; import java.util.ArrayList; import java.util.List; +import com.cloud.exception.InvalidParameterValueException; import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.exception.DiscoveryException; import com.cloud.exception.ResourceInUseException; @@ -78,6 +85,12 @@ public class AddClusterCmd extends BaseCmd { @Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster") private String vsmipaddress; + @Parameter (name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false , description = "value of the cpu overcommit ratio, defaults to 1") + private String cpuovercommitRatio; + + @Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false ,description = "value of the default ram overcommit ratio, defaults to 1") + private String memoryovercommitratio; + public String getVSMIpaddress() { return vsmipaddress; } @@ -144,9 +157,26 @@ public class AddClusterCmd extends BaseCmd { this.allocationState = allocationState; } + public Float getCpuOvercommitRatio (){ + if(cpuovercommitRatio != null){ + return Float.parseFloat(cpuovercommitRatio); + } + return 1.0f; + } + + public Float getMemoryOvercommitRaito (){ + if (memoryovercommitratio != null){ + return Float.parseFloat(memoryovercommitratio); + } + return 1.0f; + } + @Override public void execute(){ try { + if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) { + throw new InvalidParameterValueException("Cpu and ram overcommit ratios should not be less than 1"); + } List result = _resourceService.discoverCluster(this); ListResponse response = new ListResponse(); List clusterResponses = new ArrayList(); @@ -156,7 +186,7 @@ public class AddClusterCmd extends BaseCmd { clusterResponses.add(clusterResponse); } } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add cluster"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add cluster"); } response.setResponses(clusterResponses); @@ -165,10 +195,10 @@ public class AddClusterCmd extends BaseCmd { this.setResponseObject(response); } catch (DiscoveryException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (ResourceInUseException ex) { s_logger.warn("Exception: ", ex); - ServerApiException e = new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + ServerApiException e = new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); for (String proxyObj : ex.getIdProxyList()) { e.addProxyObject(proxyObj); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java index f0b40cb6b03..4fece0c7a30 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/DeleteClusterCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.cluster; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteCluster", description="Deletes a cluster.", responseObject=SuccessResponse.class) @@ -70,7 +71,7 @@ public class DeleteClusterCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete cluster"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete cluster"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java index 95ab0bff4f3..0417b187e38 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java @@ -19,17 +19,16 @@ package org.apache.cloudstack.api.command.admin.cluster; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; -import org.apache.cloudstack.api.response.PodResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.org.Cluster; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java index 03b43def3ca..95728dd184d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/cluster/UpdateClusterCmd.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.cluster; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.org.Cluster; import com.cloud.user.Account; @@ -53,6 +54,13 @@ public class UpdateClusterCmd extends BaseCmd { @Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack") private String managedState; + @Parameter(name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of cpu overcommit ratio") + private String cpuovercommitratio; + + @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of ram overcommit ratio") + private String memoryovercommitratio; + + public String getClusterName() { return clusterName; } @@ -99,6 +107,20 @@ public class UpdateClusterCmd extends BaseCmd { this.managedState = managedstate; } + public Float getCpuOvercommitRatio (){ + if(cpuovercommitratio != null){ + return Float.parseFloat(cpuovercommitratio); + } + return 1.0f; + } + + public Float getMemoryOvercommitRaito (){ + if (memoryovercommitratio != null){ + return Float.parseFloat(memoryovercommitratio); + } + return 1.0f; + } + @Override public void execute(){ Cluster cluster = _resourceService.getCluster(getId()); @@ -106,13 +128,17 @@ public class UpdateClusterCmd extends BaseCmd { throw new InvalidParameterValueException("Unable to find the cluster by id=" + getId()); } - Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate()); + if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) { + throw new InvalidParameterValueException("Cpu and ram overcommit ratios should be greater than one"); + } + + Cluster result = _resourceService.updateCluster(cluster, getClusterType(), getHypervisor(), getAllocationState(), getManagedstate(), getMemoryOvercommitRaito(), getCpuOvercommitRatio()); if (result != null) { ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, false); clusterResponse.setResponseName(getCommandName()); this.setResponseObject(clusterResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update cluster"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update cluster"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java index 16010fdb495..aabfd4a620d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListCfgsByCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ConfigurationResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.configuration.Configuration; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java index b69e9eab597..f2220271559 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/ListHypervisorCapabilitiesCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorCapabilities; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java index 79693e76f84..ffeb58621b9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateCfgCmd.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.config; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ConfigurationResponse; +import org.apache.log4j.Logger; + import com.cloud.configuration.Configuration; import com.cloud.user.Account; @@ -76,7 +77,7 @@ public class UpdateCfgCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update config"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java index 82880c1fbae..e2fe8a7b1ea 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/config/UpdateHypervisorCapabilitiesCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.config; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.hypervisor.HypervisorCapabilities; import com.cloud.user.Account; @@ -86,7 +87,7 @@ public class UpdateHypervisorCapabilitiesCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update hypervisor capabilities"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update hypervisor capabilities"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java index 0e6ae32583b..e0ba69359ad 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/CreateDomainCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.domain; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainResponse; import com.cloud.domain.Domain; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -45,6 +49,12 @@ public class CreateDomainCmd extends BaseCmd { @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain") private String networkDomain; + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region") + private String domainUUID; + + @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the Domain") + private Integer regionId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -61,6 +71,14 @@ public class CreateDomainCmd extends BaseCmd { return networkDomain; } + public String getDomainUUID() { + return domainUUID; + } + + public Integer getRegionId() { + return regionId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -78,13 +96,13 @@ public class CreateDomainCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():"")); - Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain()); + Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID(), getRegionId()); if (domain != null) { DomainResponse response = _responseGenerator.createDomainResponse(domain); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create domain"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create domain"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java index 7009e70ca32..eae393da81e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/DeleteDomainCmd.java @@ -16,12 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.admin.domain; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.domain.Domain; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -43,7 +50,11 @@ public class DeleteDomainCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, description="true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise") private Boolean cleanup; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean propagate; + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -56,6 +67,10 @@ public class DeleteDomainCmd extends BaseAsyncCmd { return cleanup; } + public Boolean isPropagate() { + return propagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -88,12 +103,12 @@ public class DeleteDomainCmd extends BaseAsyncCmd { @Override public void execute(){ UserContext.current().setEventDetails("Domain Id: "+getId()); - boolean result = _domainService.deleteDomain(id, cleanup); + boolean result = _regionService.deleteDomain(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete domain"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete domain"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java index 4bc05d1c0f9..26d8bbf64d2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainChildrenCmd.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.admin.domain; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.domain.Domain; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java index 9b9e200abcd..ed14194490e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/ListDomainsCmd.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.admin.domain; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.domain.Domain; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java index cc5926cace1..c217f16c93a 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/domain/UpdateDomainCmd.java @@ -16,13 +16,21 @@ // under the License. package org.apache.cloudstack.api.command.admin.domain; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.domain.Domain; import com.cloud.user.Account; +import com.cloud.user.UserAccount; import com.cloud.user.UserContext; @APICommand(name = "updateDomain", description="Updates a domain with a new name", responseObject=DomainResponse.class) @@ -44,6 +52,11 @@ public class UpdateDomainCmd extends BaseCmd { @Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the domain's networks; empty string will update domainName with NULL value") private String networkDomain; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -60,6 +73,10 @@ public class UpdateDomainCmd extends BaseCmd { return networkDomain; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -77,13 +94,14 @@ public class UpdateDomainCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("Domain Id: "+getId()); - Domain domain = _mgr.updateDomain(this); + Domain domain = _regionService.updateDomain(this); + if (domain != null) { DomainResponse response = _responseGenerator.createDomainResponse(domain); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update domain"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update domain"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java index 0a0a98c1c45..3a2f4144745 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddHostCmd.java @@ -19,11 +19,10 @@ package org.apache.cloudstack.api.command.admin.host; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; @@ -31,6 +30,8 @@ import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.DiscoveryException; import com.cloud.host.Host; import com.cloud.user.Account; @@ -148,7 +149,7 @@ public class AddHostCmd extends BaseCmd { hostResponses.add(hostResponse); } } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add host"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add host"); } response.setResponses(hostResponses); @@ -157,7 +158,7 @@ public class AddHostCmd extends BaseCmd { this.setResponseObject(response); } catch (DiscoveryException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java index 579e286f884..f1d12b3b07b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/AddSecondaryStorageCmd.java @@ -18,12 +18,16 @@ package org.apache.cloudstack.api.command.admin.host; import java.util.List; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.DiscoveryException; import com.cloud.host.Host; import com.cloud.user.Account; @@ -84,11 +88,11 @@ public class AddSecondaryStorageCmd extends BaseCmd { this.setResponseObject(hostResponse); } } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add secondary storage"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage"); } } catch (DiscoveryException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java index 93dca9140f9..d9e593462ea 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/CancelMaintenanceCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.host.Host; @@ -104,7 +104,7 @@ public class CancelMaintenanceCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel host maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel host maintenance"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java index 5103f986e10..e1cef62e92f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/DeleteHostCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.cloudstack.api.response.HostResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteHost", description = "Deletes a host.", responseObject = SuccessResponse.class) @@ -84,7 +85,7 @@ public class DeleteHostCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete host"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete host"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java index 82f329f4b7e..29844c31113 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java @@ -21,8 +21,6 @@ import java.util.EnumSet; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants.HostDetails; import org.apache.cloudstack.api.BaseListCmd; @@ -33,6 +31,8 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; @@ -168,17 +168,16 @@ public class ListHostsCmd extends BaseListCmd { if (getVirtualMachineId() == null) { response = _queryService.searchForServers(this); } else { - List result = new ArrayList(); + Pair,Integer> result; List hostsWithCapacity = new ArrayList(); - Pair, List> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), - this.getStartIndex(), this.getPageSizeVal()); + Pair,Integer>, List> hostsForMigration = _mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal()); result = hostsForMigration.first(); hostsWithCapacity = hostsForMigration.second(); response = new ListResponse(); List hostResponses = new ArrayList(); - for (Host host : result) { + for (Host host : result.first()) { HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails()); Boolean suitableForMigration = false; if (hostsWithCapacity.contains(host)) { @@ -189,7 +188,7 @@ public class ListHostsCmd extends BaseListCmd { hostResponses.add(hostResponse); } - response.setResponses(hostResponses); + response.setResponses(hostResponses, result.second()); } response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java index 385e2aef415..c1a83fabe28 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/PrepareForMaintenanceCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.host.Host; @@ -104,7 +104,7 @@ public class PrepareForMaintenanceCmd extends BaseAsyncCmd { response.setResponseName("host"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare host for maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare host for maintenance"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java index 99e867bbebd..b151865bab3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/ReconnectHostCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.host.Host; @@ -103,11 +103,11 @@ public class ReconnectHostCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reconnect host"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reconnect host"); } } catch (Exception ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java index 9ab27178838..3bf95dbeabe 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostCmd.java @@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.admin.host; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.HostResponse; +import org.apache.log4j.Logger; + import com.cloud.host.Host; import com.cloud.user.Account; @@ -108,7 +109,7 @@ public class UpdateHostCmd extends BaseCmd { this.setResponseObject(hostResponse); } catch (Exception e) { s_logger.debug("Failed to update host:" + getId(), e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update host:" + getId() + "," + e.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java index dd9e4559b9d..c4420bd13fe 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/host/UpdateHostPasswordCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.host; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "updateHostPassword", description = "Update password of a host/pool on management server.", responseObject = SuccessResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java index b71ba73405f..2976de4bf28 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPConfigCmd.java @@ -19,18 +19,19 @@ package org.apache.cloudstack.api.command.admin.ldap; import javax.naming.NamingException; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.LDAPConfigResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; +import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.Account; @APICommand(name = "ldapConfig", description="Configure the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.0") @@ -43,7 +44,10 @@ public class LDAPConfigCmd extends BaseCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, description="Hostname or ip address of the ldap server eg: my.ldap.com") + @Parameter(name=ApiConstants.LIST_ALL, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com") + private String listall; + + @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, description="Hostname or ip address of the ldap server eg: my.ldap.com") private String hostname; @Parameter(name=ApiConstants.PORT, type=CommandType.INTEGER, description="Specify the LDAP port if required, default is 389.") @@ -52,10 +56,10 @@ public class LDAPConfigCmd extends BaseCmd { @Parameter(name=ApiConstants.USE_SSL, type=CommandType.BOOLEAN, description="Check Use SSL if the external LDAP server is configured for LDAP over SSL.") private Boolean useSSL; - @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, required=true, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.") + @Parameter(name=ApiConstants.SEARCH_BASE, type=CommandType.STRING, description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com.") private String searchBase; - @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, required=true, description="You specify a query filter here, which narrows down the users, who can be part of this domain.") + @Parameter(name=ApiConstants.QUERY_FILTER, type=CommandType.STRING, description="You specify a query filter here, which narrows down the users, who can be part of this domain.") private String queryFilter; @Parameter(name=ApiConstants.BIND_DN, type=CommandType.STRING, description="Specify the distinguished name of a user with the search permission on the directory.") @@ -74,6 +78,10 @@ public class LDAPConfigCmd extends BaseCmd { /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// + public String getListAll() { + return listall == null ? "false" : listall; + } + public String getBindPassword() { return bindPassword; } @@ -82,30 +90,56 @@ public class LDAPConfigCmd extends BaseCmd { return bindDN; } + public void setBindDN(String bdn) { + this.bindDN=bdn; + } + public String getQueryFilter() { return queryFilter; } + public void setQueryFilter(String queryFilter) { + this.queryFilter=queryFilter; + } public String getSearchBase() { return searchBase; } + public void setSearchBase(String searchBase) { + this.searchBase=searchBase; + } + public Boolean getUseSSL() { - return useSSL == null ? Boolean.FALSE : Boolean.TRUE; + return useSSL == null ? Boolean.FALSE : useSSL; + } + + public void setUseSSL(Boolean useSSL) { + this.useSSL=useSSL; } public String getHostname() { return hostname; } + public void setHostname(String hostname) { + this.hostname=hostname; + } + public Integer getPort() { return port <= 0 ? 389 : port; } + public void setPort(Integer port) { + this.port=port; + } + public String getTrustStore() { return trustStore; } + public void setTrustStore(String trustStore) { + this.trustStore=trustStore; + } public String getTrustStorePassword() { return trustStorePassword; @@ -122,12 +156,25 @@ public class LDAPConfigCmd extends BaseCmd { InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { try { - boolean result = _configService.updateLDAP(this); - if (result){ - LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN()); + if ("true".equalsIgnoreCase(getListAll())){ + // return the existing conf + LDAPConfigCmd cmd = _configService.listLDAPConfig(this); + LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(cmd.getHostname(), cmd.getPort(), cmd.getUseSSL(), + cmd.getQueryFilter(), cmd.getSearchBase(), cmd.getBindDN()); lr.setResponseName(getCommandName()); this.setResponseObject(lr); } + else if (getHostname()==null || getSearchBase() == null || getQueryFilter() == null) { + throw new InvalidParameterValueException("You need to provide hostname, serachbase and queryfilter to configure your LDAP server"); + } + else { + boolean result = _configService.updateLDAP(this); + if (result){ + LDAPConfigResponse lr = _responseGenerator.createLDAPConfigResponse(getHostname(), getPort(), getUseSSL(), getQueryFilter(), getSearchBase(), getBindDN()); + lr.setResponseName(getCommandName()); + this.setResponseObject(lr); + } + } } catch (NamingException ne){ ne.printStackTrace(); diff --git a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java index 6bf5f4ff851..5159fbadb0b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/ldap/LDAPRemoveCmd.java @@ -18,11 +18,11 @@ package org.apache.cloudstack.api.command.admin.ldap; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.response.LDAPConfigResponse; import org.apache.cloudstack.api.response.LDAPRemoveResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "ldapRemove", description="Remove the LDAP context for this site.", responseObject=LDAPConfigResponse.class, since="3.0.1") diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java index 3e1d74df405..4983255389d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkDeviceCmd.java @@ -18,23 +18,24 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.Map; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NetworkDeviceResponse; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager; -import com.cloud.server.ManagementService; -import org.apache.cloudstack.api.response.NetworkDeviceResponse; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "addNetworkDevice", description="Adds a network device of one of the following types: ExternalDhcp, ExternalFirewall, ExternalLoadBalancer, PxeServer", responseObject = NetworkDeviceResponse.class) @@ -46,6 +47,7 @@ public class AddNetworkDeviceCmd extends BaseCmd { // ////////////// API parameters ///////////////////// // /////////////////////////////////////////////////// + @Inject ExternalNetworkDeviceManager nwDeviceMgr; @Parameter(name = ApiConstants.NETWORK_DEVICE_TYPE, type = CommandType.STRING, description = "Network device type, now supports ExternalDhcp, PxeServer, NetscalerMPXLoadBalancer, NetscalerVPXLoadBalancer, NetscalerSDXLoadBalancer, F5BigIpLoadBalancer, JuniperSRXFirewall") private String type; @@ -63,20 +65,17 @@ public class AddNetworkDeviceCmd extends BaseCmd { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { + ResourceAllocationException { try { - ExternalNetworkDeviceManager nwDeviceMgr; - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class); Host device = nwDeviceMgr.addNetworkDevice(this); NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device); response.setObjectName("networkdevice"); response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException ipve) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); } catch (CloudRuntimeException cre) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java index 6d4b962d4a1..2c6cc609ea7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/AddNetworkServiceProviderCmd.java @@ -18,16 +18,16 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ProviderResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -103,7 +103,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider to physical network"); } } @@ -114,7 +114,7 @@ public class AddNetworkServiceProviderCmd extends BaseAsyncCreateCmd { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider entity to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider entity to physical network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java index b97f85ec1ba..b48bf9e763e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateNetworkOfferingCmd.java @@ -23,12 +23,17 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NetworkOfferingResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; + import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.NetworkOfferingResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Service; @@ -69,7 +74,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.CONSERVE_MODE, type=CommandType.BOOLEAN, description="true if the network offering is IP conserve mode enabled") private Boolean conserveMode; - @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class, + @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class, description="the service offering ID used by virtual router provider") private Long serviceOfferingId; @@ -88,6 +93,9 @@ public class CreateNetworkOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.SPECIFY_IP_RANGES, type=CommandType.BOOLEAN, description="true if network offering supports specifying ip ranges; defaulted to false if not specified") private Boolean specifyIpRanges; + @Parameter(name=ApiConstants.IS_PERSISTENT, type=CommandType.BOOLEAN, description="true if network offering supports persistent networks; defaulted to false if not specified") + private Boolean isPersistent; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -147,6 +155,10 @@ public class CreateNetworkOfferingCmd extends BaseCmd { return conserveMode; } + public Boolean getIsPersistent() { + return isPersistent == null ? false : isPersistent; + } + public Map> getServiceProviders() { Map> serviceProviderMap = null; if (serviceProviderList != null && !serviceProviderList.isEmpty()) { @@ -225,7 +237,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java index f56ae7dbf50..fb6db61f9a6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreatePhysicalNetworkCmd.java @@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -151,7 +151,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network"); } } @@ -162,7 +162,7 @@ public class CreatePhysicalNetworkCmd extends BaseAsyncCreateCmd { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network entity"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create physical network entity"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java index ccd92e19d67..008fa329f7f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/CreateStorageNetworkIpRangeCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; +import org.apache.log4j.Logger; + import com.cloud.dc.StorageNetworkIpRange; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -110,7 +110,7 @@ public class CreateStorageNetworkIpRangeCmd extends BaseAsyncCmd { this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Create storage network IP range failed", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java index 09451242daf..2ca618cd1ec 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkDeviceCmd.java @@ -16,23 +16,24 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.server.ManagementService; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "deleteNetworkDevice", description="Deletes network device.", responseObject=SuccessResponse.class) @@ -40,6 +41,8 @@ public class DeleteNetworkDeviceCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetworkDeviceCmd.class); private static final String s_name = "deletenetworkdeviceresponse"; + @Inject ExternalNetworkDeviceManager nwDeviceMgr; + ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @@ -54,23 +57,20 @@ public class DeleteNetworkDeviceCmd extends BaseCmd { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { + ResourceAllocationException { try { - ExternalNetworkDeviceManager nwDeviceMgr; - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class); boolean result = nwDeviceMgr.deleteNetworkDevice(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network device:" + getId()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network device:" + getId()); } } catch (InvalidParameterValueException ipve) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); } catch (CloudRuntimeException cre) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java index c13088f6123..69f34e871ad 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkOfferingCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.NetworkOfferingResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteNetworkOffering", description="Deletes a network offering.", responseObject=SuccessResponse.class, since="3.0.0") @@ -70,7 +71,7 @@ public class DeleteNetworkOfferingCmd extends BaseCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java index bc744399a33..cbcf29b8f44 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteNetworkServiceProviderCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ProviderResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -76,14 +76,14 @@ public class DeleteNetworkServiceProviderCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network service provider"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network service provider"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java index 5f86efa9ad8..c7dd93c88f8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeletePhysicalNetworkCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -70,7 +74,7 @@ public class DeletePhysicalNetworkCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete physical network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java index 1873fc7d6ef..b2dcfa52e34 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/DeleteStorageNetworkIpRangeCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -70,7 +74,7 @@ public class DeleteStorageNetworkIpRangeCmd extends BaseAsyncCmd { this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Failed to delete storage network ip range " + getId(), e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java index 742ff1f74af..0b7836de3a8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkDeviceCmd.java @@ -20,25 +20,25 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager; -import org.apache.cloudstack.api.response.NetworkDeviceResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.NetworkDeviceResponse; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; -import com.cloud.server.ManagementService; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; @APICommand(name = "listNetworkDevice", description="List network devices", responseObject = NetworkDeviceResponse.class) @@ -46,6 +46,7 @@ public class ListNetworkDeviceCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkDeviceCmd.class); private static final String s_name = "listnetworkdevice"; + @Inject ExternalNetworkDeviceManager nwDeviceMgr; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// @@ -66,11 +67,8 @@ public class ListNetworkDeviceCmd extends BaseListCmd { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, - ResourceAllocationException { + ResourceAllocationException { try { - ExternalNetworkDeviceManager nwDeviceMgr; - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class); List devices = nwDeviceMgr.listNetworkDevice(this); List nwdeviceResponses = new ArrayList(); ListResponse listResponse = new ListResponse(); @@ -85,9 +83,9 @@ public class ListNetworkDeviceCmd extends BaseListCmd { listResponse.setResponseName(getCommandName()); this.setResponseObject(listResponse); } catch (InvalidParameterValueException ipve) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); } catch (CloudRuntimeException cre) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java index 06a0518af20..e51c47eb6df 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListNetworkServiceProvidersCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ProviderResponse; +import org.apache.log4j.Logger; + import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.user.Account; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java index a301ac004ea..f7794c3069c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListPhysicalNetworksCmd.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.network.PhysicalNetwork; import com.cloud.user.Account; import com.cloud.utils.Pair; @@ -100,7 +100,7 @@ public class ListPhysicalNetworksCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to search for physical networks"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to search for physical networks"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java index 8fcaf4958b1..46af6a69068 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListStorageNetworkIpRangeCmd.java @@ -19,14 +19,18 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.PodResponse; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; import com.cloud.dc.StorageNetworkIpRange; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -88,7 +92,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd { this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Failed to list storage network ip range for rangeId=" + getRangeId() + " podId=" + getPodId() + " zoneId=" + getZoneId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java index f7407a108e0..85ae1395060 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/ListSupportedNetworkServicesCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ServiceResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; import com.cloud.network.Network.Service; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java index dc2f3099206..ba685a94995 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkOfferingCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.NetworkOfferingResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.NetworkOfferingResponse; import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; @@ -102,7 +106,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java index b770ea26c12..4364b2d7afb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateNetworkServiceProviderCmd.java @@ -18,15 +18,15 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ProviderResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetworkServiceProvider; @@ -88,7 +88,7 @@ public class UpdateNetworkServiceProviderCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service provider"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service provider"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java index d9a3e044c73..06cf38dba3f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdatePhysicalNetworkCmd.java @@ -19,12 +19,12 @@ package org.apache.cloudstack.api.command.admin.network; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetwork; diff --git a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java index d6d0b92e4b7..613e4c01121 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/network/UpdateStorageNetworkIpRangeCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.network; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; import com.cloud.dc.StorageNetworkIpRange; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -96,7 +100,7 @@ public class UpdateStorageNetworkIpRangeCmd extends BaseAsyncCmd { this.setResponseObject(response); } catch (Exception e) { s_logger.warn("Update storage network IP range failed", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java index 08101dc4137..68d5dd466a3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateDiskOfferingCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.log4j.Logger; + import com.cloud.offering.DiskOffering; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @@ -115,7 +116,7 @@ public class CreateDiskOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create disk offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create disk offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java index f93c2a88ce2..e915c48e9b6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @@ -58,6 +59,9 @@ public class CreateServiceOfferingCmd extends BaseCmd { @Parameter(name=ApiConstants.LIMIT_CPU_USE, type=CommandType.BOOLEAN, description="restrict the CPU usage to committed service offering") private Boolean limitCpuUse; + @Parameter(name=ApiConstants.IS_VOLATILE, type=CommandType.BOOLEAN, description="true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM") + private Boolean isVolatile; + @Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the service offering. Values are local and shared.") private String storageType; @@ -105,11 +109,15 @@ public class CreateServiceOfferingCmd extends BaseCmd { } public Boolean getOfferHa() { - return offerHa; + return offerHa == null ? false : offerHa; } public Boolean GetLimitCpuUse() { - return limitCpuUse; + return limitCpuUse == null ? false : limitCpuUse; + } + + public Boolean getVolatileVm() { + return isVolatile == null ? false : isVolatile; } public String getStorageType() { @@ -162,7 +170,7 @@ public class CreateServiceOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create service offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create service offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java index 85e034f6191..f8e27fb5717 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteDiskOfferingCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.cloudstack.api.response.DiskOfferingResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteDiskOffering", description="Updates a disk offering.", responseObject=SuccessResponse.class) @@ -70,7 +71,7 @@ public class DeleteDiskOfferingCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete disk offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete disk offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java index d1ea4de0504..e3664deeea2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/DeleteServiceOfferingCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.user.Account; @APICommand(name = "deleteServiceOffering", description="Deletes a service offering.", responseObject=SuccessResponse.class) @@ -68,7 +72,7 @@ public class DeleteServiceOfferingCmd extends BaseCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete service offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete service offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java index 8db731d3b31..1e421a13d3f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateDiskOfferingCmd.java @@ -15,14 +15,15 @@ // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.offering.DiskOffering; import com.cloud.user.Account; @@ -91,7 +92,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update disk offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update disk offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java index 38220b90673..a8de0741814 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/offering/UpdateServiceOfferingCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.offering; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ServiceOfferingResponse; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @@ -89,7 +93,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update service offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service offering"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java index 331968b00db..a110b50021e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/CreatePodCmd.java @@ -16,12 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.pod; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.dc.Pod; import com.cloud.user.Account; @@ -111,7 +114,7 @@ public class CreatePodCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create pod"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java index 8c64a8dad33..f663633a6e7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/DeletePodCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.pod; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; import com.cloud.user.Account; @@ -70,7 +70,7 @@ public class DeletePodCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete pod"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java index a64ecdde9b5..3dace4244ae 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/ListPodsByCmd.java @@ -20,14 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.dc.Pod; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java index ca5e03953a3..a71c3624247 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/pod/UpdatePodCmd.java @@ -16,11 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.admin.pod; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PodResponse; +import org.apache.log4j.Logger; import com.cloud.dc.Pod; import com.cloud.user.Account; @@ -110,7 +113,7 @@ public class UpdatePodCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update pod"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update pod"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java new file mode 100644 index 00000000000..20366702dd1 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/region/AddRegionCmd.java @@ -0,0 +1,109 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.admin.region; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.RegionResponse; +import org.apache.cloudstack.region.Region; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + +import com.cloud.user.Account; + +@APICommand(name = "addRegion", description="Adds a Region", responseObject=RegionResponse.class) +public class AddRegionCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(AddRegionCmd.class.getName()); + + private static final String s_name = "addregionresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of the Region") + private Integer id; + + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, required=true, description="Name of the region") + private String regionName; + + @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, required=true, description="Region service endpoint") + private String endPoint; + + @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="API key of Admin user") + private String apiKey; + + @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="Secret Key of Admin user") + private String secretKey; + + @Inject public RegionService _regionService; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getId() { + return id; + } + + public String getRegionName() { + return regionName; + } + + public String getEndPoint() { + return endPoint; + } + + public String getApiKey() { + return apiKey; + } + + public String getSecretKey() { + return secretKey; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute(){ + Region region = _regionService.addRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey()); + if (region != null) { + RegionResponse response = _responseGenerator.createRegionResponse(region); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Region"); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java new file mode 100644 index 00000000000..79c34d0690f --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/region/RemoveRegionCmd.java @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.admin.region; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + +import com.cloud.user.Account; + +@APICommand(name = "removeRegion", description="Removes specified region", responseObject=SuccessResponse.class) +public class RemoveRegionCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(RemoveRegionCmd.class.getName()); + private static final String s_name = "updateregionresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="ID of the region to delete") + private Integer id; + + @Inject RegionService _regionService; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute(){ + boolean result = _regionService.removeRegion(id); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove region"); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java new file mode 100644 index 00000000000..16693b64650 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/region/UpdateRegionCmd.java @@ -0,0 +1,108 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.admin.region; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.RegionResponse; +import org.apache.cloudstack.region.Region; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + +import com.cloud.user.Account; + +@APICommand(name = "updateRegion", description="Updates a region", responseObject=RegionResponse.class) +public class UpdateRegionCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(UpdateRegionCmd.class.getName()); + private static final String s_name = "updateregionresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, required=true, description="Id of region to update") + private Integer id; + + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="updates region with this name") + private String regionName; + + @Parameter(name=ApiConstants.END_POINT, type=CommandType.STRING, description="updates region with this end point") + private String endPoint; + + @Parameter(name=ApiConstants.API_KEY, type=CommandType.STRING, description="new API key for the Region") + private String apiKey; + + @Parameter(name=ApiConstants.SECRET_KEY, type=CommandType.STRING, description="new Secret Key for the Region") + private String secretKey; + + @Inject RegionService _regionService; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getId() { + return id; + } + + public String getRegionName() { + return regionName; + } + + public String getEndPoint() { + return endPoint; + } + + public String getApiKey() { + return apiKey; + } + + public String getSecretKey() { + return secretKey; + } + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute(){ + Region region = _regionService.updateRegion(getId(), getRegionName(), getEndPoint(), getApiKey(), getSecretKey()); + if (region != null) { + RegionResponse response = _responseGenerator.createRegionResponse(region); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Region"); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java index db7a20b02a3..015d82bcccb 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListAlertsCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - -import com.cloud.alert.Alert; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AlertResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + +import com.cloud.alert.Alert; import com.cloud.utils.Pair; @APICommand(name = "listAlerts", description = "Lists all alerts.", responseObject = AlertResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java index ce20a3e27de..b0badb8bb42 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/ListCapacityCmd.java @@ -20,16 +20,16 @@ import java.text.DecimalFormat; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.CapacityResponse; +import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; -import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.capacity.Capacity; import com.cloud.exception.InvalidParameterValueException; diff --git a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java index 0e559189904..9704c640f28 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/resource/UploadCustomCertificateCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.resource; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.CustomCertificateResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.CustomCertificateResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -99,7 +103,7 @@ public class UploadCustomCertificateCmd extends BaseAsyncCmd { response.setObjectName("customcertificate"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload custom certificate"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload custom certificate"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java index be6be26a36f..f19e0fae7c6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ConfigureVirtualRouterElementCmd.java @@ -16,23 +16,26 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.log4j.Logger; +import java.util.List; + +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.VirtualRouterProviderResponse; -import com.cloud.network.VirtualRouterProvider; -import com.cloud.network.element.VirtualRouterElementService; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.VirtualRouterProvider; +import com.cloud.network.element.VirtualRouterElementService; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -41,8 +44,8 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureVirtualRouterElementCmd.class.getName()); private static final String s_name = "configurevirtualrouterelementresponse"; - @PlugService - private VirtualRouterElementService _service; + @Inject + private List _service; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -114,13 +117,13 @@ public class ConfigureVirtualRouterElementCmd extends BaseAsyncCmd { @Override public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException{ UserContext.current().setEventDetails("Virtual router element: " + id); - VirtualRouterProvider result = _service.configure(this); + VirtualRouterProvider result = _service.get(0).configure(this); if (result != null){ VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result); routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure the virtual router provider"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java index f6a7b744ca3..39fac136233 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/CreateVirtualRouterElementCmd.java @@ -16,12 +16,20 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.ProviderResponse; -import org.apache.log4j.Logger; +import java.util.List; + +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ProviderResponse; import org.apache.cloudstack.api.response.VirtualRouterProviderResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.VirtualRouterProvider; @@ -35,8 +43,8 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { public static final Logger s_logger = Logger.getLogger(CreateVirtualRouterElementCmd.class.getName()); private static final String s_name = "createvirtualrouterelementresponse"; - @PlugService - private VirtualRouterElementService _service; + @Inject + private List _service; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -76,24 +84,24 @@ public class CreateVirtualRouterElementCmd extends BaseAsyncCreateCmd { @Override public void execute(){ UserContext.current().setEventDetails("Virtual router element Id: "+getEntityId()); - VirtualRouterProvider result = _service.getCreatedElement(getEntityId()); + VirtualRouterProvider result = _service.get(0).getCreatedElement(getEntityId()); if (result != null) { VirtualRouterProviderResponse response = _responseGenerator.createVirtualRouterProviderResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); } } @Override public void create() throws ResourceAllocationException { - VirtualRouterProvider result = _service.addElement(getNspId(), VirtualRouterProviderType.VirtualRouter); + VirtualRouterProvider result = _service.get(0).addElement(getNspId(), VirtualRouterProviderType.VirtualRouter); if (result != null) { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Virtual Router entity to physical network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java index 1157aaa7b93..3efc865e4f2 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/DestroyRouterCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainRouterResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -104,7 +104,7 @@ public class DestroyRouterCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy router"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java index 198d8766b21..d2b26c0ac8f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java @@ -16,20 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.async.AsyncJob; diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java index 0a93ea5ab3e..9420473a52c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/ListVirtualRouterElementsCmd.java @@ -19,18 +19,19 @@ package org.apache.cloudstack.api.command.admin.router; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; -import org.apache.cloudstack.api.response.ProviderResponse; -import org.apache.log4j.Logger; +import javax.inject.Inject; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ProviderResponse; import org.apache.cloudstack.api.response.VirtualRouterProviderResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; @@ -43,8 +44,9 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName()); private static final String _name = "listvirtualrouterelementsresponse"; - @PlugService - private VirtualRouterElementService _service; + // TODO, VirtualRouterElementServer is not singleton in system! + @Inject + private List _service; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -95,7 +97,7 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - List providers = _service.searchForVirtualRouterElement(this); + List providers = _service.get(0).searchForVirtualRouterElement(this); ListResponse response = new ListResponse(); List providerResponses = new ArrayList(); for (VirtualRouterProvider provider : providers) { diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java index 9c50d2ffb0f..c9b518f63da 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/RebootRouterCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainRouterResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -98,7 +102,7 @@ public class RebootRouterCmd extends BaseAsyncCmd { response.setResponseName("router"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot router"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java index f1f3f681829..1d3930b6b63 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StartRouterCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainRouterResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -102,7 +106,7 @@ public class StartRouterCmd extends BaseAsyncCmd { routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start router"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java index 2d1b609aa5d..60dd9386c75 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/StopRouterCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainRouterResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -109,7 +109,7 @@ public class StopRouterCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop router"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java index e2b020e09f9..b049f66f648 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/router/UpgradeRouterCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.router; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainRouterResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainRouterResponse; import com.cloud.network.router.VirtualRouter; import com.cloud.user.Account; @@ -38,7 +42,7 @@ public class UpgradeRouterCmd extends BaseCmd { required=true, description="The ID of the router") private Long id; - @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = DiskOfferingResponse.class, + @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = ServiceOfferingResponse.class, required=true, description="the service offering ID to apply to the domain router") private Long serviceOfferingId; @@ -81,7 +85,7 @@ public class UpgradeRouterCmd extends BaseCmd { routerResponse.setResponseName(getCommandName()); this.setResponseObject(routerResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade router"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java index 13f066a6e57..dbd9bff632b 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/AddS3Cmd.java @@ -18,24 +18,26 @@ */ package org.apache.cloudstack.api.command.admin.storage; +import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM; import static org.apache.cloudstack.api.ApiConstants.S3_ACCESS_KEY; +import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME; import static org.apache.cloudstack.api.ApiConstants.S3_CONNECTION_TIMEOUT; import static org.apache.cloudstack.api.ApiConstants.S3_END_POINT; import static org.apache.cloudstack.api.ApiConstants.S3_HTTPS_FLAG; import static org.apache.cloudstack.api.ApiConstants.S3_MAX_ERROR_RETRY; import static org.apache.cloudstack.api.ApiConstants.S3_SECRET_KEY; import static org.apache.cloudstack.api.ApiConstants.S3_SOCKET_TIMEOUT; -import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME; +import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN; import static org.apache.cloudstack.api.BaseCmd.CommandType.INTEGER; import static org.apache.cloudstack.api.BaseCmd.CommandType.STRING; -import static org.apache.cloudstack.api.BaseCmd.CommandType.BOOLEAN; -import static com.cloud.user.Account.ACCOUNT_ID_SYSTEM; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.S3Response; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InsufficientCapacityException; @@ -93,12 +95,12 @@ public final class AddS3Cmd extends BaseCmd { result = _resourceService.discoverS3(this); if (result == null) { - throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3."); } } catch (DiscoveryException e) { - throw new ServerApiException(INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 due to " + e.getMessage()); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java index 24ef48be222..b50cb277b8f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CancelPrimaryStorageMaintenanceCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.storage; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceUnavailableException; @@ -107,7 +107,7 @@ public class CancelPrimaryStorageMaintenanceCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to cancel primary storage maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to cancel primary storage maintenance"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java index 78a142ac449..da9d3467792 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java @@ -19,19 +19,24 @@ package org.apache.cloudstack.api.command.admin.storage; import java.net.UnknownHostException; import java.util.Map; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.StoragePoolResponse; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.StoragePool; import com.cloud.user.Account; + @SuppressWarnings("rawtypes") @APICommand(name = "createStoragePool", description="Creates a storage pool.", responseObject=StoragePoolResponse.class) public class CreateStoragePoolCmd extends BaseCmd { @@ -66,6 +71,14 @@ public class CreateStoragePoolCmd extends BaseCmd { @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, required=true, description="the Zone ID for the storage pool") private Long zoneId; + + @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, + required=false, description="the storage provider uuid") + private String storageProviderUuid; + + @Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING, + required=false, description="the scope of the storage: cluster or zone") + private String scope; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -98,6 +111,14 @@ public class CreateStoragePoolCmd extends BaseCmd { public Long getZoneId() { return zoneId; } + + public String getStorageProviderUuid() { + return this.storageProviderUuid; + } + + public String getScope() { + return this.scope; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -122,17 +143,17 @@ public class CreateStoragePoolCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add storage pool"); } } catch (ResourceUnavailableException ex1) { s_logger.warn("Exception: ", ex1); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex1.getMessage()); }catch (ResourceInUseException ex2) { s_logger.warn("Exception: ", ex2); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex2.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex2.getMessage()); } catch (UnknownHostException ex3) { s_logger.warn("Exception: ", ex3); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex3.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex3.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java index 1510f7822f7..6aaf53ea5bc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/DeletePoolCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.storage; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.storage.StoragePool; import com.cloud.storage.StoragePoolStatus; import com.cloud.user.Account; @@ -78,9 +82,9 @@ public class DeletePoolCmd extends BaseCmd { } else { StoragePool pool = _storageService.getStoragePool(id); if (pool != null && pool.getStatus() == StoragePoolStatus.Removed) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to finish storage pool removal. The storage pool will not be used but cleanup is needed"); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete storage pool"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java index d0f6d722179..4ab71de24d0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListS3sCmd.java @@ -26,6 +26,7 @@ import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.S3Response; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.NetworkRuleConflictException; @@ -34,7 +35,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.storage.S3; @APICommand(name = "listS3s", description = "Lists S3s", responseObject = S3Response.class, since = "4.0.0") -public final class ListS3sCmd extends BaseListCmd { +public class ListS3sCmd extends BaseListCmd { private static final String COMMAND_NAME = "lists3sresponse"; diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java index 9c5c584b7cb..02b98037b2e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/ListStoragePoolsCmd.java @@ -16,12 +16,7 @@ // under the License. package org.apache.cloudstack.api.command.admin.storage; -import java.util.ArrayList; -import java.util.List; - import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; @@ -29,11 +24,10 @@ import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; -import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; -import com.cloud.storage.StoragePool; -import com.cloud.utils.Pair; @APICommand(name = "listStoragePools", description="Lists storage pools.", responseObject=StoragePoolResponse.class) public class ListStoragePoolsCmd extends BaseListCmd { diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java index 6a4175516cc..95a92149da9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/PreparePrimaryStorageForMaintenanceCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.storage; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.StoragePoolResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientCapacityException; @@ -105,7 +105,7 @@ public class PreparePrimaryStorageForMaintenanceCmd extends BaseAsyncCmd { response.setResponseName("storagepool"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to prepare primary storage for maintenance"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java index 806df561397..2ecb90f69c7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java @@ -18,11 +18,15 @@ package org.apache.cloudstack.api.command.admin.storage; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.StoragePoolResponse; import com.cloud.storage.StoragePool; import com.cloud.user.Account; @@ -78,7 +82,7 @@ public class UpdateStoragePoolCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update storage pool"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update storage pool"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java index 23a00ca04dc..364d916add6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/swift/AddSwiftCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.swift; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.SwiftResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.DiscoveryException; import com.cloud.storage.Swift; import com.cloud.user.Account; @@ -92,12 +96,12 @@ public class AddSwiftCmd extends BaseCmd { swiftResponse.setObjectName("swift"); this.setResponseObject(swiftResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add Swift"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift"); } } catch (DiscoveryException ex) { String errMsg = "Failed to add Swift due to " + ex.toString(); s_logger.warn(errMsg, ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, errMsg); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, errMsg); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java index d7c151188e7..7cfe6e1ab7f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/swift/ListSwiftsCmd.java @@ -20,16 +20,17 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SwiftResponse; +import org.apache.log4j.Logger; + import com.cloud.storage.Swift; import com.cloud.user.Account; +import com.cloud.utils.Pair; @APICommand(name = "listSwifts", description = "List Swift.", responseObject = HostResponse.class, since="3.0.0") public class ListSwiftsCmd extends BaseListCmd { @@ -64,20 +65,19 @@ public class ListSwiftsCmd extends BaseListCmd { @Override public void execute(){ - List result = _resourceService.listSwifts(this); + Pair, Integer> result = _resourceService.listSwifts(this); ListResponse response = new ListResponse(); List swiftResponses = new ArrayList(); if (result != null) { - SwiftResponse swiftResponse = null; - for (Swift swift : result) { - swiftResponse = _responseGenerator.createSwiftResponse(swift); + for (Swift swift : result.first()) { + SwiftResponse swiftResponse = _responseGenerator.createSwiftResponse(swift); swiftResponse.setResponseName(getCommandName()); swiftResponse.setObjectName("swift"); swiftResponses.add(swiftResponse); } } - response.setResponses(swiftResponses); + response.setResponses(swiftResponses, result.second()); response.setResponseName(getCommandName()); this.setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java index ad0f09cba46..ef7af5c0a6f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/DestroySystemVmCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SystemVmResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -95,7 +99,7 @@ public class DestroySystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to destroy system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to destroy system vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java index 27e2ee40daf..f230a20d513 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; @@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.PodResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.utils.Pair; import com.cloud.vm.VirtualMachine; diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java index dd844acd17f..31871b92b8f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/MigrateSystemVMCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; -import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.SystemVmInstanceResponse; +import org.apache.cloudstack.api.response.SystemVmResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InvalidParameterValueException; @@ -116,20 +116,20 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate the system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate the system vm"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (ManagementServerException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (VirtualMachineMigrationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java index 49e895b22fe..6e4c925ffd5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/RebootSystemVmCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SystemVmResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -105,7 +105,7 @@ public class RebootSystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java index 70ab5f38720..f97d89992c9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StartSystemVMCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SystemVmResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -109,7 +109,7 @@ public class StartSystemVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to start system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java index af2bd3ad64f..5f9a3efbdf6 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/StopSystemVmCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SystemVmResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -112,7 +116,7 @@ public class StopSystemVmCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to stop system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to stop system vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java index 290c3603f1f..e91d0053c64 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/systemvm/UpgradeSystemVMCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.admin.systemvm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; -import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SystemVmResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @@ -44,7 +48,7 @@ public class UpgradeSystemVMCmd extends BaseCmd { required=true, description="The ID of the system vm") private Long id; - @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class, + @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class, required=true, description="the service offering ID to apply to the system vm") private Long serviceOfferingId; @@ -94,7 +98,7 @@ public class UpgradeSystemVMCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Fail to reboot system vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java index 74f33915551..7d41d10ae08 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/template/PrepareTemplateCmd.java @@ -18,15 +18,15 @@ package org.apache.cloudstack.api.command.admin.template; import java.util.List; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java new file mode 100644 index 00000000000..48424fef246 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficMonitorCmd.java @@ -0,0 +1,107 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.admin.usage; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.TrafficMonitorResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.host.Host; +import com.cloud.user.Account; +import com.cloud.utils.exception.CloudRuntimeException; + +@APICommand(name = "addTrafficMonitor", description="Adds Traffic Monitor Host for Direct Network Usage", responseObject = TrafficMonitorResponse.class) +public class AddTrafficMonitorCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(AddTrafficMonitorCmd.class.getName()); + private static final String s_name = "addtrafficmonitorresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, + required = true, description="Zone in which to add the external firewall appliance.") + private Long zoneId; + + @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the traffic monitor Host") + private String url; + + @Parameter(name=ApiConstants.INCL_ZONES, type=CommandType.STRING, description="Traffic going into the listed zones will be metered") + private String inclZones; + + @Parameter(name=ApiConstants.EXCL_ZONES, type=CommandType.STRING, description="Traffic going into the listed zones will not be metered") + private String exclZones; + + /////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getInclZones() { + return inclZones; + } + + public String getExclZones() { + return exclZones; + } + + public Long getZoneId() { + return zoneId; + } + + public String getUrl() { + return url; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute(){ + try { + Host trafficMonitor = _networkUsageService.addTrafficMonitor(this); + TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor); + response.setObjectName("trafficmonitor"); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException ipve) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); + } catch (CloudRuntimeException cre) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); + } + } +} + diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java index 5dca9d2d4c1..7211bae8dd4 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/AddTrafficTypeCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.usage; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.TrafficTypeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -123,7 +123,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network"); } } @@ -134,7 +134,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd { setEntityId(result.getId()); setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add traffic type to physical network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add traffic type to physical network"); } } diff --git a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java similarity index 51% rename from server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java rename to api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java index 4c7d3a70546..e3bb299dc30 100644 --- a/server/src/com/cloud/api/commands/DeleteTrafficMonitorCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficMonitorCmd.java @@ -14,73 +14,71 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.command.admin.usage; -import org.apache.cloudstack.api.response.HostResponse; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; -import com.cloud.network.NetworkUsageManager; -import com.cloud.server.ManagementService; import com.cloud.user.Account; -import com.cloud.utils.component.ComponentLocator; @APICommand(name = "deleteTrafficMonitor", description="Deletes an traffic monitor host.", responseObject = SuccessResponse.class) public class DeleteTrafficMonitorCmd extends BaseCmd { - public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName()); - private static final String s_name = "deletetrafficmonitorresponse"; - - ///////////////////////////////////////////////////// + public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName()); + private static final String s_name = "deletetrafficmonitorresponse"; + + ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class, - required = true, description="Id of the Traffic Monitor Host.") - private Long id; - - /////////////////////////////////////////////////// - /////////////////// Accessors /////////////////////// - ///////////////////////////////////////////////////// - - public Long getId() { - return id; - } - - ///////////////////////////////////////////////////// - /////////////// API Implementation/////////////////// - ///////////////////////////////////////////////////// - @Override - public String getCommandName() { - return s_name; - } - - @Override + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = HostResponse.class, + required = true, description="Id of the Traffic Monitor Host.") + private Long id; + + /////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override public long getEntityOwnerId() { return Account.ACCOUNT_ID_SYSTEM; } - - @Override + + @Override public void execute(){ - try { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetworkUsageManager _networkUsageMgr = locator.getManager(NetworkUsageManager.class); - boolean result = _networkUsageMgr.deleteTrafficMonitor(this); - if (result) { - SuccessResponse response = new SuccessResponse(getCommandName()); - response.setResponseName(getCommandName()); - this.setResponseObject(response); - } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic monitor."); - } - } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to delete traffic monitor."); - } + try { + boolean result = _networkUsageService.deleteTrafficMonitor(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic monitor."); + } + } catch (InvalidParameterValueException e) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete traffic monitor."); + } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java index bb665fbfd58..32e0512a20f 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/DeleteTrafficTypeCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.usage; -import org.apache.cloudstack.api.response.TrafficTypeResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.TrafficTypeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -73,7 +73,7 @@ public class DeleteTrafficTypeCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete traffic type"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete traffic type"); } } diff --git a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java similarity index 91% rename from server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java rename to api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java index aa3c082ce81..13710f97490 100644 --- a/server/src/com/cloud/api/commands/GenerateUsageRecordsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GenerateUsageRecordsCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.command.admin.usage; import java.util.Date; @@ -24,7 +24,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.response.SuccessResponse; -import com.cloud.server.ManagementServerExt; import com.cloud.user.Account; @APICommand(name = "generateUsageRecords", description="Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed", responseObject=SuccessResponse.class) @@ -79,13 +78,12 @@ public class GenerateUsageRecordsCmd extends BaseCmd { @Override public void execute(){ - ManagementServerExt _mgrExt = (ManagementServerExt)_mgr; - boolean result = _mgrExt.generateUsageRecords(this); + boolean result = _usageService.generateUsageRecords(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to generate usage records"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to generate usage records"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java new file mode 100644 index 00000000000..f4960dd0e08 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/GetUsageRecordsCmd.java @@ -0,0 +1,126 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.admin.usage; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.TimeZone; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.UsageRecordResponse; +import org.apache.cloudstack.usage.Usage; +import org.apache.log4j.Logger; + +@APICommand(name = "listUsageRecords", description="Lists usage records for accounts", responseObject=UsageRecordResponse.class) +public class GetUsageRecordsCmd extends BaseListCmd { + public static final Logger s_logger = Logger.getLogger(GetUsageRecordsCmd.class.getName()); + + private static final String s_name = "listusagerecordsresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List usage records for the specified user.") + private String accountName; + + @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class, + description="List usage records for the specified domain.") + private Long domainId; + + @Parameter(name=ApiConstants.END_DATE, type=CommandType.DATE, required=true, description="End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.") + private Date endDate; + + @Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, required=true, description="Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.") + private Date startDate; + + @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class, + description="List usage records for the specified account") + private Long accountId; + + @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, + description="List usage records for specified project") + private Long projectId; + + @Parameter(name=ApiConstants.TYPE, type=CommandType.LONG, description="List usage records for the specified usage type") + private Long usageType; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Date getEndDate() { + return endDate; + } + + public Date getStartDate() { + return startDate; + } + + public Long getAccountId() { + return accountId; + } + + public Long getUsageType() { + return usageType; + } + + public Long getProjectId() { + return projectId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public void execute(){ + List usageRecords = _usageService.getUsageRecords(this); + ListResponse response = new ListResponse(); + List usageResponses = new ArrayList(); + for(Usage usageRecord: usageRecords){ + UsageRecordResponse usageResponse = _responseGenerator.createUsageResponse(usageRecord); + usageResponse.setObjectName("usagerecord"); + usageResponses.add(usageResponse); + } + + response.setResponses(usageResponses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } +} diff --git a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java similarity index 79% rename from server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java rename to api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java index 21ad339137a..e8e3b22c15b 100644 --- a/server/src/com/cloud/api/commands/ListTrafficMonitorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficMonitorsCmd.java @@ -14,29 +14,29 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.command.admin.usage; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.TrafficMonitorResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.ListResponse; import com.cloud.host.Host; -import com.cloud.network.NetworkUsageManager; -import com.cloud.server.ManagementService; -import org.apache.cloudstack.api.response.TrafficMonitorResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "listTrafficMonitors", description="List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class) public class ListTrafficMonitorsCmd extends BaseListCmd { - public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); + public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName()); private static final String s_name = "listtrafficmonitorsresponse"; ///////////////////////////////////////////////////// @@ -66,17 +66,15 @@ public class ListTrafficMonitorsCmd extends BaseListCmd { @Override public void execute(){ - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetworkUsageManager networkUsageMgr = locator.getManager(NetworkUsageManager.class); - List trafficMonitors = networkUsageMgr.listTrafficMonitors(this); + List trafficMonitors = _networkUsageService.listTrafficMonitors(this); ListResponse listResponse = new ListResponse(); List responses = new ArrayList(); for (Host trafficMonitor : trafficMonitors) { - TrafficMonitorResponse response = networkUsageMgr.getApiResponse(trafficMonitor); - response.setObjectName("trafficmonitor"); - response.setResponseName(getCommandName()); - responses.add(response); + TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor); + response.setObjectName("trafficmonitor"); + response.setResponseName(getCommandName()); + responses.add(response); } listResponse.setResponses(responses); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java index 3cd00c02af7..14b69c39437 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypeImplementorsCmd.java @@ -19,12 +19,15 @@ package org.apache.cloudstack.api.command.admin.usage; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TrafficTypeImplementorResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java index 2cbb13df0d3..f239996a769 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListTrafficTypesCmd.java @@ -20,15 +20,15 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ProviderResponse; import org.apache.cloudstack.api.response.TrafficTypeResponse; +import org.apache.log4j.Logger; + import com.cloud.network.PhysicalNetworkTrafficType; import com.cloud.user.Account; import com.cloud.utils.Pair; diff --git a/server/src/com/cloud/api/commands/ListUsageTypesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java similarity index 90% rename from server/src/com/cloud/api/commands/ListUsageTypesCmd.java rename to api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java index dfa5dc1bb20..bc029117350 100644 --- a/server/src/com/cloud/api/commands/ListUsageTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/ListUsageTypesCmd.java @@ -14,7 +14,7 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.api.commands; +package org.apache.cloudstack.api.command.admin.usage; import java.util.List; @@ -23,7 +23,6 @@ import org.apache.log4j.Logger; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.response.ListResponse; -import com.cloud.server.ManagementServerExt; import org.apache.cloudstack.api.response.UsageTypeResponse; import com.cloud.user.Account; @@ -43,8 +42,7 @@ public class ListUsageTypesCmd extends BaseCmd { @Override public void execute() { - ManagementServerExt _mgrExt = (ManagementServerExt)_mgr; - List result = _mgrExt.listUsageTypes(); + List result = _usageService.listUsageTypes(); ListResponse response = new ListResponse(); response.setResponses(result); response.setResponseName(getCommandName()); diff --git a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java index 279c2b858d3..d3cf3f8434e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/usage/UpdateTrafficTypeCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.usage; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.TrafficTypeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.PhysicalNetworkTrafficType; @@ -95,7 +95,7 @@ public class UpdateTrafficTypeCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update traffic type"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update traffic type"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java index 2045abf4e93..d1f72c45dd7 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/CreateUserCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserContext; @@ -64,6 +65,12 @@ public class CreateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.") private String username; + @Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region") + private String userUUID; + + @Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the User") + private Integer regionId; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -100,6 +107,14 @@ public class CreateUserCmd extends BaseCmd { return username; } + public String getUserUUID() { + return userUUID; + } + + public Integer getRegionId() { + return regionId; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -131,13 +146,13 @@ public class CreateUserCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName()); - User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId()); + User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID(), getRegionId()); if (user != null) { UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a user"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java index a43501e7641..e8f671de1b9 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DeleteUserCmd.java @@ -16,15 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserContext; @@ -41,6 +45,11 @@ public class DeleteUserCmd extends BaseCmd { @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user") private Long id; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -49,6 +58,10 @@ public class DeleteUserCmd extends BaseCmd { return id; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -71,12 +84,12 @@ public class DeleteUserCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("UserId: "+getId()); - boolean result = _accountService.deleteUser(this); + boolean result = _regionService.deleteUser(this); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete user"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java index f483e628928..95013ec30bc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/DisableUserCmd.java @@ -16,15 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; +import javax.inject.Inject; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -45,6 +49,11 @@ public class DisableUserCmd extends BaseAsyncCmd { required=true, description="Disables user by user ID.") private Long id; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -53,6 +62,10 @@ public class DisableUserCmd extends BaseAsyncCmd { return id; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -86,13 +99,14 @@ public class DisableUserCmd extends BaseAsyncCmd { @Override public void execute(){ UserContext.current().setEventDetails("UserId: "+getId()); - UserAccount user = _accountService.disableUser(getId()); + UserAccount user = _regionService.disableUser(this); + if (user != null){ UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable user"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java index e444aa395d2..c1ba9003b05 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/EnableUserCmd.java @@ -16,11 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; @@ -39,7 +46,11 @@ public class EnableUserCmd extends BaseCmd { required=true, description="Enables user by user ID.") private Long id; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -48,6 +59,10 @@ public class EnableUserCmd extends BaseCmd { return id; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -70,13 +85,14 @@ public class EnableUserCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("UserId: "+getId()); - UserAccount user = _accountService.enableUser(getId()); + UserAccount user = _regionService.enableUser(this); + if (user != null){ UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable user"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java index 2ffe4ab245d..c7b7e09eee5 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/GetUserCmd.java @@ -16,13 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.UserAccount; diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java index 3d68e2f48c9..c5c466c1f35 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/ListUsersCmd.java @@ -16,14 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; @APICommand(name = "listUsers", description="Lists user accounts", responseObject=UserResponse.class) public class ListUsersCmd extends BaseListAccountResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java index 622b4e9a023..dbe330317a0 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/LockUserCmd.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; @@ -77,7 +78,7 @@ public class LockUserCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to lock user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to lock user"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java index 06ffc537995..c92e65db66d 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/RegisterCmd.java @@ -16,14 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.RegisterResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; diff --git a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java index 170d852ff58..ee59d07cb79 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java @@ -16,11 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.admin.user; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import javax.inject.Inject; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.User; import com.cloud.user.UserAccount; @@ -64,6 +71,11 @@ public class UpdateUserCmd extends BaseCmd { @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="Unique username") private String username; + @Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region") + private Boolean isPropagate; + + @Inject RegionService _regionService; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -104,6 +116,10 @@ public class UpdateUserCmd extends BaseCmd { return username; } + public Boolean getIsPropagate() { + return isPropagate; + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -126,13 +142,14 @@ public class UpdateUserCmd extends BaseCmd { @Override public void execute(){ UserContext.current().setEventDetails("UserId: "+getId()); - UserAccount user = _accountService.updateUser(this); + UserAccount user = _regionService.updateUser(this); + if (user != null){ UserResponse response = _responseGenerator.createUserResponse(user); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update user"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java index c9717480e44..541da1ece50 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/CreateVlanIpRangeCmd.java @@ -16,17 +16,21 @@ // under the License. package org.apache.cloudstack.api.command.admin.vlan; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.PodResponse; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; -import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.VlanIpRangeResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.dc.Vlan; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -71,7 +75,7 @@ public class CreateVlanIpRangeCmd extends BaseCmd { description="optional parameter. Have to be specified for Direct Untagged vlan only.") private Long podId; - @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, required=true, description="the beginning IP address in the VLAN IP range") + @Parameter(name=ApiConstants.START_IP, type=CommandType.STRING, description="the beginning IP address in the VLAN IP range") private String startIp; @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the ID or VID of the VLAN. If not specified," + @@ -90,6 +94,19 @@ public class CreateVlanIpRangeCmd extends BaseCmd { description="the physical network id") private Long physicalNetworkId; + @Parameter(name=ApiConstants.START_IPV6, type=CommandType.STRING, description="the beginning IPv6 address in the IPv6 network range") + private String startIpv6; + + @Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range") + private String endIpv6; + + @Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " + + "for Shared networks and Isolated networks when it belongs to VPC") + private String ip6Gateway; + + @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64") + private String ip6Cidr; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -137,6 +154,35 @@ public class CreateVlanIpRangeCmd extends BaseCmd { public Long getProjectId() { return projectId; } + + public String getStartIpv6() { + if (startIpv6 == null) { + return null; + } + return startIpv6.toLowerCase(); + } + + public String getEndIpv6() { + if (endIpv6 == null) { + return null; + } + return endIpv6.toLowerCase(); + } + + public String getIp6Gateway() { + if (ip6Gateway == null) { + return null; + } + return ip6Gateway.toLowerCase(); + } + + public String getIp6Cidr() { + if (ip6Cidr == null) { + return null; + } + return ip6Cidr.toLowerCase(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -149,7 +195,6 @@ public class CreateVlanIpRangeCmd extends BaseCmd { return physicalNetworkId; } - @Override public String getCommandName() { return s_name; @@ -169,14 +214,14 @@ public class CreateVlanIpRangeCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vlan ip range"); } } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java index f12b2175aef..6023b3d6dcd 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/DeleteVlanIpRangeCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.vlan; -import org.apache.cloudstack.api.response.VlanIpRangeResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.VlanIpRangeResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteVlanIpRange", description="Creates a VLAN IP range.", responseObject=SuccessResponse.class) @@ -70,7 +71,7 @@ public class DeleteVlanIpRangeCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vlan ip range"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vlan ip range"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java index 9b6b997c4b8..db6006a6f5c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vlan/ListVlanIpRangesCmd.java @@ -20,19 +20,19 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.PodResponse; -import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; -import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.VlanIpRangeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.dc.Vlan; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java index 3482ec756fb..8a75c66531c 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/AssignVMCmd.java @@ -19,16 +19,19 @@ package org.apache.cloudstack.api.command.admin.vm; import java.util.List; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.uservm.UserVm; @@ -101,14 +104,14 @@ public class AssignVMCmd extends BaseCmd { try { UserVm userVm = _userVmService.moveVMToUser(this); if (userVm == null){ - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm"); } UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", userVm).get(0); response.setResponseName(DeployVMCmd.getResultObjectName()); this.setResponseObject(response); }catch (Exception e){ e.printStackTrace(); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to move vm " + e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to move vm " + e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java index 5bb694da655..ddba78ea083 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/MigrateVMCmd.java @@ -16,14 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.admin.vm; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InvalidParameterValueException; @@ -150,20 +153,20 @@ public class MigrateVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate vm"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (ManagementServerException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } catch (VirtualMachineMigrationException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java index f8308614b89..13e755c5791 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vm/RecoverVMCmd.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.vm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ResourceAllocationException; import com.cloud.user.Account; import com.cloud.uservm.UserVm; @@ -77,7 +78,7 @@ public class RecoverVMCmd extends BaseCmd { recoverVmResponse.setResponseName(getCommandName()); this.setResponseObject(recoverVmResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recover vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recover vm"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java index 5bb76ab034b..9fd736f8543 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreatePrivateGatewayCmd.java @@ -16,18 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.PrivateGatewayResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -115,17 +115,17 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { } catch (InsufficientCapacityException ex){ s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } if (result != null) { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway"); } } @@ -138,7 +138,7 @@ public class CreatePrivateGatewayCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private gateway"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java index 273f7c05233..3c7956b7d7e 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; -import java.util.List; - -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; +import java.util.*; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.vpc.VpcOffering; @@ -48,6 +52,10 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{ description="services supported by the vpc offering") private List supportedServices; + @Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. " + + "If not specified, the provider for the service will be mapped to the default provider on the physical network") + private Map serviceProviderList; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -64,15 +72,38 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{ return supportedServices; } + public Map> getServiceProviders() { + Map> serviceProviderMap = null; + if (serviceProviderList != null && !serviceProviderList.isEmpty()) { + serviceProviderMap = new HashMap>(); + Collection servicesCollection = serviceProviderList.values(); + Iterator iter = servicesCollection.iterator(); + while (iter.hasNext()) { + HashMap services = (HashMap) iter.next(); + String service = services.get("service"); + String provider = services.get("provider"); + List providerList = null; + if (serviceProviderMap.containsKey(service)) { + providerList = serviceProviderMap.get(service); + } else { + providerList = new ArrayList(); + } + providerList.add(provider); + serviceProviderMap.put(service, providerList); + } + } + + return serviceProviderMap; + } @Override public void create() throws ResourceAllocationException { - VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices()); + VpcOffering vpcOff = _vpcService.createVpcOffering(getVpcOfferingName(), getDisplayText(), getSupportedServices(), getServiceProviders()); if (vpcOff != null) { this.setEntityId(vpcOff.getId()); this.setEntityUuid(vpcOff.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC offering"); } } @@ -84,7 +115,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC offering"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java index 4a1e8d05912..182a19e0622 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeletePrivateGatewayCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; -import org.apache.cloudstack.api.response.PrivateGatewayResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -87,7 +87,7 @@ public class DeletePrivateGatewayCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete private gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete private gateway"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java index 231f2ee2955..9e2968e66fe 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/DeleteVPCOfferingCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; -import org.apache.cloudstack.api.response.VpcOfferingResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.user.Account; @@ -71,7 +71,7 @@ public class DeleteVPCOfferingCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC offering"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java index 65df48e3e1f..de61ee74b31 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/vpc/UpdateVPCOfferingCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.admin.vpc; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.VpcOfferingResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VpcOfferingResponse; import com.cloud.event.EventTypes; import com.cloud.network.vpc.VpcOffering; import com.cloud.user.Account; @@ -90,7 +94,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC offering"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC offering"); } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java index e49f2439288..5cc905227ab 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/CreateZoneCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.zone; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; - import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.dc.DataCenter; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -46,6 +46,12 @@ public class CreateZoneCmd extends BaseCmd { @Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone") private String dns2; + @Parameter(name=ApiConstants.IP6_DNS1, type=CommandType.STRING, description="the first DNS for IPv6 network in the Zone") + private String ip6Dns1; + + @Parameter(name=ApiConstants.IP6_DNS2, type=CommandType.STRING, description="the second DNS for IPv6 network in the Zone") + private String ip6Dns2; + @Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone") private String guestCidrAddress; @@ -89,6 +95,14 @@ public class CreateZoneCmd extends BaseCmd { return dns2; } + public String getIp6Dns1() { + return ip6Dns1; + } + + public String getIp6Dns2() { + return ip6Dns2; + } + public String getGuestCidrAddress() { return guestCidrAddress; } @@ -156,7 +170,7 @@ public class CreateZoneCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a zone"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java index d09c7fff891..e3d14f729e3 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/DeleteZoneCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.admin.zone; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -71,7 +75,7 @@ public class DeleteZoneCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete zone"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java index 816befbd029..858457bf4fc 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/MarkDefaultZoneForAccountCmd.java @@ -17,21 +17,20 @@ package org.apache.cloudstack.api.command.admin.zone; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.user.Account; -import com.cloud.event.EventTypes; -import com.cloud.async.AsyncJob; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.BaseCmd; +import com.cloud.async.AsyncJob; +import com.cloud.event.EventTypes; +import com.cloud.user.Account; @APICommand(name = "markDefaultZoneForAccount", description="Marks a default zone for this account", responseObject=AccountResponse.class, since="4.0") public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd { @@ -109,7 +108,7 @@ public class MarkDefaultZoneForAccountCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to mark the account with the default zone"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to mark the account with the default zone"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java index 0bfd1a31a0f..16c334eebc8 100644 --- a/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java +++ b/api/src/org/apache/cloudstack/api/command/admin/zone/UpdateZoneCmd.java @@ -19,11 +19,15 @@ package org.apache.cloudstack.api.command.admin.zone; import java.util.List; import java.util.Map; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ZoneResponse; import com.cloud.dc.DataCenter; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -44,6 +48,12 @@ public class UpdateZoneCmd extends BaseCmd { @Parameter(name=ApiConstants.DNS2, type=CommandType.STRING, description="the second DNS for the Zone") private String dns2; + @Parameter(name=ApiConstants.IP6_DNS1, type=CommandType.STRING, description="the first DNS for IPv6 network in the Zone") + private String ip6Dns1; + + @Parameter(name=ApiConstants.IP6_DNS2, type=CommandType.STRING, description="the second DNS for IPv6 network in the Zone") + private String ip6Dns2; + @Parameter(name=ApiConstants.GUEST_CIDR_ADDRESS, type=CommandType.STRING, description="the guest CIDR address for the Zone") private String guestCidrAddress; @@ -101,6 +111,14 @@ public class UpdateZoneCmd extends BaseCmd { return id; } + public String getIp6Dns1() { + return ip6Dns1; + } + + public String getIp6Dns2() { + return ip6Dns2; + } + public String getInternalDns1() { return internalDns1; } @@ -164,7 +182,7 @@ public class UpdateZoneCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update zone; internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update zone; internal error."); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java index 889c3697515..ebc22723585 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/AddAccountToProjectCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.account; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; @@ -87,7 +91,7 @@ public class AddAccountToProjectCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add account to the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add account to the project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java index f9e967ad4c2..df6deae1887 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/DeleteAccountFromProjectCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.account; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.project.DeleteProjectCmd; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; @@ -76,7 +80,7 @@ public class DeleteAccountFromProjectCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete account from the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete account from the project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java index f679a5ae7d1..ebf2e4ba037 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/ListAccountsCmd.java @@ -16,21 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.account; -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListDomainResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.UserResponse; - -import com.cloud.user.Account; -import com.cloud.utils.Pair; +import org.apache.log4j.Logger; @APICommand(name = "listAccounts", description="Lists accounts and provides detailed account information for listed accounts", responseObject=AccountResponse.class) public class ListAccountsCmd extends BaseListDomainResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java index 2c279db64a8..c91e2f2b5d1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/account/ListProjectAccountsCmd.java @@ -17,14 +17,13 @@ package org.apache.cloudstack.api.command.user.account; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.log4j.Logger; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java index 93bb2401d8f..406f782da51 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/AssociateIPAddrCmd.java @@ -18,21 +18,21 @@ package org.apache.cloudstack.api.command.user.address; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -219,15 +219,15 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { this.setEntityId(ip.getId()); this.setEntityUuid(ip.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to allocate ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address"); } } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientAddressCapacityException ex) { s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } @@ -249,7 +249,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd { ipResponse.setResponseName(getCommandName()); this.setResponseObject(ipResponse); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java index 20ccd89ba84..827111902ff 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/DisassociateIPAddrCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.address; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.IPAddressResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientAddressCapacityException; @@ -75,7 +79,7 @@ public class DisassociateIPAddrCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disassociate ip address"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disassociate ip address"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java index 06b08da6907..ac0f823c1f4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/address/ListPublicIpAddressesCmd.java @@ -19,19 +19,19 @@ package org.apache.cloudstack.api.command.user.address; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.VlanIpRangeResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.network.IpAddress; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java index e92721d77bf..f6e4f96ddb1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScalePolicyCmd.java @@ -18,12 +18,16 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import com.cloud.async.AsyncJob; import com.cloud.domain.Domain; import com.cloud.event.EventTypes; @@ -157,7 +161,7 @@ public class CreateAutoScalePolicyCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create AutoScale Policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create AutoScale Policy"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java index e3d47a09c7d..135c87717be 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmGroupCmd.java @@ -18,14 +18,18 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -159,7 +163,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } } @@ -182,7 +186,7 @@ public class CreateAutoScaleVmGroupCmd extends BaseAsyncCreateCmd { } finally { if (!success || vmGroup == null) { _autoScaleService.deleteAutoScaleVmGroup(getEntityId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Group"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java index 25bb03b778f..87d4466e79a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateAutoScaleVmProfileCmd.java @@ -19,19 +19,19 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.HashMap; import java.util.Map; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; -import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -56,7 +56,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { required = true, description = "availability zone for the auto deployed virtual machine") private Long zoneId; - @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = DiskOfferingResponse.class, + @Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the service offering of the auto deployed virtual machine") private Long serviceOfferingId; @@ -231,7 +231,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd { this.setEntityId(result.getId()); this.setEntityUuid(result.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Autoscale Vm Profile"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java index 58926f2a4ff..3eff5d08e8b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/CreateConditionCmd.java @@ -17,17 +17,17 @@ package org.apache.cloudstack.api.command.user.autoscale; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.cloudstack.api.response.CounterResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.ConditionResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -74,7 +74,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd { this.setEntityId(condition.getId()); this.setEntityUuid(condition.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create condition."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create condition."); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java index 483a87ac892..f8b3595660b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScalePolicyCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.cloudstack.api.response.AutoScalePolicyResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScalePolicy; @@ -92,7 +92,7 @@ public class DeleteAutoScalePolicyCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale policy " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete AutoScale Policy"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java index 1d78fe80395..d0107368e85 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmGroupCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; @@ -92,7 +92,7 @@ public class DeleteAutoScaleVmGroupCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm group " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm group"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java index e49f0c862a3..c55973c91d6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteAutoScaleVmProfileCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmProfile; @@ -91,7 +91,7 @@ public class DeleteAutoScaleVmProfileCmd extends BaseAsyncCmd { this.setResponseObject(response); } else { s_logger.warn("Failed to delete autoscale vm profile " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete autoscale vm profile"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java index a1fba2e3725..57e38f9ab1e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DeleteConditionCmd.java @@ -17,16 +17,16 @@ package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.cloudstack.api.response.ConditionResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceInUseException; @@ -57,14 +57,14 @@ public class DeleteConditionCmd extends BaseAsyncCmd { result = _autoScaleService.deleteCondition(getId()); } catch (ResourceInUseException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage()); } if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { s_logger.warn("Failed to delete condition " + getId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete condition."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete condition."); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java index 2aba82c2a93..5d2fb4bd18e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/DisableAutoScaleVmGroupCmd.java @@ -17,15 +17,15 @@ package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; @@ -56,7 +56,7 @@ public class DisableAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable AutoScale Vm Group"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java index db7acdf5d98..5cb7e56058e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/EnableAutoScaleVmGroupCmd.java @@ -17,11 +17,15 @@ package org.apache.cloudstack.api.command.user.autoscale; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; @@ -52,7 +56,7 @@ public class EnableAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable AutoScale Vm Group"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java index 31621442252..8426db8c1f0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScalePoliciesCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; -import org.apache.cloudstack.api.response.ConditionResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; +import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.as.AutoScalePolicy; @APICommand(name = "listAutoScalePolicies", description = "Lists autoscale policies.", responseObject = AutoScalePolicyResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java index 7561757fcab..5b3ee42e588 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmGroupsCmd.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; @@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.as.AutoScaleVmGroup; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java index 7a88db3e7b9..8afdf028ed2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.TemplateResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.log4j.Logger; + import com.cloud.network.as.AutoScaleVmProfile; @APICommand(name = "listAutoScaleVmProfiles", description = "Lists autoscale vm profiles.", responseObject = AutoScaleVmProfileResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java index 0b3ffec040c..1c949232403 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListConditionsCmd.java @@ -20,16 +20,16 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.AutoScalePolicyResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AutoScalePolicyResponse; import org.apache.cloudstack.api.response.ConditionResponse; import org.apache.cloudstack.api.response.CounterResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.as.Condition; @APICommand(name = "listConditions", description = "List Conditions for the specific user", responseObject = CounterResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java index 66a38f34396..bd6790d67fc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/ListCountersCmd.java @@ -21,13 +21,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.CounterResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.as.Counter; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java index 56d71078ece..fbe2be840dc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScalePolicyCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; -import org.apache.cloudstack.api.response.ConditionResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; +import org.apache.cloudstack.api.response.ConditionResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScalePolicy; @@ -68,7 +68,7 @@ public class UpdateAutoScalePolicyCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale policy"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java index ea5b6a9f489..5acfb942f09 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmGroupCmd.java @@ -19,12 +19,16 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AutoScalePolicyResponse; +import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmGroup; @@ -75,7 +79,7 @@ public class UpdateAutoScaleVmGroupCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale VmGroup"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale VmGroup"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java index c8ef8b11198..34def9daca3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/autoscale/UpdateAutoScaleVmProfileCmd.java @@ -19,13 +19,17 @@ package org.apache.cloudstack.api.command.user.autoscale; import java.util.Map; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.as.AutoScaleVmProfile; @@ -73,7 +77,7 @@ public class UpdateAutoScaleVmProfileCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update autoscale vm profile"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update autoscale vm profile"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java index 129aeb85d24..eb862e62f47 100644 --- a/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/config/ListCapabilitiesCmd.java @@ -18,11 +18,11 @@ package org.apache.cloudstack.api.command.user.config; import java.util.Map; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.response.CapabilitiesResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.CapabilitiesResponse; import com.cloud.user.Account; @APICommand(name = "listCapabilities", description="Lists capabilities", responseObject=CapabilitiesResponse.class) @@ -52,6 +52,8 @@ public class ListCapabilitiesCmd extends BaseCmd { response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired")); response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects")); response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize")); + response.setApiLimitInterval((Integer)capabilities.get("apiLimitInterval")); + response.setApiLimitMax((Integer)capabilities.get("apiLimitMax")); response.setObjectName("capability"); response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java index 4c432f35ebb..9cbc204b7c9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventTypesCmd.java @@ -19,11 +19,11 @@ package org.apache.cloudstack.api.command.user.event; import java.util.ArrayList; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.response.EventTypeResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "listEventTypes", description = "List Event Types", responseObject = EventTypeResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java index 94205d13226..63fa194c8ea 100644 --- a/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/event/ListEventsCmd.java @@ -17,14 +17,14 @@ package org.apache.cloudstack.api.command.user.event; import java.util.Date; -import org.apache.log4j.Logger; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.EventResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; @APICommand(name = "listEvents", description="A command to list events.", responseObject=EventResponse.class) public class ListEventsCmd extends BaseListProjectAndAccountResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java new file mode 100644 index 00000000000..097b2c55f80 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateEgressFirewallRuleCmd.java @@ -0,0 +1,341 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License.package org.apache.cloudstack.api.command.user.firewall; + +package org.apache.cloudstack.api.command.user.firewall; + +import java.util.ArrayList; +import java.util.List; +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.FirewallResponse; +import org.apache.cloudstack.api.response.NetworkResponse; + +import com.cloud.async.AsyncJob; +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.NetworkRuleConflictException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.Network; +import com.cloud.network.rules.FirewallRule; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.utils.net.NetUtils; + +@APICommand(name = "createEgressFirewallRule", description = "Creates a egress firewall rule for a given network ", responseObject = FirewallResponse.class) +public class CreateEgressFirewallRuleCmd extends BaseAsyncCreateCmd implements FirewallRule { + public static final Logger s_logger = Logger.getLogger(CreateEgressFirewallRuleCmd.class.getName()); + + private static final String s_name = "createegressfirewallruleresponse"; + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + @Parameter (name = ApiConstants.NETWORK_ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the network id of the port forwarding rule") + private Long networkId; + + @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, required = true, description = "the protocol for the firewall rule. Valid values are TCP/UDP/ICMP.") + private String protocol; + + @Parameter(name = ApiConstants.START_PORT, type = CommandType.INTEGER, description = "the starting port of firewall rule") + private Integer publicStartPort; + + @Parameter(name = ApiConstants.END_PORT, type = CommandType.INTEGER, description = "the ending port of firewall rule") + private Integer publicEndPort; + + @Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "the cidr list to forward traffic from") + private List cidrlist; + + @Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "type of the icmp message being sent") + private Integer icmpType; + + @Parameter(name = ApiConstants.ICMP_CODE, type = CommandType.INTEGER, description = "error code for this icmp message") + private Integer icmpCode; + + @Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "type of firewallrule: system/user") + private String type; + + // /////////////////////////////////////////////////// + // ///////////////// Accessors /////////////////////// + // /////////////////////////////////////////////////// + + public Long getIpAddressId() { + return null; + } + + @Override + public String getProtocol() { + return protocol.trim(); + } + + @Override + public List getSourceCidrList() { + if (cidrlist != null) { + return cidrlist; + } else { + List oneCidrList = new ArrayList(); + oneCidrList.add(_networkService.getNetwork(networkId).getCidr()); + return oneCidrList; + } + } + + public Long getVpcId() { + Network network = _networkService.getNetwork(getNetworkId()); + if (network == null) { + throw new InvalidParameterValueException("Invalid networkId is given"); + } + + Long vpcId = network.getVpcId(); + return vpcId; + } + + + + // /////////////////////////////////////////////////// + // ///////////// API Implementation/////////////////// + // /////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + public void setSourceCidrList(List cidrs){ + cidrlist = cidrs; + } + + @Override + public void execute() throws ResourceUnavailableException { + UserContext callerContext = UserContext.current(); + boolean success = false; + FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId()); + try { + UserContext.current().setEventDetails("Rule Id: " + getEntityId()); + success = _firewallService.applyEgressFirewallRules (rule, callerContext.getCaller()); + // State is different after the rule is applied, so get new object here + rule = _entityMgr.findById(FirewallRule.class, getEntityId()); + FirewallResponse fwResponse = new FirewallResponse(); + if (rule != null) { + fwResponse = _responseGenerator.createFirewallResponse(rule); + setResponseObject(fwResponse); + } + fwResponse.setResponseName(getCommandName()); + } finally { + if (!success || rule == null) { + _firewallService.revokeFirewallRule(getEntityId(), true); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create firewall rule"); + } + } + } + + @Override + public long getId() { + throw new UnsupportedOperationException("database id can only provided by VO objects"); + } + + @Override + public String getXid() { + // FIXME: We should allow for end user to specify Xid. + return null; + } + + @Override + public Long getSourceIpAddressId() { + return null; + } + + @Override + public Integer getSourcePortStart() { + if (publicStartPort != null) { + return publicStartPort.intValue(); + } + return null; + } + + @Override + public Integer getSourcePortEnd() { + if (publicEndPort == null) { + if (publicStartPort != null) { + return publicStartPort.intValue(); + } + } else { + return publicEndPort.intValue(); + } + + return null; + } + + @Override + public Purpose getPurpose() { + return Purpose.Firewall; + } + + @Override + public State getState() { + throw new UnsupportedOperationException("Should never call me to find the state"); + } + + @Override + public long getNetworkId() { + return networkId; + } + + @Override + public long getEntityOwnerId() { + Account account = UserContext.current().getCaller(); + + if (account != null) { + return account.getId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + } + + @Override + public long getDomainId() { + Network network =_networkService.getNetwork(networkId); + return network.getDomainId(); + } + + @Override + public void create() { + if (getSourceCidrList() != null) { + String guestCidr = _networkService.getNetwork(getNetworkId()).getCidr(); + + for (String cidr: getSourceCidrList()){ + if (!NetUtils.isValidCIDR(cidr)){ + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr); + } + if (cidr.equals(NetUtils.ALL_CIDRS)) { + continue; + } + if(!NetUtils.isNetworkAWithinNetworkB(cidr, guestCidr)) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, cidr + "is not within the guest cidr " + guestCidr); + } + } + } + if (getProtocol().equalsIgnoreCase(NetUtils.ALL_PROTO)) { + if (getSourcePortStart() != null && getSourcePortEnd() != null) { + throw new InvalidParameterValueException("Do not pass ports to protocol ALL, porotocol ALL do not require ports. Unable to create " + +"firewall rule for the network id=" + networkId); + } + } + + if (getVpcId() != null ){ + throw new InvalidParameterValueException("Unable to create firewall rule for the network id=" + networkId + + " as firewall egress rule can be created only for non vpc networks."); + } + + try { + FirewallRule result = _firewallService.createEgressFirewallRule(this); + setEntityId(result.getId()); + } catch (NetworkRuleConflictException ex) { + s_logger.info("Network rule conflict: " + ex.getMessage()); + s_logger.trace("Network Rule Conflict: ", ex); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + } + } + + @Override + public String getEventType() { + return EventTypes.EVENT_FIREWALL_OPEN; + } + + @Override + public String getEventDescription() { + Network network = _networkService.getNetwork(networkId); + return ("Creating firewall rule for network: " + network + " for protocol:" + this.getProtocol()); + } + + + @Override + public long getAccountId() { + Network network = _networkService.getNetwork(networkId); + return network.getAccountId(); + } + + @Override + public String getSyncObjType() { + return BaseAsyncCmd.networkSyncObject; + } + + @Override + public Long getSyncObjId() { + return getNetworkId(); + } + + + @Override + public Integer getIcmpCode() { + if (icmpCode != null) { + return icmpCode; + } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) { + return -1; + } + return null; + } + + @Override + public Integer getIcmpType() { + if (icmpType != null) { + return icmpType; + } else if (protocol.equalsIgnoreCase(NetUtils.ICMP_PROTO)) { + return -1; + + } + return null; + } + + @Override + public Long getRelated() { + return null; + } + + @Override + public FirewallRuleType getType() { + if (type != null && type.equalsIgnoreCase("system")) { + return FirewallRuleType.System; + } else { + return FirewallRuleType.User; + } + } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.FirewallRule; + } + + @Override + public TrafficType getTrafficType() { + return TrafficType.Egress; + } + + @Override + public String getUuid() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java index 7039b417ced..b7cb4712047 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreateFirewallRuleCmd.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.firewall; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallResponse; +import org.apache.cloudstack.api.response.IPAddressResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -121,7 +121,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal FirewallRule rule = _entityMgr.findById(FirewallRule.class, getEntityId()); try { UserContext.current().setEventDetails("Rule Id: " + getEntityId()); - success = _firewallService.applyFirewallRules(rule.getSourceIpAddressId(), callerContext.getCaller()); + success = _firewallService.applyIngressFirewallRules(rule.getSourceIpAddressId(), callerContext.getCaller()); // State is different after the rule is applied, so get new object here rule = _entityMgr.findById(FirewallRule.class, getEntityId()); @@ -134,7 +134,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal } finally { if (!success || rule == null) { _firewallService.revokeFirewallRule(getEntityId(), true); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create firewall rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create firewall rule"); } } } @@ -231,19 +231,19 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal if (getSourceCidrList() != null) { for (String cidr: getSourceCidrList()){ if (!NetUtils.isValidCIDR(cidr)){ - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Source cidrs formatting error " + cidr); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr); } } } try { - FirewallRule result = _firewallService.createFirewallRule(this); + FirewallRule result = _firewallService.createIngressFirewallRule(this); setEntityId(result.getId()); setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " + ex.getMessage()); s_logger.trace("Network Rule Conflict: ", ex); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } @@ -324,7 +324,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal @Override public TrafficType getTrafficType() { - return null; + return FirewallRule.TrafficType.Ingress; } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java index 1feefde9a1a..39ab812909d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/CreatePortForwardingRuleCmd.java @@ -18,14 +18,19 @@ package org.apache.cloudstack.api.command.user.firewall; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.FirewallRuleResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -163,7 +168,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P UserContext.current().setEventDetails("Rule Id: " + getEntityId()); if (getOpenFirewall()) { - success = success && _firewallService.applyFirewallRules(ipAddressId, callerContext.getCaller()); + success = success && _firewallService.applyIngressFirewallRules(ipAddressId, callerContext.getCaller()); } success = success && _rulesService.applyPortForwardingRules(ipAddressId, callerContext.getCaller()); @@ -185,7 +190,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P _rulesService.revokePortForwardingRule(getEntityId(), true); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply port forwarding rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply port forwarding rule"); } } } @@ -302,7 +307,7 @@ public class CreatePortForwardingRuleCmd extends BaseAsyncCreateCmd implements P } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " , ex); s_logger.trace("Network Rule Conflict: ", ex); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java new file mode 100644 index 00000000000..0e1d48640bc --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteEgressFirewallRuleCmd.java @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License.package org.apache.cloudstack.api.command.user.firewall; + +package org.apache.cloudstack.api.command.user.firewall; + +import org.apache.cloudstack.api.APICommand; +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import com.cloud.async.AsyncJob; +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.network.rules.FirewallRule; +import com.cloud.user.UserContext; + +@APICommand(name = "deleteEgressFirewallRule", description="Deletes an ggress firewall rule", responseObject=SuccessResponse.class) +public class DeleteEgressFirewallRuleCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger.getLogger(DeleteEgressFirewallRuleCmd.class.getName()); + private static final String s_name = "deleteegressfirewallruleresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class, required=true, description="the ID of the firewall rule") + private Long id; + + // unexposed parameter needed for events logging + @Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class, expose=false) + private Long ownerId; + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + @Override + public String getCommandName() { + return s_name; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_FIREWALL_CLOSE; + } + + @Override + public String getEventDescription() { + return ("Deleting egress firewall rule id=" + id); + } + + @Override + public long getEntityOwnerId() { + if (ownerId == null) { + FirewallRule rule = _entityMgr.findById(FirewallRule.class, id); + if (rule == null) { + throw new InvalidParameterValueException("Unable to find egress firewall rule by id"); + } else { + ownerId = _entityMgr.findById(FirewallRule.class, id).getAccountId(); + } + } + return ownerId; + } + + @Override + public void execute() throws ResourceUnavailableException { + UserContext.current().setEventDetails("Rule Id: " + id); + boolean result = _firewallService.revokeFirewallRule(id, true); + + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete egress firewall rule"); + } + } + + + @Override + public String getSyncObjType() { + return BaseAsyncCmd.networkSyncObject; + } + + @Override + public Long getSyncObjId() { + return _firewallService.getFirewallRule(id).getNetworkId(); + } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.FirewallRule; + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java index 5655b5e430f..b9008282978 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeleteFirewallRuleCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.firewall; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -95,7 +99,7 @@ public class DeleteFirewallRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete firewall rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete firewall rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java index 8f4d5996df8..838859585ad 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/DeletePortForwardingRuleCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.firewall; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -97,7 +101,7 @@ public class DeletePortForwardingRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete port forwarding rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete port forwarding rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java new file mode 100644 index 00000000000..b5eed754794 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListEgressFirewallRulesCmd.java @@ -0,0 +1,91 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License.package org.apache.cloudstack.api.command.user.firewall; + +package org.apache.cloudstack.api.command.user.firewall; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.cloudstack.api.APICommand; +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.FirewallResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import com.cloud.network.rules.FirewallRule; +import com.cloud.utils.Pair; + +@APICommand(name = "listEgressFirewallRules", description="Lists all egress firewall rules for network id.", responseObject=FirewallResponse.class) +public class ListEgressFirewallRulesCmd extends ListFirewallRulesCmd { + public static final Logger s_logger = Logger.getLogger(ListEgressFirewallRulesCmd.class.getName()); + private static final String s_name = "listegressfirewallrulesresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = FirewallRuleResponse.class, description="Lists rule with the specified ID.") + private Long id; + + @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType = NetworkResponse.class, description="the id network network for the egress firwall services") + private Long networkId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getNetworkId() { + return networkId; + } + + public FirewallRule.TrafficType getTrafficType () { + return FirewallRule.TrafficType.Egress; + } + + public Long getId() { + return id; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public void execute(){ + Pair, Integer> result = _firewallService.listFirewallRules(this); + ListResponse response = new ListResponse(); + List fwResponses = new ArrayList(); + + for (FirewallRule fwRule : result.first()) { + FirewallResponse ruleData = _responseGenerator.createFirewallResponse(fwRule); + ruleData.setObjectName("firewallrule"); + fwResponses.add(ruleData); + } + response.setResponses(fwResponses, result.second()); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java index 80581fb7d3b..c2aee55f51e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListFirewallRulesCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.firewall; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.FirewallResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.FirewallRule; import com.cloud.utils.Pair; @@ -56,6 +56,10 @@ public class ListFirewallRulesCmd extends BaseListTaggedResourcesCmd { return ipAddressId; } + public FirewallRule.TrafficType getTrafficType () { + return FirewallRule.TrafficType.Ingress; + } + public Long getId() { return id; } diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java index 665af44ad96..9fd4e450ea6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/ListPortForwardingRulesCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.firewall; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.PortForwardingRule; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java index a52ebb77257..2a8b9003fa8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/firewall/UpdatePortForwardingRuleCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.firewall; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.FirewallRuleResponse; import com.cloud.event.EventTypes; import com.cloud.network.IpAddress; import com.cloud.user.Account; @@ -124,7 +124,7 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd { // response.setResponseName(getName()); // this.setResponseObject(response); // } else { -// throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update port forwarding rule"); +// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update port forwarding rule"); // } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java index 3b4c4cd2c34..19d2341fd73 100644 --- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCategoriesCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.guest; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.storage.GuestOsCategory; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java index 3c145e9bd95..1b050b8960f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/guest/ListGuestOsCmd.java @@ -20,15 +20,15 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; -import org.apache.cloudstack.api.response.GuestOSCategoryResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.user.iso.ListIsosCmd; +import org.apache.cloudstack.api.response.GuestOSCategoryResponse; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.storage.GuestOS; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java index 1e154e2a07d..933ee8bde53 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/AttachIsoCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; -import org.apache.cloudstack.api.response.TemplateResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.user.UserContext; @@ -46,7 +46,7 @@ public class AttachIsoCmd extends BaseAsyncCmd { required=true, description="the ID of the ISO file") private Long id; - @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, + @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class, required=true, description="the ID of the virtual machine") private Long virtualMachineId; @@ -104,10 +104,10 @@ public class AttachIsoCmd extends BaseAsyncCmd { response.setResponseName(DeployVMCmd.getResultObjectName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso"); } } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach iso"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java index b449ff59180..89aa71f8ffd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/CopyIsoCmd.java @@ -16,11 +16,10 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.command.user.template.CopyTemplateCmd; +import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.log4j.Logger; @APICommand(name = "copyIso", description="Copies an iso from one zone to another.", responseObject=TemplateResponse.class) public class CopyIsoCmd extends CopyTemplateCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java index 44efbf88f2c..c8217759944 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/DeleteIsoCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.template.VirtualMachineTemplate; @@ -112,7 +112,7 @@ public class DeleteIsoCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete iso"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java index eb1c6eed2d6..c04fba50295 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/DetachIsoCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; -import org.apache.cloudstack.api.response.TemplateResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.vm.DeployVMCmd; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.uservm.UserVm; @@ -41,7 +41,7 @@ public class DetachIsoCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, + @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType = UserVmResponse.class, required=true, description="The ID of the virtual machine") private Long virtualMachineId; @@ -91,7 +91,7 @@ public class DetachIsoCmd extends BaseAsyncCmd { response.setResponseName(DeployVMCmd.getResultObjectName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach iso"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java index 5f8303ec320..08a15eece73 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ExtractIsoCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ExtractResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ExtractResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InternalErrorException; @@ -126,11 +130,11 @@ public class ExtractIsoCmd extends BaseAsyncCmd { response.setObjectName("iso"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract iso"); } } catch (InternalErrorException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java index 0ca711f4664..faa4f607edc 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsoPermissionsCmd.java @@ -16,8 +16,8 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd; import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import org.apache.log4j.Logger; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java index e6ccfff3449..1824612ebb0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/ListIsosCmd.java @@ -21,14 +21,14 @@ import java.util.List; import java.util.Set; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java index 214d18de5cc..284d5530846 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/RegisterIsoCmd.java @@ -18,16 +18,20 @@ package org.apache.cloudstack.api.command.user.iso; import java.util.List; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ResourceAllocationException; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.UserContext; @@ -84,6 +88,10 @@ public class RegisterIsoCmd extends BaseCmd { @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, description="Register iso for the project") private Long projectId; + + @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING, + description="Image store uuid") + private String imageStoreUuid; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -136,6 +144,10 @@ public class RegisterIsoCmd extends BaseCmd { public String getChecksum() { return checksum; } + + public String getImageStoreUuid() { + return this.imageStoreUuid; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -166,7 +178,7 @@ public class RegisterIsoCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register iso"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java index f54f8a66daa..37294e3563a 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoCmd.java @@ -16,13 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; -import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.log4j.Logger; + import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; @@ -72,7 +72,7 @@ public class UpdateIsoCmd extends BaseUpdateTemplateOrIsoCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update iso"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update iso"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java index b7a2c5685e0..5e884df40f3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/iso/UpdateIsoPermissionsCmd.java @@ -16,11 +16,11 @@ // under the License. package org.apache.cloudstack.api.command.user.iso; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java index 50ac52e025f..85062188ef2 100644 --- a/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/job/ListAsyncJobsCmd.java @@ -16,19 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.user.job; -import java.util.ArrayList; import java.util.Date; -import java.util.List; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.AsyncJobResponse; import org.apache.cloudstack.api.response.ListResponse; -import com.cloud.async.AsyncJob; -import com.cloud.utils.Pair; @APICommand(name = "listAsyncJobs", description="Lists all pending asynchronous jobs for the account.", responseObject=AsyncJobResponse.class) public class ListAsyncJobsCmd extends BaseListAccountResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java index 256d4ff5cc3..5d2ef6898c1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/job/QueryAsyncJobResultCmd.java @@ -16,13 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.job; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.AsyncJobResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "queryAsyncJobResult", description="Retrieves the current status of asynchronous job.", responseObject=AsyncJobResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java index 972673f4954..e0f9bcdd80d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/AssignToLoadBalancerRuleCmd.java @@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.List; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.LoadBalancer; @@ -102,7 +102,7 @@ public class AssignToLoadBalancerRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to assign load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign load balancer rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java index c01e138c1d1..02b253a7c0c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLBStickinessPolicyCmd.java @@ -19,22 +19,22 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.Map; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.LBStickinessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.rules.StickinessPolicy; -import org.apache.cloudstack.api.response.LBStickinessResponse; import com.cloud.network.rules.LoadBalancer; +import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -129,7 +129,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd { } } finally { if (!success || (policy == null)) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create stickiness policy "); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create stickiness policy "); } } } @@ -142,7 +142,7 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd { this.setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java index 4e76a6b676f..5f1d97b2803 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/CreateLoadBalancerRuleCmd.java @@ -18,12 +18,10 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; @@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -244,7 +244,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements UserContext.current().setEventDetails("Rule Id: " + getEntityId()); if (getOpenFirewall()) { - success = success && _firewallService.applyFirewallRules(getSourceIpAddressId(), callerContext.getCaller()); + success = success && _firewallService.applyIngressFirewallRules(getSourceIpAddressId(), callerContext.getCaller()); } // State might be different after the rule is applied, so get new object here @@ -266,7 +266,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements // no need to apply the rule on the backend as it exists in the db only _lbService.deleteLoadBalancerRule(getEntityId(), false); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create load balancer rule"); } } } @@ -283,10 +283,10 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements this.setEntityUuid(result.getUuid()); } catch (NetworkRuleConflictException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } catch (InsufficientAddressCapacityException e) { s_logger.warn("Exception: ", e); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java index 9329bd35aba..fc7be24d482 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLBStickinessPolicyCmd.java @@ -16,20 +16,20 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; -import org.apache.cloudstack.api.response.LBStickinessResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.LBStickinessResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; -import com.cloud.network.rules.StickinessPolicy; import com.cloud.network.rules.LoadBalancer; +import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -91,7 +91,7 @@ public class DeleteLBStickinessPolicyCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete load balancer stickiness policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer stickiness policy"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java index d53155f17b9..88fa400bb35 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/DeleteLoadBalancerRuleCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -89,7 +93,7 @@ public class DeleteLoadBalancerRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete load balancer"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete load balancer"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java index 90708c0bfe0..9456a157f35 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLBStickinessPoliciesCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.LBStickinessResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.StickinessPolicy; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java index 374c6fb25e5..49ab42c32df 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRuleInstancesCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.uservm.UserVm; @APICommand(name = "listLoadBalancerRuleInstances", description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java index d0d4e8db85c..e022cc78db0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/ListLoadBalancerRulesCmd.java @@ -19,11 +19,9 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.IPAddressResponse; @@ -31,6 +29,8 @@ import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.LoadBalancer; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java index f56f06d15c5..92a05d6c9e6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/RemoveFromLoadBalancerRuleCmd.java @@ -18,13 +18,17 @@ package org.apache.cloudstack.api.command.user.loadbalancer; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.cloudstack.api.response.UserVmResponse; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.rules.LoadBalancer; @@ -98,7 +102,7 @@ public class RemoveFromLoadBalancerRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove instance from load balancer rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java index 8a86f74260d..c2960579977 100644 --- a/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/loadbalancer/UpdateLoadBalancerRuleCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.loadbalancer; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.LoadBalancerResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.LoadBalancerResponse; import com.cloud.event.EventTypes; import com.cloud.network.rules.LoadBalancer; import com.cloud.user.Account; @@ -106,7 +110,7 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update load balancer rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load balancer rule"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java index 1ce3458dde3..4cb5288ceeb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/CreateIpForwardingRuleCmd.java @@ -18,18 +18,18 @@ package org.apache.cloudstack.api.command.user.nat; import java.util.List; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.IpForwardingRuleResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -114,7 +114,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta UserContext.current().setEventDetails("Rule Id: "+ getEntityId()); if (getOpenFirewall()) { - result = result && _firewallService.applyFirewallRules(ipAddressId, UserContext.current().getCaller()); + result = result && _firewallService.applyIngressFirewallRules(ipAddressId, UserContext.current().getCaller()); } result = result && _rulesService.applyStaticNatRules(ipAddressId, UserContext.current().getCaller()); @@ -132,7 +132,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta _rulesService.revokeStaticNatRule(getEntityId(), true); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Error in creating ip forwarding rule on the domr"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Error in creating ip forwarding rule on the domr"); } } } @@ -151,7 +151,7 @@ public class CreateIpForwardingRuleCmd extends BaseAsyncCreateCmd implements Sta this.setEntityUuid(rule.getUuid()); } catch (NetworkRuleConflictException e) { s_logger.info("Unable to create Static Nat Rule due to ", e); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java index 6300a412d54..b736b03a62e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/DeleteIpForwardingRuleCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.nat; -import org.apache.cloudstack.api.response.AccountResponse; -import org.apache.cloudstack.api.response.FirewallRuleResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -78,7 +78,7 @@ public class DeleteIpForwardingRuleCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete ip forwarding rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete ip forwarding rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java index fbd0b5ce900..9bd769aca1f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/DisableStaticNatCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.nat; -import org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.user.firewall.DeletePortForwardingRuleCmd; +import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InvalidParameterValueException; @@ -86,7 +86,7 @@ public class DisableStaticNatCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to disable static nat"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable static nat"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java index 79a8e2bc9ff..ce6ea1663b9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/EnableStaticNatCmd.java @@ -16,17 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.nat; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; @@ -114,12 +115,12 @@ public class EnableStaticNatCmd extends BaseCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to enable static nat"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable static nat"); } } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " + ex.getMessage()); s_logger.trace("Network Rule Conflict: ", ex); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java index e4aaff3e56f..776639b5f1e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/nat/ListIpForwardingRulesCmd.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; @@ -30,6 +28,8 @@ import org.apache.cloudstack.api.response.IPAddressResponse; import org.apache.cloudstack.api.response.IpForwardingRuleResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.StaticNatRule; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java index 16843b56d67..2e307018eed 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkACLCmd.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.NetworkResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.NetworkACLResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -164,7 +164,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR } finally { if (!success || rule == null) { _networkACLService.revokeNetworkACL(getEntityId(), true); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network ACL"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network ACL"); } } } @@ -250,7 +250,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR if (getSourceCidrList() != null) { for (String cidr: getSourceCidrList()){ if (!NetUtils.isValidCIDR(cidr)){ - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Source cidrs formatting error " + cidr); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Source cidrs formatting error " + cidr); } } } @@ -262,7 +262,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd implements FirewallR } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " + ex.getMessage()); s_logger.trace("Network Rule Conflict: ", ex); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java index 3b2608729a4..fc7bd9fdd3f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/CreateNetworkCmd.java @@ -16,20 +16,21 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkOfferingResponse; +import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; @@ -112,6 +113,18 @@ public class CreateNetworkCmd extends BaseCmd { description="the VPC network belongs to") private Long vpcId; + @Parameter(name=ApiConstants.START_IPV6, type=CommandType.STRING, description="the beginning IPv6 address in the IPv6 network range") + private String startIpv6; + + @Parameter(name=ApiConstants.END_IPV6, type=CommandType.STRING, description="the ending IPv6 address in the IPv6 network range") + private String endIpv6; + + @Parameter(name=ApiConstants.IP6_GATEWAY, type=CommandType.STRING, description="the gateway of the IPv6 network. Required " + + "for Shared networks and Isolated networks when it belongs to VPC") + private String ip6Gateway; + + @Parameter(name=ApiConstants.IP6_CIDR, type=CommandType.STRING, description="the CIDR of IPv6 network, must be at least /64") + private String ip6Cidr; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -206,6 +219,34 @@ public class CreateNetworkCmd extends BaseCmd { } } + public String getStartIpv6() { + if (startIpv6 == null) { + return null; + } + return startIpv6.toLowerCase(); + } + + public String getEndIpv6() { + if (endIpv6 == null) { + return null; + } + return endIpv6.toLowerCase(); + } + + public String getIp6Gateway() { + if (ip6Gateway == null) { + return null; + } + return ip6Gateway.toLowerCase(); + } + + public String getIp6Cidr() { + if (ip6Cidr == null) { + return null; + } + return ip6Cidr.toLowerCase(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -233,7 +274,7 @@ public class CreateNetworkCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); }else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java index 4b078ed7fe3..2a2444b3e1b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkACLCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.FirewallRuleResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -99,7 +99,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network ACL"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java index df070ff8ecb..954146e0f87 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/DeleteNetworkCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.network.Network; @@ -68,7 +72,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java index f556ce1cbfd..d166974e7d1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkACLsCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkACLResponse; -import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.log4j.Logger; + import com.cloud.network.rules.FirewallRule; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java index 94bc71dc993..e2c970157a7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworkOfferingsCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkOfferingResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.offering.NetworkOffering; @APICommand(name = "listNetworkOfferings", description="Lists all available network offerings.", responseObject=NetworkOfferingResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java index 1f366c223a6..afce0926e4d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/ListNetworksCmd.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.network; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.network.Network; @APICommand(name = "listNetworks", description="Lists all available networks.", responseObject=NetworkResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java index ee9af3b0009..b054781b6c5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/RestartNetworkCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.IPAddressResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.cloudstack.api.response.SuccessResponse; -import org.apache.cloudstack.api.response.NetworkResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -90,7 +94,7 @@ public class RestartNetworkCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java index 5ab8a6035ad..41aaaaada12 100644 --- a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.network; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkOfferingResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -64,6 +64,9 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { description="network offering ID") private Long networkOfferingId; + @Parameter(name=ApiConstants.GUEST_VM_CIDR, type=CommandType.STRING, description="CIDR for Guest VMs,Cloudstack allocates IPs to Guest VMs only from this CIDR") + private String guestVmCidr; + ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// @@ -94,6 +97,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { } return false; } + + private String getGuestVmCidr() { + return guestVmCidr; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -125,10 +132,10 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { Network result = null; if (network.getVpcId() != null) { result = _vpcService.updateVpcGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, - callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr()); + callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr()); } else { result = _networkService.updateGuestNetwork(getId(), getNetworkName(), getDisplayText(), callerAccount, - callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr()); + callerUser, getNetworkDomain(), getNetworkOfferingId(), getChangeCidr(), getGuestVmCidr()); } if (result != null) { @@ -136,7 +143,7 @@ public class UpdateNetworkCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update network"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update network"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java index 7209429cfa0..eb48d814290 100644 --- a/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListDiskOfferingsCmd.java @@ -19,15 +19,16 @@ package org.apache.cloudstack.api.command.user.offering; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.AsyncJobResponse; import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; + import com.cloud.offering.DiskOffering; @APICommand(name = "listDiskOfferings", description="Lists all available disk offerings.", responseObject=DiskOfferingResponse.class) @@ -78,16 +79,8 @@ public class ListDiskOfferingsCmd extends BaseListCmd { @Override public void execute(){ - List result = _mgr.searchForDiskOfferings(this); - ListResponse response = new ListResponse(); - List diskOfferingResponses = new ArrayList(); - for (DiskOffering offering : result) { - DiskOfferingResponse diskOffResp = _responseGenerator.createDiskOfferingResponse(offering); - diskOffResp.setObjectName("diskoffering"); - diskOfferingResponses.add(diskOffResp); - } - response.setResponses(diskOfferingResponses); + ListResponse response = _queryService.searchForDiskOfferings(this); response.setResponseName(getCommandName()); this.setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java index 9fad577d8ad..ca16cdc7efe 100644 --- a/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/offering/ListServiceOfferingsCmd.java @@ -16,20 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.offering; -import java.util.ArrayList; -import java.util.List; - -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.UserVmResponse; -import com.cloud.offering.ServiceOffering; + +import org.apache.log4j.Logger; @APICommand(name = "listServiceOfferings", description="Lists all available service offerings.", responseObject=ServiceOfferingResponse.class) public class ListServiceOfferingsCmd extends BaseListCmd { @@ -102,17 +98,10 @@ public class ListServiceOfferingsCmd extends BaseListCmd { @Override public void execute(){ - List offerings = _mgr.searchForServiceOfferings(this); - ListResponse response = new ListResponse(); - List offeringResponses = new ArrayList(); - for (ServiceOffering offering : offerings) { - ServiceOfferingResponse offeringResponse = _responseGenerator.createServiceOfferingResponse(offering); - offeringResponse.setObjectName("serviceoffering"); - offeringResponses.add(offeringResponse); - } - response.setResponses(offeringResponses); + ListResponse response = _queryService.searchForServiceOfferings(this); response.setResponseName(getCommandName()); this.setResponseObject(response); + } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java index 6cc9387ac2b..95889fe4040 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ActivateProjectCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ProjectResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; @@ -79,7 +83,7 @@ public class ActivateProjectCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to activate a project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to activate a project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java index 865f7a0aa99..7515f0513b5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/CreateProjectCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; @@ -114,7 +118,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } } @@ -126,7 +130,7 @@ public class CreateProjectCmd extends BaseAsyncCreateCmd { this.setEntityId(project.getId()); this.setEntityUuid(project.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java index fb41a7f14ef..9b61b699665 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.response.ProjectResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.projects.Project; @@ -71,7 +71,7 @@ public class DeleteProjectCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java index 67c7cefc252..27d1b50ca30 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/DeleteProjectInvitationCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.response.ProjectInvitationResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -72,7 +72,7 @@ public class DeleteProjectInvitationCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete the project invitation"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete the project invitation"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java index 4157daa7b4a..6e8b2da5df6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectInvitationsCmd.java @@ -16,15 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.response.ProjectResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectInvitationResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.log4j.Logger; @APICommand(name = "listProjectInvitations", description = "Lists projects and provides detailed information for listed projects", responseObject = ProjectInvitationResponse.class, since = "3.0.0") public class ListProjectInvitationsCmd extends BaseListAccountResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java index 321a19fe62d..08cef101259 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/ListProjectsCmd.java @@ -21,14 +21,13 @@ import java.util.HashMap; import java.util.Iterator; import java.util.Map; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.log4j.Logger; import com.cloud.exception.InvalidParameterValueException; diff --git a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java index 120e4fe0c55..e2f4bd6219b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/SuspendProjectCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ProjectResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InvalidParameterValueException; @@ -69,7 +73,7 @@ public class SuspendProjectCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to suspend a project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to suspend a project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java index bad117727e0..e475bc7b8ba 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; @@ -97,7 +97,7 @@ public class UpdateProjectCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update a project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update a project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java index 32e1a755484..f34814a4335 100644 --- a/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/project/UpdateProjectInvitationCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.project; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -92,7 +96,7 @@ public class UpdateProjectInvitationCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to join the project"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to join the project"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java new file mode 100644 index 00000000000..07f93a4568a --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/region/ListRegionsCmd.java @@ -0,0 +1,88 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.region; + +import java.util.ArrayList; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.RegionResponse; +import org.apache.cloudstack.region.Region; +import org.apache.cloudstack.region.RegionService; +import org.apache.log4j.Logger; + +@APICommand(name = "listRegions", description="Lists Regions", responseObject=RegionResponse.class) +public class ListRegionsCmd extends BaseListCmd { + public static final Logger s_logger = Logger.getLogger(ListRegionsCmd.class.getName()); + + private static final String s_name = "listregionsresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ID, type=CommandType.INTEGER, description="List Region by region ID.") + private Integer id; + + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="List Region by region name.") + private String name; + + @Inject RegionService _regionService; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Integer getId() { + return id; + } + + public String getName() { + return name; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public void execute(){ + List result = _regionService.listRegions(this); + ListResponse response = new ListResponse(); + List regionResponses = new ArrayList(); + for (Region region : result) { + RegionResponse regionResponse = _responseGenerator.createRegionResponse(region); + regionResponse.setObjectName("region"); + regionResponses.add(regionResponse); + } + + response.setResponses(regionResponses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java index 0d62c18f55d..716addba2c9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/GetCloudIdentifierCmd.java @@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.user.resource; import java.util.ArrayList; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.CloudIdentifierResponse; import org.apache.cloudstack.api.response.UserResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "getCloudIdentifier", description="Retrieves a cloud identifier.", responseObject=CloudIdentifierResponse.class) @@ -74,7 +75,7 @@ public class GetCloudIdentifierCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to get cloud identifier"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to get cloud identifier"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java index c1e29d3f37e..fffd3ade368 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListHypervisorsCmd.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.user.resource; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd; import org.apache.cloudstack.api.response.HypervisorResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "listHypervisors", description = "List hypervisors", responseObject = HypervisorResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java index 12a8494bde8..191e9589a65 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/ListResourceLimitsCmd.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.user.resource; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ResourceLimitResponse; +import org.apache.log4j.Logger; + import com.cloud.configuration.ResourceLimit; @APICommand(name = "listResourceLimits", description="Lists resource limits.", responseObject=ResourceLimitResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java index d2b6870f0ca..f6d3a98a05d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceCountCmd.java @@ -19,14 +19,18 @@ package org.apache.cloudstack.api.command.user.resource; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.ResourceCountResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ProjectResponse; -import org.apache.cloudstack.api.response.ListResponse; -import org.apache.cloudstack.api.response.ResourceCountResponse; import com.cloud.configuration.ResourceCount; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -49,12 +53,17 @@ public class UpdateResourceCountCmd extends BaseCmd { required=true, description="If account parameter specified then updates resource counts for a specified account in this domain else update resource counts for all accounts & child domains in specified domain.") private Long domainId; - @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, and 4. If not specified will update all resource counts" + + @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, description= "Type of resource to update. If specifies valid values are 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. If not specified will update all resource counts" + "0 - Instance. Number of instances a user can create. " + "1 - IP. Number of public IP addresses a user can own. " + "2 - Volume. Number of disk volumes a user can create." + "3 - Snapshot. Number of snapshots a user can create." + - "4 - Template. Number of templates that a user can register/create.") + "4 - Template. Number of templates that a user can register/create." + + "5 - Project. Number of projects that a user can create." + + "6 - Network. Number of guest network a user can create." + + "7 - VPC. Number of VPC a user can create." + + "8 - CPU. Total number of CPU cores a user can use." + + "9 - Memory. Total Memory (in MB) a user can use." ) private Integer resourceType; @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, @@ -123,7 +132,7 @@ public class UpdateResourceCountCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to recalculate resource counts"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to recalculate resource counts"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java index 262d12dc264..0039f6293f7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/resource/UpdateResourceLimitCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.resource; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceLimitResponse; +import org.apache.log4j.Logger; + import com.cloud.configuration.ResourceLimit; import com.cloud.user.UserContext; @@ -50,11 +54,15 @@ public class UpdateResourceLimitCmd extends BaseCmd { @Parameter(name=ApiConstants.MAX, type=CommandType.LONG, description=" Maximum resource limit.") private Long max; - @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, required=true, description="Type of resource to update. Values are 0, 1, 2, 3, and 4. 0 - Instance. Number of instances a user can create. " + + @Parameter(name=ApiConstants.RESOURCE_TYPE, type=CommandType.INTEGER, required=true, description="Type of resource to update. Values are 0, 1, 2, 3, 4, 6, 7, 8 and 9. 0 - Instance. Number of instances a user can create. " + "1 - IP. Number of public IP addresses a user can own. " + "2 - Volume. Number of disk volumes a user can create." + "3 - Snapshot. Number of snapshots a user can create." + - "4 - Template. Number of templates that a user can register/create.") + "4 - Template. Number of templates that a user can register/create." + + "6 - Network. Number of guest network a user can create." + + "7 - VPC. Number of VPC a user can create." + + "8 - CPU. Total number of CPU cores a user can use." + + "9 - Memory. Total Memory (in MB) a user can use." ) private Integer resourceType; ///////////////////////////////////////////////////// @@ -100,7 +108,7 @@ public class UpdateResourceLimitCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update resource limit"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update resource limit"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java index acafcbe19a9..74eb5c7cea5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupEgressCmd.java @@ -22,13 +22,18 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; -import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -206,7 +211,7 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd { SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(egressRules); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group egress rule(s)"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java index abd20fcc81d..22e88c23103 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/AuthorizeSecurityGroupIngressCmd.java @@ -22,18 +22,18 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -210,7 +210,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { if(cidrList != null){ for(String cidr : cidrList ){ if (!NetUtils.isValidCIDR(cidr)){ - throw new ServerApiException(BaseCmd.PARAM_ERROR, cidr + " is an Invalid CIDR "); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, cidr + " is an Invalid CIDR "); } } } @@ -219,7 +219,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd { SecurityGroupResponse response = _responseGenerator.createSecurityGroupResponseFromSecurityGroupRule(ingressRules); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to authorize security group ingress rule(s)"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java index c494355e15e..839afb2c220 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/CreateSecurityGroupCmd.java @@ -16,16 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.securitygroup; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.log4j.Logger; + import com.cloud.network.security.SecurityGroup; import com.cloud.user.Account; import com.cloud.user.UserContext; @@ -116,7 +117,7 @@ public class CreateSecurityGroupCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create security group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create security group"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java index 15a00253b63..aa6ec2d384f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/DeleteSecurityGroupCmd.java @@ -16,17 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.securitygroup; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceInUseException; import com.cloud.user.UserContext; @@ -120,11 +121,11 @@ public class DeleteSecurityGroupCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete security group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete security group"); } } catch (ResourceInUseException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java index cf1ab84bad0..670124d5e30 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/ListSecurityGroupsCmd.java @@ -16,15 +16,14 @@ // under the License. package org.apache.cloudstack.api.command.user.securitygroup; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; import com.cloud.async.AsyncJob; diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java index 53d8fcf59c7..8e7f2ec1be9 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupEgressCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.securitygroup; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.security.SecurityGroup; @@ -88,7 +92,7 @@ public class RevokeSecurityGroupEgressCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group egress rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group egress rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java index 1f56dee9bca..1d450647c8e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/securitygroup/RevokeSecurityGroupIngressCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.securitygroup; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SecurityGroupRuleResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.network.security.SecurityGroup; @@ -92,7 +92,7 @@ public class RevokeSecurityGroupIngressCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to revoke security group ingress rule"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to revoke security group ingress rule"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java index 14f46540cc3..95d76599f70 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotCmd.java @@ -16,14 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; +import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -152,7 +157,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { this.setEntityId(snapshot.getId()); this.setEntityUuid(snapshot.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot"); } } @@ -165,7 +170,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot due to an internal error creating snapshot for volume " + volumeId); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java index cafb79e0523..5a9ea2a073d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/CreateSnapshotPolicyCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.PermissionDeniedException; import com.cloud.projects.Project; @@ -126,7 +130,7 @@ public class CreateSnapshotPolicyCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create snapshot policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create snapshot policy"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java index 6def8730cbd..6f37af8b4b8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.snapshot; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.storage.Snapshot; @@ -94,7 +98,7 @@ public class DeleteSnapshotCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java index 17f28d931ea..5a75ea06c24 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/DeleteSnapshotPoliciesCmd.java @@ -18,15 +18,16 @@ package org.apache.cloudstack.api.command.user.snapshot; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; @APICommand(name = "deleteSnapshotPolicies", description="Deletes snapshot policies for the account.", responseObject=SuccessResponse.class) @@ -80,7 +81,7 @@ public class DeleteSnapshotPoliciesCmd extends BaseCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete snapshot policy"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete snapshot policy"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java index 647c503a445..f1c60105961 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotPoliciesCmd.java @@ -20,15 +20,16 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SnapshotPolicyResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.storage.snapshot.SnapshotPolicy; +import com.cloud.utils.Pair; @APICommand(name = "listSnapshotPolicies", description="Lists snapshot policies.", responseObject=SnapshotPolicyResponse.class) public class ListSnapshotPoliciesCmd extends BaseListCmd { @@ -63,15 +64,15 @@ public class ListSnapshotPoliciesCmd extends BaseListCmd { @Override public void execute(){ - List result = _snapshotService.listPoliciesforVolume(this); + Pair, Integer> result = _snapshotService.listPoliciesforVolume(this); ListResponse response = new ListResponse(); List policyResponses = new ArrayList(); - for (SnapshotPolicy policy : result) { + for (SnapshotPolicy policy : result.first()) { SnapshotPolicyResponse policyResponse = _responseGenerator.createSnapshotPolicyResponse(policy); policyResponse.setObjectName("snapshotpolicy"); policyResponses.add(policyResponse); } - response.setResponses(policyResponses); + response.setResponses(policyResponses, result.second()); response.setResponseName(getCommandName()); this.setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java index 5c6e79c9170..17f20aeb0d0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/snapshot/ListSnapshotsCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.snapshot; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.storage.Snapshot; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java index bade8572f82..56bec7eacd7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/CreateSSHKeyPairCmd.java @@ -17,14 +17,14 @@ package org.apache.cloudstack.api.command.user.ssh; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SSHKeyPairResponse; +import org.apache.log4j.Logger; + import com.cloud.user.SSHKeyPair; import com.cloud.user.UserContext; diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java index 9b6d403f48e..b05a675af62 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/DeleteSSHKeyPairCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.ssh; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.user.UserContext; diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java index 27013dfd5f6..e1788ce9f88 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/ListSSHKeyPairsCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.SSHKeyPairResponse; +import org.apache.log4j.Logger; + import com.cloud.user.SSHKeyPair; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java index 2f08692f09b..b05c6b18c75 100644 --- a/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/ssh/RegisterSSHKeyPairCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.ssh; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.SSHKeyPairResponse; +import org.apache.log4j.Logger; + import com.cloud.user.SSHKeyPair; import com.cloud.user.UserContext; diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java index 54338bd24e2..63e2788b77c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/tag/CreateTagsCmd.java @@ -23,15 +23,15 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag; import com.cloud.server.ResourceTag.TaggedResourceType; @@ -115,7 +115,7 @@ public class CreateTagsCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create tags"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create tags"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java index cf2ea9ec1cb..084a5142aa1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/tag/DeleteTagsCmd.java @@ -23,15 +23,15 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.server.ResourceTag.TaggedResourceType; @APICommand(name = "deleteTags", description = "Deleting resource tag(s)", responseObject = SuccessResponse.class, since = "Burbank") @@ -106,7 +106,7 @@ public class DeleteTagsCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete tags"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete tags"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java index c6461a75e28..a4f05821244 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/CopyTemplateCmd.java @@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.template; import java.util.List; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -50,7 +50,7 @@ public class CopyTemplateCmd extends BaseAsyncCmd { required=true, description="ID of the zone the template is being copied to.") private Long destZoneId; - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class, + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class, required=true, description="Template ID.") private Long id; @@ -133,11 +133,11 @@ public class CopyTemplateCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to copy template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to copy template"); } } catch (StorageUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java index e72b49b4e4d..ba1f924fe02 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/CreateTemplateCmd.java @@ -20,16 +20,20 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.SnapshotResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -235,33 +239,23 @@ import com.cloud.user.UserContext; @Override public void create() throws ResourceAllocationException { - if (isBareMetal()) { - _bareMetalVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId())); - /*Baremetal creates template record after taking image proceeded, use vmId as entity id and uuid here*/ - this.setEntityId(vmId); - this.setEntityUuid(vmId.toString()); + VirtualMachineTemplate template = null; + template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId())); + if (template != null) { + this.setEntityId(template.getId()); + this.setEntityUuid(template.getUuid()); } else { - VirtualMachineTemplate template = null; - template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId())); - if (template != null) { - this.setEntityId(template.getId()); - this.setEntityUuid(template.getUuid()); - } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, - "Failed to create a template"); - } + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to create a template"); } + } @Override public void execute() { UserContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId())); VirtualMachineTemplate template = null; - if (isBareMetal()) { - template = _bareMetalVmService.createPrivateTemplate(this); - } else { - template = _userVmService.createPrivateTemplate(this); - } + template = this._templateService.createPrivateTemplate(this); if (template != null){ List templateResponses; @@ -277,7 +271,7 @@ import com.cloud.user.UserContext; response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create private template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create private template"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java index 26f3e841f68..1f030a56591 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/DeleteTemplateCmd.java @@ -16,13 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; + import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.template.VirtualMachineTemplate; @@ -38,7 +43,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class, + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class, required=true, description="the ID of the template") private Long id; @@ -109,7 +114,7 @@ public class DeleteTemplateCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete template"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java index 521293cb275..9a2dee30bcb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ExtractTemplateCmd.java @@ -16,13 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import org.apache.cloudstack.api.*; -import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ExtractResponse; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; + import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.ExtractResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InternalErrorException; @@ -40,7 +45,7 @@ public class ExtractTemplateCmd extends BaseAsyncCmd { //////////////// API parameters ///////////////////// ///////////////////////////////////////////////////// - @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = UserVmResponse.class, + @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = TemplateResponse.class, required=true, description="the ID of the template") private Long id; @@ -126,11 +131,11 @@ public class ExtractTemplateCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract template"); } } catch (InternalErrorException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java index 7446195d5fb..d727a334c82 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatePermissionsCmd.java @@ -16,8 +16,8 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseListTemplateOrIsoPermissionsCmd; import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import org.apache.log4j.Logger; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java index a1464ccdc4e..c48534e0bd1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/ListTemplatesCmd.java @@ -20,17 +20,15 @@ import java.util.ArrayList; import java.util.List; import java.util.Set; -import com.cloud.storage.template.TemplateInfo; -import org.apache.cloudstack.api.response.UserVmResponse; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.template.VirtualMachineTemplate.TemplateFilter; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java index b3677b9d3a1..c9da0c28cd6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/RegisterTemplateCmd.java @@ -21,19 +21,20 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.GuestOSResponse; +import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.exception.ResourceAllocationException; import com.cloud.template.VirtualMachineTemplate; @@ -109,7 +110,11 @@ public class RegisterTemplateCmd extends BaseCmd { @Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class, description="Register template for the project") private Long projectId; - + + @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING, + description="Image store uuid") + private String imageStoreUuid; + @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="Template details in key/value pairs.") protected Map details; @@ -188,6 +193,10 @@ public class RegisterTemplateCmd extends BaseCmd { public String getTemplateTag() { return templateTag; } + + public String getImageStoreUuid() { + return this.imageStoreUuid; + } public Map getDetails() { if (details == null || details.isEmpty()) { @@ -233,11 +242,11 @@ public class RegisterTemplateCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to register template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to register template"); } } catch (URISyntaxException ex1) { s_logger.info(ex1); - throw new ServerApiException(BaseCmd.PARAM_ERROR, ex1.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex1.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java index 01ea200293e..3987dbedc3e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplateCmd.java @@ -16,13 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.template; -import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoCmd; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.TemplateResponse; +import org.apache.log4j.Logger; + import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; @@ -73,7 +73,7 @@ public class UpdateTemplateCmd extends BaseUpdateTemplateOrIsoCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update template"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java index 8f3e660bd1a..e44969e1313 100644 --- a/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/template/UpdateTemplatePermissionsCmd.java @@ -16,11 +16,11 @@ // under the License. package org.apache.cloudstack.api.command.user.template; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.BaseUpdateTemplateOrIsoPermissionsCmd; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.template.VirtualMachineTemplate; import com.cloud.user.Account; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java new file mode 100644 index 00000000000..43340008e16 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vm/AddNicToVMCmd.java @@ -0,0 +1,121 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.vm; + +import java.util.ArrayList; +import java.util.EnumSet; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ApiConstants.VMDetails; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.NetworkResponse; +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; + +@APICommand(name = "addNicToVirtualMachine", description="Adds VM to specified network by creating a NIC", responseObject=UserVmResponse.class) + +public class AddNicToVMCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger.getLogger(AddNicToVMCmd.class); + private static final String s_name = "addnictovirtualmachineresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, + required=true, description="Virtual Machine ID") + private Long vmId; + + @Parameter(name=ApiConstants.NETWORK_ID, type=CommandType.UUID, entityType=NetworkResponse.class, + required=true, description="Network ID") + private Long netId; + + @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="IP Address for the new network") + private String ipaddr; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getVmId() { + return vmId; + } + + public Long getNetworkId() { + return netId; + } + + public String getIpAddress() { + return ipaddr; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + public static String getResultObjectName() { + return "virtualmachine"; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NIC_CREATE; + } + + @Override + public String getEventDescription() { + return "Adding network " + getNetworkId() + " to user vm: " + getVmId(); + } + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmById(getVmId()); + if (vm == null) { + return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked + } + return vm.getAccountId(); + } + + @Override + public void execute(){ + UserContext.current().setEventDetails("Vm Id: " + getVmId() + " Network Id: " + getNetworkId()); + UserVm result = _userVmService.addNicToVirtualMachine(this); + ArrayList dc = new ArrayList(); + dc.add(VMDetails.valueOf("nics")); + EnumSet details = EnumSet.copyOf(dc); + if (result != null){ + UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add NIC to vm. Refer to server logs for details."); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java old mode 100644 new mode 100755 index e675c83dd6f..0ac6476cf43 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DeployVMCmd.java @@ -24,11 +24,13 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.HostResponse; @@ -39,6 +41,8 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; @@ -51,6 +55,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.IpAddress; import com.cloud.network.Network; +import com.cloud.network.Network.IpAddresses; import com.cloud.offering.DiskOffering; import com.cloud.offering.ServiceOffering; import com.cloud.template.VirtualMachineTemplate; @@ -146,15 +151,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { "Mutually exclusive with securitygroupids parameter") private List securityGroupNameList; - @ACL(checkKeyAccess=true) - @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, entityType={Network.class, IpAddress.class}, + @Parameter(name = ApiConstants.IP_NETWORK_LIST, type = CommandType.MAP, description = "ip to network mapping. Can't be specified with networkIds parameter." + - " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid") + " Example: iptonetworklist[0].ip=10.10.10.11&iptonetworklist[0].ipv6=fc00:1234:5678::abcd&iptonetworklist[0].networkid=uuid - requests to use ip 10.10.10.11 in network id=uuid") private Map ipToNetworkList; @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="the ip address for default vm's network") private String ipAddress; + @Parameter(name=ApiConstants.IP6_ADDRESS, type=CommandType.STRING, description="the ipv6 address for default vm's network") + private String ip6Address; + @Parameter(name=ApiConstants.KEYBOARD, type=CommandType.STRING, description="an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us") private String keyboard; @@ -245,7 +252,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { public List getNetworkIds() { if (ipToNetworkList != null) { - if (networkIds != null || ipAddress != null) { + if (networkIds != null || ipAddress != null || getIp6Address() != null) { throw new InvalidParameterValueException("ipToNetworkMap can't be specified along with networkIds or ipAddress"); } else { List networks = new ArrayList(); @@ -272,13 +279,13 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { return startVm == null ? true : startVm; } - private Map getIpToNetworkMap() { - if ((networkIds != null || ipAddress != null) && ipToNetworkList != null) { + private Map getIpToNetworkMap() { + if ((networkIds != null || ipAddress != null || getIp6Address() != null) && ipToNetworkList != null) { throw new InvalidParameterValueException("NetworkIds and ipAddress can't be specified along with ipToNetworkMap parameter"); } - LinkedHashMap ipToNetworkMap = null; + LinkedHashMap ipToNetworkMap = null; if (ipToNetworkList != null && !ipToNetworkList.isEmpty()) { - ipToNetworkMap = new LinkedHashMap(); + ipToNetworkMap = new LinkedHashMap(); Collection ipsCollection = ipToNetworkList.values(); Iterator iter = ipsCollection.iterator(); while (iter.hasNext()) { @@ -295,13 +302,25 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { } } String requestedIp = (String) ips.get("ip"); - ipToNetworkMap.put(networkId, requestedIp); + String requestedIpv6 = (String) ips.get("ipv6"); + if (requestedIpv6 != null) { + requestedIpv6 = requestedIpv6.toLowerCase(); + } + IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6); + ipToNetworkMap.put(networkId, addrs); } } return ipToNetworkMap; } + public String getIp6Address() { + if (ip6Address == null) { + return null; + } + return ip6Address.toLowerCase(); + } + ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// @@ -357,21 +376,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { if (getStartVm()) { try { UserContext.current().setEventDetails("Vm Id: "+getEntityId()); - if (getHypervisor() == HypervisorType.BareMetal) { - result = _bareMetalVmService.startVirtualMachine(this); - } else { - result = _userVmService.startVirtualMachine(this); - } + result = _userVmService.startVirtualMachine(this); } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); - s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + s_logger.info(ex.getMessage(), ex); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } else { result = _userVmService.getUserVm(getEntityId()); @@ -382,7 +397,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm"); } } @@ -426,27 +441,24 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { } UserVm vm = null; - if (getHypervisor() == HypervisorType.BareMetal) { - vm = _bareMetalVmService.createVirtualMachine(this); - } else { - if (zone.getNetworkType() == NetworkType.Basic) { - if (getNetworkIds() != null) { - throw new InvalidParameterValueException("Can't specify network Ids in Basic zone"); - } else { - vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, - displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard); - } + IpAddresses addrs = new IpAddresses(ipAddress, getIp6Address()); + if (zone.getNetworkType() == NetworkType.Basic) { + if (getNetworkIds() != null) { + throw new InvalidParameterValueException("Can't specify network Ids in Basic zone"); } else { - if (zone.isSecurityGroupEnabled()) { - vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), - owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard); - } else { - if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) { - throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone"); - } - vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName, - diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), ipAddress, keyboard); + vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, + displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard); + } + } else { + if (zone.isSecurityGroupEnabled()) { + vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), + owner, name, displayName, diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard); + } else { + if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) { + throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone"); } + vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName, + diskOfferingId, size, group, getHypervisor(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, keyboard); } } @@ -454,18 +466,19 @@ public class DeployVMCmd extends BaseAsyncCreateCmd { setEntityId(vm.getId()); setEntityUuid(vm.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to deploy vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm"); } } catch (InsufficientCapacityException ex) { s_logger.info(ex); - s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + s_logger.trace(ex.getMessage(), ex); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } + } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java index db830d1a188..567768dee13 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/DestroyVMCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.UserVmResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -93,18 +97,14 @@ public class DestroyVMCmd extends BaseAsyncCmd { public void execute() throws ResourceUnavailableException, ConcurrentOperationException{ UserContext.current().setEventDetails("Vm Id: "+getId()); UserVm result; - if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { - result = _bareMetalVmService.destroyVm(this); - } else { - result = _userVmService.destroyVm(this); - } + result = _userVmService.destroyVm(this); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); response.setResponseName("virtualmachine"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to destroy vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to destroy vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java index cd3a5609d8c..839f9378db5 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/GetVMPasswordCmd.java @@ -19,13 +19,13 @@ package org.apache.cloudstack.api.command.user.vm; import java.security.InvalidParameterException; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.GetVMPasswordResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.uservm.UserVm; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java index b74c8e70f13..30f03b88995 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java @@ -20,14 +20,11 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants.VMDetails; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; - import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.IsoVmResponse; @@ -39,6 +36,7 @@ import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; import com.cloud.async.AsyncJob; import com.cloud.exception.InvalidParameterValueException; diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java index 45ebc287913..6838b9613db 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RebootVMCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientCapacityException; @@ -96,18 +96,14 @@ public class RebootVMCmd extends BaseAsyncCmd { public void execute() throws ResourceUnavailableException, InsufficientCapacityException{ UserContext.current().setEventDetails("Vm Id: "+getId()); UserVm result; - if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { - result = _bareMetalVmService.rebootVirtualMachine(this); - } else { - result = _userVmService.rebootVirtualMachine(this); - } + result = _userVmService.rebootVirtualMachine(this); if (result !=null){ UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reboot vm instance"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reboot vm instance"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java new file mode 100644 index 00000000000..b1a870ec8f6 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RemoveNicFromVMCmd.java @@ -0,0 +1,115 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.vm; + +import java.util.ArrayList; +import java.util.EnumSet; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ApiConstants.VMDetails; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.NicResponse; +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; + +@APICommand(name = "removeNicFromVirtualMachine", description="Removes VM from specified network by deleting a NIC", responseObject=UserVmResponse.class) + +public class RemoveNicFromVMCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger.getLogger(RemoveNicFromVMCmd.class); + private static final String s_name = "removenicfromvirtualmachineresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, + required=true, description="Virtual Machine ID") + private Long vmId; + + @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType=NicResponse.class, + required=true, description="NIC ID") + private Long nicId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getVmId() { + return vmId; + } + + public Long getNicId() { + return nicId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + public static String getResultObjectName() { + return "virtualmachine"; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NIC_DELETE; + } + + @Override + public String getEventDescription() { + return "Removing NIC " + getNicId() + " from user vm: " + getVmId(); + } + + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmById(getVmId()); + if (vm == null) { + return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked + } + return vm.getAccountId(); + } + + @Override + public void execute(){ + UserContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId()); + UserVm result = _userVmService.removeNicFromVirtualMachine(this); + ArrayList dc = new ArrayList(); + dc.add(VMDetails.valueOf("nics")); + EnumSet details = EnumSet.copyOf(dc); + if (result != null){ + UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove NIC from vm, see error log for details"); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java index a4c2b3772e9..80f3e852ea6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMPasswordCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InsufficientCapacityException; @@ -116,7 +116,7 @@ public class ResetVMPasswordCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset vm password"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm password"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java new file mode 100644 index 00000000000..3d1da155fcf --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vm/ResetVMSSHKeyCmd.java @@ -0,0 +1,151 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.user.vm; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import com.cloud.async.AsyncJob; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; +import com.cloud.event.EventTypes; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; + +@APICommand(name = "resetSSHKeyForVirtualMachine", responseObject = UserVmResponse.class, description = "Resets the SSH Key for virtual machine. " + + "The virtual machine must be in a \"Stopped\" state. [async]") +public class ResetVMSSHKeyCmd extends BaseAsyncCmd { + + public static final Logger s_logger = Logger.getLogger(ResetVMSSHKeyCmd.class.getName()); + + private static final String s_name = "resetSSHKeyforvirtualmachineresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine") + private Long id; + + @Parameter(name = ApiConstants.SSH_KEYPAIR, type = CommandType.STRING, required = true, description = "name of the ssh key pair used to login to the virtual machine") + private String name; + + + //Owner information + @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional account for the ssh key. Must be used with domainId.") + private String accountName; + + @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId for the virtual machine. If the account parameter is used, domainId must also be used.") + private Long domainId; + + @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "an optional project for the ssh key") + private Long projectId; + + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public String getName() { + return name; + } + + + public Long getId() { + return id; + } + + public String getAccountName() { + return accountName; + } + + public Long getDomainId() { + return domainId; + } + + public Long getProjectId() { + return projectId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_RESETSSHKEY; + } + + @Override + public String getEventDescription() { + return "resetting SSHKey for vm: " + getId(); + } + + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.VirtualMachine; + } + + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmById(getId()); + if (vm != null) { + return vm.getAccountId(); + } + + return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked + } + + public Long getInstanceId() { + return getId(); + } + + + @Override + public void execute() throws ResourceUnavailableException, + InsufficientCapacityException { + + UserContext.current().setEventDetails("Vm Id: " + getId()); + UserVm result = _userVmService.resetVMSSHKey(this); + + if (result != null) { + UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset vm SSHKey"); + } + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java index 9b2452e355d..9c33f97c317 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/RestoreVMCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.TemplateResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -34,7 +35,7 @@ import com.cloud.user.Account; import com.cloud.user.UserContext; import com.cloud.uservm.UserVm; -@APICommand(name = "restoreVirtualMachine", description="Restore a VM to original template or specific snapshot", responseObject=UserVmResponse.class, since="3.0.0") +@APICommand(name = "restoreVirtualMachine", description="Restore a VM to original template or new template", responseObject=UserVmResponse.class, since="3.0.0") public class RestoreVMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(RestoreVMCmd.class); private static final String s_name = "restorevmresponse"; @@ -43,6 +44,9 @@ public class RestoreVMCmd extends BaseAsyncCmd { required=true, description="Virtual Machine ID") private Long vmId; + @Parameter(name=ApiConstants.TEMPLATE_ID, type=CommandType.UUID, entityType = TemplateResponse.class, description="an optional template Id to restore vm from the new template") + private Long templateId; + @Override public String getEventType() { return EventTypes.EVENT_VM_RESTORE; @@ -64,7 +68,7 @@ public class RestoreVMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restore vm " + getVmId()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restore vm " + getVmId()); } } @@ -85,4 +89,8 @@ public class RestoreVMCmd extends BaseAsyncCmd { public long getVmId() { return vmId; } + + public Long getTemplateId() { + return templateId; + } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java index 36199d13c24..3012780cb81 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/StartVMCmd.java @@ -16,13 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.HostResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -114,28 +117,24 @@ public class StartVMCmd extends BaseAsyncCmd { UserContext.current().setEventDetails("Vm Id: " + getId()); UserVm result ; - if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { - result = _bareMetalVmService.startVirtualMachine(this); - } else { - result = _userVmService.startVirtualMachine(this); - } + result = _userVmService.startVirtualMachine(this); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to start a vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to start a vm"); } } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (StorageUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ExecutionException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java index 8e589060520..d66c33422bf 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/StopVMCmd.java @@ -16,11 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.UserVmResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; @@ -109,18 +114,14 @@ public class StopVMCmd extends BaseAsyncCmd { UserContext.current().setEventDetails("Vm Id: " + getId()); UserVm result; - if (_userVmService.getHypervisorTypeOfUserVM(getId()) == HypervisorType.BareMetal) { - result = _bareMetalVmService.stopVirtualMachine(getId(), isForced()); - } else { - result = _userVmService.stopVirtualMachine(getId(), isForced()); - } + result = _userVmService.stopVirtualMachine(getId(), isForced()); if (result != null) { UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to stop vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to stop vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java new file mode 100644 index 00000000000..07518c90928 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateDefaultNicForVMCmd.java @@ -0,0 +1,115 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.vm; + +import java.util.ArrayList; +import java.util.EnumSet; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.ApiConstants.VMDetails; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.NicResponse; +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; + +@APICommand(name = "updateDefaultNicForVirtualMachine", description="Changes the default NIC on a VM", responseObject=UserVmResponse.class) + +public class UpdateDefaultNicForVMCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger.getLogger(UpdateDefaultNicForVMCmd.class); + private static final String s_name = "updatedefaultnicforvirtualmachineresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.VIRTUAL_MACHINE_ID, type=CommandType.UUID, entityType=UserVmResponse.class, + required=true, description="Virtual Machine ID") + private Long vmId; + + @Parameter(name=ApiConstants.NIC_ID, type=CommandType.UUID, entityType=NicResponse.class, + required=true, description="NIC ID") + private Long nicId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getVmId() { + return vmId; + } + + public Long getNicId() { + return nicId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + public static String getResultObjectName() { + return "virtualmachine"; + } + + @Override + public String getEventType() { + return EventTypes.EVENT_NIC_UPDATE; + } + + @Override + public String getEventDescription() { + return "Updating NIC " + getNicId() + " on user vm: " + getVmId(); + } + + + @Override + public long getEntityOwnerId() { + UserVm vm = _responseGenerator.findUserVmById(getVmId()); + if (vm == null) { + return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked + } + return vm.getAccountId(); + } + + @Override + public void execute(){ + UserContext.current().setEventDetails("Vm Id: "+getVmId() + " Nic Id: " + getNicId()); + UserVm result = _userVmService.updateDefaultNicForVirtualMachine(this); + ArrayList dc = new ArrayList(); + dc.add(VMDetails.valueOf("nics")); + EnumSet details = EnumSet.copyOf(dc); + if (result != null){ + UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", details, result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to set default nic for VM. Refer to server logs for details."); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java index 7f1e7efdc1a..ff8fff1c19f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpdateVMCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; - import org.apache.cloudstack.api.response.GuestOSResponse; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.user.Account; @@ -126,7 +126,7 @@ public class UpdateVMCmd extends BaseCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java index f2c3882bd3c..6719b8f0682 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vm/UpgradeVMCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vm; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; +import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; - -import org.apache.cloudstack.api.response.DiskOfferingResponse; -import org.apache.cloudstack.api.response.UserVmResponse; import com.cloud.exception.InvalidParameterValueException; import com.cloud.offering.ServiceOffering; import com.cloud.user.Account; @@ -44,7 +48,7 @@ public class UpgradeVMCmd extends BaseCmd { required=true, description="The ID of the virtual machine") private Long id; - @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class, + @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class, required=true, description="the service offering ID to apply to the virtual machine") private Long serviceOfferingId; @@ -98,7 +102,7 @@ public class UpgradeVMCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upgrade vm"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java index 9c2c6027ac9..bcb7bdaebbd 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/CreateVMGroupCmd.java @@ -16,14 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vmgroup; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.ProjectAccountResponse; +import org.apache.log4j.Logger; + import com.cloud.user.UserContext; import com.cloud.vm.InstanceGroup; @@ -99,7 +102,7 @@ public class CreateVMGroupCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create vm instance group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create vm instance group"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java index 47c2f764db6..641b6ced232 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/DeleteVMGroupCmd.java @@ -16,13 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vmgroup; -import org.apache.cloudstack.api.*; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.APICommand; - +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; @@ -73,7 +76,7 @@ public class DeleteVMGroupCmd extends BaseCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete vm group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm group"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java index 8a581b02e12..5a7ce273ede 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/ListVMGroupsCmd.java @@ -16,14 +16,13 @@ // under the License. package org.apache.cloudstack.api.command.user.vmgroup; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; @APICommand(name = "listInstanceGroups", description="Lists vm groups", responseObject=InstanceGroupResponse.class) public class ListVMGroupsCmd extends BaseListProjectAndAccountResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java index 09313c0f797..83a1a1d0e0b 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vmgroup/UpdateVMGroupCmd.java @@ -16,11 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vmgroup; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.InstanceGroupResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.InstanceGroupResponse; import com.cloud.user.Account; import com.cloud.vm.InstanceGroup; @@ -80,7 +84,7 @@ public class UpdateVMGroupCmd extends BaseCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update vm instance group"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update vm instance group"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java new file mode 100644 index 00000000000..f0dbf16b250 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java @@ -0,0 +1,125 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.user.vmsnapshot; + +import java.util.logging.Logger; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VMSnapshotResponse; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; +import com.cloud.vm.snapshot.VMSnapshot; + +@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class) +public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd { + + public static final Logger s_logger = Logger + .getLogger(CreateVMSnapshotCmd.class.getName()); + private static final String s_name = "createvmsnapshotresponse"; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType=UserVmResponse.class, description = "The ID of the vm") + private Long vmId; + + @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The discription of the snapshot") + private String description; + + @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot") + private String displayName; + + @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true") + private Boolean snapshotMemory; + + public Boolean snapshotMemory() { + if (snapshotMemory == null) { + return false; + } else { + return snapshotMemory; + } + } + + public String getDisplayName() { + return displayName; + } + + public String getDescription() { + return description; + } + + public Long getVmId() { + return vmId; + } + + @Override + public void create() throws ResourceAllocationException { + VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(),getDisplayName(),getDescription(),snapshotMemory()); + if (vmsnapshot != null) { + this.setEntityId(vmsnapshot.getId()); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, + "Failed to create vm snapshot"); + } + } + + @Override + public String getEventDescription() { + return "creating snapshot for VM: " + getVmId(); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_SNAPSHOT_CREATE; + } + + @Override + public void execute() { + UserContext.current().setEventDetails("VM Id: " + getVmId()); + VMSnapshot result = _vmSnapshotService.creatVMSnapshot(getVmId(),getEntityId()); + if (result != null) { + VMSnapshotResponse response = _responseGenerator + .createVMSnapshotResponse(result); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException( + ApiErrorCode.INTERNAL_ERROR, + "Failed to create vm snapshot due to an internal error creating snapshot for vm " + + getVmId()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + UserVm userVM = _userVmService.getUserVm(vmId); + return userVM.getAccountId(); + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java new file mode 100644 index 00000000000..a2b2c08b381 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.user.vmsnapshot; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.VMSnapshotResponse; +import org.apache.log4j.Logger; + +import com.cloud.event.EventTypes; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.vm.snapshot.VMSnapshot; + +@APICommand(name="deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class) +public class DeleteVMSnapshotCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger + .getLogger(DeleteVMSnapshotCmd.class.getName()); + private static final String s_name = "deletevmsnapshotresponse"; + + @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class, + required=true, description="The ID of the VM snapshot") + private Long id; + + public Long getId() { + return id; + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getId()); + if (vmSnapshot != null) { + return vmSnapshot.getAccountId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute() { + UserContext.current().setEventDetails("vmsnapshot id: " + getId()); + boolean result = _vmSnapshotService.deleteVMSnapshot(getId()); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot"); + } + } + + @Override + public String getEventDescription() { + return "Delete VM snapshot: " + getId(); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_SNAPSHOT_DELETE; + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java new file mode 100644 index 00000000000..936d348950d --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package org.apache.cloudstack.api.command.user.vmsnapshot; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VMSnapshotResponse; + +import com.cloud.vm.snapshot.VMSnapshot; + +@APICommand(name="listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class) +public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd { + + private static final String s_name = "listvmsnapshotresponse"; + + @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class, + description="The ID of the VM snapshot") + private Long id; + + @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine snapshot") + private String state; + + @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType=UserVmResponse.class, description = "the ID of the vm") + private Long vmId; + + @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name or display name") + private String vmSnapshotName; + + public String getState() { + return state; + } + + public String getVmSnapshotName() { + return vmSnapshotName; + } + + public Long getVmId() { + return vmId; + } + + public Long getId() { + return id; + } + + @Override + public void execute() { + List result = _vmSnapshotService + .listVMSnapshots(this); + ListResponse response = new ListResponse(); + List snapshotResponses = new ArrayList(); + for (VMSnapshot r : result) { + VMSnapshotResponse vmSnapshotResponse = _responseGenerator + .createVMSnapshotResponse(r); + vmSnapshotResponse.setObjectName("vmSnapshot"); + snapshotResponses.add(vmSnapshotResponse); + } + response.setResponses(snapshotResponses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } + + @Override + public String getCommandName() { + return s_name; + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java new file mode 100644 index 00000000000..d7b4599d6c4 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java @@ -0,0 +1,92 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.vmsnapshot; + +import java.util.logging.Logger; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VMSnapshotResponse; + +import com.cloud.event.EventTypes; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.UserContext; +import com.cloud.uservm.UserVm; +import com.cloud.vm.snapshot.VMSnapshot; + +@APICommand(name = "revertToSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class) +public class RevertToSnapshotCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger + .getLogger(RevertToSnapshotCmd.class.getName()); + private static final String s_name = "reverttosnapshotresponse"; + + @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot") + private Long vmSnapShotId; + + public Long getVmSnapShotId() { + return vmSnapShotId; + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId()); + if (vmSnapshot != null) { + return vmSnapshot.getAccountId(); + } + return Account.ACCOUNT_ID_SYSTEM; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException { + UserContext.current().setEventDetails( + "vmsnapshot id: " + getVmSnapShotId()); + UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId()); + if (result != null) { + UserVmResponse response = _responseGenerator.createUserVmResponse( + "virtualmachine", result).get(0); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot"); + } + } + + @Override + public String getEventDescription() { + return "Revert from VM snapshot: " + getVmSnapShotId(); + } + + @Override + public String getEventType() { + return EventTypes.EVENT_VM_SNAPSHOT_REVERT; + } + +} diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java index e48e4e43093..e577e35795e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.response.UserVmResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.storage.Volume; @@ -119,13 +119,13 @@ public class AttachVolumeCmd extends BaseAsyncCmd { @Override public void execute(){ UserContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId()); - Volume result = _userVmService.attachVolumeToVM(this); + Volume result = _volumeService.attachVolumeToVM(this); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to attach volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to attach volume"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java index 04541b9fda7..5db06bcd47f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/CreateVolumeCmd.java @@ -16,15 +16,20 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.response.*; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.SnapshotResponse; +import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceAllocationException; @@ -148,19 +153,19 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd { @Override public void create() throws ResourceAllocationException{ - Volume volume = _storageService.allocVolume(this); + Volume volume = this._volumeService.allocVolume(this); if (volume != null) { this.setEntityId(volume.getId()); this.setEntityUuid(volume.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create volume"); } } @Override public void execute(){ UserContext.current().setEventDetails("Volume Id: "+getEntityId()+((getSnapshotId() == null) ? "" : " from snapshot: " + getSnapshotId())); - Volume volume = _storageService.createVolume(this); + Volume volume = _volumeService.createVolume(this); if (volume != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(volume); //FIXME - have to be moved to ApiResponseHelper @@ -179,7 +184,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a volume"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java index 2b2e94cab6b..394b0092123 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/DeleteVolumeCmd.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.response.VolumeResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + import com.cloud.exception.ConcurrentOperationException; import com.cloud.storage.Volume; import com.cloud.user.Account; @@ -79,12 +80,12 @@ public class DeleteVolumeCmd extends BaseCmd { @Override public void execute() throws ConcurrentOperationException { UserContext.current().setEventDetails("Volume Id: "+getId()); - boolean result = _storageService.deleteVolume(id, UserContext.current().getCaller()); + boolean result = this._volumeService.deleteVolume(id, UserContext.current().getCaller()); if (result) { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete volume"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java index c8ecddea699..9a5929eccca 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/DetachVolumeCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VolumeResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.storage.Volume; @@ -126,13 +130,13 @@ public class DetachVolumeCmd extends BaseAsyncCmd { @Override public void execute(){ UserContext.current().setEventDetails("Volume Id: "+getId()+" VmId: "+getVirtualMachineId()); - Volume result = _userVmService.detachVolumeFromVM(this); + Volume result = _volumeService.detachVolumeFromVM(this); if (result != null){ VolumeResponse response = _responseGenerator.createVolumeResponse(result); response.setResponseName("volume"); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to detach volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to detach volume"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java index 43b25a83663..b86155b2a6c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ExtractVolumeCmd.java @@ -18,17 +18,17 @@ package org.apache.cloudstack.api.command.user.volume; import java.net.URISyntaxException; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ExtractResponse; import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.ExtractResponse; import com.cloud.async.AsyncJob; import com.cloud.dc.DataCenter; import com.cloud.event.EventTypes; @@ -148,11 +148,11 @@ public class ExtractVolumeCmd extends BaseAsyncCmd { response.setUrl(uploadInfo.getUploadUrl()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to extract volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to extract volume"); } } catch (URISyntaxException ex) { s_logger.info(ex); - throw new ServerApiException(BaseCmd.PARAM_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java index 9ba4f346869..4c78eedeb08 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ListVolumesCmd.java @@ -16,13 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.response.*; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.response.UserVmResponse; +import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java index 30e672ada1b..287241a8d90 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/MigrateVolumeCmd.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.VolumeResponse; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.storage.Volume; @@ -91,14 +92,14 @@ public class MigrateVolumeCmd extends BaseAsyncCmd { public void execute(){ Volume result; try { - result = _storageService.migrateVolume(getVolumeId(), getStoragePoolId()); + result = _volumeService.migrateVolume(this); if (result != null) { VolumeResponse response = _responseGenerator.createVolumeResponse(result); response.setResponseName(getCommandName()); this.setResponseObject(response); } } catch (ConcurrentOperationException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to migrate volume: "); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to migrate volume: "); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java new file mode 100644 index 00000000000..955727a7d82 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java @@ -0,0 +1,146 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.volume; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DiskOfferingResponse; +import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.log4j.Logger; + +import com.cloud.async.AsyncJob; +import com.cloud.event.EventTypes; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.projects.Project; +import com.cloud.storage.Volume; +import com.cloud.user.Account; +import com.cloud.user.UserContext; + + +@APICommand(name="resizeVolume", description="Resizes a volume", responseObject=VolumeResponse.class) +public class ResizeVolumeCmd extends BaseAsyncCmd { + public static final Logger s_logger = Logger.getLogger(ResizeVolumeCmd.class.getName()); + + private static final String s_name = "resizevolumeresponse"; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.ID, entityType=VolumeResponse.class, type=CommandType.UUID, description="the ID of the disk volume") + private Long id; + + @Parameter(name=ApiConstants.SIZE, type=CommandType.LONG, required=false, description="New volume size in G") + private Long size; + + @Parameter(name=ApiConstants.SHRINK_OK, type=CommandType.BOOLEAN, required=false, description="Verify OK to Shrink") + private boolean shrinkOk; + + @Parameter(name=ApiConstants.DISK_OFFERING_ID, entityType=DiskOfferingResponse.class, type=CommandType.UUID, required=false, description="new disk offering id") + private Long newDiskOfferingId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getEntityId() { + return id; + } + + public Long getSize() { + return size; + } + + public boolean getShrinkOk() { + return shrinkOk; + } + + public Long getNewDiskOfferingId() { + return newDiskOfferingId; + } + + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public AsyncJob.Type getInstanceType() { + return AsyncJob.Type.Volume; + } + + public static String getResultObjectName() { + return "volume"; + } + + @Override + public long getEntityOwnerId() { + + Volume volume = _entityMgr.findById(Volume.class, getEntityId()); + if (volume == null) { + throw new InvalidParameterValueException("Unable to find volume by id=" + id); + } + + Account account = _accountService.getAccount(volume.getAccountId()); + //Can resize volumes for enabled projects/accounts only + if (account.getType() == Account.ACCOUNT_TYPE_PROJECT) { + Project project = _projectService.findByProjectAccountId(volume.getAccountId()); + if (project.getState() != Project.State.Active) { + throw new PermissionDeniedException("Can't add resources to project id=" + project.getId() + " in state=" + project.getState() + " as it's no longer active"); + } + } else if (account.getState() == Account.State.disabled) { + throw new PermissionDeniedException("The owner of volume " + id + " is disabled: " + account); + } + + return volume.getAccountId(); + } + + + @Override + public String getEventType() { + return EventTypes.EVENT_VOLUME_RESIZE; + } + + @Override + public String getEventDescription() { + return "Volume Id: " + getEntityId() + " to size " + getSize() + "G" ; + } + + @Override + public void execute(){ + UserContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G"); + Volume volume = _volumeService.resizeVolume(this); + if (volume != null) { + VolumeResponse response = _responseGenerator.createVolumeResponse(volume); + //FIXME - have to be moved to ApiResponseHelper + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to resize volume"); + } + } +} diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java index 4167ffd6460..3b00ba0d4bb 100644 --- a/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/volume/UploadVolumeCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.volume; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.VolumeResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VolumeResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -63,6 +67,10 @@ public class UploadVolumeCmd extends BaseAsyncCmd { @Parameter(name=ApiConstants.CHECKSUM, type=CommandType.STRING, description="the MD5 checksum value of this volume") private String checksum; + + @Parameter(name=ApiConstants.IMAGE_STORE_UUID, type=CommandType.STRING, + description="Image store uuid") + private String imageStoreUuid; ///////////////////////////////////////////////////// /////////////////// Accessors /////////////////////// @@ -95,6 +103,10 @@ public class UploadVolumeCmd extends BaseAsyncCmd { public String getChecksum() { return checksum; } + + public String getImageStoreUuid() { + return this.imageStoreUuid; + } ///////////////////////////////////////////////////// /////////////// API Implementation/////////////////// @@ -106,13 +118,13 @@ public class UploadVolumeCmd extends BaseAsyncCmd { ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { - Volume volume = _storageService.uploadVolume(this); + Volume volume = _volumeService.uploadVolume(this); if (volume != null){ VolumeResponse response = _responseGenerator.createVolumeResponse(volume); response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to upload volume"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upload volume"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java index 96de56a5be5..76a76d6ddb0 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateStaticRouteCmd.java @@ -16,16 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; -import org.apache.cloudstack.api.response.PrivateGatewayResponse; -import org.apache.log4j.Logger; +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.StaticRouteResponse; +import org.apache.log4j.Logger; + import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -71,7 +72,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{ } catch (NetworkRuleConflictException ex) { s_logger.info("Network rule conflict: " + ex.getMessage()); s_logger.trace("Network rule conflict: ", ex); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, ex.getMessage()); } } @@ -105,7 +106,7 @@ public class CreateStaticRouteCmd extends BaseAsyncCreateCmd{ } finally { if (!success || route == null) { _vpcService.revokeStaticRoute(getEntityId()); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create static route"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create static route"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java index 8a2e1f641fb..04a77888d9d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/CreateVPCCmd.java @@ -16,19 +16,19 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ProjectResponse; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.cloudstack.api.response.VpcOfferingResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ProjectResponse; +import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -126,7 +126,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ this.setEntityId(vpc.getId()); this.setEntityUuid(vpc.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create a VPC"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create a VPC"); } } @@ -139,14 +139,14 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } if (vpc != null) { @@ -154,7 +154,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPC"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPC"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java index c9e4463db14..e43412a19f8 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteStaticRouteCmd.java @@ -16,13 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.StaticRouteResponse; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.async.AsyncJob; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; @@ -95,7 +99,7 @@ public class DeleteStaticRouteCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete static route"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete static route"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java index ed4e754f736..18866beb06d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/DeleteVPCCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.VpcResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ResourceUnavailableException; @@ -71,14 +75,14 @@ public class DeleteVPCCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete VPC"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete VPC"); } }catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java index 08da25df279..12b58224fca 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListPrivateGatewaysCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PrivateGatewayResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.network.vpc.PrivateGateway; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java index e9fada0a314..ab69d4a3ef4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListStaticRoutesCmd.java @@ -18,16 +18,18 @@ package org.apache.cloudstack.api.command.user.vpc; import java.util.ArrayList; import java.util.List; + +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.PrivateGatewayResponse; import org.apache.cloudstack.api.response.StaticRouteResponse; +import org.apache.cloudstack.api.response.VpcResponse; + import com.cloud.network.vpc.StaticRoute; import com.cloud.utils.Pair; -import org.apache.cloudstack.api.response.VpcResponse; @APICommand(name = "listStaticRoutes", description="Lists all static routes", responseObject=StaticRouteResponse.class) public class ListStaticRoutesCmd extends BaseListTaggedResourcesCmd { diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java index f776302d3c1..9aef26f016c 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCOfferingsCmd.java @@ -19,14 +19,14 @@ package org.apache.cloudstack.api.command.user.vpc; import java.util.ArrayList; import java.util.List; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.log4j.Logger; + import com.cloud.network.vpc.VpcOffering; @APICommand(name = "listVPCOfferings", description="Lists VPC offerings", responseObject=VpcOfferingResponse.class) diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java index 6d3c8bd06c7..b6bc68f9f4e 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/ListVPCsCmd.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.user.vpc; import java.util.ArrayList; import java.util.List; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.cloudstack.api.response.ZoneResponse; -import org.apache.cloudstack.api.response.VpcOfferingResponse; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.cloudstack.api.response.ListResponse; -import org.apache.log4j.Logger; - +import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListTaggedResourcesCmd; -import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.VpcOfferingResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.network.vpc.Vpc; @@ -64,15 +64,6 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ , description="list by ID of the VPC offering") private Long VpcOffId; - @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="list by account associated with the VPC. " + - "Must be used with the domainId parameter.") - private String accountName; - - @Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType=DomainResponse.class, - description="list by domain ID associated with the VPC. " + - "If used with the account parameter returns the VPC associated with the account for the specified domain.") - private Long domainId; - @Parameter(name=ApiConstants.SUPPORTED_SERVICES, type=CommandType.LIST, collectionType=CommandType.STRING, description="list VPC supporting certain services") private List supportedServices; @@ -87,14 +78,6 @@ public class ListVPCsCmd extends BaseListTaggedResourcesCmd{ /////////////////// Accessors /////////////////////// ///////////////////////////////////////////////////// - public String getAccountName() { - return accountName; - } - - public Long getDomainId() { - return domainId; - } - public Long getZoneId() { return zoneId; } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java index 4a23e6e6595..bd56c744a2f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/RestartVPCCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.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.SuccessResponse; import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -78,18 +82,18 @@ public class RestartVPCCmd extends BaseAsyncCmd{ SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to restart VPC"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to restart VPC"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } catch (ConcurrentOperationException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage()); } catch (InsufficientCapacityException ex) { s_logger.info(ex); s_logger.trace(ex); - throw new ServerApiException(BaseCmd.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java index 2dc64dba267..2cc3c98b087 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpc/UpdateVPCCmd.java @@ -16,15 +16,15 @@ // under the License. package org.apache.cloudstack.api.command.user.vpc; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.network.vpc.Vpc; import com.cloud.user.Account; @@ -92,7 +92,7 @@ public class UpdateVPCCmd extends BaseAsyncCmd{ response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update VPC"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update VPC"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java index f2d19a7cce6..0618e3467b3 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/AddVpnUserCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.VpnUsersResponse; +import org.apache.log4j.Logger; + import com.cloud.domain.Domain; import com.cloud.event.EventTypes; import com.cloud.network.VpnUser; @@ -119,7 +119,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { VpnUser vpnUser = _entityMgr.findById(VpnUser.class, getEntityId()); Account account = _entityMgr.findById(Account.class, vpnUser.getAccountId()); if (!_ravService.applyVpnUsers(vpnUser.getAccountId(), userName)) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user"); } VpnUsersResponse vpnResponse = new VpnUsersResponse(); @@ -144,7 +144,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd { VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password); if (vpnUser == null) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add vpn user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user"); } setEntityId(vpnUser.getId()); setEntityUuid(vpnUser.getUuid()); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java index b517af883c3..ff681a9d1e6 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateRemoteAccessVpnCmd.java @@ -16,13 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -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.DomainResponse; import org.apache.cloudstack.api.response.IPAddressResponse; +import org.apache.cloudstack.api.response.RemoteAccessVpnResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.RemoteAccessVpnResponse; import com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.NetworkRuleConflictException; @@ -148,12 +153,12 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { this.setEntityUuid(ipAddr.getUuid()); } } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); } } catch (NetworkRuleConflictException e) { s_logger.info("Network rule conflict: " + e.getMessage()); s_logger.trace("Network Rule Conflict: ", e); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } } @@ -166,11 +171,11 @@ public class CreateRemoteAccessVpnCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create remote access vpn"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create remote access vpn"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java index 3dc334d0e2a..fee0325e908 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnConnectionCmd.java @@ -16,13 +16,18 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -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.Site2SiteCustomerGatewayResponse; +import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; import com.cloud.event.EventTypes; import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.ResourceUnavailableException; @@ -94,12 +99,12 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { this.setEntityId(conn.getId()); this.setEntityUuid(conn.getUuid()); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection"); } } catch (NetworkRuleConflictException e) { s_logger.info("Network rule conflict: " + e.getMessage()); s_logger.trace("Network Rule Conflict: ", e); - throw new ServerApiException(BaseCmd.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); + throw new ServerApiException(ApiErrorCode.NETWORK_RULE_CONFLICT_ERROR, e.getMessage()); } } @@ -112,11 +117,11 @@ public class CreateVpnConnectionCmd extends BaseAsyncCreateCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create site to site vpn connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create site to site vpn connection"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java index bde98b0b44b..38b40b54c5f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnCustomerGatewayCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.cloudstack.api.response.DomainResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.user.UserContext; @@ -34,7 +34,7 @@ import com.cloud.user.UserContext; public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(CreateVpnCustomerGatewayCmd.class.getName()); - private static final String s_name = "createcustomergatewayresponse"; + private static final String s_name = "createvpncustomergatewayresponse"; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -160,7 +160,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create customer VPN gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create customer VPN gateway"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java index 4b405541a90..4cc650f704d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/CreateVpnGatewayCmd.java @@ -16,16 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteVpnGateway; import com.cloud.network.vpc.Vpc; @@ -86,7 +86,7 @@ public class CreateVpnGatewayCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create VPN gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create VPN gateway"); } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java index a634a0a7c5a..7ddd7952172 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteRemoteAccessVpnCmd.java @@ -17,14 +17,14 @@ package org.apache.cloudstack.api.command.user.vpn; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.AccountResponse; -import org.apache.cloudstack.api.response.IPAddressResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; +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 com.cloud.event.EventTypes; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceUnavailableException; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java index 23a7793ef88..667e179f3b7 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnConnectionCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -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.Site2SiteVpnConnectionResponse; +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.ResourceUnavailableException; import com.cloud.network.Site2SiteVpnConnection; @@ -86,11 +90,11 @@ public class DeleteVpnConnectionCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete site to site VPN connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete site to site VPN connection"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java index 181ee3bbc68..a239bdfe48f 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnCustomerGatewayCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -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.Site2SiteCustomerGatewayResponse; +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.network.Site2SiteCustomerGateway; import com.cloud.user.Account; @@ -84,7 +88,7 @@ public class DeleteVpnCustomerGatewayCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java index 9ac27d07664..fa4c1df9fa4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/DeleteVpnGatewayCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -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.Site2SiteVpnGatewayResponse; +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.network.Site2SiteVpnGateway; import com.cloud.user.Account; @@ -85,7 +89,7 @@ public class DeleteVpnGatewayCmd extends BaseAsyncCmd { SuccessResponse response = new SuccessResponse(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete customer VPN gateway"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java index 4b6a2058bee..12ee95ba5f4 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListRemoteAccessVpnsCmd.java @@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.vpn; 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.BaseListProjectAndAccountResourcesCmd; -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.RemoteAccessVpnResponse; +import org.apache.log4j.Logger; + import com.cloud.network.RemoteAccessVpn; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java index 56f8aa547e8..6fb7d73af19 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnConnectionsCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.network.Site2SiteVpnConnection; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java index 0e4209ba873..418cad53d34 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnCustomerGatewaysCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; +import org.apache.log4j.Logger; + import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java index 63f70e3efe0..41981dfd185 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnGatewaysCmd.java @@ -20,14 +20,14 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.VpcResponse; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse; +import org.apache.cloudstack.api.response.VpcResponse; +import org.apache.log4j.Logger; + import com.cloud.network.Site2SiteVpnGateway; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java index fb12f65faa5..8a36f4b9b55 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ListVpnUsersCmd.java @@ -20,13 +20,13 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.log4j.Logger; - import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.VpnUsersResponse; +import org.apache.log4j.Logger; + import com.cloud.network.VpnUser; import com.cloud.utils.Pair; diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java index bdad7e31dd9..9520e80858d 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/RemoveVpnUserCmd.java @@ -16,17 +16,17 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.log4j.Logger; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; import org.apache.cloudstack.api.response.ProjectResponse; 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; @@ -110,11 +110,11 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd { Account owner = _accountService.getAccount(getEntityOwnerId()); boolean result = _ravService.removeVpnUser(owner.getId(), userName, UserContext.current().getCaller()); if (!result) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to remove vpn user"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove vpn user"); } if (!_ravService.applyVpnUsers(owner.getId(), userName)) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to apply vpn user removal"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to apply vpn user removal"); } SuccessResponse response = new SuccessResponse(getCommandName()); setResponseObject(response); diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java index ed28ea5610f..d9f38d235d1 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/ResetVpnConnectionCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse; import com.cloud.event.EventTypes; import com.cloud.exception.ResourceUnavailableException; import com.cloud.network.Site2SiteVpnConnection; @@ -104,11 +108,11 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to reset site to site VPN connection"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset site to site VPN connection"); } } catch (ResourceUnavailableException ex) { s_logger.warn("Exception: ", ex); - throw new ServerApiException(BaseCmd.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); + throw new ServerApiException(ApiErrorCode.RESOURCE_UNAVAILABLE_ERROR, ex.getMessage()); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java index 7564129c38f..3aca5cd4758 100644 --- a/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/vpn/UpdateVpnCustomerGatewayCmd.java @@ -16,12 +16,16 @@ // under the License. package org.apache.cloudstack.api.command.user.vpn; -import org.apache.cloudstack.api.*; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.DomainResponse; +import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; import org.apache.log4j.Logger; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse; import com.cloud.event.EventTypes; import com.cloud.network.Site2SiteCustomerGateway; import com.cloud.user.UserContext; @@ -155,7 +159,7 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update customer VPN gateway"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update customer VPN gateway"); } } } diff --git a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java index 5f5f9e7bda0..97fe2ffeb90 100644 --- a/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java +++ b/api/src/org/apache/cloudstack/api/command/user/zone/ListZonesByCmd.java @@ -20,14 +20,15 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.response.DomainResponse; -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.ServiceOfferingResponse; import org.apache.cloudstack.api.response.ZoneResponse; +import org.apache.log4j.Logger; + import com.cloud.dc.DataCenter; @APICommand(name = "listZones", description="Lists zones", responseObject=ZoneResponse.class) @@ -86,16 +87,8 @@ public class ListZonesByCmd extends BaseListCmd { @Override public void execute(){ - List dataCenters = _mgr.listDataCenters(this); - ListResponse response = new ListResponse(); - List zoneResponses = new ArrayList(); - for (DataCenter dataCenter : dataCenters) { - ZoneResponse zoneResponse = _responseGenerator.createZoneResponse(dataCenter, showCapacities); - zoneResponse.setObjectName("zone"); - zoneResponses.add(zoneResponse); - } - response.setResponses(zoneResponses); + ListResponse response = _queryService.listDataCenters(this); response.setResponseName(getCommandName()); this.setResponseObject(response); } diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java index 51d3352c647..9a98a356492 100644 --- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java @@ -20,12 +20,12 @@ import java.util.List; import java.util.Map; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.serializer.Param; import com.cloud.user.Account; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") @EntityReference(value = Account.class) @@ -123,15 +123,33 @@ public class AccountResponse extends BaseResponse { @SerializedName("networkavailable") @Param(description="the total number of networks available to be created for this account", since="3.0.1") private String networkAvailable; - @SerializedName("vpclimit") @Param(description="the total number of vpcs the account can own", since="3.0.5") + @SerializedName("vpclimit") @Param(description="the total number of vpcs the account can own", since="4.0.0") private String vpcLimit; - @SerializedName("vpctotal") @Param(description="the total number of vpcs owned by account", since="3.0.5") + @SerializedName("vpctotal") @Param(description="the total number of vpcs owned by account", since="4.0.0") private Long vpcTotal; - @SerializedName("vpcavailable") @Param(description="the total number of vpcs available to be created for this account", since="3.0.5") + @SerializedName("vpcavailable") @Param(description="the total number of vpcs available to be created for this account", since="4.0.0") private String vpcAvailable; + @SerializedName("cpulimit") @Param(description="the total number of cpu cores the account can own", since="4.1.0") + private String cpuLimit; + + @SerializedName("cputotal") @Param(description="the total number of cpu cores owned by account", since="4.1.0") + private Long cpuTotal; + + @SerializedName("cpuavailable") @Param(description="the total number of cpu cores available to be created for this account", since="4.1.0") + private String cpuAvailable; + + @SerializedName("memorylimit") @Param(description="the total memory (in MB) the account can own", since="4.1.0") + private String memoryLimit; + + @SerializedName("memorytotal") @Param(description="the total memory (in MB) owned by account", since="4.1.0") + private Long memoryTotal; + + @SerializedName("memoryavailable") @Param(description="the total memory (in MB) available to be created for this account", since="4.1.0") + private String memoryAvailable; + @SerializedName(ApiConstants.STATE) @Param(description="the state of the account") private String state; @@ -294,6 +312,30 @@ public class AccountResponse extends BaseResponse { this.networkAvailable = networkAvailable; } + public void setCpuLimit(String cpuLimit) { + this.cpuLimit = cpuLimit; + } + + public void setCpuTotal(Long cpuTotal) { + this.cpuTotal = cpuTotal; + } + + public void setCpuAvailable(String cpuAvailable) { + this.cpuAvailable = cpuAvailable; + } + + public void setMemoryLimit(String memoryLimit) { + this.memoryLimit = memoryLimit; + } + + public void setMemoryTotal(Long memoryTotal) { + this.memoryTotal = memoryTotal; + } + + public void setMemoryAvailable(String memoryAvailable) { + this.memoryAvailable = memoryAvailable; + } + public void setDefaultZone(String defaultZoneId) { this.defaultZoneId = defaultZoneId; } diff --git a/api/src/org/apache/cloudstack/api/response/AlertResponse.java b/api/src/org/apache/cloudstack/api/response/AlertResponse.java index f01a3e9c1f3..f3755e58d46 100644 --- a/api/src/org/apache/cloudstack/api/response/AlertResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AlertResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.alert.Alert; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.alert.Alert; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Alert.class) @SuppressWarnings("unused") public class AlertResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java b/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java index 1a47cd2a3d2..a237714789c 100644 --- a/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AsyncJobResponse.java @@ -22,6 +22,7 @@ import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.ResponseObject; + import com.cloud.async.AsyncJob; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java index 424a4fa446a..6a2bfbe4de7 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScalePolicyResponse.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.as.AutoScalePolicy; +import java.util.List; + import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; -import java.util.List; +import com.cloud.network.as.AutoScalePolicy; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value=AutoScalePolicy.class) public class AutoScalePolicyResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java index dc0e0155d5f..98fdcad3985 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmGroupResponse.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.as.AutoScaleVmGroup; +import java.util.List; + import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; -import java.util.List; +import com.cloud.network.as.AutoScaleVmGroup; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value=AutoScaleVmGroup.class) public class AutoScaleVmGroupResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java index 0ae216706d0..4c97adf1e9d 100644 --- a/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java +++ b/api/src/org/apache/cloudstack/api/response/AutoScaleVmProfileResponse.java @@ -20,12 +20,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import com.cloud.network.as.AutoScaleVmProfile; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseCmd.CommandType; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.Parameter; + +import com.cloud.network.as.AutoScaleVmProfile; import com.cloud.serializer.Param; import com.cloud.utils.Pair; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java b/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java index 20d160dd2d5..c2996f0aa0a 100644 --- a/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CapabilitiesResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class CapabilitiesResponse extends BaseResponse { @@ -45,6 +46,12 @@ public class CapabilitiesResponse extends BaseResponse { "create disk from disk offering with custom size") private Long diskOffMaxSize; + @SerializedName("apilimitinterval") @Param(description="time interval (in seconds) to reset api count") + private Integer apiLimitInterval; + + @SerializedName("apilimitmax") @Param(description="Max allowed number of api requests within the specified interval") + private Integer apiLimitMax; + public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) { this.securityGroupsEnabled = securityGroupsEnabled; @@ -74,4 +81,13 @@ public class CapabilitiesResponse extends BaseResponse { this.diskOffMaxSize = diskOffMaxSize; } + public void setApiLimitInterval(Integer apiLimitInterval) { + this.apiLimitInterval = apiLimitInterval; + } + + public void setApiLimitMax(Integer apiLimitMax) { + this.apiLimitMax = apiLimitMax; + } + + } diff --git a/api/src/org/apache/cloudstack/api/response/CapabilityResponse.java b/api/src/org/apache/cloudstack/api/response/CapabilityResponse.java index 5fe3072fe87..e960c2ddd94 100644 --- a/api/src/org/apache/cloudstack/api/response/CapabilityResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CapabilityResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class CapabilityResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/CapacityResponse.java b/api/src/org/apache/cloudstack/api/response/CapacityResponse.java index 2c98dc9d6ca..c1ef62c7305 100644 --- a/api/src/org/apache/cloudstack/api/response/CapacityResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CapacityResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class CapacityResponse extends BaseResponse { @SerializedName(ApiConstants.TYPE) @Param(description="the capacity type") diff --git a/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java b/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java index d6d2fa70138..5e744864923 100644 --- a/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CloudIdentifierResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class CloudIdentifierResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java index e436c9987e9..a90acde6145 100644 --- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java @@ -20,12 +20,12 @@ import java.util.ArrayList; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.org.Cluster; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @EntityReference(value = Cluster.class) public class ClusterResponse extends BaseResponse { @@ -62,6 +62,12 @@ public class ClusterResponse extends BaseResponse { @SerializedName("capacity") @Param(description="the capacity of the Cluster", responseObject = CapacityResponse.class) private List capacitites; + @SerializedName("cpuovercommitratio") @Param(description = "The cpu overcommit ratio of the cluster") + private String cpuovercommitratio; + + @SerializedName("memoryovercommitratio") @Param (description = "The ram overcommit ratio of the cluster") + private String memoryovercommitratio; + public String getId() { return id; } @@ -149,4 +155,18 @@ public class ClusterResponse extends BaseResponse { public void setCapacitites(ArrayList arrayList) { this.capacitites = arrayList; } + public void setCpuovercommitratio(String cpuovercommitratio){ + this.cpuovercommitratio= cpuovercommitratio; + } + public void setRamovercommitratio (String memoryOvercommitRatio){ + this.memoryovercommitratio= memoryOvercommitRatio; + } + + public String getCpuovercommitratio (){ + return cpuovercommitratio; + } + + public String getRamovercommitratio (){ + return memoryovercommitratio; + } } diff --git a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java index f398f0aaed5..ccdd2782f74 100644 --- a/api/src/org/apache/cloudstack/api/response/ConditionResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ConditionResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.as.Condition; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.as.Condition; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Condition.class) @SuppressWarnings("unused") public class ConditionResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java index ded0fb5fb39..95b8af2f4c5 100644 --- a/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ConfigurationResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class ConfigurationResponse extends BaseResponse { @SerializedName(ApiConstants.CATEGORY) @Param(description="the category of the configuration") diff --git a/api/src/org/apache/cloudstack/api/response/CounterResponse.java b/api/src/org/apache/cloudstack/api/response/CounterResponse.java index 4dc44e767bf..4f5784a302d 100644 --- a/api/src/org/apache/cloudstack/api/response/CounterResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CounterResponse.java @@ -18,12 +18,12 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.network.as.Counter; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") @EntityReference(value=Counter.class) diff --git a/api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java b/api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java index f45b0c8e49b..59c108e3c7c 100644 --- a/api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java +++ b/api/src/org/apache/cloudstack/api/response/CustomCertificateResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class CustomCertificateResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java index de3daf587ad..04c318f8a2f 100644 --- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.offering.DiskOffering; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.offering.DiskOffering; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=DiskOffering.class) public class DiskOfferingResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="unique ID of the disk offering") diff --git a/api/src/org/apache/cloudstack/api/response/DomainResponse.java b/api/src/org/apache/cloudstack/api/response/DomainResponse.java index c74e7c98d2f..736a96cceaf 100644 --- a/api/src/org/apache/cloudstack/api/response/DomainResponse.java +++ b/api/src/org/apache/cloudstack/api/response/DomainResponse.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; + import com.cloud.domain.Domain; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java index cf2f3f41f56..274e7a5becb 100644 --- a/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java +++ b/api/src/org/apache/cloudstack/api/response/DomainRouterResponse.java @@ -20,15 +20,15 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; - -import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.cloud.vm.VirtualMachine.State; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VirtualMachine.class) @SuppressWarnings("unused") public class DomainRouterResponse extends BaseResponse implements ControlledViewEntityResponse{ @@ -47,6 +47,12 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView @SerializedName(ApiConstants.DNS2) @Param(description="the second DNS for the router") private String dns2; + @SerializedName(ApiConstants.IP6_DNS1) @Param(description="the first IPv6 DNS for the router") + private String ip6Dns1; + + @SerializedName(ApiConstants.IP6_DNS2) @Param(description="the second IPv6 DNS for the router") + private String ip6Dns2; + @SerializedName("networkdomain") @Param(description="the network domain for the router") private String networkDomain; @@ -338,4 +344,20 @@ public class DomainRouterResponse extends BaseResponse implements ControlledView public void addNic(NicResponse nic) { this.nics.add(nic); } + + 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/org/apache/cloudstack/api/response/EventResponse.java b/api/src/org/apache/cloudstack/api/response/EventResponse.java index b2148db5da1..c2bf75773e5 100644 --- a/api/src/org/apache/cloudstack/api/response/EventResponse.java +++ b/api/src/org/apache/cloudstack/api/response/EventResponse.java @@ -19,11 +19,12 @@ package org.apache.cloudstack.api.response; import java.util.Date; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + import com.cloud.event.Event; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; -import org.apache.cloudstack.api.EntityReference; @EntityReference(value=Event.class) @SuppressWarnings("unused") diff --git a/api/src/org/apache/cloudstack/api/response/EventTypeResponse.java b/api/src/org/apache/cloudstack/api/response/EventTypeResponse.java index 4dcc44179a6..b526435a4d3 100644 --- a/api/src/org/apache/cloudstack/api/response/EventTypeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/EventTypeResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class EventTypeResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) @Param(description="Event Type") diff --git a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java index 5f8e642140a..3afd516e075 100644 --- a/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ExceptionResponse.java @@ -18,9 +18,10 @@ package org.apache.cloudstack.api.response; import java.util.ArrayList; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class ExceptionResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java b/api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java index 30fe86f88da..50f523325a4 100644 --- a/api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ExternalFirewallResponse.java @@ -17,9 +17,9 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.response.NetworkDeviceResponse; public class ExternalFirewallResponse extends NetworkDeviceResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java index 6f80c1084f8..5a323a7af79 100644 --- a/api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ExternalLoadBalancerResponse.java @@ -17,9 +17,9 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.response.NetworkDeviceResponse; public class ExternalLoadBalancerResponse extends NetworkDeviceResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ExtractResponse.java b/api/src/org/apache/cloudstack/api/response/ExtractResponse.java index 5d415e94349..f5595f95a5e 100644 --- a/api/src/org/apache/cloudstack/api/response/ExtractResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ExtractResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.Date; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class ExtractResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of extracted object") diff --git a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java index 27992569e78..26d243386fc 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class FirewallResponse extends BaseResponse { @@ -40,6 +41,9 @@ public class FirewallResponse extends BaseResponse { @SerializedName(ApiConstants.IP_ADDRESS_ID) @Param(description="the public ip address id for the firewall rule") private Long publicIpAddressId; + @SerializedName(ApiConstants.NETWORK_ID) @Param(description="the network id of the firewall rule") + private Long networkId; + @SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the public ip address for the firewall rule") private String publicIpAddress; @@ -82,6 +86,10 @@ public class FirewallResponse extends BaseResponse { this.publicIpAddress = publicIpAddress; } + public void setNetworkId(Long networkId) { + this.networkId = networkId; + } + public void setState(String state) { this.state = state; } diff --git a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java index 0009658c2a7..08722ae2c6b 100644 --- a/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/FirewallRuleResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.rules.FirewallRule; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.rules.FirewallRule; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=FirewallRule.class) @SuppressWarnings("unused") public class FirewallRuleResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java b/api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java index 8147df3fae1..56ced5b8ca9 100644 --- a/api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java +++ b/api/src/org/apache/cloudstack/api/response/GetVMPasswordResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class GetVMPasswordResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java b/api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java index a14ce59f968..eab6bbac644 100644 --- a/api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java +++ b/api/src/org/apache/cloudstack/api/response/GuestOSCategoryResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.storage.GuestOsCategory; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.storage.GuestOsCategory; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=GuestOsCategory.class) public class GuestOSCategoryResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the OS category") diff --git a/api/src/org/apache/cloudstack/api/response/GuestOSResponse.java b/api/src/org/apache/cloudstack/api/response/GuestOSResponse.java index 0bc5dd2956e..af3aea92c2f 100644 --- a/api/src/org/apache/cloudstack/api/response/GuestOSResponse.java +++ b/api/src/org/apache/cloudstack/api/response/GuestOSResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.storage.GuestOS; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.storage.GuestOS; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=GuestOS.class) public class GuestOSResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the OS type") diff --git a/api/src/org/apache/cloudstack/api/response/HostResponse.java b/api/src/org/apache/cloudstack/api/response/HostResponse.java index 35b07dda83d..f5aa8f90a17 100644 --- a/api/src/org/apache/cloudstack/api/response/HostResponse.java +++ b/api/src/org/apache/cloudstack/api/response/HostResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + import com.cloud.host.Host; import com.cloud.host.Status; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; -import org.apache.cloudstack.api.EntityReference; @EntityReference(value=Host.class) public class HostResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java b/api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java index 44e0513e32c..36021876184 100644 --- a/api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java +++ b/api/src/org/apache/cloudstack/api/response/HypervisorCapabilitiesResponse.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.hypervisor.HypervisorCapabilities; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.HypervisorCapabilities; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=HypervisorCapabilities.class) public class HypervisorCapabilitiesResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the hypervisor capabilities row") diff --git a/api/src/org/apache/cloudstack/api/response/HypervisorResponse.java b/api/src/org/apache/cloudstack/api/response/HypervisorResponse.java index 3828539746b..8bfb15e15df 100644 --- a/api/src/org/apache/cloudstack/api/response/HypervisorResponse.java +++ b/api/src/org/apache/cloudstack/api/response/HypervisorResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class HypervisorResponse extends BaseResponse { @SerializedName(ApiConstants.NAME) @Param(description="Hypervisor name") diff --git a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java index 4d18aef5569..251b2dd09e8 100644 --- a/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java +++ b/api/src/org/apache/cloudstack/api/response/IPAddressResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.cloud.network.IpAddress; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.IpAddress; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=IpAddress.class) @SuppressWarnings("unused") public class IPAddressResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java b/api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java index 24706ab09fc..b04f2b8c2d0 100644 --- a/api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java +++ b/api/src/org/apache/cloudstack/api/response/InstanceGroupResponse.java @@ -21,8 +21,9 @@ import java.util.Date; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; -import com.cloud.vm.InstanceGroup; + import com.cloud.serializer.Param; +import com.cloud.vm.InstanceGroup; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") diff --git a/api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java b/api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java index 93c86c31332..d6a42f77621 100644 --- a/api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/IpForwardingRuleResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class IpForwardingRuleResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the ID of the port forwarding rule") diff --git a/api/src/org/apache/cloudstack/api/response/IsoVmResponse.java b/api/src/org/apache/cloudstack/api/response/IsoVmResponse.java index a667e50c5f9..14803d598ff 100644 --- a/api/src/org/apache/cloudstack/api/response/IsoVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/IsoVmResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class IsoVmResponse extends BaseResponse { @SerializedName("id") @Param(description="the ISO ID") diff --git a/api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java b/api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java index 0eb4d58d50b..626d0ea4644 100644 --- a/api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java +++ b/api/src/org/apache/cloudstack/api/response/LBStickinessPolicyResponse.java @@ -16,15 +16,16 @@ // under the License. package org.apache.cloudstack.api.response; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.network.rules.StickinessPolicy; import com.cloud.serializer.Param; import com.cloud.utils.Pair; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; - -import java.util.List; -import java.util.Map; -import java.util.HashMap; public class LBStickinessPolicyResponse extends BaseResponse { @SerializedName("id") diff --git a/api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java b/api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java index 7887e7c430a..cd44aa74990 100644 --- a/api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java +++ b/api/src/org/apache/cloudstack/api/response/LBStickinessResponse.java @@ -16,14 +16,15 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.rules.StickinessPolicy; +import java.util.List; + import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; -import java.util.List; +import com.cloud.network.rules.StickinessPolicy; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; @EntityReference(value=StickinessPolicy.class) public class LBStickinessResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java b/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java index e851e38e2bd..bbeec630d81 100644 --- a/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java +++ b/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class LDAPConfigResponse extends BaseResponse { @@ -29,7 +30,7 @@ public class LDAPConfigResponse extends BaseResponse { @SerializedName(ApiConstants.PORT) @Param(description="Specify the LDAP port if required, default is 389") private String port; - @SerializedName(ApiConstants.PORT) @Param(description="Check Use SSL if the external LDAP server is configured for LDAP over SSL") + @SerializedName(ApiConstants.USE_SSL) @Param(description="Check Use SSL if the external LDAP server is configured for LDAP over SSL") private String useSSL; @SerializedName(ApiConstants.SEARCH_BASE) @Param(description="The search base defines the starting point for the search in the directory tree Example: dc=cloud,dc=com") diff --git a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java index bd5efdba1e4..79b01b17ff2 100644 --- a/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java +++ b/api/src/org/apache/cloudstack/api/response/LoadBalancerResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class LoadBalancerResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java index e16a1a5a434..b45b43cf6ec 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkACLResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class NetworkACLResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java index dc67b53e1ed..8eb3987effa 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkDeviceResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class NetworkDeviceResponse extends BaseResponse { @SerializedName(ApiConstants.ID) diff --git a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java index 5c1479105f8..b1dcd423117 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkOfferingResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.cloud.offering.NetworkOffering; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.offering.NetworkOffering; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=NetworkOffering.class) @SuppressWarnings("unused") public class NetworkOfferingResponse extends BaseResponse { @@ -80,6 +81,8 @@ public class NetworkOfferingResponse extends BaseResponse { @SerializedName(ApiConstants.FOR_VPC) @Param(description="true if network offering can be used by VPC networks only") private Boolean forVpc; + @SerializedName(ApiConstants.IS_PERSISTENT) @Param(description="true if network offering supports persistent networks, false otherwise") + private Boolean isPersistent; public void setId(String id) { this.id = id; @@ -149,4 +152,9 @@ public class NetworkOfferingResponse extends BaseResponse { public void setForVpc(Boolean forVpc) { this.forVpc = forVpc; } + + public void setIsPersistent(Boolean isPersistent) { + this.isPersistent = isPersistent; + } + } diff --git a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java index 64cc9531901..cd32dede3c8 100644 --- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java @@ -18,10 +18,11 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.Network; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; + +import com.cloud.network.Network; import com.cloud.projects.ProjectAccount; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -51,9 +52,15 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @SerializedName(ApiConstants.NETMASK) @Param(description="the network's netmask") private String netmask; - @SerializedName(ApiConstants.CIDR) @Param(description="the cidr the network") + @SerializedName(ApiConstants.CIDR) @Param(description="Cloudstack managed address space, all CloudStack managed VMs get IP address from CIDR") private String cidr; + @SerializedName(ApiConstants.NETWORK_CIDR) @Param(description="the network CIDR of the guest network configured with IP reservation. It is the summation of CIDR and RESERVED_IP_RANGE") + private String networkCidr; + + @SerializedName(ApiConstants.RESERVED_IP_RANGE) @Param(description="the network's IP range not to be used by CloudStack guest VMs and can be used for non CloudStack purposes") + private String reservedIpRange; + @SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id of the network") private String zoneId; @@ -141,9 +148,18 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes @SerializedName(ApiConstants.CAN_USE_FOR_DEPLOY) @Param(description="list networks available for vm deployment") private Boolean canUseForDeploy; + @SerializedName(ApiConstants.IS_PERSISTENT) @Param(description="list networks that are persistent") + private Boolean isPersistent; + @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with network", responseObject = ResourceTagResponse.class) private List tags; + @SerializedName(ApiConstants.IP6_GATEWAY) @Param(description="the gateway of IPv6 network") + private String ip6Gateway; + + @SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network") + private String ip6Cidr; + public void setId(String id) { this.id = id; } @@ -279,6 +295,14 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes this.cidr = cidr; } + public void setNetworkCidr(String networkCidr) { + this.networkCidr = networkCidr; + } + + public void setReservedIpRange(String reservedIpRange) { + this.reservedIpRange = reservedIpRange; + } + public void setRestartRequired(Boolean restartRequired) { this.restartRequired = restartRequired; } @@ -295,7 +319,19 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes this.canUseForDeploy = canUseForDeploy; } + public void setIsPersistent(Boolean isPersistent) { + this.isPersistent = isPersistent; + } + public void setTags(List tags) { this.tags = tags; } + + public void setIp6Gateway(String ip6Gateway) { + this.ip6Gateway = ip6Gateway; + } + + public void setIp6Cidr(String ip6Cidr) { + this.ip6Cidr = ip6Cidr; + } } diff --git a/api/src/org/apache/cloudstack/api/response/NicResponse.java b/api/src/org/apache/cloudstack/api/response/NicResponse.java index a6ca5b8232d..a7d1a0d068e 100644 --- a/api/src/org/apache/cloudstack/api/response/NicResponse.java +++ b/api/src/org/apache/cloudstack/api/response/NicResponse.java @@ -17,11 +17,18 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import com.cloud.vm.Nic; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; @SuppressWarnings("unused") +@EntityReference(value=Nic.class) public class NicResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the nic") @@ -60,6 +67,15 @@ public class NicResponse extends BaseResponse { @SerializedName("macaddress") @Param(description="true if nic is default, false otherwise") private String macAddress; + @SerializedName(ApiConstants.IP6_GATEWAY) @Param(description="the gateway of IPv6 network") + private String ip6Gateway; + + @SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network") + private String ip6Cidr; + + @SerializedName(ApiConstants.IP6_ADDRESS) @Param(description="the IPv6 address of network") + private String ip6Address; + public String getId() { return id; } @@ -113,6 +129,18 @@ public class NicResponse extends BaseResponse { this.macAddress = macAddress; } + public void setIp6Gateway(String ip6Gateway) { + this.ip6Gateway = ip6Gateway; + } + + public void setIp6Cidr(String ip6Cidr) { + this.ip6Cidr = ip6Cidr; + } + + public void setIp6Address(String ip6Address) { + this.ip6Address = ip6Address; + } + @Override public int hashCode() { final int prime = 31; @@ -139,5 +167,4 @@ public class NicResponse extends BaseResponse { return false; return true; } - } diff --git a/api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java b/api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java index 78257b1bd0f..1f93b468d21 100644 --- a/api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java +++ b/api/src/org/apache/cloudstack/api/response/PhysicalNetworkResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.PhysicalNetwork; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.PhysicalNetwork; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=PhysicalNetwork.class) @SuppressWarnings("unused") public class PhysicalNetworkResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/PodResponse.java b/api/src/org/apache/cloudstack/api/response/PodResponse.java index 71192796b25..f31c289217e 100644 --- a/api/src/org/apache/cloudstack/api/response/PodResponse.java +++ b/api/src/org/apache/cloudstack/api/response/PodResponse.java @@ -19,12 +19,12 @@ package org.apache.cloudstack.api.response; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; import com.cloud.dc.Pod; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @EntityReference(value = Pod.class) public class PodResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java index 37c96ff6a17..4123477dbfe 100644 --- a/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java +++ b/api/src/org/apache/cloudstack/api/response/PrivateGatewayResponse.java @@ -15,13 +15,14 @@ // specific language governing permissions and limitations // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.vpc.VpcGateway; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.vpc.VpcGateway; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VpcGateway.class) @SuppressWarnings("unused") public class PrivateGatewayResponse extends BaseResponse implements ControlledEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java index 134841caf31..cb69ee59c37 100644 --- a/api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ProjectAccountResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.projects.ProjectAccount; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.projects.ProjectAccount; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=ProjectAccount.class) @SuppressWarnings("unused") public class ProjectAccountResponse extends BaseResponse implements ControlledViewEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java index 0c9ce685bcc..1ece6900d6c 100644 --- a/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ProjectInvitationResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.projects.ProjectInvitation; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.projects.ProjectInvitation; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=ProjectInvitation.class) @SuppressWarnings("unused") public class ProjectInvitationResponse extends BaseResponse implements ControlledViewEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java index 7ecda234814..cff27e54dcd 100644 --- a/api/src/org/apache/cloudstack/api/response/ProjectResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ProjectResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.ArrayList; import java.util.List; -import com.cloud.projects.Project; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.projects.Project; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Project.class) @SuppressWarnings("unused") public class ProjectResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ProviderResponse.java b/api/src/org/apache/cloudstack/api/response/ProviderResponse.java index b83c2348390..fd0994959f1 100644 --- a/api/src/org/apache/cloudstack/api/response/ProviderResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ProviderResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.PhysicalNetworkServiceProvider; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=PhysicalNetworkServiceProvider.class) @SuppressWarnings("unused") public class ProviderResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/RegionResponse.java b/api/src/org/apache/cloudstack/api/response/RegionResponse.java new file mode 100644 index 00000000000..f8bfe53aae3 --- /dev/null +++ b/api/src/org/apache/cloudstack/api/response/RegionResponse.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 org.apache.cloudstack.api.response; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import org.apache.cloudstack.region.Region; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value = Region.class) +public class RegionResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) @Param(description="the ID of the region") + private Integer id; + + @SerializedName(ApiConstants.NAME) @Param(description="the name of the region") + private String name; + + @SerializedName(ApiConstants.END_POINT) @Param(description="the end point of the region") + private String endPoint; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEndPoint() { + return endPoint; + } + + public void setEndPoint(String endPoint) { + this.endPoint = endPoint; + } + + } diff --git a/api/src/org/apache/cloudstack/api/response/RegisterResponse.java b/api/src/org/apache/cloudstack/api/response/RegisterResponse.java index eee924940fb..c2bd2b5bfcc 100644 --- a/api/src/org/apache/cloudstack/api/response/RegisterResponse.java +++ b/api/src/org/apache/cloudstack/api/response/RegisterResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class RegisterResponse extends BaseResponse { @SerializedName("apikey") @Param(description="the api key of the registered user") diff --git a/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java b/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java index 3fd7d7a668b..7db56630bc0 100644 --- a/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java +++ b/api/src/org/apache/cloudstack/api/response/RemoteAccessVpnResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.RemoteAccessVpn; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.RemoteAccessVpn; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=RemoteAccessVpn.class) @SuppressWarnings("unused") public class RemoteAccessVpnResponse extends BaseResponse implements ControlledEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java index 7a291945f76..a7fbbf2630b 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class ResourceCountResponse extends BaseResponse implements ControlledEntityResponse{ @@ -39,7 +40,7 @@ public class ResourceCountResponse extends BaseResponse implements ControlledEnt @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name for which resource count's are updated") private String domainName; - @SerializedName(ApiConstants.RESOURCE_TYPE) @Param(description="resource type. Values include 0, 1, 2, 3, 4. See the resourceType parameter for more information on these values.") + @SerializedName(ApiConstants.RESOURCE_TYPE) @Param(description="resource type. Values include 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. See the resourceType parameter for more information on these values.") private String resourceType; @SerializedName("resourcecount") @Param(description="resource count") diff --git a/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java index c01e12f2e23..b444e7a68a7 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.configuration.ResourceLimit; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.configuration.ResourceLimit; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value = ResourceLimit.class) @SuppressWarnings("unused") public class ResourceLimitResponse extends BaseResponse implements ControlledEntityResponse { @@ -35,7 +36,7 @@ public class ResourceLimitResponse extends BaseResponse implements ControlledEnt @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name of the resource limit") private String domainName; - @SerializedName(ApiConstants.RESOURCE_TYPE) @Param(description="resource type. Values include 0, 1, 2, 3, 4. See the resourceType parameter for more information on these values.") + @SerializedName(ApiConstants.RESOURCE_TYPE) @Param(description="resource type. Values include 0, 1, 2, 3, 4, 6, 7, 8, 9. See the resourceType parameter for more information on these values.") private String resourceType; @SerializedName("max") @Param(description="the maximum number of the resource. A -1 means the resource currently has no limit.") diff --git a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java index 30bcbfd38a2..47b06250a2c 100644 --- a/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ResourceTagResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class ResourceTagResponse extends BaseResponse implements ControlledViewEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/S3Response.java b/api/src/org/apache/cloudstack/api/response/S3Response.java index 4dab2175a3a..259a3088c1e 100644 --- a/api/src/org/apache/cloudstack/api/response/S3Response.java +++ b/api/src/org/apache/cloudstack/api/response/S3Response.java @@ -18,11 +18,20 @@ */ package org.apache.cloudstack.api.response; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; +import static org.apache.cloudstack.api.ApiConstants.ID; +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 org.apache.cloudstack.api.BaseResponse; -import static org.apache.cloudstack.api.ApiConstants.*; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; public class S3Response extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java b/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java index 606636382a1..2791853d4a2 100644 --- a/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class SSHKeyPairResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/SecurityGroupResponse.java b/api/src/org/apache/cloudstack/api/response/SecurityGroupResponse.java index f3b9beb8d3e..1130ec03f37 100644 --- a/api/src/org/apache/cloudstack/api/response/SecurityGroupResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SecurityGroupResponse.java @@ -22,6 +22,7 @@ import java.util.Set; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; + import com.cloud.network.security.SecurityGroup; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java b/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java index 19aaa4594b9..5aeee6f0611 100644 --- a/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SecurityGroupRuleResponse.java @@ -17,11 +17,12 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; + import com.cloud.network.security.SecurityGroupRules; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @EntityReference(value = SecurityGroupRules.class) public class SecurityGroupRuleResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java index 7a10f7f7673..f35e87e3b0f 100644 --- a/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ServiceOfferingResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.offering.ServiceOffering; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.offering.ServiceOffering; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value = ServiceOffering.class) public class ServiceOfferingResponse extends BaseResponse { @SerializedName("id") @Param(description="the id of the service offering") diff --git a/api/src/org/apache/cloudstack/api/response/ServiceResponse.java b/api/src/org/apache/cloudstack/api/response/ServiceResponse.java index 11f7d710383..445afcfcf5b 100644 --- a/api/src/org/apache/cloudstack/api/response/ServiceResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ServiceResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; @SuppressWarnings("unused") public class ServiceResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java index d164580bdea..dbaa45116e0 100644 --- a/api/src/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java +++ b/api/src/org/apache/cloudstack/api/response/Site2SiteCustomerGatewayResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.network.Site2SiteCustomerGateway; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.Site2SiteCustomerGateway; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Site2SiteCustomerGateway.class) @SuppressWarnings("unused") public class Site2SiteCustomerGatewayResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java index c398116a9f8..99075b5f213 100644 --- a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java +++ b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnConnectionResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.network.Site2SiteVpnConnection; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.Site2SiteVpnConnection; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Site2SiteVpnConnection.class) @SuppressWarnings("unused") public class Site2SiteVpnConnectionResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java index 8cb06fc8a56..06dbf370ce6 100644 --- a/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java +++ b/api/src/org/apache/cloudstack/api/response/Site2SiteVpnGatewayResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.network.Site2SiteVpnGateway; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.Site2SiteVpnGateway; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Site2SiteVpnGateway.class) @SuppressWarnings("unused") public class Site2SiteVpnGatewayResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java index 6bf77a04298..2b7f9f4c497 100644 --- a/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SnapshotPolicyResponse.java @@ -16,11 +16,12 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + import com.cloud.serializer.Param; import com.cloud.storage.snapshot.SnapshotPolicy; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; -import org.apache.cloudstack.api.EntityReference; @EntityReference(value=SnapshotPolicy.class) public class SnapshotPolicyResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java index 8ea0d7fb87f..5b77fb2f360 100644 --- a/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SnapshotResponse.java @@ -20,12 +20,22 @@ import java.util.Date; import java.util.List; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + import com.cloud.serializer.Param; import com.cloud.storage.Snapshot; import com.google.gson.annotations.SerializedName; +import com.cloud.serializer.Param; +import com.cloud.storage.Snapshot; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import java.util.Date; +import java.util.List; + @EntityReference(value=Snapshot.class) @SuppressWarnings("unused") public class SnapshotResponse extends BaseResponse implements ControlledEntityResponse { @@ -81,7 +91,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe @SerializedName(ApiConstants.STATE) @Param(description = "the state of the snapshot. BackedUp means that snapshot is ready to be used; Creating - the snapshot is being allocated on the primary storage; BackingUp - the snapshot is being backed up on secondary storage") - private Snapshot.Status state; + private Snapshot.State state; @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with snapshot", responseObject = ResourceTagResponse.class) private List tags; @@ -149,7 +159,7 @@ public class SnapshotResponse extends BaseResponse implements ControlledEntityRe this.intervalType = intervalType; } - public void setState(Snapshot.Status state) { + public void setState(Snapshot.State state) { this.state = state; } diff --git a/api/src/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java b/api/src/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java index 19bb189467b..a25d02f2760 100644 --- a/api/src/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SnapshotScheduleResponse.java @@ -18,9 +18,10 @@ package org.apache.cloudstack.api.response; import java.util.Date; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class SnapshotScheduleResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the snapshot schedule") diff --git a/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java b/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java index e7383e3787d..9001252e769 100644 --- a/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java +++ b/api/src/org/apache/cloudstack/api/response/StaticRouteResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.network.vpc.StaticRoute; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.vpc.StaticRoute; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=StaticRoute.class) @SuppressWarnings("unused") public class StaticRouteResponse extends BaseResponse implements ControlledEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/StatusResponse.java b/api/src/org/apache/cloudstack/api/response/StatusResponse.java index ffe7c7c0c1e..28776b7a321 100644 --- a/api/src/org/apache/cloudstack/api/response/StatusResponse.java +++ b/api/src/org/apache/cloudstack/api/response/StatusResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; +import com.google.gson.annotations.SerializedName; + public class StatusResponse extends BaseResponse { @SerializedName("status") private Boolean status; diff --git a/api/src/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java b/api/src/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java index 328180f5260..c72d1e2c02d 100644 --- a/api/src/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/StorageNetworkIpRangeResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.dc.StorageNetworkIpRange; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.dc.StorageNetworkIpRange; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=StorageNetworkIpRange.class) public class StorageNetworkIpRangeResponse extends BaseResponse { @SerializedName(ApiConstants.ID) @Param(description="the uuid of storage network IP range.") diff --git a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java index 7afce716fda..66dde3655f0 100644 --- a/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java +++ b/api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java @@ -18,14 +18,15 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.storage.StoragePool; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.cloud.storage.StoragePoolStatus; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.storage.StoragePool; +import com.cloud.storage.StoragePoolStatus; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=StoragePool.class) public class StoragePoolResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the storage pool") diff --git a/api/src/org/apache/cloudstack/api/response/SuccessResponse.java b/api/src/org/apache/cloudstack/api/response/SuccessResponse.java index 47c65b6a068..8647d193184 100644 --- a/api/src/org/apache/cloudstack/api/response/SuccessResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SuccessResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class SuccessResponse extends BaseResponse { @SerializedName("success") @Param(description="true if operation is executed successfully") diff --git a/api/src/org/apache/cloudstack/api/response/SwiftResponse.java b/api/src/org/apache/cloudstack/api/response/SwiftResponse.java index 83fceb348f7..08b260943ef 100644 --- a/api/src/org/apache/cloudstack/api/response/SwiftResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SwiftResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.Date; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class SwiftResponse extends BaseResponse { @SerializedName(ApiConstants.ID) diff --git a/api/src/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java b/api/src/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java index 48df8549ab3..43411c7a260 100644 --- a/api/src/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SystemVmInstanceResponse.java @@ -16,9 +16,10 @@ // under the License. package org.apache.cloudstack.api.response; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; /* * This is the generic response for all types of System VMs (SSVM, consoleproxy, domain routers(router, LB, DHCP)) diff --git a/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java b/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java index 8b0f80b255a..8d2798a9d04 100644 --- a/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/SystemVmResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.cloud.vm.VirtualMachine; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.vm.VirtualMachine; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VirtualMachine.class) public class SystemVmResponse extends BaseResponse { @SerializedName("id") @Param(description="the ID of the system VM") diff --git a/api/src/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java b/api/src/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java index f1e08e3dcc6..c4b10ab11f1 100644 --- a/api/src/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TemplatePermissionsResponse.java @@ -18,13 +18,14 @@ package org.apache.cloudstack.api.response; import java.util.List; -import com.cloud.template.VirtualMachineTemplate; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.template.VirtualMachineTemplate; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VirtualMachineTemplate.class) @SuppressWarnings("unused") public class TemplatePermissionsResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java index 033c2e243d5..ed933ff18c3 100644 --- a/api/src/org/apache/cloudstack/api/response/TemplateResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TemplateResponse.java @@ -20,14 +20,15 @@ import java.util.Date; import java.util.List; import java.util.Map; -import com.cloud.template.VirtualMachineTemplate; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.cloud.storage.Storage.ImageFormat; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.template.VirtualMachineTemplate; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VirtualMachineTemplate.class) @SuppressWarnings("unused") public class TemplateResponse extends BaseResponse implements ControlledEntityResponse { diff --git a/api/src/org/apache/cloudstack/api/response/TrafficMonitorResponse.java b/api/src/org/apache/cloudstack/api/response/TrafficMonitorResponse.java index 366e5d631b0..7e0646e4ac2 100644 --- a/api/src/org/apache/cloudstack/api/response/TrafficMonitorResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TrafficMonitorResponse.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java b/api/src/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java index 30adc3d87ca..56beca51fc7 100644 --- a/api/src/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TrafficTypeImplementorResponse.java @@ -17,9 +17,10 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class TrafficTypeImplementorResponse extends BaseResponse { @SerializedName(ApiConstants.TRAFFIC_TYPE) @Param(description="network traffic type") diff --git a/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java b/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java index 43760f2e1b4..494048e347f 100644 --- a/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/TrafficTypeResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.PhysicalNetworkTrafficType; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.PhysicalNetworkTrafficType; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=PhysicalNetworkTrafficType.class) public class TrafficTypeResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/UpgradeVmResponse.java b/api/src/org/apache/cloudstack/api/response/UpgradeVmResponse.java index 767f783da44..544a9bbea30 100644 --- a/api/src/org/apache/cloudstack/api/response/UpgradeVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UpgradeVmResponse.java @@ -19,9 +19,10 @@ package org.apache.cloudstack.api.response; import java.util.Date; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.api.BaseResponse; public class UpgradeVmResponse extends BaseResponse { @SerializedName("id") diff --git a/api/src/org/apache/cloudstack/api/response/UsageRecordResponse.java b/api/src/org/apache/cloudstack/api/response/UsageRecordResponse.java index 9679575c046..4b355cb0c96 100644 --- a/api/src/org/apache/cloudstack/api/response/UsageRecordResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UsageRecordResponse.java @@ -18,7 +18,7 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; -import org.apache.cloudstack.api.response.ControlledEntityResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/UsageTypeResponse.java b/api/src/org/apache/cloudstack/api/response/UsageTypeResponse.java index b21d26f3774..3dbb27ac1b0 100644 --- a/api/src/org/apache/cloudstack/api/response/UsageTypeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UsageTypeResponse.java @@ -18,6 +18,7 @@ package org.apache.cloudstack.api.response; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; + import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; diff --git a/api/src/org/apache/cloudstack/api/response/UserResponse.java b/api/src/org/apache/cloudstack/api/response/UserResponse.java index 9ab6248ed2e..9cd25cb7ad6 100644 --- a/api/src/org/apache/cloudstack/api/response/UserResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserResponse.java @@ -18,13 +18,13 @@ package org.apache.cloudstack.api.response; import java.util.Date; -import com.google.gson.annotations.SerializedName; -import com.cloud.serializer.Param; -import com.cloud.user.User; - import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.user.User; +import com.google.gson.annotations.SerializedName; + @EntityReference(value = User.class) public class UserResponse extends BaseResponse { @SerializedName("id") @Param(description="the user ID") diff --git a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java index 5450bfb6452..cb2113e1eaf 100644 --- a/api/src/org/apache/cloudstack/api/response/UserVmResponse.java +++ b/api/src/org/apache/cloudstack/api/response/UserVmResponse.java @@ -20,13 +20,14 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; -import com.cloud.network.router.VirtualRouter; -import com.cloud.uservm.UserVm; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; -import com.cloud.vm.VirtualMachine; + +import com.cloud.network.router.VirtualRouter; import com.cloud.serializer.Param; +import com.cloud.uservm.UserVm; +import com.cloud.vm.VirtualMachine; import com.google.gson.annotations.SerializedName; @SuppressWarnings("unused") diff --git a/api/src/org/apache/cloudstack/api/response/VMSnapshotResponse.java b/api/src/org/apache/cloudstack/api/response/VMSnapshotResponse.java new file mode 100644 index 00000000000..3b30ab61a8f --- /dev/null +++ b/api/src/org/apache/cloudstack/api/response/VMSnapshotResponse.java @@ -0,0 +1,220 @@ +// 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.response; + +import java.util.Date; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + +import com.cloud.serializer.Param; +import com.cloud.vm.snapshot.VMSnapshot; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value=VMSnapshot.class) +public class VMSnapshotResponse extends BaseResponse implements ControlledEntityResponse{ + + @SerializedName(ApiConstants.ID) + @Param(description = "the ID of the vm snapshot") + private String id; + + @SerializedName(ApiConstants.NAME) + @Param(description = "the name of the vm snapshot") + private String name; + + @SerializedName(ApiConstants.STATE) + @Param(description = "the state of the vm snapshot") + private VMSnapshot.State state; + + @SerializedName(ApiConstants.DESCRIPTION) + @Param(description = "the description of the vm snapshot") + private String description; + + @SerializedName(ApiConstants.DISPLAY_NAME) + @Param(description = "the display name of the vm snapshot") + private String displayName; + + @SerializedName(ApiConstants.ZONE_ID) + @Param(description = "the Zone ID of the vm snapshot") + private String zoneId; + + @SerializedName(ApiConstants.VIRTUAL_MACHINE_ID) + @Param(description = "the vm ID of the vm snapshot") + private String virtualMachineid; + + @SerializedName("parent") + @Param(description = "the parent ID of the vm snapshot") + private String parent; + + @SerializedName("parentName") + @Param(description = "the parent displayName of the vm snapshot") + private String parentName; + + @SerializedName("current") + @Param(description = "indiates if this is current snapshot") + private Boolean current; + + @SerializedName("type") + @Param(description = "VM Snapshot type") + private String type; + + @SerializedName(ApiConstants.CREATED) + @Param(description = "the create date of the vm snapshot") + private Date created; + + @SerializedName(ApiConstants.ACCOUNT) + @Param(description = "the account associated with the disk volume") + private String accountName; + + @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vpn") + private String projectId; + + @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vpn") + private String projectName; + + @SerializedName(ApiConstants.DOMAIN_ID) + @Param(description = "the ID of the domain associated with the disk volume") + private String domainId; + + @SerializedName(ApiConstants.DOMAIN) + @Param(description = "the domain associated with the disk volume") + private String domainName; + + @Override + public String getObjectId() { + return getId(); + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } + + public String getVirtualMachineid() { + return virtualMachineid; + } + + public void setVirtualMachineid(String virtualMachineid) { + this.virtualMachineid = virtualMachineid; + } + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + public void setState(VMSnapshot.State state) { + this.state = state; + } + + public VMSnapshot.State getState() { + return state; + } + + public Boolean getCurrent() { + return current; + } + + public void setCurrent(Boolean current) { + this.current = current; + } + + public void setParentName(String parentName) { + this.parentName = parentName; + } + + public String getParentName() { + return parentName; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public void setAccountName(String accountName) { + this.accountName = accountName; + + } + + @Override + public void setProjectId(String projectId) { + this.projectId = projectId; + + } + + @Override + public void setProjectName(String projectName) { + this.projectName = projectName; + + } + + @Override + public void setDomainId(String domainId) { + this.domainId = domainId; + } + + @Override + public void setDomainName(String domainName) { + this.domainName = domainName; + + } +} diff --git a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java index dcb2322e5b9..92d9a1d0cc1 100644 --- a/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VirtualRouterProviderResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.VirtualRouterProvider; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.VirtualRouterProvider; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VirtualRouterProvider.class) public class VirtualRouterProviderResponse extends BaseResponse implements ControlledEntityResponse { @SerializedName(ApiConstants.ID) @Param(description="the id of the router") diff --git a/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java b/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java index bfde73963c1..6c5c364cd8b 100644 --- a/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VlanIpRangeResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.dc.Vlan; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.dc.Vlan; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Vlan.class) @SuppressWarnings("unused") public class VlanIpRangeResponse extends BaseResponse implements ControlledEntityResponse{ @@ -80,6 +81,19 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network this belongs to") private String physicalNetworkId; + @SerializedName(ApiConstants.START_IPV6) @Param(description="the start ipv6 of the VLAN IP range") + private String startIpv6; + + @SerializedName(ApiConstants.END_IPV6) @Param(description="the end ipv6 of the VLAN IP range") + private String endIpv6; + + @SerializedName(ApiConstants.IP6_GATEWAY) @Param(description="the gateway of IPv6 network") + private String ip6Gateway; + + @SerializedName(ApiConstants.IP6_CIDR) @Param(description="the cidr of IPv6 network") + private String ip6Cidr; + + public void setId(String id) { this.id = id; } @@ -157,4 +171,24 @@ public class VlanIpRangeResponse extends BaseResponse implements ControlledEntit public String getphysicalNetworkId() { return physicalNetworkId; } + + public String getStartIpv6() { + return startIpv6; + } + + public void setStartIpv6(String startIpv6) { + this.startIpv6 = startIpv6; + } + + public void setEndIpv6(String endIpv6) { + this.endIpv6 = endIpv6; + } + + public void setIp6Gateway(String ip6Gateway) { + this.ip6Gateway = ip6Gateway; + } + + public void setIp6Cidr(String ip6Cidr) { + this.ip6Cidr = ip6Cidr; + } } diff --git a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java index d92153d0dbe..b10da0c032a 100644 --- a/api/src/org/apache/cloudstack/api/response/VolumeResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VolumeResponse.java @@ -20,13 +20,14 @@ import java.util.Date; import java.util.HashSet; import java.util.Set; -import com.cloud.storage.Volume; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.serializer.Param; +import com.cloud.storage.Volume; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Volume.class) @SuppressWarnings("unused") public class VolumeResponse extends BaseResponse implements ControlledViewEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java b/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java index 3e196febe24..70120d1d71f 100644 --- a/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpcOfferingResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.cloud.network.vpc.VpcOffering; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.vpc.VpcOffering; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=VpcOffering.class) @SuppressWarnings("unused") public class VpcOfferingResponse extends BaseResponse { diff --git a/api/src/org/apache/cloudstack/api/response/VpcResponse.java b/api/src/org/apache/cloudstack/api/response/VpcResponse.java index 94ea5983bf6..3dfd23b9653 100644 --- a/api/src/org/apache/cloudstack/api/response/VpcResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpcResponse.java @@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response; import java.util.Date; import java.util.List; -import com.cloud.network.vpc.Vpc; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.vpc.Vpc; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value=Vpc.class) @SuppressWarnings("unused") public class VpcResponse extends BaseResponse implements ControlledEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/VpnUsersResponse.java b/api/src/org/apache/cloudstack/api/response/VpnUsersResponse.java index 958c8b59bc4..e654e8a522a 100644 --- a/api/src/org/apache/cloudstack/api/response/VpnUsersResponse.java +++ b/api/src/org/apache/cloudstack/api/response/VpnUsersResponse.java @@ -16,13 +16,14 @@ // under the License. package org.apache.cloudstack.api.response; -import com.cloud.network.VpnUser; import org.apache.cloudstack.api.ApiConstants; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; +import com.cloud.network.VpnUser; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + @EntityReference(value = VpnUser.class) @SuppressWarnings("unused") public class VpnUsersResponse extends BaseResponse implements ControlledEntityResponse{ diff --git a/api/src/org/apache/cloudstack/api/response/ZoneResponse.java b/api/src/org/apache/cloudstack/api/response/ZoneResponse.java index 72e0bb2844d..2ebb15a1ecf 100644 --- a/api/src/org/apache/cloudstack/api/response/ZoneResponse.java +++ b/api/src/org/apache/cloudstack/api/response/ZoneResponse.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.EntityReference; + import com.cloud.dc.DataCenter; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; @@ -43,6 +44,12 @@ public class ZoneResponse extends BaseResponse { @SerializedName(ApiConstants.DNS2) @Param(description="the second DNS for the Zone") private String dns2; + @SerializedName(ApiConstants.IP6_DNS1) @Param(description="the first IPv6 DNS for the Zone") + private String ip6Dns1; + + @SerializedName(ApiConstants.IP6_DNS2) @Param(description="the second IPv6 DNS for the Zone") + private String ip6Dns2; + @SerializedName(ApiConstants.INTERNAL_DNS1) @Param(description="the first internal DNS for the Zone") private String internalDns1; @@ -65,8 +72,8 @@ public class ZoneResponse extends BaseResponse { @SerializedName(ApiConstants.DOMAIN) @Param(description="Network domain name for the networks in the zone") private String domain; - @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the containing domain, null for public zones") - private Long domainId; + @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the UUID of the containing domain, null for public zones") + private String domainId; @SerializedName("domainname") @Param(description="the name of the containing domain, null for public zones") private String domainName; @@ -140,7 +147,7 @@ public class ZoneResponse extends BaseResponse { this.domain = domain; } - public void setDomainId(Long domainId) { + public void setDomainId(String domainId) { this.domainId = domainId; } @@ -175,4 +182,20 @@ public class ZoneResponse extends BaseResponse { public void setLocalStorageEnabled(boolean localStorageEnabled) { this.localStorageEnabled = localStorageEnabled; } + + 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/org/apache/cloudstack/network/ExternalNetworkDeviceManager.java b/api/src/org/apache/cloudstack/network/ExternalNetworkDeviceManager.java index 1070355038b..485d04da6bb 100644 --- a/api/src/org/apache/cloudstack/network/ExternalNetworkDeviceManager.java +++ b/api/src/org/apache/cloudstack/network/ExternalNetworkDeviceManager.java @@ -19,12 +19,13 @@ package org.apache.cloudstack.network; import java.util.ArrayList; import java.util.List; -import com.cloud.network.Network; import org.apache.cloudstack.api.command.admin.network.AddNetworkDeviceCmd; import org.apache.cloudstack.api.command.admin.network.DeleteNetworkDeviceCmd; import org.apache.cloudstack.api.command.admin.network.ListNetworkDeviceCmd; -import com.cloud.host.Host; import org.apache.cloudstack.api.response.NetworkDeviceResponse; + +import com.cloud.host.Host; +import com.cloud.network.Network; import com.cloud.utils.component.Manager; public interface ExternalNetworkDeviceManager extends Manager { diff --git a/api/src/org/apache/cloudstack/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java index b03a7fc0062..c3f86aabb7f 100644 --- a/api/src/org/apache/cloudstack/query/QueryService.java +++ b/api/src/org/apache/cloudstack/query/QueryService.java @@ -16,8 +16,6 @@ // under the License. package org.apache.cloudstack.query; -import java.util.List; - import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; @@ -26,6 +24,8 @@ import org.apache.cloudstack.api.command.user.account.ListAccountsCmd; import org.apache.cloudstack.api.command.user.account.ListProjectAccountsCmd; import org.apache.cloudstack.api.command.user.event.ListEventsCmd; import org.apache.cloudstack.api.command.user.job.ListAsyncJobsCmd; +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.project.ListProjectInvitationsCmd; import org.apache.cloudstack.api.command.user.project.ListProjectsCmd; import org.apache.cloudstack.api.command.user.securitygroup.ListSecurityGroupsCmd; @@ -33,8 +33,10 @@ import org.apache.cloudstack.api.command.user.tag.ListTagsCmd; import org.apache.cloudstack.api.command.user.vm.ListVMsCmd; import org.apache.cloudstack.api.command.user.vmgroup.ListVMGroupsCmd; import org.apache.cloudstack.api.command.user.volume.ListVolumesCmd; +import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd; import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.response.AsyncJobResponse; +import org.apache.cloudstack.api.response.DiskOfferingResponse; import org.apache.cloudstack.api.response.DomainRouterResponse; import org.apache.cloudstack.api.response.EventResponse; import org.apache.cloudstack.api.response.HostResponse; @@ -45,20 +47,17 @@ import org.apache.cloudstack.api.response.ProjectInvitationResponse; import org.apache.cloudstack.api.response.ProjectResponse; import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse; +import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.UserResponse; import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.VolumeResponse; +import org.apache.cloudstack.api.response.ZoneResponse; - - -import com.cloud.async.AsyncJob; import com.cloud.exception.PermissionDeniedException; -import com.cloud.utils.Pair; /** * Service used for list api query. - * @author minc * */ public interface QueryService { @@ -92,4 +91,10 @@ public interface QueryService { public ListResponse searchForAccounts(ListAccountsCmd cmd); public ListResponse searchForAsyncJobs(ListAsyncJobsCmd cmd); + + public ListResponse searchForDiskOfferings(ListDiskOfferingsCmd cmd); + + public ListResponse searchForServiceOfferings(ListServiceOfferingsCmd cmd); + + public ListResponse listDataCenters(ListZonesByCmd cmd); } diff --git a/api/src/org/apache/cloudstack/region/Region.java b/api/src/org/apache/cloudstack/region/Region.java new file mode 100644 index 00000000000..7f0aeeab2ef --- /dev/null +++ b/api/src/org/apache/cloudstack/region/Region.java @@ -0,0 +1,35 @@ +// 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.region; + +/** + * + */ +public interface Region { + + public int getId(); + + public String getName(); + + public void setName(String name); + + public String getEndPoint(); + + public String getApiKey(); + + public String getSecretKey(); +} diff --git a/api/src/org/apache/cloudstack/region/RegionService.java b/api/src/org/apache/cloudstack/region/RegionService.java new file mode 100644 index 00000000000..8679ca92b10 --- /dev/null +++ b/api/src/org/apache/cloudstack/region/RegionService.java @@ -0,0 +1,157 @@ +// 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.region; + +import java.util.List; + +import org.apache.cloudstack.api.command.admin.account.DeleteAccountCmd; +import org.apache.cloudstack.api.command.admin.account.DisableAccountCmd; +import org.apache.cloudstack.api.command.admin.account.EnableAccountCmd; +import org.apache.cloudstack.api.command.admin.account.UpdateAccountCmd; +import org.apache.cloudstack.api.command.admin.domain.DeleteDomainCmd; +import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd; +import org.apache.cloudstack.api.command.admin.user.DeleteUserCmd; +import org.apache.cloudstack.api.command.admin.user.DisableUserCmd; +import org.apache.cloudstack.api.command.admin.user.EnableUserCmd; +import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd; +import org.apache.cloudstack.api.command.user.region.ListRegionsCmd; + +import com.cloud.domain.Domain; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.user.Account; +import com.cloud.user.UserAccount; + + +public interface RegionService { + /** + * Adds a Region to the local Region + * @param id + * @param name + * @param endPoint + * @param apiKey + * @param secretKey + * @return Return added Region object + */ + public Region addRegion(int id, String name, String endPoint, String apiKey, String secretKey); + + /** + * Update details of the Region with specified Id + * @param id + * @param name + * @param endPoint + * @param apiKey + * @param secretKey + * @return Return updated Region object + */ + public Region updateRegion(int id, String name, String endPoint, String apiKey, String secretKey); + + /** + * @param id + * @return True if region is successfully removed + */ + public boolean removeRegion(int id); + + /** List all Regions or by Id/Name + * @param id + * @param name + * @return List of Regions + */ + public List listRegions(ListRegionsCmd cmd); + + /** + * Deletes a user by userId + * isPopagate flag is set to true if sent from peer Region + * @param cmd + * + * @return true if delete was successful, false otherwise + */ + boolean deleteUserAccount(DeleteAccountCmd cmd); + + /** + * Updates an account + * isPopagate falg is set to true if sent from peer Region + * + * @param cmd + * - the parameter containing accountId or account nameand domainId + * @return updated account object + */ + Account updateAccount(UpdateAccountCmd cmd); + + /** + * Disables an account by accountName and domainId or accountId + * @param cmd + * @return + * @throws ResourceUnavailableException + * @throws ConcurrentOperationException + */ + Account disableAccount(DisableAccountCmd cmd) throws ConcurrentOperationException, ResourceUnavailableException; + + /** + * Enables an account by accountId + * @param cmd + * @return + */ + Account enableAccount(EnableAccountCmd cmd); + + /** + * Deletes user by Id + * @param deleteUserCmd + * @return true if delete was successful, false otherwise + */ + boolean deleteUser(DeleteUserCmd deleteUserCmd); + + /** + * update an existing domain + * + * @param cmd + * - the command containing domainId and new domainName + * @return Domain object if the command succeeded + */ + public Domain updateDomain(UpdateDomainCmd updateDomainCmd); + + /** + * Deletes domain + * @param cmd + * @return true if delete was successful, false otherwise + */ + public boolean deleteDomain(DeleteDomainCmd cmd); + + /** + * Update a user by userId + * + * @param userId + * @return UserAccount object + */ + public UserAccount updateUser(UpdateUserCmd updateUserCmd); + + /** + * Disables a user by userId + * + * @param cmd + * @return UserAccount object + */ + public UserAccount disableUser(DisableUserCmd cmd); + + /** + * Enables a user + * + * @param cmd + * @return UserAccount object + */ + public UserAccount enableUser(EnableUserCmd cmd); +} diff --git a/api/src/org/apache/cloudstack/region/RegionSync.java b/api/src/org/apache/cloudstack/region/RegionSync.java new file mode 100644 index 00000000000..5a1f5a6c19d --- /dev/null +++ b/api/src/org/apache/cloudstack/region/RegionSync.java @@ -0,0 +1,33 @@ +// 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.region; + +import java.util.Date; + +/** + * + */ +public interface RegionSync { + + public long getId(); + + public int getRegionId(); + + public String getApi(); + + Date getCreateDate(); +} diff --git a/api/src/org/apache/cloudstack/usage/Usage.java b/api/src/org/apache/cloudstack/usage/Usage.java new file mode 100644 index 00000000000..c74d3b7273e --- /dev/null +++ b/api/src/org/apache/cloudstack/usage/Usage.java @@ -0,0 +1,69 @@ +// 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.usage; + +import org.apache.cloudstack.api.InternalIdentity; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +public interface Usage { + + public long getId(); + + public Long getZoneId(); + + public Long getAccountId(); + + public Long getDomainId(); + + public String getDescription(); + + public String getUsageDisplay(); + + public int getUsageType(); + + public Double getRawUsage(); + + public Long getVmInstanceId(); + + public String getVmName(); + + public Long getOfferingId(); + + public Long getTemplateId(); + + public Long getUsageId(); + + public String getType(); + + public Long getNetworkId(); + + public Long getSize(); + + public Date getStartDate(); + + public Date getEndDate(); +} diff --git a/server/src/com/cloud/server/ManagementServerExt.java b/api/src/org/apache/cloudstack/usage/UsageService.java old mode 100644 new mode 100755 similarity index 89% rename from server/src/com/cloud/server/ManagementServerExt.java rename to api/src/org/apache/cloudstack/usage/UsageService.java index 4e506a3bc4a..383822592bc --- a/server/src/com/cloud/server/ManagementServerExt.java +++ b/api/src/org/apache/cloudstack/usage/UsageService.java @@ -14,16 +14,16 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.server; +package org.apache.cloudstack.usage; import java.util.List; import java.util.TimeZone; -import com.cloud.api.commands.GenerateUsageRecordsCmd; -import com.cloud.api.commands.GetUsageRecordsCmd; +import org.apache.cloudstack.api.command.admin.usage.GenerateUsageRecordsCmd; +import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd; import org.apache.cloudstack.api.response.UsageTypeResponse; -import com.cloud.usage.UsageVO; -public interface ManagementServerExt extends ManagementServer { + +public interface UsageService { /** * Generate Billing Records from the last time it was generated to the * time specified. @@ -50,7 +50,7 @@ public interface ManagementServerExt extends ManagementServer { * the appropriate page number) * @return a list of usage records */ - List getUsageRecords(GetUsageRecordsCmd cmd); + List getUsageRecords(GetUsageRecordsCmd cmd); /** * Retrieves the timezone used for usage aggregation. One day is represented as midnight to 11:59:59pm @@ -60,4 +60,5 @@ public interface ManagementServerExt extends ManagementServer { TimeZone getUsageTimezone(); List listUsageTypes(); + } diff --git a/server/src/com/cloud/usage/UsageTypes.java b/api/src/org/apache/cloudstack/usage/UsageTypes.java similarity index 98% rename from server/src/com/cloud/usage/UsageTypes.java rename to api/src/org/apache/cloudstack/usage/UsageTypes.java index e5a48d5c143..2baa1d20057 100644 --- a/server/src/com/cloud/usage/UsageTypes.java +++ b/api/src/org/apache/cloudstack/usage/UsageTypes.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.usage; +package org.apache.cloudstack.usage; import java.util.ArrayList; import java.util.List; diff --git a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java index 91573d03c43..71004977d89 100644 --- a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java +++ b/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java @@ -35,83 +35,113 @@ import com.cloud.storage.StoragePoolStatus; public class BackupSnapshotCommandTest { public StoragePool pool = new StoragePool() { + @Override public long getId() { return 1L; }; + @Override public String getName() { return "name"; }; + @Override public String getUuid() { return "bed9f83e-cac3-11e1-ac8a-0050568b007e"; }; + @Override public StoragePoolType getPoolType() { return StoragePoolType.Filesystem; }; + @Override public Date getCreated() { Date date = null; try { date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") - .parse("01/01/1970 12:12:12"); + .parse("01/01/1970 12:12:12"); } catch (ParseException e) { e.printStackTrace(); } return date; } + @Override public Date getUpdateTime() { return new Date(); }; + @Override public long getDataCenterId() { return 0L; }; + @Override public long getCapacityBytes() { return 0L; }; + @Override public long getAvailableBytes() { return 0L; }; + @Override public Long getClusterId() { return 0L; }; + @Override public String getHostAddress() { return "hostAddress"; }; + @Override public String getPath() { return "path"; }; + @Override public String getUserInfo() { return "userInfo"; }; + @Override public boolean isShared() { return false; }; + @Override public boolean isLocal() { return false; }; + @Override public StoragePoolStatus getStatus() { return StoragePoolStatus.Up; }; + @Override public int getPort() { return 25; }; + @Override public Long getPodId() { return 0L; + } + + @Override + public Long getStorageProviderId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isInMaintenance() { + // TODO Auto-generated method stub + return false; }; }; @@ -205,7 +235,7 @@ public class BackupSnapshotCommandTest { public void testGetCreated() { try { Date date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") - .parse("01/01/1970 12:12:12"); + .parse("01/01/1970 12:12:12"); Date d = pool.getCreated(); assertTrue(d.compareTo(date) == 0); } catch (ParseException e) { diff --git a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java index a7359134f0a..767d7c37c5e 100644 --- a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java +++ b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java @@ -20,13 +20,13 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.junit.Before; -import org.junit.Test; - import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; +import org.junit.Before; +import org.junit.Test; + import com.cloud.agent.api.SnapshotCommand; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.storage.StoragePool; @@ -112,6 +112,18 @@ public class SnapshotCommandTest { public Long getPodId() { return 0L; + } + + @Override + public Long getStorageProviderId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isInMaintenance() { + // TODO Auto-generated method stub + return false; }; }; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java index 60fea9e54d2..90759fe6702 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddClusterCmdTest.java @@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.test; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd; import org.junit.Before; import org.junit.Rule; @@ -26,8 +28,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ResponseGenerator; -import org.apache.cloudstack.api.ServerApiException; import com.cloud.exception.DiscoveryException; import com.cloud.exception.ResourceInUseException; import com.cloud.org.Cluster; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java index 4c1b5ee0e0a..531f51105e1 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddHostCmdTest.java @@ -19,17 +19,17 @@ package org.apache.cloudstack.api.command.test; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.host.AddHostCmd; +import org.apache.cloudstack.api.response.HostResponse; +import org.apache.cloudstack.api.response.ListResponse; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ResponseGenerator; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.HostResponse; -import org.apache.cloudstack.api.response.ListResponse; import com.cloud.exception.DiscoveryException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java index 0b5798fbe23..2046052eb46 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddNetworkServiceProviderCmdTest.java @@ -22,6 +22,7 @@ import java.util.List; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.network.AddNetworkServiceProviderCmd; import org.junit.Before; import org.junit.Rule; @@ -29,7 +30,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ServerApiException; import com.cloud.exception.ResourceAllocationException; import com.cloud.network.NetworkService; import com.cloud.network.PhysicalNetworkServiceProvider; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java index 1cdd76fbfe2..d6de94dd033 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddSecondaryStorageCmdTest.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.test; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.host.AddSecondaryStorageCmd; +import org.apache.cloudstack.api.response.HostResponse; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ResponseGenerator; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.HostResponse; import com.cloud.host.Host; import com.cloud.resource.ResourceService; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java index 34d0baff5ab..141a2368d78 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddSwiftCmdTest.java @@ -19,16 +19,16 @@ package org.apache.cloudstack.api.command.test; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.admin.swift.AddSwiftCmd; +import org.apache.cloudstack.api.response.SwiftResponse; import org.junit.Before; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ResponseGenerator; -import org.apache.cloudstack.api.ServerApiException; -import org.apache.cloudstack.api.response.SwiftResponse; import com.cloud.exception.DiscoveryException; import com.cloud.resource.ResourceService; import com.cloud.storage.Swift; diff --git a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java index 78e9d92fc9b..69b9050ce91 100644 --- a/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java +++ b/api/test/org/apache/cloudstack/api/command/test/AddVpnUserCmdTest.java @@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.test; import junit.framework.Assert; import junit.framework.TestCase; +import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.command.user.vpn.AddVpnUserCmd; import org.junit.Before; import org.junit.Rule; @@ -26,7 +27,6 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mockito; -import org.apache.cloudstack.api.ServerApiException; import com.cloud.network.VpnUser; import com.cloud.network.vpn.RemoteAccessVpnService; import com.cloud.user.Account; diff --git a/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java new file mode 100644 index 00000000000..01cd33bec80 --- /dev/null +++ b/api/test/org/apache/cloudstack/api/command/test/RegionCmdTest.java @@ -0,0 +1,104 @@ +// 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.test; + +import junit.framework.Assert; +import junit.framework.TestCase; + +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.command.admin.region.AddRegionCmd; +import org.apache.cloudstack.api.response.RegionResponse; +import org.apache.cloudstack.region.Region; +import org.apache.cloudstack.region.RegionService; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; + +public class RegionCmdTest extends TestCase { + + private AddRegionCmd addRegionCmd; + private ResponseGenerator responseGenerator; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void setUp() { + + addRegionCmd = new AddRegionCmd() { + + @Override + public Integer getId() { + return 2; + } + + @Override + public String getRegionName() { + return "APAC"; + } + + }; + } + + @Test + public void testCreateSuccess() { + + RegionService regionService = Mockito.mock(RegionService.class); + + Region region = Mockito.mock(Region.class); + Mockito.when( + regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(region); + + addRegionCmd._regionService = regionService; + responseGenerator = Mockito.mock(ResponseGenerator.class); + + RegionResponse regionResponse = Mockito.mock(RegionResponse.class); + + Mockito.when(responseGenerator.createRegionResponse(region)).thenReturn( + regionResponse); + + addRegionCmd._responseGenerator = responseGenerator; + addRegionCmd.execute(); + + } + + @Test + public void testCreateFailure() { + + RegionService regionService = Mockito.mock(RegionService.class); + + Region region = Mockito.mock(Region.class); + Mockito.when( + regionService.addRegion(Mockito.anyInt(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString(), Mockito.anyString())) + .thenReturn(null); + + addRegionCmd._regionService = regionService; + + try { + addRegionCmd.execute(); + } catch (ServerApiException exception) { + Assert.assertEquals("Failed to add Region", + exception.getDescription()); + } + + } + +} diff --git a/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java b/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java new file mode 100644 index 00000000000..1f218f47e2a --- /dev/null +++ b/api/test/org/apache/cloudstack/api/command/test/UsageCmdTest.java @@ -0,0 +1,69 @@ +// 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.test; + +import junit.framework.TestCase; +import org.apache.cloudstack.api.command.admin.usage.GetUsageRecordsCmd; +import org.apache.cloudstack.usage.Usage; +import org.apache.cloudstack.usage.UsageService; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.mockito.Mockito; + +import java.util.ArrayList; +import java.util.List; + +public class UsageCmdTest extends TestCase { + + private GetUsageRecordsCmd getUsageRecordsCmd; + + @Rule + public ExpectedException expectedException = ExpectedException.none(); + + @Before + public void setUp() { + + getUsageRecordsCmd = new GetUsageRecordsCmd() { + + }; + } + + @Test + public void testExecuteSuccess() { + UsageService usageService = Mockito.mock(UsageService.class); + getUsageRecordsCmd._usageService = usageService; + getUsageRecordsCmd.execute(); + } + + @Test + public void testExecuteEmptyResult() { + + UsageService usageService = Mockito.mock(UsageService.class); + + List usageRecords = new ArrayList(); + + Mockito.when(usageService.getUsageRecords(getUsageRecordsCmd)).thenReturn( + usageRecords); + + getUsageRecordsCmd._usageService = usageService; + getUsageRecordsCmd.execute(); + + } + +} diff --git a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java new file mode 100644 index 00000000000..852e52b1b86 --- /dev/null +++ b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java @@ -0,0 +1,229 @@ +// 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 src.com.cloud.agent.api.test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.junit.Test; + +import com.cloud.agent.api.storage.ResizeVolumeCommand; +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePool; +import com.cloud.storage.StoragePoolStatus; + + +public class ResizeVolumeCommandTest { + + public StoragePool dummypool = new StoragePool() { + @Override + public long getId() { + return 1L; + }; + + @Override + public String getName() { + return "name"; + }; + + @Override + public String getUuid() { + return "bed9f83e-cac3-11e1-ac8a-0050568b007e"; + }; + + @Override + public StoragePoolType getPoolType() { + return StoragePoolType.Filesystem; + }; + + @Override + public Date getCreated() { + Date date = null; + try { + date = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss") + .parse("01/01/1970 12:12:12"); + } catch (ParseException e) { + e.printStackTrace(); + } + return date; + } + + @Override + public Date getUpdateTime() { + return new Date(); + }; + + @Override + public long getDataCenterId() { + return 0L; + }; + + @Override + public long getCapacityBytes() { + return 0L; + }; + + @Override + public long getAvailableBytes() { + return 0L; + }; + + @Override + public Long getClusterId() { + return 0L; + }; + + @Override + public String getHostAddress() { + return "hostAddress"; + }; + + @Override + public String getPath() { + return "path"; + }; + + @Override + public String getUserInfo() { + return "userInfo"; + }; + + @Override + public boolean isShared() { + return false; + }; + + @Override + public boolean isLocal() { + return false; + }; + + @Override + public StoragePoolStatus getStatus() { + return StoragePoolStatus.Up; + }; + + @Override + public int getPort() { + return 25; + }; + + @Override + public Long getPodId() { + return 0L; + } + + @Override + public Long getStorageProviderId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isInMaintenance() { + // TODO Auto-generated method stub + return false; + }; + }; + + Long newSize = 4194304L; + Long currentSize = 1048576L; + + ResizeVolumeCommand rv = new ResizeVolumeCommand("dummydiskpath", + new StorageFilerTO(dummypool), currentSize, newSize, false, + "vmName"); + + @Test + public void testExecuteInSequence() { + boolean b = rv.executeInSequence(); + assertFalse(b); + } + + @Test + public void testGetPath() { + String path = rv.getPath(); + assertTrue(path.equals("dummydiskpath")); + } + + @Test + public void testGetPoolUuid() { + String poolUuid = rv.getPoolUuid(); + assertTrue(poolUuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e")); + } + + @Test + public void testGetPool() { + StorageFilerTO pool = rv.getPool(); + + Long id = pool.getId(); + Long expectedL = 1L; + assertEquals(expectedL, id); + + String uuid = pool.getUuid(); + assertTrue(uuid.equals("bed9f83e-cac3-11e1-ac8a-0050568b007e")); + + String host = pool.getHost(); + assertTrue(host.equals("hostAddress")); + + String path = pool.getPath(); + assertTrue(path.equals("path")); + + String userInfo = pool.getUserInfo(); + assertTrue(userInfo.equals("userInfo")); + + Integer port = pool.getPort(); + Integer expectedI = 25; + assertEquals(expectedI, port); + + StoragePoolType type = pool.getType(); + assertEquals(StoragePoolType.Filesystem, type); + + String str = pool.toString(); + assertTrue(str.equals("Pool[" + id.toString() + "|" + host + ":" + + port.toString() + "|" + path + "]")); + } + + @Test + public void testGetNewSize() { + long newSize = rv.getNewSize(); + assertTrue(newSize == 4194304L); + } + + @Test + public void testGetCurrentSize() { + long currentSize = rv.getCurrentSize(); + assertTrue(currentSize == 1048576L); + } + + @Test + public void testGetShrinkOk() { + assertFalse(rv.getShrinkOk()); + } + + @Test + public void testGetInstanceName() { + String vmName = rv.getInstanceName(); + assertTrue(vmName.equals("vmName")); + } + +} diff --git a/awsapi/conf/applicationContext.xml.in b/awsapi/conf/applicationContext.xml.in new file mode 100644 index 00000000000..0a24df214af --- /dev/null +++ b/awsapi/conf/applicationContext.xml.in @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/awsapi/conf/cloud-bridge.properties b/awsapi/conf/cloud-bridge.properties.in similarity index 100% rename from awsapi/conf/cloud-bridge.properties rename to awsapi/conf/cloud-bridge.properties.in diff --git a/awsapi/conf/ec2-service.properties b/awsapi/conf/ec2-service.properties.in similarity index 100% rename from awsapi/conf/ec2-service.properties rename to awsapi/conf/ec2-service.properties.in diff --git a/awsapi/modules/.gitignore b/awsapi/modules/.gitignore deleted file mode 100644 index 68b3d43138d..00000000000 --- a/awsapi/modules/.gitignore +++ /dev/null @@ -1,54 +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. - -build/replace.properties -build/build.number -bin/ -cloudstack-proprietary/ -premium/ -.lock-wscript -artifacts/ -.waf-* -waf-* -target/ -override/ -.metadata -dist/ -*~ -*.bak -cloud-*.tar.bz2 -*.log -*.pyc -build.number -api.log.*.gz -cloud.log.*.* -unittest -deps/cloud.userlibraries -deps/awsapi-lib/ -.DS_Store -.idea -*.iml -git-remote-https.exe.stackdump -*.swp -tools/devcloud/devcloudbox/.vagrant -deps/*.jar -deps/*.war -deps/*.mar -*.jar -awsapi/modules/* -!.gitignore - diff --git a/awsapi/pom.xml b/awsapi/pom.xml index 3ab595211d4..8e07f9e2124 100644 --- a/awsapi/pom.xml +++ b/awsapi/pom.xml @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT @@ -302,8 +302,20 @@ ../utils/conf/ + + ${basedir}/resource/AmazonEC2 + + + org.apache.maven.plugins + maven-war-plugin + 2.3 + + ./web/web.xml + ./target/generated-webapp + + org.mortbay.jetty maven-jetty-plugin @@ -317,9 +329,40 @@ /awsapi ${basedir}/web/web.xml - ${basedir}/target/cloud-awsapi-${project.version} + ${basedir}/target/generated-webapp - + + + maven-antrun-plugin + 1.7 + + + generate-resource + generate-resources + + run + + + + + + + + + + + + + + + + + + + - CloudBridgeEC2Servlet + EC2RestServlet /rest/AmazonEC2/* - CloudBridgeEC2Servlet + EC2RestServlet /rest/AmazonEC2 diff --git a/build.xml b/build.xml deleted file mode 100755 index b013518ac72..00000000000 --- a/build.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - This is the overall dispatch file. It includes other build - files but doesnot provide targets of its own. Do not modify - this file. If you need to create your own targets, modify the - developer.xml. - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-aws-api.xml b/build/build-aws-api.xml deleted file mode 100644 index 40ad22c2679..00000000000 --- a/build/build-aws-api.xml +++ /dev/null @@ -1,478 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-cloud-plugins.xml b/build/build-cloud-plugins.xml deleted file mode 100755 index 207ef7113c8..00000000000 --- a/build/build-cloud-plugins.xml +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - - - - - - Cloud Stack ant build file for building all the plugins - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-cloud.xml b/build/build-cloud.xml deleted file mode 100755 index c31d00da220..00000000000 --- a/build/build-cloud.xml +++ /dev/null @@ -1,595 +0,0 @@ - - - - - - - Cloud Stack ant build file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-common.xml b/build/build-common.xml deleted file mode 100755 index 7240f5323c3..00000000000 --- a/build/build-common.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-devcloud.xml b/build/build-devcloud.xml deleted file mode 100644 index a001dc2dd9c..00000000000 --- a/build/build-devcloud.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-docs.xml b/build/build-docs.xml deleted file mode 100755 index c38b986ed5f..00000000000 --- a/build/build-docs.xml +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - Cloud Stack ant build file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-marvin.xml b/build/build-marvin.xml deleted file mode 100644 index 6daac03f2ce..00000000000 --- a/build/build-marvin.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - This build file contains simple targets that - - build - - package - - distribute - the Marvin test client written in python - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/build-tests.xml b/build/build-tests.xml deleted file mode 100755 index 5f41ba278ff..00000000000 --- a/build/build-tests.xml +++ /dev/null @@ -1,319 +0,0 @@ - - - - - - - Cloud Stack ant build file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - diff --git a/build/build-usage.xml b/build/build-usage.xml deleted file mode 100644 index 9940f46edb3..00000000000 --- a/build/build-usage.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - Cloud Stack Usage server build - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/developer.xml b/build/developer.xml deleted file mode 100755 index fdda171aff6..00000000000 --- a/build/developer.xml +++ /dev/null @@ -1,431 +0,0 @@ - - - - - - - This is a developer.xml with tools to start and stop tomcat and - generally developer targets that has nothing to do with compiling. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - password - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/overview.html b/build/overview.html deleted file mode 100755 index 22f349fe10b..00000000000 --- a/build/overview.html +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - -

- -VMOps source javadoc. - -

-Javadoc for JUnit tests -is also available. -

- - - diff --git a/build/package.xml b/build/package.xml deleted file mode 100755 index 3efdd7dda05..00000000000 --- a/build/package.xml +++ /dev/null @@ -1,305 +0,0 @@ - - - - - - - This is a package.xml with tools to package the cloud stack distribution - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/release-notes b/build/release-notes deleted file mode 100644 index 34b20803a00..00000000000 --- a/build/release-notes +++ /dev/null @@ -1,328 +0,0 @@ -******************************************************************************** - VMOps Cloud Stack Version 0.4 - Release Notes -******************************************************************************** - -================================= -WHAT'S NEW : -================================= - -* NIC bonding support for the Computing, Routing, and Storage nodes to take -advantage of the multiple NICS installed on the server. -* Maintenance Mode support for physical servers. Administrators now have the -option to enable or disable maintenance mode on any physical servers. Enabling -maintenance mode on a Routing or Computing node will result in the seamless live -migration of guest virtual machines into other physical servers within the same -zone before making the server available for maintenance. -* Introduction of a new user web interface for allowing user accounts to manage -their own virtual machines. This new interface has a brand new look and feel, -allows for easier branding and customization, and is easier to incorporate into -existing web interfaces. -* Added support for the creation of Reseller Domains. The Reseller Domain -feature allows host providers to create resellers complete with their own -user base and administrators while using the same global computing resources -provided by the host provider. -* Added a new email alerting system that will now inform administrators of -events such as when physical servers are down or computing resources are -passing a pre-configured threshold. -* Massive improvements to the existing Developer and Integration API. Error -codes have now been added and existing API method names and parameters have been -made more consistent. A JSON format can also now be optionally -returned in addition to the existing XML format. Please read the new API -Reference documentation for more details on the changes. -* Billing records have now been changed to Usage records to provide data for -both billing integration and usage metering. Price has been completely removed -from VMOps. Instead we added ability to set your own display text for both -service offering and templates. You can now use this to set any text for the UI -to display. -* New virtual machines deployed will now generate a random password. A reset -password is also now available both in the web user interface as well as the -API. We support both Linux and Windows OS based templates. -* Storage server is now a bare-bone installation and uses the new COMSTAR iSCSI -stack for improved performance. We recognized that while running the storage -server as a virtual machine does allows for more hardware support, it severely -impacts performance. The list of compatible hardware can be found in the Open -Solaris website. -* Added clustering support for the VMOps Management Server. -* Added the ability to configure an additional storage ip address (separate -subnet) for both Routing and Computing servers. If a server is configured with -an additional storage ip, all storage traffic will route through this subnet and -all network/internet traffic will route through the existing private network. -* Added concept of a user account. VMOps supports multiple username for a -single user account. -* Created new installers for the VMOps MultiTenant Hypervisor and the VMOps -Storage. - -================================= -KNOWN ISSUES : -================================= - -* DomR is still counting internal network activities as part of the usage that -is being returned by the API. -* The reset password for virtual machine feature does not return an error if it -fails to successfully reset the password. -* VMOps installation scripts to not validate bad network configuration values. -* VNX Proxy Server does not handle rapid refreshes of web console proxy well. -* VNC Proxy Server at times do not return a thumbnail image. -* Rebooting a DomR instance will cause network traffic to not be collected. -* Associating new IP addresses should clean out existing LB or PF rules before -assigning it to a DomR instance. -* The Usage parse engine needs to be split out from the VMOps Management Server -so that only a single instance of this can be running and does not affect -normal operations. -* Templates needs a way of specifying the minimum CPU and Memory requirements. -* createUser API method currently allows you to assign users to admin accounts. -* Installations of servers with more than 3 NIC sometimes duplicates the MAC -address on the ifcfg configuration files. -* Additional admin only API methods are missing (ie. Domain management, router -management). -* Usage parse engine could go OOM in the event it has not been run recently -and there are a large (2 million+ records). -* Problem with domU when both e1000 and e1000e used as a NIC drivers for a -Computing Server. The installer needs to blacklist one of the drivers. -* vnet failures and xen crashes currently do not generate an alert to the administrator. -* The current limit for domU instances created on a Computing Server is 64 and -the currently limit for domR instances created is 59 on a Routing Server. -* No current way of allowing different subnets for different pods within the -same zone. -* limit the number of usage and event records returned by the API. A large -enough of the query could cause the Management Server to go oom. - -================================= -BUG FIXES : -================================= - -* Improved transactions across both database calls and calls across agents. -* Fixed an issue where duplicate IP or LB rules could be sent to the DomR -instance during a DomR restart. -* Removed requirement of the reverse DNS lookup for the Storage Server. -* Massive improvements to the HA process. -* Fixed an issue where the it would take too long for the management server -to detect a TCP disconnect. -* Fixed an issue where the the agent would *think* it has connected to the -management server but in reality, it is just stuck waiting for a response that -will never come. -* Generic DB lock wait timeout fixes. -* Improvements to the general state management of the servers. -* Fixed issue where where physical servers with the same IP attempts to connect -to the Management Server. The second server is now prevented from registering. -* Fixed an issue where deleting a user from an account would result in all the -virtual machines to be cleaned up. This can only happen if the last user for -an account has been deleted. -* Fixed an issue where the source NAT ip address of a DomR instance is being -released back into the public pool even though the DomR instance was not -successfully destroyed. -* Fixed an issue where a guest virtual machine cannot be destroyed while in HA -state. -* Removed requirement to specify the storage type when installing a new tempate. -* Fixed an issue where the console proxy from different zones are all starting -in the same zone. -* Fixed an issue where the listing of virtual machines would hang if the console -proxy is not even started. -* Massive improvements to our installer scripts. -* Massive improvements to the general stability of the Cloud Stack. -* Fixed an issue where the Hypervisor installer is unable to install onto -machines with a IPMI card. -* As usual, there are too many bug fixes to list... - -******************************************************************************** - VMOps Cloud Stack Version 0.3.xxxx - Release Notes -******************************************************************************** - -================================= -WHAT'S NEW : -================================= - -* Introduction of VMOps Developer API. This allows users of the VMOps Cloud - Stack to manage their virtual machines through a set of REST-like API. -* Improved collection of user usage data that can be used for both billing - aggregation and metric collection. -* High availability support for user virtual machines. -* Support for automatic hypervisor agent software update. -* VNC console proxy servers can now run as managed VMOps system VMs. The new - implementation provides features such as on-demand VM startup, standby - capacity pre-allocation and console proxy load monitoring. -* Much Improved VMOps Cloud Stack installation process. VMOps Cloud Stack can - now be installed with a minimum of two physical servers. -* VMOps Cloud Stack installation DVD now comes in two flavors. VMOps Cloud Stack - Management Server Installation DVD and VMOps Cloud Stack Multitenant - Hypervisor Installation DVD. - -================================= -KNOWN ISSUES : -================================= - -* PV drivers for Windows 2003 and Windows 2003 x86_64 (Incomplete Feature) -* GUI panel for allowing administrators to set various system configurations - - i.e. zones, pods, ip addresses (Incomplete Feature) -* Support for multiple NIC cards on computing, routing, and storage servers - (Disabled Feature) -* Support for resellers (Incomplete Feature) -* Allow admins/users to specify the root password for their new instance. It - cannot default to root/password (Bug 134) -* Admin/User Dashboard (Bug 154 and 155) -* Dynamically refresh server and vm instance status in GUI without a manual - refresh (Bug 389) -* Need transaction semantics across DB and agent. Without this, it is possible - to timeout db calls that first lock a record and relies on an agent response - before releasing that record. (Bug 408) -* All Server Roles (Mgmt, Computing, Routing, and Storage) require a functioning - eth0 NIC in order to install correctly. (Bug 470) -* Unable to handle HA when an entire Pod is unreachable (Bug 620) -* Improved network traffic reporting (Bug 642) -* Multiple login support a single user account (Bug 589) -* DomR instances continue to run even though all VMs associated with the DomR - are no longer even running. (Bug 617) -* HA fails when VM and Router for the same user go down at the same time - (Bug 603) - -================================= -BUG FIXES : -================================= - -* Improved Billing data generation (Bug 482) -* Able to create new admins through the admin console UI. (Bug 492) -* Able to create new Service Offerings through the admin console UI (Bug 500) -* Significantly improved the imaging speed when installing VMOps Cloud Stack - (Bug 476) -* Harden DomR Template to prevent unauthorized access -* No longer require eth0 during installation process of the hosts (Bug 490) -* Fixed issue where having multiple NIC cards caused issues (Bug 489) -* Installation UI will now allow you to select to the disk for storage - (Bug 556) -* Installation UI will now allow you to select NIC to use as private, public, - or simply disabled -* Mgmt server will now reflect the status of user vms if the storage server that - hosts the vm's volumes is no longer accessible. (Bug 521) -* Routing and Console Proxy VM will now be HA-enabled by default (Bug 614) -* Console Proxy VM are now automatically managed by the Mgmt Server (Bug 110) -* Template Management from the console admin UI should be improved -* Too many to list... - -******************************************************************************** - VMOps Cloud Stack Version 0.2.6297 - Release Notes -******************************************************************************** - -================================= -WHAT'S NEW : -================================= - -* VMOps Server - - Introduction of VMOps Integration API. This API allows service providers - to provision users and to retrieve billing info and events. It is a simple - query language written on top of HTTP that simply returns results in XML - format. - - Improved VMOps Server installation process. - -* VMOps Multitenant Hypervisor - - Improved VMOps Multitenant Hypervisor installation process. - -================================= -KNOWN ISSUES : -================================= - -* PV drivers for Windows 2003 and Windows 2003 x86_64 (Incomplete Feature) -* Developer, Billing, and Provisioning API (Incomplete Feature) -* Mirroring of disk images on storage servers across pods (Incomplete Feature) -* HA Enabled VMs (Disabled Feature) -* Firewall integration API (Incomplete Feature) -* GUI panel for allowing administrators to set various system configurations - - i.e. zones, pods, ip addresses (Incomplete Feature) -* Support for multiple NIC cards on computing, routing, and storage servers - (Disabled Feature) -* Ability to deploy agent upgrade on VMOps server and have the upgrade - automatically propagated to storage, routing, and computing servers. - (Bug 386) -* Detailed IO stats for storage servers (Bug 94) -* Admin/User Dashboard (Bug 154 and 155) -* OpenSolaris kernel panic (Bug 413) -* Dynamically refresh server and vm instance status in GUI without a manual - refresh (Bug 389) -* Need transaction semantics across DB and agent. Without this, it is possible - to timeout db calls that first lock a record and relies on an agent response - before releasing that record. (Bug 408) -* All Server Roles (Mgmt, Computing, Routing, and Storage) require a functioning - eth0 NIC in order to install correctly. (Bug 470) -* Admin Console UI Templates Tab needs improvement. (Bug 469) -* Unable to create new admins through the admin console UI. (Bug 492) -* Unable to create new Service Offerings through the admin console UI (Bug 500) - -================================= -BUG FIXES : -================================= - -* Added a new XML (server-setup.xml) to configure initial VMOps Server data. - (Bug 430) -* Made installation of the router template easier (Bug 434) -* Deleting a user through the admin UI will now show a progress bar (Bug 428) -* You can no longer any drop down boxes in the search left panel of the console - UI (Bug 439) -* Configured dom0 and domR to no longer do any reverse DNS lookup (Bug 459) -* Fixed installer to handle multiple NIC (Bug 457) -* Missing SDL module in all templates (Bug 449) - -******************************************************************************** - VMOps Cloud Stack Version 0.1.6053 - Release Notes -******************************************************************************** - -================================= -WHAT'S NEW : -================================= - -* VMOps Server - - Complete web UI for both administrators and users to manage VMOps Cloud - Stack. - - Allows administrators to manage the creation of service offerings and set - its pricing along with pricing for network bandwidth, additional public - ips, and vm templates. - - Allows administrators to retrieve billing records and user usages. - - VM Sync - coordinates, manages, and maintains the life cycle of VMOps agents - running on attached computing, routing, and storage hosts. - - VM Template Management - allows administrators to manage and upload hosted - vm templates into VMOps Cloud Stack. - -* VMOps Multitenant Hypervisor - - Designed to allow for the complete isolation of CPU, memory, storage, and - network resources for each user. - • Hypervisor Attached Storage (HAS) – The storage solution that is - integrated within the hypervisor and does not rely on centralized SAN or NAS - to implement storage virtualization. It provides a high performance and - ultra-reliable block storage for virtual machine images - - Hypervisor Aware Network (HAN) – The network solution for VMOps Cloud Stack - that implements the necessary IP address translation and tunneling for the - guest OS running inside the virtual machine. It does not rely on VLAN to - implement any network virtualization and isolation. - -================================= -KNOWN ISSUES : -================================= - -* PV drivers for Windows 2003 and Windows 2003 x86_64 (Incomplete Feature) -* Developer, Billing, and Provisioning API (Incomplete Feature) -* Mirroring of disk images on storage servers across pods (Incomplete Feature) -* HA Enabled VMs (Disabled Feature) -* Firewall integration API (Incomplete Feature) -* GUI panel for allowing administrators to set various system configurations - - i.e. zones, pods, ip addresses (Incomplete Feature) -* Support for multiple NIC cards on computing, routing, and storage servers - (Disabled Feature) -* Ability to deploy agent upgrade on VMOps server and have the upgrade - automatically propagated to storage, routing, and computing servers. - (Bug 386) -* Detailed IO stats for storage servers (Bug 94) -* Admin/User Dashboard (Bug 154 and 155) -* OpenSolaris kernel panic (Bug 413) -* Dynamically refresh server and vm instance status in GUI without a manual - refresh (Bug 389) -* Need transaction semantics across DB and agent. Without this, it is possible - to timeout db calls that first lock a record and relies on an agent response - before releasing that record. (Bug 408) - -================================= -BUG FIXES : -================================= - -* N/A \ No newline at end of file diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties index 3dc01aa2008..a0ed7c9a277 100644 --- a/client/WEB-INF/classes/resources/messages.properties +++ b/client/WEB-INF/classes/resources/messages.properties @@ -17,6 +17,11 @@ #new labels (begin) ********************************************************************************************** +label.plugins=Plugins +label.plugin.details=Plugin details +label.author.name=Author name +label.author.email=Author e-mail +label.external.link=External link label.egress.rules=Egress rules message.acquire.new.ip.vpc=Please confirm that you would like to acquire a new IP for this VPC. label.zoneWizard.trafficType.management=Management: Traffic between CloudStack\'s internal resources, including any components that communicate with the Management Server, such as hosts and CloudStack system VMs @@ -1139,6 +1144,7 @@ label.lang.chinese=Chinese (Simplified) label.lang.english=English label.lang.japanese=Japanese label.lang.spanish=Spanish +label.lang.korean=Korean label.lang.russian=Russian label.lang.french=French label.lang.brportugese=Brazilian Portugese @@ -1215,6 +1221,7 @@ label.network.offering.id=Network Offering ID label.network.offering.name=Network Offering Name label.network.offering=Network Offering label.network.rate=Network Rate +label.network.rate.megabytes=Network Rate (Mb/s) label.network.read=Network Read label.network.type=Network Type label.network.write=Network Write @@ -1359,8 +1366,8 @@ label.type=Type label.unavailable=Unavailable label.unlimited=Unlimited label.untagged=Untagged -label.update.ssl.cert=Update SSL Certificate -label.update.ssl=Update SSL Certificate +label.update.ssl.cert= SSL Certificate +label.update.ssl= SSL Certificate label.updating=Updating label.url=URL label.usage.interface=Usage Interface @@ -1408,6 +1415,20 @@ label.zone.step.4.title=Step 4: Add an IP range label.zone.wide=Zone-Wide label.zone=Zone +#VM snapshot label +label.vmsnapshot=VM Snapshots +label.vmsnapshot.type=Type +label.vmsnapshot.parentname=Parent +label.vmsnapshot.current=isCurrent +label.vmsnapshot.memory=Snapshot memory +message.action.vmsnapshot.delete=Please confirm that you want to delete this VM snapshot. +label.action.vmsnapshot.delete=Delete VM snapshot +label.action.vmsnapshot.revert=Revert to VM snapshot +message.action.vmsnapshot.revert=Revert VM snapshot +label.action.vmsnapshot.create=Take VM Snapshot + + + #Messages message.acquire.public.ip=Please select a zone from which you want to acquire your new IP from. message.action.cancel.maintenance.mode=Please confirm that you want to cancel this maintenance. @@ -1544,3 +1565,9 @@ label.nicira.controller.address=Controller Address label.nicira.transportzoneuuid=Transport Zone Uuid label.nicira.l3gatewayserviceuuid=L3 Gateway Service Uuid +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK diff --git a/client/WEB-INF/classes/resources/messages_fr_FR.properties b/client/WEB-INF/classes/resources/messages_fr_FR.properties index 4ba3c725892..e29d61b51ea 100644 --- a/client/WEB-INF/classes/resources/messages_fr_FR.properties +++ b/client/WEB-INF/classes/resources/messages_fr_FR.properties @@ -1114,6 +1114,7 @@ label.keep=Conserver label.lang.chinese=Chinois (simplifié) label.lang.english=Anglais label.lang.japanese=Japonais +label.lang.korean=Coréen label.lang.spanish=Espagnol label.last.disconnected=Dernière Déconnexion label.last.name=Nom de famille @@ -1510,3 +1511,9 @@ error.menu.select=Echec de l\'action car il n\'y a aucun error.mgmt.server.inaccessible=Le serveur de management est indisponible. Essayez plus tard. error.session.expired=Votre session a expiré. error.unresolved.internet.name=Votre nom internet ne peut pas être résolu. +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK diff --git a/client/WEB-INF/classes/resources/messages_ja.properties b/client/WEB-INF/classes/resources/messages_ja.properties index 7555b83dd78..977c0109f7b 100644 --- a/client/WEB-INF/classes/resources/messages_ja.properties +++ b/client/WEB-INF/classes/resources/messages_ja.properties @@ -1116,6 +1116,7 @@ label.keep=ç¶­æŒ label.lang.chinese=簡体字中国語 label.lang.english=英語 label.lang.japanese=日本語 +label.lang.korean=韓国語 label.lang.spanish=スペイン語 label.last.disconnected=最終切断日時 label.last.name=å§“ @@ -1509,4 +1510,10 @@ error.login=ユーザーå/パスワードãŒè¨˜éŒ²ã¨ä¸€è‡´ã—ã¾ã›ã‚“。 error.menu.select=é …ç›®ãŒé¸æŠžã•れã¦ã„ãªã„ãŸã‚æ“作を実行ã§ãã¾ã›ã‚“。 error.mgmt.server.inaccessible=管ç†ã‚µãƒ¼ãƒãƒ¼ã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã›ã‚“。後ã§å†å®Ÿè¡Œã—ã¦ãã ã•ã„。 error.session.expired=ã‚»ãƒƒã‚·ãƒ§ãƒ³ã®æœ‰åŠ¹æœŸé™ãŒåˆ‡ã‚Œã¾ã—ãŸã€‚ -error.unresolved.internet.name=インターãƒãƒƒãƒˆåを解決ã§ãã¾ã›ã‚“。 + +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK diff --git a/client/WEB-INF/classes/resources/messages_ko_KR.properties b/client/WEB-INF/classes/resources/messages_ko_KR.properties new file mode 100644 index 00000000000..a7b534aa3cd --- /dev/null +++ b/client/WEB-INF/classes/resources/messages_ko_KR.properties @@ -0,0 +1,1514 @@ +# 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. + +#new labels (begin) ********************************************************************************************** + + +#new labels (end) ************************************************************************************************ + + +#modified labels (begin) ***************************************************************************************** + + +#modified labels (end) ******************************************************************************************* + +label.configure.network.ACLs=ë„¤íŠ¸ì›Œí¬ ê¶Œí•œ 관리(ACL) 구성 +label.network.ACLs=ë„¤íŠ¸ì›Œí¬ ê¶Œí•œ 관리(ACL) +label.add.network.ACL=ë„¤íŠ¸ì›Œí¬ ê¶Œí•œ 관리(ACL) 추가 +label.private.Gateway=사설 게ì´íŠ¸ì›¨ì´ +label.VPC.router.details=VPC ë¼ìš°í„° ìƒì„¸ +label.VMs.in.tier=계층 ë‚´ë¶€ ê°€ìƒë¨¸ì‹  + +message.zoneWizard.enable.local.storage=경고:현재 Zoneì˜ ë¡œì»¬ 스토리지를 사용 하는 경우는 시스템 VMì˜ ì‹œìž‘ ìž¥ì†Œì— ë”°ë¼ ë‹¤ìŒ ìž‘ì—…ì´ í•„ìš”í•©ë‹ˆë‹¤.

1. 시스템 VMì„ ê¸°ë³¸ 스토리지로 시작해야 하는 경우 기본 스토리지를 만들기한 다ìŒì— Zoneì— ì¶”ê°€í•´ì•¼ 합니다. ë˜í•œ, 유효하지 ì•Šì€ ìƒíƒœì˜ Zoneì„ ì‹œìž‘í•´ì•¼ 합니다.

2. 시스템 VM를 로컬 스토리지로 시작할 필요가 있는 경우 system.vm.use.local.storage를 true 로 설정하고 나서 Zoneì„ ì‚¬ìš©í•´ì•¼ 합니다.


ì§„í–‰ 하시겠습니까? +label.local.storage.enabled=로컬 스토리지는 유효 +label.tier.details=계층 ìƒì„¸ 장버 +label.edit.tags=태그 편집 +label.network.rate.megabytes=ë„¤íŠ¸ì›Œí¬ ì†ë„ (MB/ì´ˆ) +label.action.enable.physical.network=물리 ë„¤íŠ¸ì›Œí¬ ì‚¬ìš©í•¨ +label.action.disable.physical.network=물리 ë„¤íŠ¸ì›Œí¬ ì‚¬ìš© 안 함 +message.action.enable.physical.network=현재 물리 네트워í¬ë¥¼ 사용하시겠습니까? +message.action.disable.physical.network=현재 물리 네트워í¬ë¥¼ 사용 안 함으로 하시겠습니까? + +label.select.tier=계층 ì„ íƒ +label.add.ACL=권한 관리(ACL) 추가 +label.remove.ACL=권한 관리(ACL) ì‚­ì œ +label.tier=계층 +label.network.ACL=ë„¤íŠ¸ì›Œí¬ ê¶Œí•œ 관리(ACL) +label.network.ACL.total=ë„¤íŠ¸ì›Œí¬ ê¶Œí•œ 관리(ACL) 합계 +label.add.new.gateway=새 게ì´íŠ¸ì›¨ì´ ì¶”ê°€í•˜ê¸° +message.add.new.gateway.to.vpc=현재 VPCì— ìƒˆë¡œìš´ 게ì´íŠ¸ì›¨ì´ë¥¼ 추가하기 위한 정보를 지정해 주십시오. +label.delete.gateway=게ì´íŠ¸ì›¨ì´ ì‚­ì œ +message.delete.gateway=현재 게ì´íŠ¸ì›¨ì´ë¥¼ 삭제하시겠습니까? +label.CIDR.of.destination.network=ëŒ€ìƒ ë„¤íŠ¸ì›Œí¬ CIDR +label.add.route=ë¼ìš°íЏ 추가 +label.add.static.route=ì •ì  ë¼ìš°íЏ 추가 +label.remove.static.route=ì •ì  ë¼ìš°íЏ ì‚­ì œ +label.site.to.site.VPN=사ì´íŠ¸ê°„ 사설네트워í¬(VPN) +label.add.VPN.gateway=VPN 게ì´íŠ¸ì›¨ì´ ì¶”ê°€ +message.add.VPN.gateway=VPN 게ì´íŠ¸ì›¨ì´ë¥¼ 추가하시겠습니까? +label.VPN.gateway=VPN 게ì´íŠ¸ì›¨ì´ +label.delete.VPN.gateway=VPN 게ì´íŠ¸ì›¨ì´ì‚­ì œ +message.delete.VPN.gateway=현재 VPN 게ì´íŠ¸ì›¨ì´ë¥¼ 삭제하시겠습니까? +label.VPN.connection=VPN ì ‘ì† +label.IPsec.preshared.key=IPsec 사전 공유 키 +label.IKE.policy=IKE ì •ì±… +label.ESP.policy=ESP ì •ì±… +label.create.VPN.connection=VPN ì ‘ì† ë§Œë“¤ê¸° +label.VPN.customer.gateway=VPN ê³ ê° ê²Œì´íŠ¸ì›¨ì´ +label.CIDR.list=CIDR ëª©ë¡ +label.IKE.lifetime=IKE 유효기간(ì´ˆ) +label.ESP.lifetime=ESP 유효기간(ì´ˆ) +label.dead.peer.detection=ì •ì§€ 피어 ê°ì§€ +label.reset.VPN.connection=VPN ì ‘ì† ìž¬ì„¤ì • +message.reset.VPN.connection=VPN ì ‘ì†ì„ 재설정 하시겠습니까? +label.delete.VPN.connection=VPN ì ‘ì† ì‚­ì œ +message.delete.VPN.connection=VPN ì ‘ì†ì„ 삭제하시겠습니까? +label.add.new.tier=새 계층 추가 +label.add.VM.to.tier=ê³„ì¸µì— VM 추가 +label.remove.tier=계층 ì‚­ì œ + +label.local.storage.enabled=로컬 스토리지 사용함 +label.associated.network=관련 ë„¤íŠ¸ì›Œí¬ +label.add.port.forwarding.rule=í¬í†  전송 ê·œì¹™ì˜ ì¶”ê°€ +label.dns=DNS + +label.vpc=VPC +label.vpc.id=VPC ID +label.tier=계층 +label.add.vpc=VPC 추가 +label.super.cidr.for.guest.networks=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ ìŠˆí¼ CIDR +label.DNS.domain.for.guest.networks=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ DNS ë„ë©”ì¸ +label.configure.vpc=VPC 구성 +label.edit.vpc=VPC 편집 +label.restart.vpc=VPC 재시작 +message.restart.vpc=VPC를 재시작하시겠습니까? +label.remove.vpc=VPC ì‚­ì œ +message.remove.vpc=VPC를 삭제하시겠습니까? +label.vpn.customer.gateway=VPN ê³ ê° ê²Œì´íŠ¸ì›¨ì´ +label.add.vpn.customer.gateway=VPN ê³ ê° ê²Œì´íŠ¸ì›¨ì´ ì¶”ê°€ +label.IKE.encryption=IKE 암호화 +label.IKE.hash=IKE 해시 +label.IKE.DH=IKE DH +label.ESP.encryption=ESP 암호화 +label.ESP.hash=ESP 해시 +label.perfect.forward.secrecy=Perfect Forward Secrecy +label.IKE.lifetime=IKE 유효기간(ì´ˆ) +label.ESP.lifetime=ESP 유효기간(ì´ˆ) +label.dead.peer.detection=ì •ì§€ 피어 ê°ì§€ +label.delete.VPN.customer.gateway=VPN ê³ ê° ê²Œì´íŠ¸ì›¨ì´ ì‚­ì œ +message.delete.VPN.customer.gateway=현재 VPN ê³ ê° ê²Œì´íŠ¸ì›¨ì´ë¥¼ 삭제하시겠습니까? + +label.network.domain.text=ë„¤íŠ¸ì›Œí¬ ë„ë©”ì¸ +label.memory.mb=메모리 (MB) +label.cpu.mhz=CPU (MHz) +message.action.remove.host=현재 호스트를 삭제하시겠습니까? + +message.action.reboot.router=현재 ê°€ìƒ ë¼ìš°í„°ë¡œ 제공하는 모든 서비스가 중단ë©ë‹ˆë‹¤. ì´ ë¼ìš°í„°ë¥¼ 재시작하시겠습니까? +message.action.stop.router=현재 ê°€ìƒ ë¼ìš°í„°ë¡œ 제공하는 모든 서비스가 중단ë©ë‹ˆë‹¤. ì´ ë¼ìš°í„°ë¥¼ 정지하시겠습니까? +message.restart.network=현재 네트워í¬ë¡œ 제공하는 모든 서비스가 중단ë©ë‹ˆë‹¤. ì´ ë„¤íŠ¸ì›Œí¬ë¥¼ 재시작하시겠습니까? + + +label.ipaddress=IP 주소 +label.vcdcname=vCenter DC 명 +label.vcipaddress=vCenter IP 주소 +label.vsmctrlvlanid=제어 VLAN ID +label.vsmpktvlanid=패킷 VLAN ID +label.vsmstoragevlanid=스토리지 VLAN ID +label.nexusVswitch=Nexus 1000V +label.action.delete.nexusVswitch=Nexus 1000V ì‚­ì œ +label.action.enable.nexusVswitch=Nexus 1000V 사용함 +label.action.disable.nexusVswitch=Nexus 1000V 사용 안 함 +label.action.list.nexusVswitch=Nexus 1000V ëª©ë¡ í‘œì‹œ +message.action.delete.nexusVswitch=현재 Nexus 1000V를 삭제하시겠습니까? +message.action.enable.nexusVswitch=현재 Nexus 1000V를 사용 하시겠습니까? +message.action.disable.nexusVswitch=현재 Nexus 1000V를 사용 안 함으로 하시겠습니까? +message.specify.url=URL를 지정해 주십시오 +label.select.instance.to.attach.volume.to=ë³¼ë¥¨ì„ ì—°ê²°í•˜ëŠ” ì¸ìŠ¤í„´ìŠ¤ë¥¼ ì„ íƒí•´ 주십시오 +label.upload=업로드 +label.upload.volume=ë³¼ë¥¨ì˜ ì—…ë¡œë“œ +label.virtual.routers=ê°€ìƒ ë¼ìš°í„° +label.primary.storage.count=기본 스토리지 그룹 +label.secondary.storage.count=2ì°¨ 스토리지 그룹 +label.number.of.system.vms=시스템 VM 수 +label.number.of.virtual.routers=ê°€ìƒ ë¼ìš°í„°ìˆ˜ +label.action.register.iso=ISO ë“±ë¡ +label.isolation.method=분리 방법 +label.action.register.template=템플릿 ë“±ë¡ +label.checksum=MD5 ì²´í¬ì„¬ +label.vpn=ê°€ìƒ ì‚¬ì„¤ë§(VPN) +label.vlan=ê°€ìƒ ë„¤íŠ¸ì›Œí¬(VLAN) + + +label.management.ips=관리 IP 주소 +label.devices=기기 +label.rules=규칙 +label.traffic.label=트래픽 ë¼ë²¨ +label.vm.state=VM ìƒíƒœ +message.setup.physical.network.during.zone.creation.basic=기본 Zoneì„ ì¶”ê°€í•  때는 하ì´í¼ ë°”ì´ì €ìƒì˜ 네트ì›ì¹´ë“œ(NIC)ì— ëŒ€ì‘하는 한 가지 물리 네트워í¬ë¥¼ 설정 í•  수 있습니다. 네트워í¬ëŠ” 몇 가지 ì¢…ë¥˜ì˜ íŠ¸ëž˜í”½ì„ ì „ì†¡í•©ë‹ˆë‹¤.

물리 네트워í¬ì— 다른 íŠ¸ëž˜í”½ì˜ ì¢…ë¥˜ë¥¼ë“œëž˜ê·¸ 앤 드롭 í•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +label.domain.router=ë„ë©”ì¸ ë¼ìš°í„° +label.console.proxy=콘솔 프ë¡ì‹œ +label.secondary.storage.vm=2ì°¨ 스토리지 VM +label.add.netScaler.device=Netscaler 기기 추가 +label.add.F5.device=F5 기기 추가 +label.add.SRX.device=SRX 기기 추가 +label.account.and.security.group=계정 ì •ë³´, 보안 그룹 +label.fetch.latest=최신 ì •ë³´ ì·¨ë“ +label.system.offering=시스템 제공 +message.validate.instance.name=ì¸ìŠ¤í„´ìŠ¤ëª…ì€ 63 ë¬¸ìž ì´ë‚´ì—서 지정해 주십시오. ASCII 문ìžì˜ a-z, A-Z, 숫ìžì˜ 0-9 ë° í•˜ì´í”ˆë§Œì„ 사용할 수 있습니다. 문ìžë¡œ 시작하여 ë¬¸ìž ë˜ëŠ” 숫ìžë¡œ ë내야 합니다. + + +label.isolated.networks=분리 ë„¤íŠ¸ì›Œí¬ +label.latest.events=최신 ì´ë²¤íЏ +state.Enabled=사용함 +label.system.wide.capacity=시스템 ì „ì²´ 처리 능력 +label.network.service.providers=ë„¤íŠ¸ì›Œí¬ ì„œë¹„ìŠ¤ ì œê³µìž +message.launch.zone=Zoneì„ ì‹œìž‘í•  준비가 ë˜ì—ˆìŠµë‹ˆë‹¤. ë‹¤ìŒ ìˆœì„œì— ë”°ë¼ ì§„í–‰í•´ 주십시오. +error.unable.to.reach.management.server=관리 서버와 통신할 수 없습니다. +label.internal.name=내부명 +message.configure.all.traffic.types=ë³µìˆ˜ì˜ ë¬¼ë¦¬ 네트워í¬ê°€ 있습니다. [편집]ì„ í´ë¦­í•´ íŠ¸ëž˜í”½ì˜ ì¢…ë¥˜ 마다 ë¼ë²¨ì„ 구성해 주십시오. +message.edit.traffic.type=현재 íŠ¸ëž˜í”½ì˜ ì¢…ë¥˜ì— ê´€ë ¨ 트래픽 ë¼ë²¨ì„ 지정해 주십시오. +label.edit.traffic.type=트래픽 종류 편집 +label.label=ë¼ë²¨ +label.max.networks=최대 네트워í¬ìˆ˜ +error.invalid.username.password=유효하지 ì•Šì€ ì‚¬ìš©ìžëª… ë˜ëŠ” 암호 +message.enabling.security.group.provider=보안 그룹 제공ìžë¥¼ 사용 하고 있습니다. +message.adding.Netscaler.provider=Netscaler 제공ìžë¥¼ 추가하고 있습니다. +message.creating.guest.network=ì†ë‹˜ 네트워í¬ë¥¼ 만듭니다. +label.action.delete.physical.network=물리 ë„¤íŠ¸ì›Œí¬ ì‚­ì œ +message.action.delete.physical.network=현재 물리 네트워í¬ë¥¼ 삭제하시겠습니까? +message.installWizard.copy.whatIsAHost=호스트는 ë‹¨ì¼ ì»´í“¨í„°ë¡œ ì†ë‹˜ ê°€ìƒ ë¨¸ì‹ ì„ ì‹¤í–‰í•˜ëŠ” 컴퓨팅 ìžì›ì„ 제공합니다. ë² ì–´ 메탈 호스트를 제외하고, ê° í˜¸ìŠ¤íŠ¸ëŠ” 게스트 ê°€ìƒ ë¨¸ì‹ ì„ ê´€ë¦¬í•˜ê¸° 위한 하ì´í¼ ë°”ì´ì € 소프트웨어를 설치합니다. ë² ì–´ 메탈 í˜¸ìŠ¤íŠ¸ì— ëŒ€í•´ì„œëŠ” 설치 ê°€ì´ë“œ 고급편 특수 사례로서 설명합니다. 예를 들어, KVMì€ ìœ íš¨í•œ Linux 서버, Citrix XenServerê°€ ë™ìž‘하는 서버 ë° ESXi 서버가 호스트입니다. 기본 설치ì—서는 XenServer ë˜ëŠ” KVM를 실행하는 ë‹¨ì¼ í˜¸ìŠ¤íŠ¸ë¥¼ 사용합니다.

호스트는 CloudStackâ„¢ í™˜ê²½ë‚´ì˜ ìµœì†Œì˜ ì¡°ì§ ë‹¨ìœ„ìž…ë‹ˆë‹¤. 호스트는 í´ëŸ¬ìŠ¤í„°ì— í¬í•¨ë˜ì–´ í´ëŸ¬ìŠ¤í„°ëŠ” Podì— í¬í•¨ë˜ì–´ Pod는 Zoneì— í¬í•¨ë©ë‹ˆë‹¤. + + +label.add.compute.offering=컴퓨팅 ìžì› 추가 +label.compute.offering=컴퓨팅 ìžì› 제공 +label.compute.offerings=컴퓨팅 ìžì› 제공 +label.select.offering=제공 ì„ íƒ +label.menu.infrastructure=ì¸í”„ë¼ìŠ¤íŠ¸ëŸ­ì³ +label.sticky.tablesize=í…Œì´ë¸” í¬ê¸° +label.sticky.expire=만료시간 +label.sticky.cookie-name=Cookie 명 +label.sticky.mode=모드 +label.sticky.length=ê¸¸ì´ +label.sticky.holdtime=ë³´ê´€ 유지 시간 +label.sticky.request-learn=ëŸ¬ë‹ ìš”êµ¬ +label.sticky.prefix=프레픽스 +label.sticky.nocache=ìºì‹œ ì—†ìŒ +label.sticky.indirect=ê°„ì ‘ +label.sticky.postonly=í¬ìŠ¤íŠ¸ë§Œ +label.sticky.domain=ë„ë©”ì¸ +state.Allocating=할당 중 +state.Migrating=ì´ì „ 중 +error.please.specify.physical.network.tags=현재 물리 ë„¤íŠ¸ì›Œí¬ íƒœê·¸ë¥¼ 지정하지 않으면, ë„¤íŠ¸ì›Œí¬ ì œê³µì€ ì‚¬ìš©í•  수 없습니다. + + +state.Stopping=정지하고 있는 중 +message.add.load.balancer.under.ip=ë‹¤ìŒ IP ì£¼ì†Œì— ëŒ€í•´ì„œ ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 ê·œì¹™ì„ ì¶”ê°€í•©ë‹ˆë‹¤: +message.select.instance=ì¸ìŠ¤í„´ìŠ¤ë¥¼ ì„ íƒí•´ 주십시오. +label.select=ì„ íƒ +label.select.vm.for.static.nat=ì •ì  NATìš© VM ì„ íƒ +label.select.instance=ì¸ìŠ¤í„´ìŠ¤ ì„ íƒ +label.nat.port.range=NAT í¬í†  범위 +label.static.nat.vm.details=ì •ì  NAT VM ìƒì„¸ ì •ë³´ +label.edit.lb.rule=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 규칙 편집 +message.migrate.instance.to.host=다른 호스트ì—게 ì¸ìŠ¤í„´ìŠ¤ë¥¼ ì´ì „하시겠습니까? +label.migrate.instance.to.host=다른 호스트ì—게 ì¸ìŠ¤í„´ìŠ¤ ì´ì „ +message.migrate.instance.to.ps=다른 기본 ìŠ¤í† ë¦¬ì§€ì— ì¸ìŠ¤í„´ìŠ¤ë¥¼ ì´ì „하시겠습니까? +label.migrate.instance.to.ps=다른 기본 ìŠ¤í† ë¦¬ì§€ì— ì¸ìŠ¤í„´ìŠ¤ ì´ì „ +label.corrections.saved=ì ‘ì† ì •ë³´ 저장 +message.installWizard.copy.whatIsSecondaryStorage=2ì°¨ 스토리지는 Zoneê³¼ ê´€ë ¨ë¤ ì•„ëž˜ì˜ í•­ëª©ì„ í¬í•¨í•©ë‹ˆë‹¤.
  • 템플릿 - VM 시작 시 사용할 수 있는 OS ì´ë¯¸ì§€ë¡œ 애플리케ì´ì…˜ì˜ 설치 등 추가 êµ¬ì„±ì„ í¬í•¨í•  수 있습니다.
  • ISO ì´ë¯¸ì§€ - 바로 시작 가능 ë˜ëŠ” 시작 ë¶ˆê°€ì˜ OS ì´ë¯¸ì§€ìž…니다.
  • ë””ìŠ¤í¬ ë³¼ë¥¨ 스냅샷 - VM ë°ì´í„° 저장 복사본입니다. ë°ì´í„°ì˜ ë³µì› ë˜ëŠ” 새로운 템플릿 ë§Œë“¤ê¸°ì— ì‚¬ìš©í•  수 있습니다.
+message.installWizard.copy.whatIsPrimaryStorage=CloudStackâ„¢ í´ë¼ìš°ë“œ ì¸í”„ë¼ìŠ¤íŠ¸ëŸ­ì³ì—서는 기본 스토리지와 2ì°¨ 스토리지 ë‘ ì¢…ë¥˜ì˜ ìŠ¤í† ë¦¬ì§€ë¥¼ 사용합니다. 양쪽 스토리지ì—서 iSCSI, NFS 서버, ë˜ëŠ” 로컬 디스í¬ë¥¼ 사용할 수 있습니다.

기본 스토리지는 í´ëŸ¬ìŠ¤í„°ì— ê´€ë ¨ë˜ì–´ê·¸ í´ëŸ¬ìŠ¤í„°ë‚´ì˜ í˜¸ìŠ¤íŠ¸ë¡œ ë™ìž‘하는 모든 VM 중 ê° ê²ŒìŠ¤íŠ¸ VMì˜ ë””ìŠ¤í¬ ë³¼ë¥¨ì„ í¬í•¨í•©ë‹ˆë‹¤. ì›ëž˜, 기본 스토리지 서버는 호스트 ê·¼ì²˜ì— ì„¤ì¹˜í•©ë‹ˆë‹¤. +message.installWizard.copy.whatIsACluster=í´ëŸ¬ìŠ¤í„°ëŠ” 호스트를 그룹화 하는 방법입니다. 한 가지 í´ëŸ¬ìŠ¤í„°ë‚´ 호스트는 ëª¨ë‘ ë™ì¼í•œ 하드웨어ì—서 구성ë˜ì–´ ê°™ì€ í•˜ì´í¼ ë°”ì´ì €ë¥¼ 실행하고 ê°™ì€ ì„œë¸Œ 네트워í¬ìƒì— 있어서 ê°™ì€ ê³µìœ  ìŠ¤í† ë¦¬ì§€ì— ì ‘ê·¼ 합니다. ê°™ì€ í´ëŸ¬ìŠ¤í„°ë‚´ì˜ í˜¸ìŠ¤íŠ¸ 사ì´ì—서는 사용ìžì—게 서비스를 중단하지 않고 ê°€ìƒ ë¨¸ì‹  ì¸ìŠ¤í„´ìŠ¤ë¥¼ 실시간 ì´ì „ í•  수 있습니다. í´ëŸ¬ìŠ¤í„°ëŠ” CloudStackâ„¢ í™˜ê²½ë‚´ì˜ ì„¸ 번째로 í° ì¡°ì§ ë‹¨ìœ„ìž…ë‹ˆë‹¤. í´ëŸ¬ìŠ¤í„°ëŠ” Podì— í¬í•¨ë˜ì–´ Pod는 Zoneì— í¬í•¨ë©ë‹ˆë‹¤.

CloudStackâ„¢ ì—서는 한 가지 í´ë¼ìš°ë“œ í™˜ê²½ì— ë³µìˆ˜ í´ëŸ¬ìŠ¤í„°ë¥¼ 설정할 수 있으나 기본 설치ì—서는 í´ëŸ¬ìŠ¤í„°ëŠ” 한 개입니다. +message.installWizard.copy.whatIsAPod=ì›ëž˜ 한 가지 Pod는 ë‹¨ì¼ ìž ê¸ˆì„ ë‚˜íƒ€ëƒ…ë‹ˆë‹¤. ê°™ì€ Podë‚´ 호스트는 ê°™ì€ ì„œë¸Œ 네트워í¬ì— í¬í•¨ë©ë‹ˆë‹¤.

Pod는 CloudStackâ„¢ í™˜ê²½ë‚´ì˜ ë‘ ë²ˆì§¸ë¡œ í° ì¡°ì§ ë‹¨ìœ„ìž…ë‹ˆë‹¤. Pod는 Zoneì— í¬í•¨ë©ë‹ˆë‹¤. ê° Zoneì€ í•œ ê°œ ì´ìƒì˜ Pod를 í¬í•¨í•  수 있습니다. 기본 설치ì—서는 Zoneë‚´ Pod는 한 개입니다. +message.installWizard.copy.whatIsAZone=Zoneì€ CloudStackâ„¢ 환경내 최대 ì¡°ì§ ë‹¨ìœ„ìž…ë‹ˆë‹¤. 한 가지 ë°ì´í„° ì„¼í„°ë‚´ì— ë³µìˆ˜ Zoneì„ ì„¤ì •í•  수 있으나 ì›ëž˜ Zoneì€ ë‹¨ì¼ì˜ ë°ì´í„° ì„¼í„°ì— í• ë‹¹í•©ë‹ˆë‹¤. ì¸í”„ë¼ìŠ¤íŠ¸ëŸ­ì³ë¥¼ Zoneì— ì¡°ì§í™”하면, Zoneì„ ë¬¼ë¦¬ì ìš°ë¡œ 분리해 설정할 수 있습니다. 예를 들어, ê° Zoneì— ì „ì›ê³¼ ë„¤íŠ¸ì›Œí¬ ì—…ë§í¬ë¥¼ 배치합니다. 필수가 아니지만 ì›ê²©ì§€ì— ë¶„ì‚°í•  수 있습니다. +message.installWizard.copy.whatIsCloudStack=CloudStack™는 컴퓨팅 ìžì›ì„ í¬í•¨í•˜ëŠ” 소프트웨어 플랫웹 ì–‘ì‹ì—서 공개, 사설, ë° í•˜ì´ë¸Œë¦¬ë“œì˜ Infrastructure as a Service (IaaS) í´ë¼ìš°ë“œë¥¼ 구축할 수 있습니다. CloudStack™를 사용하고, í´ë¼ìš°ë“œ ì¸í”„ë¼ìŠ¤íŠ¸ëŸ­ì³ë¥¼ 구성하는 네트워í¬, 스토리지 ë° ì»´í“¨íŒ… 노드를 관리하고 í´ë¼ìš°ë“œ 컴퓨팅 í™˜ê²½ì„ ì„¤ì •, 관리 ë° êµ¬ì„±í•©ë‹ˆë‹¤.

CloudStackâ„¢ì€ í•˜ë“œì›¨ì–´ìƒì—서 ë™ìž‘하는 개별 ê°€ìƒ ë¨¸ì‹  ì´ë¯¸ì§€ë¥¼ 넘어 확장할 수 있기 ë•Œë¬¸ì— ê°„ë‹¨í•œ 설정으로 ë™ìž‘하는 í´ë¼ìš°ë“œ ì¸í”„ë¼ìŠ¤íŠ¸ëŸ­ì³ ì†Œí”„íŠ¸ì›¨ì–´ 스íƒì— ì˜í•´ ê°€ìƒ ë°ì´í„° 센터 즉 여러 층형 멀티 ì„¸ìž…ìž í´ë¼ìš°ë“œ 애플리케ì´ì…˜ì„ 서비스로서 구축하고 설정하고 관리하기 위해서 불가결한 í•­ëª©ì„ ëª¨ë‘ ì œê³µí•©ë‹ˆë‹¤. 오픈 소스 버전과 프리미엄 버전 양쪽 모ë‘ì— ì œê³µí•˜ë©° 오픈 소스 버전ì—ì„œë„ ëŒ€ë¶€ë¶„ ê¸°ëŠ¥ì„ ì‚¬ìš©í•  수 있습니다. +message.installWizard.tooltip.addSecondaryStorage.path=위ì—서 지정한 ì„œë²„ì— ì¡´ìž¬í•˜ëŠ” 내보내기 경로입니다. +message.installWizard.tooltip.addSecondaryStorage.nfsServer=2ì°¨ 스토리지를 호스트 하는 NFS 서버 IP 주소입니다. +message.installWizard.tooltip.addPrimaryStorage.path=(NFSì˜ ê²½ìš°) 서버ì—서 내보내기 경로입니다. (SharedMountPointì˜ ê²½ìš°) ì¼ë°˜ 경로입니다. KVMì—서는 기본 스토리지가 마운트ë˜ëŠ” ê° í˜¸ìŠ¤íŠ¸ìƒì˜ 경로입니다. 예를 들어, /mnt/primary 입니다. +message.installWizard.tooltip.addPrimaryStorage.server=(NFS, iSCSI ë˜ëŠ” PreSetupì˜ ê²½ìš°) 스토리지 ê¸°ê¸°ì˜ IP 주소 ë˜ëŠ” DNS 명입니다. +message.installWizard.tooltip.addPrimaryStorage.name=스토리지 ê¸°ê¸°ì˜ ì´ë¦„입니다. +message.installWizard.tooltip.addHost.password=XenServer 측ì—서 지정한 ìœ„ì˜ ì‚¬ìš©ìžëª…ì— ëŒ€í•œ 암호입니다. +message.installWizard.tooltip.addHost.username=ì›ëž˜ root 입니다. +message.installWizard.tooltip.addHost.hostname=호스트 DNS 명 ë˜ëŠ” IP 주소입니다. +message.installWizard.tooltip.addCluster.name=í´ëŸ¬ìŠ¤í„° ì´ë¦„입니다. CloudStackì—서 예약하지 ì•Šì€ ìž„ì˜ í…스트를 지정할 수 있습니다. +message.installWizard.tooltip.addPod.reservedSystemEndIp=ì´ê²ƒì€ 2ì°¨ 스토리지 VM ë° ì½˜ì†” 프ë¡ì‹œ VM를 관리하기 위해서 CloudStackì—서 사용하는 사설 네트워í¬ë‚´ IP 주소 범위입니다. ì´ëŸ¬í•œ IP 주소는 컴퓨팅 서버와 ê°™ì€ ì„œë¸Œë„¤íŠ¸ì›Œí¬ì—서 할당합니다. +message.installWizard.tooltip.addPod.reservedSystemStartIp=ì´ê²ƒì€ 2ì°¨ 스토리지 VM ë° ì½˜ì†” 프ë¡ì‹œ VM를 관리하기 위해서 CloudStackì—서 사용하는 사설 네트워í¬ë‚´ì˜ IP 주소 범위입니다. ì´ëŸ¬í•œ IP 주소는 컴퓨팅 서버와 ê°™ì€ ì„œë¸Œë„¤íŠ¸ì›Œí¬ì—서 할당합니다. +message.installWizard.tooltip.addPod.reservedSystemNetmask=게스트가 사용하는 서브네트워í¬ìƒì—서 지정한 ë„· 마스í¬ìž…니다. +message.installWizard.tooltip.addPod.reservedSystemGateway=현재 Podë‚´ 호스트 게ì´íŠ¸ì›¨ì´ìž…니다. +message.installWizard.tooltip.addPod.name=Pod ì´ë¦„입니다. +message.installWizard.tooltip.configureGuestTraffic.guestEndIp=현재 Zoneì˜ ê²ŒìŠ¤íŠ¸ì—게 할당할 수 있는 IP 주소 범위입니다. 사용하는 NICê°€ 한 ê°€ì§€ì¸ ê²½ìš°ëŠ” ì´ëŸ¬í•œ IP 주소는 Podì˜ CIDR와 ê°™ì€ CIDRì— í¬í•¨ë˜ì–´ 있어야 합니다. +message.installWizard.tooltip.configureGuestTraffic.guestStartIp=현재 Zoneì˜ ê²ŒìŠ¤íŠ¸ì—게 할당할 수 있는 IP 주소 범위입니다. 사용하는 NICê°€ 한 가지 경우는 ì´ëŸ¬í•œ IP 주소는 Podì˜ CIDR와 ê°™ì€ CIDRì— í¬í•¨ë˜ì–´ 있어야 합니다. +message.installWizard.tooltip.configureGuestTraffic.guestNetmask=게스트ì—서 사용하는 서브네트워í¬ìƒì—서 사용ë˜ëŠ” ë„· 마스í¬ìž…니다. +message.installWizard.tooltip.configureGuestTraffic.guestGateway=게스트ì—서 사용하는 게ì´íŠ¸ì›¨ì´ìž…니다. +message.installWizard.tooltip.configureGuestTraffic.description=ë„¤íŠ¸ì›Œí¬ ì„¤ëª…ìž…ë‹ˆë‹¤. +message.installWizard.tooltip.configureGuestTraffic.name=ë„¤íŠ¸ì›Œí¬ ì´ë¦„입니다. +message.installWizard.tooltip.addZone.internaldns2=Zoneë‚´ 시스템 VM으로 사용하는 DNS 서버입니다. 현재 DNS 서버는 시스템 VMì˜ ì‚¬ì„¤ ë„¤íŠ¸ì›Œí¬ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 개입시켜 접근합니다. Podì˜ ì‚¬ì„¤ IP 주소ì—서 여기서 지정하는 DNS ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.installWizard.tooltip.addZone.internaldns1=Zoneë‚´ì˜ ì‹œìŠ¤í…œ VM 로 사용하는 DNS 서버입니다. 현재 DNS 서버는 시스템 VMì˜ ì‚¬ì„¤ ë„¤íŠ¸ì›Œí¬ ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 개입시켜 접근합니다. Podì˜ ì‚¬ì„¤ IP 주소ì—서 여기서 지정하는 DNS ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.installWizard.tooltip.addZone.dns2=Zoneë‚´ 게스트 VM 로 사용하는 DNS 서버입니다. 현재 DNS 서버ì—는 다ìŒì— 추가하는 공개 ë„¤íŠ¸ì›Œí¬ ê²½ìœ ë¡œ 접근합니다. Zoneì˜ ê³µê°œ IP 주소ì—서 여기서 지정하는 공개 DNS ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.installWizard.tooltip.addZone.name=Zoneì˜ ì´ë¦„입니다. +message.installWizard.tooltip.addZone.dns1=Zoneë‚´ì˜ ê²ŒìŠ¤íŠ¸ VM으로 사용하는 DNS 서버입니다. ì´ëŸ¬í•œ DNS 서버ì—는 다ìŒì— 추가하는 공개 ë„¤íŠ¸ì›Œí¬ ê²½ìœ ë¡œ ì ‘ê·¼ 합니다. Zoneì˜ ê³µê°œ IP 주소ì—서 여기서 지정하는 공개 DNS ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.setup.successful=í´ë¼ìš°ë“œê°€ 설정 ë˜ì—ˆìŠµë‹ˆë‹¤. +label.may.continue=실행 í•  수 ìžˆìŒ +error.installWizard.message=문제가 ë°œìƒí–ˆìŠµë‹ˆë‹¤. 다시 오류를 수정할 수 있습니다. +message.installWizard.now.building=í´ë¼ìš°ë“œë¥¼ 구축하고 있는 중... +message.installWizard.click.retry=ì‹œìž‘ì„ ìž¬ì‹œí–‰í•˜ë ¤ë©´ ë²„íŠ¼ì„ í´ë¦­í•´ 주십시오. +label.launch=시작 +label.installWizard.click.launch=[시작]ì„ í´ë¦­í•´ 주십시오. +label.congratulations=ì„¤ì •ì´ ê³§ 완료입니다. +label.installWizard.addSecondaryStorageIntro.subtitle=2ì°¨ ìŠ¤í† ë¦¬ì§€ì— ëŒ€í•´ +label.installWizard.addSecondaryStorageIntro.title=2ì°¨ 스토리지 추가 +label.installWizard.addPrimaryStorageIntro.subtitle=기본 ìŠ¤í† ë¦¬ì§€ì— ëŒ€í•´ +label.installWizard.addPrimaryStorageIntro.title=기본 스토리지 추가 +label.installWizard.addHostIntro.subtitle=í˜¸ìŠ¤íŠ¸ì— ëŒ€í•´ +label.installWizard.addHostIntro.title=호스트 추가 +label.installWizard.addClusterIntro.subtitle=í´ëŸ¬ìŠ¤í„° 대한 ì •ë³´ +label.installWizard.addClusterIntro.title=í´ëŸ¬ìŠ¤í„° 추가 +label.installWizard.addPodIntro.subtitle=Podì— ëŒ€í•œ ì •ë³´ +label.installWizard.addPodIntro.title=Pod 추가 +label.installWizard.addZone.title=Zone 추가 +label.installWizard.addZoneIntro.subtitle=Zoneì— ëŒ€í•œ ì •ë³´ +label.installWizard.addZoneIntro.title=Zone 추가 +error.password.not.match=암호가 ì¼ì¹˜í•˜ì§€ ì•ŠìŒ +label.confirm.password=암호 í™•ì¸ ìž…ë ¥ +message.change.password=암호를 변경해 주십시오. +label.save.and.continue=저장하기 +label.skip.guide=CloudStack 사용 ê°€ì´ë“œ 건너뛰기 +label.continue.basic.install=기본 설치 실행 +label.introduction.to.cloudstack=CloudStackâ„¢ 소개 +label.what.is.cloudstack=CloudStackâ„¢ ì •ë³´ +label.hints=ì •ë³´ +label.installWizard.subtitle=현재 ê°€ì´ë“œ 투어는 CloudStackâ„¢ 환경 ì„¤ì •ì— ë„ì›€ì´ ë©ë‹ˆë‹¤ +label.continue=실행 +label.installWizard.title=CloudStackâ„¢ 마법사 +label.agree=ë™ì˜ +label.manage.resources=ìžì› 관리 +label.port.forwarding.policies=í¬í†  전송 ì •ì±… +label.load.balancing.policies=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 ì •ì±… +label.networking.and.security=네트워í¬ì™€ 보안 +label.bandwidth=ëŒ€ì—­í­ +label.virtual.machines=ê°€ìƒ ë¨¸ì‹  +label.compute.and.storage=컴퓨팅과 스토리지 +label.task.completed=작업 완료 +label.update.project.resources=프로ì íЏ ìžì› ì—…ë°ì´íЏ +label.remove.project.account=프로ì íЏ 계정 ì •ë³´ ì‚­ì œ +label.item.listing=항목 ëª©ë¡ +message.select.item=í•­ëª©ì„ ì„ íƒí•´ 주십시오. +label.removing=삭제하는 중 +label.invite=초대 +label.add.by=추가 단위 +label.max.vms=최대 ì‚¬ìš©ìž VM수 +label.max.public.ips=최대 공개 IP 주소수 +label.max.volumes=최대 볼륨수 +label.max.snapshots=최대 스냅샷수 +label.max.templates=최대 템플릿수 +label.project.dashboard=프로ì íЏ 대시 보드 +label.remind.later=알림 표시 +label.invited.accounts=초대가 ë난 계정 ì •ë³´ +label.invite.to=초대 프로ì íЏ: +label.add.accounts.to=계정 ì •ë³´ 추가: +label.add.accounts=계정 ì •ë³´ 추가 +label.project.name=프로ì íŠ¸ëª… +label.create.project=프로ì íЏ 만들기 +label.networks=ë„¤íŠ¸ì›Œí¬ +label.launch.vm=VM 시작 +label.new.vm=새 VM +label.previous=뒤로 +label.add.to.group=ê·¸ë£¹ì— ì¶”ê°€ +message.vm.review.launch=다ìŒì˜ 정보를 참조하고 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ë¥¼ 올바르게 설정한 ê²ƒì„ í™•ì¸í•˜ê³  나서 시작해 주십시오. +message.select.security.groups=새로운 ê°€ìƒ ë¨¸ì‹  보안 ê·¸ë£¹ì„ ì„ íƒí•´ 주십시오. +label.new=ì‹ ê·œ +message.please.select.networks=ê°€ìƒ ë¨¸ì‹  네트워í¬ë¥¼ ì„ íƒí•´ 주십시오. +message.please.proceed=다ìŒì˜ ìˆœì„œì— ì§„í–‰í•´ 주십시오. +message.zone.no.network.selection=ì„ íƒí•œ Zoneì—서는 네트워í¬ë¥¼ ì„ íƒí•  수 없습니다. +label.no.thanks=설정 안함 +label.my.templates=ë‚˜ì˜ í…œí”Œë¦¿ +message.select.template=새로운 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ í…œí”Œë¦¿ì„ ì„ íƒí•´ 주십시오. +message.select.iso=새로운 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ ISO를 ì„ íƒí•´ 주십시오. +message.template.desc=VMì˜ ì‹œìž‘ì— ì‚¬ìš©í•  수 있는 OS ì´ë¯¸ì§€ +message.iso.desc=ë°ì´í„° ë˜ëŠ” OS 시작 가능 미디어를 í¬í•¨í•œ ë””ìŠ¤í¬ ì´ë¯¸ì§€ +label.select.iso.or.template=ISO ë˜ëŠ” 템플릿 ì„ íƒ +message.select.a.zone=Zoneì€ ì›ëž˜ ë‹¨ì¼ ë°ì´í„° ì„¼í„°ì— í•´ë‹¹í•©ë‹ˆë‹¤. 복수 Zoneì„ ì„¤ì •í•˜ê³  물리ì ìœ¼ë¡œ 분리하는 방법으로 í´ë¼ìš°ë“œì˜ ì‹ ë¢°ì„±ì„ ë†’ì¼ ìˆ˜ 있습니다. +label.select.a.zone=Zone ì„ íƒ +label.review=í™•ì¸ +label.select.a.template=템플릿 ì„ íƒ +label.setup=설정 +state.Allocated=할당 ë난 ìƒíƒœ +changed.item.properties=항목 ì†ì„± 변경 +label.apply=ì ìš© +label.default=기본 +label.viewing=표시 항목: +label.move.to.top=처ìŒìœ¼ë¡œ ì´ë™ +label.move.up.row=위로 ì´ë™ +label.move.down.row=아래로 ì´ë™ +label.move.to.bottom=마지막으로 ì´ë™ +label.drag.new.position=새로운 ìœ„ì¹˜ì— ëŒì–´ì˜¤ê¸° +label.order=순서 +label.no.data=표시할 ë°ì´í„°ê°€ ì—†ìŒ +label.change.value=ê°’ 변경 +label.clear.list=ëª©ë¡ ì‚­ì œ +label.full.path=ì „ì²´ 경로 +message.add.domain=현재 ë„ë©”ì¸ì— ë§Œë“¤ê³ ìž í•˜ëŠ” 서브 ë„ë©”ì¸ì„ 지정해 주십시오. +message.delete.user=현재 사용ìžë¥¼ 삭제하시겠습니까? +message.enable.user=현재 사용ìžë¥¼ 사용 하시겠습니까? +message.disable.user=현재 사용ìžë¥¼ 사용 안 함으로 하시겠습니까? +message.generate.keys=현재 사용ìžì—게 새로운 키를 ìƒì„±í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.update.resource.count=현재 계정 ì •ë³´ ìžì›ìˆ˜ë¥¼ ì—…ë°ì´íŠ¸í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.edit.account=편집 ("-1"는 ìžì› 만들기 숫ìžì— ì œí•œì´ ì—†ëŠ” 값입니다.) +label.total.of.vm=VM 합계 +label.total.of.ip=IP 주소 합계 +state.enabled=유효함 +message.action.download.iso=현재 ISO를 다운로드하시겠습니까? +message.action.download.template=현재 í…œí”Œë¦¿ì„ ë‹¤ìš´ë¡œë“œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +label.destination.zone=복사할 Zone +label.keyboard.type=키보드 종류 +label.nic.adapter.type=NIC 아답터 종류 +label.root.disk.controller=루트 ë””ìŠ¤í¬ ì½˜íŠ¸ë¡¤ëŸ¬ +label.community=커뮤니티 +label.remove.egress.rule=전송 규칙 ì‚­ì œ +label.add.egress.rule=전송 규칙 추가 +label.egress.rule=전송 규칙 +label.remove.ingress.rule=수신 규칙 ì‚­ì œ +label.delete.vpn.user=VPN ì‚¬ìš©ìž ì‚­ì œ +label.add.vpn.user=VPN ì‚¬ìš©ìž ì¶”ê°€ +label.remove.pf=í¬í†  전송 규칙 ì‚­ì œ +label.remove.vm.from.lb=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 ê·œì¹™ì— VM ì‚­ì œ +label.add.vms.to.lb=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 ê·œì¹™ì— VM 추가 +label.add.vm=VM 추가 +label.remove.static.nat.rule=ì •ì  NAT 규칙 ì‚­ì œ +label.remove.rule=규칙 ì‚­ì œ +label.add.static.nat.rule=ì •ì  NAT 규칙 추가 +label.add.rule=규칙 추가 +label.configuration=구성 +message.disable.vpn=VPN를 사용 안 함으로 하시겠습니까? +label.disable.vpn=VPN 사용 안 함 +message.enable.vpn=현재 IP ì£¼ì†Œì— ëŒ€í•œ VPN 접근를 사용 하시겠습니까? +label.enable.vpn=VPN 사용함 +message.acquire.new.ip=현재 네트워í¬ê°€ 새로운 IP 주소를 ì·¨ë“하시겠습니까? +label.elastic=오류 스틱 +label.my.network=ë‚´ ë„¤íŠ¸ì›Œí¬ +label.add.vms=VM 추가 +label.configure=구성 +label.stickiness=ì§€ì†ì„± +label.source=시작 위치 +label.least.connections=최소 ì ‘ì† +label.round.robin=ë¼ìš´ë“œ 로빈 +label.restart.required=재시작 í•„ìš” +label.clean.up=삭제하기 +label.restart.network=ë„¤íŠ¸ì›Œí¬ ìž¬ì‹œìž‘ +label.edit.network.details=ë„¤íŠ¸ì›Œí¬ ìƒì„¸í•œ 편집 +label.add.guest.network=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ ì¶”ê°€ +label.guest.networks=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ +message.ip.address.changed=사용 IP 주소가 ë³€ê²½ëœ ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤. 목ë¡ì„ ì—…ë°ì´íŠ¸í•©ë‹ˆê¹Œ? ê·¸ 경우는 ìƒì„¸ ì„¤ì •ì°½ì´ ë‹«ëŠ” ê²ƒì— ì£¼ì˜í•´ 주십시오. +state.BackingUp=백업 중 +state.BackedUp=백업 완료 +label.done=완료 +label.vm.name=VM 명 +message.migrate.volume=다른 기본 ìŠ¤í† ë¦¬ì§€ì— ë³¼ë¥¨ì„ ì´ì „하시겠습니까? +label.migrate.volume=다른 기본 ìŠ¤í† ë¦¬ì§€ì— ë³¼ë¥¨ ì´ì „ +message.create.template=í…œí”Œë¦¿ì„ ë§Œë“¤ê¸°í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +label.create.template=템플릿 만들기 +message.download.volume.confirm=현재 ë³¼ë¥¨ì„ ë‹¤ìš´ë¡œë“œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.detach.disk=현재 디스í¬ë¥¼ 분리 하시겠습니까? +state.ready=준비 완료 +state.Ready=준비 완료 +label.vm.display.name=VM 표시명 +label.select-view=표시 방법 ì„ íƒ +label.local.storage=로컬 스토리지 +label.direct.ips=ì§ì ‘ IP 주소 +label.view.all=ëª¨ë‘ í‘œì‹œ +label.zone.details=Zone ìƒì„¸ +message.alert.state.detected=경계체제 ìƒíƒœê°€ ê°ì§€ë˜ì—ˆìŠµë‹ˆë‹¤ +state.Starting=시작 중 +state.Expunging=제거 중 +state.Creating=ìƒì„± 중 +message.decline.invitation=현재 프로ì íŠ¸ì— ì´ˆëŒ€ë¥¼ 거절하시겠습니까? +label.decline.invitation=초대 ê±°ì ˆ +message.confirm.join.project=현재 프로ì íŠ¸ì— ì°¸ì—¬í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.join.project=ì´ê²ƒìœ¼ë¡œ, 프로ì íŠ¸ì— ì°¸ì—¬í–ˆìŠµë‹ˆë‹¤. 프로ì íŠ¸ë¥¼ 참조하려면 프로ì íЏ 보기로 전환해 주십시오. +label.accept.project.invitation=프로ì íЏ 초대 ìŠ¹ì¸ +label.token=í† í° +label.project.id=프로ì íЏ ID +message.enter.token=ì „ìž ë©”ì¼ ì´ˆëŒ€ìž¥ì— ì„¤ëª…ë˜ì–´ 있는 토í°ì„ 입력해 주십시오. +label.enter.token=í† í° ìž…ë ¥ +state.Accepted=ìŠ¹ì¸ ì™„ë£Œ +state.Pending=보류 +state.Completed=완료 +state.Declined=ê±°ì ˆ +label.project=프로ì íЏ +label.invitations=초대장 +label.delete.project=프로ì íЏ ì‚­ì œ +message.delete.project=현재 프로ì íŠ¸ë¥¼ 삭제하시겠습니까? +message.activate.project=현재 프로ì íŠ¸ë¥¼ 활성화 하시겠습니까? +label.activate.project=프로ì íЏ 활성화 +label.suspend.project=프로ì íЏ ì¼ì‹œì •ì§€ +message.suspend.project=현재 프로ì íŠ¸ë¥¼ ì¼ì‹œì •지하시겠습니까? +state.Suspended=ì¼ì‹œì •ì§€ +label.edit.project.details=프로ì íЏ ìƒì„¸ 편집 +label.new.project=새 프로ì íЏ +state.Active=활성 +state.Disabled=유효하지 ì•Šì€ +label.projects=프로ì íЏ +label.make.project.owner=계정 ì •ë³´ 프로ì íЏ ì†Œìœ ìž +label.remove.project.account=계정 ì •ë³´ 프로ì íЏì—서 ì‚­ì œ +message.project.invite.sent=사용ìžì—게 ì´ˆëŒ€ìž¥ì´ ì „ì†¡ë˜ì—ˆìŠµë‹ˆë‹¤. 사용ìžê°€ 초대를 승ì¸í•˜ë©´, 프로ì íŠ¸ì— ì¶”ê°€ë©ë‹ˆë‹¤. +label.add.account.to.project=계정 ì •ë³´ 프로ì íŠ¸ì— ì¶”ê°€ +label.revoke.project.invite=초대 취소 +label.project.invite=프로ì íŠ¸ì— ì´ˆëŒ€ +label.select.project=프로ì íЏ ì„ íƒ +message.no.projects=프로ì íŠ¸ê°€ 없습니다.
프로ì íЏ 섹션ì—서 새로운 프로ì íŠ¸ë¥¼ 만들어 주십시오. +message.no.projects.adminOnly=프로ì íŠ¸ê°€ 없습니다.
관리ìžì—게 새로운 프로ì íЏ ìƒì„±ì„ ì˜ë¢°í•˜ì‹­ì‹œì˜¤. +message.pending.projects.1=ë³´ë¥˜ì¤‘ì¸ í”„ë¡œì íЏ ì´ˆëŒ€ìž¥ì´ ìžˆìŠµë‹ˆë‹¤. +message.pending.projects.2=표시하려면 프로ì íЏ 섹션으로 ì´ë™í•˜ê³  목ë¡ì—서 ì´ˆëŒ€ìž¥ì„ ì„ íƒí•©ë‹ˆë‹¤. +message.instanceWizard.noTemplates=사용 가능한 í…œí”Œë¦¿ì´ ì—†ìŠµë‹ˆë‹¤. í˜¸í™˜ì„±ì´ ìžˆëŠ” í…œí”Œë¦¿ì„ ì¶”ê°€í•˜ê³ , ì¸ìŠ¤í„´ìŠ¤ 위저드를 재시작해 주십시오. +label.view=표시 - +instances.actions.reboot.label=ì¸ìŠ¤í„´ìŠ¤ 재시작 +label.filterBy=í•„í„° +label.ok=í™•ì¸ +notification.reboot.instance=ì¸ìŠ¤í„´ìŠ¤ 재시작 +notification.start.instance=ì¸ìŠ¤í„´ìŠ¤ 시작 +notification.stop.instance=ì¸ìŠ¤í„´ìŠ¤ ì •ì§€ +label.display.name=표시명 +label.zone.name=Zone ì´ë¦„ +ui.listView.filters.all=ëª¨ë‘ +ui.listView.filters.mine=ë‚´ ì •ë³´ë§Œ +state.Running=실행 중 +state.Stopped=ì •ì§€ëœ ìƒíƒœ +state.Destroyed=íŒŒê¸°ëœ ìƒíƒœ +state.Error=오류 +message.reset.password.warning.notPasswordEnabled=현재 ì¸ìŠ¤í„´ìŠ¤ í…œí”Œë¦¿ì€ ì•”í˜¸ 관리를 사용 하지 않고 ìƒì„±ë˜ì—ˆìŠµë‹ˆë‹¤. +message.reset.password.warning.notStopped=현재 암호를 변경하기 ì „ì— ì¸ìŠ¤í„´ìŠ¤ë¥¼ 정지해야 합니다. +label.notifications=알림 +label.default.view=기본 보기 +label.project.view=프로ì íЏ 보기 + +message.add.system.service.offering=새로운 시스템 서비스 ì œê³µì„ ì¶”ê°€í•˜ê¸° 위해 ë‹¤ìŒ ë°ì´í„°ë¥¼ 입력해 주십시오. +message.action.delete.system.service.offering=현재 시스템 서비스 ì œê³µì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +label.action.delete.system.service.offering=시스템 서비스 제공 ì‚­ì œ +label.hypervisor.capabilities=하ì´í¼ ë°”ì´ì € 기능 +label.hypervisor.version=하ì´í¼ ë°”ì´ì € 버전 +label.max.guest.limit=최대 게스트 제한 +label.add.network.offering=ë„¤íŠ¸ì›Œí¬ ì œê³µ 추가 +label.supported.services=기술 ì§€ì›ë˜ëŠ” 서비스 +label.service.capabilities=서비스 기능 +label.guest.type=게스트 종류 +label.specify.IP.ranges=IP 주소 범위 지정 +label.conserve.mode=절약 모드 +label.created.by.system=시스템 만들기 +label.menu.system.service.offerings=시스템 제공 +label.add.system.service.offering=시스템 서비스 제공 추가 +label.redundant.router.capability=중복 ë¼ìš°í„° 기능 +label.supported.source.NAT.type=기술 ì§€ì›ë˜ëŠ” 전송 NAT 종류 +label.elastic.LB=íƒ„ë ¥ì  ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 +label.LB.isolation=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 분리 +label.elastic.IP=íƒ„ë ¥ì  IP 주소 +label.network.label.display.for.blank.value=기본 게ì´íŠ¸ì›¨ì´ë¥¼ 사용 +label.xen.traffic.label=XenServer 트래픽 ë¼ë²¨ +label.kvm.traffic.label=KVM 트래픽 ë¼ë²¨ +label.vmware.traffic.label=VMware 트래픽 ë¼ë²¨ +label.start.IP=시작 IP 주소 +label.end.IP=종료 IP 주소 +label.remove.ip.range=IP 주소 범위 ì‚­ì œ +label.ip.ranges=IP 주소 범위 +label.start.vlan=시작 VLAN +label.end.vlan=종료 VLAN +label.broadcast.domain.range=브로드ìºìŠ¤íŠ¸ ë„ë©”ì¸ ë²”ìœ„ +label.compute=컴퓨팅 +message.add.guest.network=ì†ë‹˜ 네트워í¬ë¥¼ 추가하시겠습니까? +label.subdomain.access=서브 ë„ë©”ì¸ ì ‘ê·¼ +label.guest.start.ip=게스트 시작 IP 주소 +label.guest.end.ip=게스트 종료 IP 주소 +label.virtual.router=ê°€ìƒ ë¼ìš°í„° +label.physical.network.ID=물리 ë„¤íŠ¸ì›Œí¬ ID +label.destination.physical.network.id=ëª©ì  ë¬¼ë¦¬ ë„¤íŠ¸ì›Œí¬ ID +label.dhcp=DHCP +label.destroy.router=ë¼ìš°í„° 파기 +message.confirm.destroy.router=현재 ë¼ìš°í„°ë¥¼ 파기하시겠습니까? +label.change.service.offering=서비스 제공 변경 +label.view.console=콘솔 표시 +label.redundant.state=중복 ìƒíƒœ +label.enable.provider=ì œê³µìž ì‚¬ìš©í•¨ +message.confirm.enable.provider=현재 제공ìžë¥¼ 사용하시겠습니까? +label.disable.provider=ì œê³µìž ì‚¬ìš© 안 함 +message.confirm.disable.provider=현재 제공ìžë¥¼ 사용 안 함으로 하시겠습니까? +label.shutdown.provider=ì œê³µìž ì¢…ë£Œ +message.confirm.shutdown.provider=현재 제공ìžë¥¼ 종료하시겠습니까? +label.netScaler=NetScaler +label.add.new.NetScaler=새로운 NetScaler 추가 +label.capacity=처리 능력 +label.dedicated=ì „ìš© +label.f5=F5 +label.add.new.F5=새로운 F5 추가 +label.srx=SRX +label.providers=ì œê³µìž +label.add.new.SRX=새로운 SRX 추가 +label.timeout=시간 초과 +label.public.network=공개 ë„¤íŠ¸ì›Œí¬ +label.private.network=사설 ë„¤íŠ¸ì›Œí¬ +label.enable.swift=Swift 사용함 +confirm.enable.swift=Swift 기술 ì§€ì›ë¥¼ 사용 하려면 ë‹¤ìŒ ì •ë³´ë¥¼ 입력해 주십시오. +message.after.enable.swift=Swiftê°€ 구성ë˜ì—ˆìŠµë‹ˆë‹¤. 주ì˜:ì´ íŽ˜ì´ì§€ë¥¼ 닫으면 Swift를 재구성할 수 없습니다. +label.key=키 +label.delete.NetScaler=NetScaler ì‚­ì œ +message.confirm.delete.NetScaler=NetScaler를 삭제하시겠습니까? +label.delete.F5=F5 ì‚­ì œ +message.confirm.delete.F5=F5를 삭제하시겠습니까? +label.delete.SRX=SRX ì‚­ì œ +message.confirm.delete.SRX=SRX를 삭제하시겠습니까? +label.pods=Pod +label.pod.name=Pod명 +label.reserved.system.gateway=ì˜ˆì•½ëœ ì‹œìŠ¤í…œ 게ì´íŠ¸ì›¨ì´ +label.reserved.system.netmask=ì˜ˆì•½ëœ ì‹œìŠ¤í…œ ë„· ë§ˆìŠ¤í¬ +label.start.reserved.system.IP=ì˜ˆì•½ëœ ì‹œìž‘ 시스템 IP 주소 +label.end.reserved.system.IP=ì˜ˆì•½ëœ ì¢…ë£Œ 시스템 IP 주소 +label.clusters=í´ëŸ¬ìŠ¤í„° +label.cluster.name=í´ëŸ¬ìŠ¤í„°ëª… +label.host.MAC=호스트 MAC +label.agent.username=ì—ì´ì „트 사용ìžëª… +label.agent.password=ì—ì´ì „트 암호 +message.confirm.action.force.reconnect=현재 호스트를 ê°•ì œ 재접ì†í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +label.resource.state=ìžì› ìƒíƒœ +label.LUN.number=LUN 번호 +message.confirm.remove.IP.range=현재 IP 주소 범위를 삭제하시겠습니까? +message.tooltip.zone.name=Zone ì´ë¦„입니다. +message.tooltip.dns.1=Zoneë‚´ VM 로 사용하는 DNS 서버 ì´ë¦„입니다. Zone 공개 IP 주소ì—서 ì´ ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.tooltip.dns.2=Zoneë‚´ VM 로 사용하는 ë‘번째 DNS 서버 ì´ë¦„입니다. Zone 공개 IP 주소ì—서 ì´ ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.tooltip.internal.dns.1=Zoneë‚´ CloudStack ë‚´ë¶€ 시스템 VM 로 사용하는 DNS 서버 ì´ë¦„입니다. Pod 사설 IP 주소ì—서 ì´ ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.tooltip.internal.dns.2=Zoneë‚´ CloudStack ë‚´ë¶€ 시스템 VM 로 사용하는 DNS 서버 ì´ë¦„입니다. Pod 사설 IP 주소ì—서 ì´ ì„œë²„ì— í†µì‹ í•  수 있어야 합니다. +message.tooltip.network.domain=DNS 서픽스입니다. ì´ ì„œí”½ìŠ¤ì—서 게스트 VM 로 ì ‘ê·¼ 하는 ë„¤íŠ¸ì›Œí¬ ë§žì¶¤í˜• ë„ë©”ì¸ëª…ì„ ë§Œë“­ë‹ˆë‹¤. +message.tooltip.pod.name=현재 Pod ì´ë¦„입니다. +message.tooltip.reserved.system.gateway=Podë‚´ 호스트 게ì´íŠ¸ì›¨ì´ìž…니다. +message.tooltip.reserved.system.netmask=Pod 서브네트워í¬ë¥¼ 정하는 ë„¤íŠ¸ì›Œí¬ í”„ë ˆí”½ìŠ¤ìž…ë‹ˆë‹¤. CIDR 표기를 사용합니다. +message.creating.zone=Zoneì„ ë§Œë“¤ì—ˆìŠµë‹ˆë‹¤. +message.creating.physical.networks=물리 네트워í¬ë¥¼ 만들었습니다. +message.configuring.physical.networks=물리 네트워í¬ë¥¼ 구성해 있습니다 +message.adding.Netscaler.device=Netscaler 기기를 추가하고 있습니다 +message.creating.pod=Pod를 만들었습니다. +message.configuring.public.traffic=공개 íŠ¸ëž˜í”½ì„ êµ¬ì„±í•´ 있습니다 +message.configuring.storage.traffic=스토리지 íŠ¸ëž˜í”½ì„ êµ¬ì„±í•´ 있습니다 +message.configuring.guest.traffic=게스트 íŠ¸ëž˜í”½ì„ êµ¬ì„±í•´ 있습니다 +message.creating.cluster=í´ëŸ¬ìŠ¤í„°ë¥¼ 만들었습니다. +message.adding.host=호스트를 추가하고 있습니다 +message.creating.primary.storage=기본 스토리지를 만들었습니다. +message.creating.secondary.storage=2ì°¨ 스토리지를 만들었습니다. +message.Zone.creation.complete=Zoneì„ ë§Œë“¤ì—ˆìŠµë‹ˆë‹¤. +message.enabling.zone=Zoneì„ ì‚¬ìš©í•˜ê³  있습니다 +error.something.went.wrong.please.correct.the.following=문제가 ë°œìƒí–ˆìŠµë‹ˆë‹¤. ë‹¤ìŒ ë‚´ìš©ì„ ìˆ˜ì •í•´ 주십시오 +error.could.not.enable.zone=Zoneì„ ì‚¬ìš© í•  수 없습니다. +message.zone.creation.complete.would.you.like.to.enable.this.zone=Zoneì„ ë§Œë“¤ì—ˆìŠµë‹ˆë‹¤. ì´ Zoneì„ ì‚¬ìš© 하시겠습니까? +message.please.add.at.lease.one.traffic.range=ì ì–´ë„ 한 ê°œ ì´ìƒ 트래픽 범위를 추가해 주십시오. +message.you.must.have.at.least.one.physical.network=ì ì–´ë„ 한 ê°œ ì´ìƒ 물리 네트워í¬ê°€ 필요합니다 +message.please.select.a.different.public.and.management.network.before.removing=ì‚­ì œ ì „ì— ë‹¤ë¥¸ 공개 ë° ê´€ë¦¬ 네트워í¬ë¥¼ ì„ íƒí•´ 주십시오. + +label.zone.type=Zone 종류 +label.setup.zone=Zone 설정 +label.setup.network=ë„¤íŠ¸ì›Œí¬ ì„¤ì • +label.add.resources=ìžì› 추가 +label.launch=시작 +label.set.up.zone.type=Zone 종류 설정 +message.please.select.a.configuration.for.your.zone=Zone êµ¬ì„±ì„ ì„ íƒí•´ 주십시오. +message.desc.basic.zone= ê° VM ì¸ìŠ¤í„´ìŠ¤ì— IP 주소가 네트워í¬ì—서 ì§ì ‘ 할당할 수 있는 ë‹¨ì¼ ë„¤íŠ¸ì›Œí¬ë¥¼ 제공합니다. 보안 그룹 (ì „ì†¡ì› IP 주소 í•„í„°)ê³¼ ê°™ì€ ì¸µ 세 가지 레벨 방법으로 게스트를 분리할 수 있습니다. +label.basic=기본 +message.desc.advanced.zone=보다 ì„¸ë ¨ëœ ë„¤íŠ¸ì›Œí¬ ê¸°ìˆ ì„ ì§€ì›í•©ë‹ˆë‹¤. ì´ ë„¤íŠ¸ì›Œí¬ ëª¨ë¸ì„ ì„ íƒí•˜ë©´, 보다 유연하게 게스트 네트워í¬ë¥¼ 정하고 방화벽(fire wall), VPN, ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치 기술 ì§€ì›ì™€ ê°™ì€ ì‚¬ìš©ìž ì§€ì • 한 ë„¤íŠ¸ì›Œí¬ ì œê³µì„ ì œê³µí•  수 있습니다. +label.advanced=확장 +message.desc.zone=Zoneì€ CloudStack 환경내 최대 ì¡°ì§ ë‹¨ìœ„ë¡œ ì›ëž˜ ë‹¨ì¼ ë°ì´í„° ì„¼í„°ì— í•´ë‹¹í•©ë‹ˆë‹¤. Zoneì— í•´ì„œ 물리ì ì¸ 분리와 ì¤‘ë³µì„±ì´ ì œê³µë©ë‹ˆë‹¤. Zoneì€ í•œ ê°œ ì´ìƒ Pod( ê° Pod는 호스트와 기본 스토리지 서버ì—서 구성)와 Zoneë‚´ 모든 Pod로 공유ë˜ëŠ” 2ì°¨ 스토리지 서버로 구성ë©ë‹ˆë‹¤. +label.physical.network=물리 ë„¤íŠ¸ì›Œí¬ +label.public.traffic=공개 트래픽 +label.guest.traffic=게스트 트래픽 +label.storage.traffic=스토리지 트래픽 +message.setup.physical.network.during.zone.creation=확장 Zoneì„ ì¶”ê°€í•  때는 한 ê°œ ì´ìƒ 물리 네트워í¬ë¥¼ 설정해야 합니다. ê° ë„¤íŠ¸ì›Œí¬ëŠ” 하ì´í¼ ë°”ì´ì €ìƒ 한 가지 ë„¤íŠ¸ì›Œí¬ ì¹´ë“œ(NIC)ì— ëŒ€ì‘합니다. ê° ë¬¼ë¦¬ 네트워í¬ì—서는 êµ¬ì„±ì— ì œí•œì´ ìžˆìœ¼ë‚˜, 한 가지 종류 ì´ìƒ íŠ¸ëž˜í”½ì„ í†µì‹ í•  수 있습니다.

ê° ë¬¼ë¦¬ 네트워í¬ì— 대해서트래픽 종류를 드래그 앤 드롭해 주십시오. +label.add.physical.network=물리 ë„¤íŠ¸ì›Œí¬ ì¶”ê°€ +label.traffic.types=트래픽 종류 +label.management=관리 +label.guest=게스트 +label.please.specify.netscaler.info=Netscaler 정보를 지정해 주십시오 +message.public.traffic.in.advanced.zone=í´ë¼ìš°ë“œ ë‚´ë¶€ VMì´ ì¸í„°ë„·ì— ì ‘ê·¼ 하면, 공개 íŠ¸ëž˜í”½ì´ ìƒì„±ë©ë‹ˆë‹¤. ì´ ë•Œë¬¸ì— ì¼ë°˜ì ìœ¼ë¡œ ì ‘ê·¼ 가능한 IP 주소를 할당할 필요가 있습니다. 최종 사용ìžëŠ” CloudStack ì‚¬ìš©ìž ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 사용해 ì´ëŸ¬í•œ IP 주소를 ì·¨ë“하고 ì†ë‹˜ 네트워í¬ì™€ 공개 ë„¤íŠ¸ì›Œí¬ ì‚¬ì´ì— NAT를 구현할 수 있습니다.

ì¸í„°ë„· íŠ¸ëž˜í”½ì„ ìœ„í•´ ì ì–´ë„ 한 ê°œ ì´ìƒ IP 주소 범위를 입력해 주십시오. +message.public.traffic.in.basic.zone=í´ë¼ìš°ë“œ ë‚´ë¶€ VMì´ ì¸í„°ë„·ì— ì ‘ê·¼ í•  때 ì¸í„°ë„· 경유로 í´ë¼ì´ì–¸íŠ¸ì— ì„œë¹„ìŠ¤ë¥¼ 제공하면, 공개 íŠ¸ëž˜í”½ì´ ìƒì„±ë©ë‹ˆë‹¤. ì´ ë•Œë¬¸ì— ì¼ë°˜ì ìœ¼ë¡œ ì ‘ê·¼ 가능한 IP 주소를 할당할 필요가 있습니다. ì¸ìŠ¤í„´ìŠ¤ë¥¼ 만들기하면, 게스트 IP 주소 외ì—ì´ ê³µê°œ IP 주소 범위ì—서 주소가 í•˜ë‚˜ì˜ ì¸ìŠ¤í„´ìŠ¤ì— í• ë‹¹í•  수 있습니다. 공개 IP 주소와 게스트 IP 주소 사ì´ì— ì •ì ì¸ 1대 1 NATê°€ ìžë™ìœ¼ë¡œ 설정 ë©ë‹ˆë‹¤. 최종 사용ìžëŠ” CloudStack ì‚¬ìš©ìž ì¸í„°íŽ˜ì´ìŠ¤ë¥¼ 사용해 추가 IP 주소를 ì·¨ë“하고 ì¸ìŠ¤í„´ìŠ¤ì™€ 공개 IP 주소 사ì´ì— ì •ì  NAT를 구현할 ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +message.add.pod.during.zone.creation= ê° Zoneì—는 한 ê°œ ì´ìƒ Podê°€ 필요합니다. 지금 여기서 첫번째 Pod를 추가합니다. Pod는 호스트와 기본 스토리지 서버ì—서 구성합니다만 ì´ëŠ” ë‹¤ìŒ ìˆœì„œë¡œ 추가합니다. 맨 ì²˜ìŒ CloudStack ë‚´ë¶€ 관리 íŠ¸ëž˜í”½ì„ ìœ„í•´ì„œ IP 주소 범위를 예약합니다. IP 주소 범위는 í´ë¼ìš°ë“œ ë‚´ë¶€ ê° Zoneì—서 중복 하지 않게 예약할 필요가 있습니다. +message.guest.traffic.in.advanced.zone=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ íŠ¸ëž˜í”½ì€ ìµœì¢… ì‚¬ìš©ìž ê°€ìƒ ë¨¸ì‹ ê°„ 통신입니다. ê° ë¬¼ë¦¬ ë„¤íŠ¸ì›Œí¬ ê²ŒìŠ¤íŠ¸ íŠ¸ëž˜í”½ì„ í†µì‹ í•˜ê¸° 위한 VLAN ID 범위를 지정해 주십시오. +message.guest.traffic.in.basic.zone=ì†ë‹˜ ë„¤íŠ¸ì›Œí¬ íŠ¸ëž˜í”½ì€ ìµœì¢… 사용ìžì˜ ê°€ìƒ ë¨¸ì‹ ê°„ 통신입니다. CloudStackì— ê²ŒìŠ¤íŠ¸ VMì— í• ë‹¹í•  수 있는 IP 주소 범위를 지정해 주십시오.ì´ ë²”ìœ„ê°€ 예약 ë난 시스템 IP 주소 범위와 중복 하지 않게 주ì˜í•´ 주십시오. +message.storage.traffic=호스트나 CloudStack 시스템 VM 등 관리 서버와 통신하는 CloudStack ë‚´ë¶€ ìžì›ê°„ 트래픽입니다. 여기서 스토리지 íŠ¸ëž˜í”½ì„ êµ¬ì„±í•´ 주십시오. +message.desc.cluster= ê° Podì—는 한 ê°œ ì´ìƒ í´ëŸ¬ìŠ¤í„°ê°€ 필요합니다. 지금 여기서 최초 í´ëŸ¬ìŠ¤í„°ë¥¼ 추가합니다. í´ëŸ¬ìŠ¤í„°ëŠ” 호스트를 그룹화 하는 방법입니다. 한 í´ëŸ¬ìŠ¤í„° ë‚´ë¶€ 호스트는 ëª¨ë‘ ë™ì¼í•œ 하드웨어ì—서 구성ë˜ì–´ ê°™ì€ í•˜ì´í¼ ë°”ì´ì €ë¥¼ 실행하고 ê°™ì€ ì„œë¸Œ 네트워í¬ìƒì— 있어 ê°™ì€ ê³µìœ  ìŠ¤í† ë¦¬ì§€ì— ì ‘ê·¼ 합니다. ê° í´ëŸ¬ìŠ¤í„°ëŠ” 한 ê°œ ì´ìƒ 호스트와 한 ê°œ ì´ìƒ 기본 스토리지 서버ì—서 구성ë©ë‹ˆë‹¤. +message.desc.host= ê° í´ëŸ¬ìŠ¤í„°ì—는 ì ì–´ë„ 한 ê°œ ì´ìƒ 게스트 VM를 실행하기 위한 호스트 (컴퓨터)ê°€ 필요합니다. 지금 여기서 첫번째 호스트를 추가합니다. CloudStack으로 호스트를 ë™ìž‘하려면 호스트ì—게 하ì´í¼ ë°”ì´ì €ë¥¼ 설치하고 IP 주소를 할당해 호스트가 CloudStack 관리 ì„œë²„ì— ì ‘ì†í•˜ë„ë¡ í•©ë‹ˆë‹¤.

호스트 DNS 명 ë˜ëŠ” IP 주소, 사용ìžëª…(ì›ëž˜ root)ê³¼ 암호 ë° í˜¸ìŠ¤íŠ¸ ë¶„ë¥˜ì— ì‚¬ìš©í•˜ëŠ” ë¼ë²¨ì„ 입력해 주십시오. +message.desc.primary.storage= ê° í´ëŸ¬ìŠ¤í„°ì—는 ì ì–´ë„ 한 ê°œ ì´ìƒì˜ 기본 스토리지 서버가 필요합니다. 지금 여기서 첫번째 서버를 추가합니다. 기본 스토리지는 í´ëŸ¬ìŠ¤í„° ë‚´ ë¶€ 호스트ìƒì—서 ë™ìž‘하는 모든 VM ë””ìŠ¤í¬ ë³¼ë¥¨ì„ í¬í•¨í•©ë‹ˆë‹¤. 기본ì ìœ¼ë¡œ 하ì´í¼ ë°”ì´ì €ì—서 기술 ì§€ì›ë˜ëŠ” í‘œì¤€ì— ì¤€ê±°í•œ í”„ë¡œí† ì½œì„ ì‚¬ìš©í•´ 주십시오. +message.desc.secondary.storage= ê° Zoneì—는 ì ì–´ë„ 한 ê°œ ì´ìƒì˜ NFS 즉 2ì°¨ 스토리지 서버가 필요합니다. 지금 여기서 첫번째 서버를 추가합니다. 2ì°¨ 스토리지는 VM 템플릿, ISO ì´ë¯¸ì§€ ë° VM ë””ìŠ¤í¬ ë³¼ë¥¨ ìŠ¤ëƒ…ìƒ·ì„ í¬í•¨í•©ë‹ˆë‹¤. ì´ ì„œë²„ëŠ” Zoneë‚´ 모든 호스트ì—서 사용할 수 있어야 합니다.

IP 주소와 내보내낼 경로를 입력해 주십시오. +label.launch.zone=Zone 시작 +message.please.wait.while.zone.is.being.created=Zoneì´ ë§Œë“¤ê¸°ë  ë•Œê¹Œì§€ ìž ê¹ ê¸°ë‹¤ë ¤ 주십시오... + +label.load.balancing=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 +label.static.nat.enabled=ì •ì  NAT 유효 +label.zones=Zone +label.view.more=ìƒì„¸ 표시 +label.number.of.zones=Zone수 +label.number.of.pods=Pod수 +label.number.of.clusters=í´ëŸ¬ìŠ¤í„°ìˆ˜ +label.number.of.hosts=호스트수 +label.total.hosts=호스트 합계 +label.total.CPU=CPU 합계 +label.total.memory=메모리 합계 +label.total.storage=스토리지 합계 +label.purpose=ëª©ì  + +label.action.migrate.router=ë¼ìš°í„° ì´ì „ +label.action.migrate.router.processing=ë¼ìš°í„°ë¥¼ ì´ì „하는 중... +message.migrate.router.confirm=ë¼ìš°í„° ì´ì „ 위치로 호스트를 ì„ íƒì‹­ì‹œì˜¤. +label.migrate.router.to=ë¼ìš°í„° ì´ì „ 위치: + +label.action.migrate.systemvm=시스템 VM ì´ì „ +label.action.migrate.systemvm.processing=시스템 VM를 ì´ì „하는 중 +message.migrate.systemvm.confirm=시스템 VM ì´ì „ ì´ì „ 위치로 호스트를 ì„ íƒì‹­ì‹œì˜¤. +label.migrate.systemvm.to=시스템 VM ì´ì „ 위치: + +mode=모드 +side.by.side=병렬 +inline=ì§ë ¬ + +extractable=추출 가능 + +label.ocfs2=OCFS2 + +label.action.edit.host=호스트 편집 + +network.rate=ë„¤íŠ¸ì›Œí¬ ì†ë„ + +ICMP.type=ICMP 종류 +ICMP.code=ICMP 코드 + +image.directory=ì´ë¯¸ì§€ 디렉토리 + +label.action.create.template.from.vm=VMì—서 템플릿 만들기 +label.action.create.template.from.volume=볼륨ì—서 템플릿 만들기 + +message.vm.create.template.confirm=템플릿 만들기하면 VMì´ ìžë™ìœ¼ë¡œ 재시작ë©ë‹ˆë‹¤. + +label.action.manage.cluster=í´ëŸ¬ìŠ¤í„° 관리 ë™ìž‘ +message.action.manage.cluster=í´ëŸ¬ìŠ¤í„°ë¥¼ 관리 대ìƒìœ¼ë¡œ 하시겠습니까? +label.action.manage.cluster.processing=í´ëŸ¬ìŠ¤í„°ë¥¼ 관리 대ìƒìœ¼ë¡œ 하는 중... + +label.action.unmanage.cluster=í´ëŸ¬ìŠ¤í„° 비관리 ë™ìž‘ +message.action.unmanage.cluster=í´ëŸ¬ìŠ¤í„°ë¥¼ 비관리 대ìƒìœ¼ë¡œ 하시겠습니까? +label.action.unmanage.cluster.processing=í´ëŸ¬ìŠ¤í„°ë¥¼ 비관리 대ìƒìœ¼ë¡œ 하는 중... + +label.allocation.state=할당 ìƒíƒœ +managed.state=관리 ëŒ€ìƒ ìƒíƒœ + +label.default.use=기본 사용 +label.host.tags=호스트 태그 + +label.cidr=CIDR +label.cidr.list=ì „ì†¡ì› CIDR + +label.storage.tags=스토리지 태그 + +label.redundant.router=중복 ë¼ìš°í„° +label.is.redundant.router=중복 + +force.delete=ê°•ì œ ì‚­ì œ +force.delete.domain.warning=경고:ì´ ì˜µì…˜ì„ ì„ íƒí•˜ë©´, 모든 ë‚´ë¶€ ë„ë©”ì¸ ë° ê´€ë ¨í•˜ëŠ” 모든 계정 정보와 ê·¸ ìžì›ì´ ì‚­ì œë©ë‹ˆë‹¤. + +force.remove=ê°•ì œ í•´ì œ +force.remove.host.warning=경고:ì´ ì˜µì…˜ì„ ì„ íƒí•˜ë©´, 실행중 모든 ê°€ìƒ ë¨¸ì‹ ì´ ê°•ì œì ìœ¼ë¡œ ì •ì§€ë˜ì–´ í´ëŸ¬ìŠ¤í„°ì—서 호스트가 ê°•ì œì ìœ¼ë¡œ í•´ì œë©ë‹ˆë‹¤. + +force.stop=ê°•ì œ ì •ì§€ +force.stop.instance.warning=경고: ì¸ìŠ¤í„´ìŠ¤ ê°•ì œ 정지는 최종 수단으로 í•´ 주십시오. ë°ì´í„°ê°€ ì†ì‹¤ë  ë¿ë§Œ ì•„ë‹ˆë¼ ê°€ìƒ ë¨¸ì‹  ë™ìž‘ì´ ì¼ê´€í•˜ì§€ 않게 ë  ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤. + +label.PreSetup=PreSetup +label.SR.name = SR 명 ë¼ë²¨ +label.SharedMountPoint=SharedMountPoint +label.clvm=CLVM +label.volgroup=볼륨 그룹 +label.VMFS.datastore=VMFS ë°ì´í„° 스토어 + +label.network.device=ë„¤íŠ¸ì›Œí¬ ê¸°ê¸° +label.add.network.device=ë„¤íŠ¸ì›Œí¬ ê¸°ê¸° 추가 +label.network.device.type=ë„¤íŠ¸ì›Œí¬ ê¸°ê¸° 종류 +label.DHCP.server.type=DHCP 서버 종류 +label.Pxe.server.type=PXE 서버 종류 +label.PING.storage.IP=PING ëŒ€ìƒ ìŠ¤í† ë¦¬ì§€ IP 주소 +label.PING.dir=PING 디렉토리 +label.TFTP.dir=TFTP 디렉토리 +label.PING.CIFS.username=PING CIFS 사용ìžëª… +label.PING.CIFS.password=PING CIFS 암호 +label.CPU.cap=CPU 제한 + + +label.action.enable.zone=Zone 사용함 +label.action.enable.zone.processing=Zoneì„ ì‚¬ìš© 설정 중... +message.action.enable.zone=현재 Zoneì„ ì‚¬ìš© 하시겠습니까? +label.action.disable.zone=Zone 사용 안 함 +label.action.disable.zone.processing=Zoneì„ ì‚¬ìš© 안 함으로 설정 중... +message.action.disable.zone=현재 Zoneì„ ì‚¬ìš© 안 함으로 하시겠습니까? + +label.action.enable.pod=Pod 사용함 +label.action.enable.pod.processing=Pod를 사용 설정 중... +message.action.enable.pod=현재 Pod를 사용 하시겠습니까? +label.action.disable.pod=Pod 사용 안 함 +label.action.disable.pod.processing=Pod를 사용 안 함으로 설정 중... +message.action.disable.pod=현재 Pod를 사용 안 함으로 하시겠습니까? + +label.action.enable.cluster=í´ëŸ¬ìŠ¤í„° 사용함 +label.action.enable.cluster.processing=í´ëŸ¬ìŠ¤í„°ë¥¼ 사용 설정 중... +message.action.enable.cluster=현재 í´ëŸ¬ìŠ¤í„°ë¥¼ 사용 하시겠습니까? +label.action.disable.cluster=í´ëŸ¬ìŠ¤í„° 사용 안 함 +label.action.disable.cluster.processing=í´ëŸ¬ìŠ¤í„°ë¥¼ 사용 안 함으로 설정 중... +message.action.disable.cluster=현재 í´ëŸ¬ìŠ¤í„°ë¥¼ 사용 안 함으로 하시겠습니까? + +label.account.id=계정 ì •ë³´ ID +label.account.name=계정 정보명 +label.account.specific=계정 ì •ë³´ 고유 +label.account=계정 ì •ë³´ +label.accounts=계정 ì •ë³´ +label.acquire.new.ip=새로운 IP 주소 ì·¨ë“ +label.show.ingress.rule=수신 규칙 표시 +label.hide.ingress.rule=수신 ê·œì¹™ì„ ìˆ¨ê¸°ê¸° +label.action.attach.disk.processing=디스í¬ë¥¼ 연결하는 중... +label.action.attach.disk=ë””ìŠ¤í¬ ì—°ê²° +label.action.attach.iso.processing=ISO를 연결하는 중... +label.action.attach.iso=ISO ì—°ê²° +label.action.cancel.maintenance.mode.processing=유지 보수 모드를 취소하는 중... +label.action.cancel.maintenance.mode=유지 보수 모드 취소 +label.action.change.password=암호 변경 +label.action.change.service.processing=서비스를 변경하는 중... +label.action.change.service=서비스 변경 +label.action.copy.ISO.processing=ISO를 복사하는 중... +label.action.copy.ISO=ISO 복사 +label.action.copy.template.processing=í…œí”Œë¦¿ì„ ë³µì‚¬í•˜ëŠ” 중... +label.action.copy.template=템플릿 복사 +label.action.create.template.processing=í…œí”Œë¦¿ì„ ë§Œë“œëŠ” 중... +label.action.create.template=템플릿 만들기 +label.action.create.vm.processing=VM를 만드는 중... +label.action.create.vm=VM 만들기 +label.action.create.volume.processing=ë³¼ë¥¨ì„ ë§Œë“œëŠ” 중... +label.action.create.volume=볼륨 만들기 +label.action.delete.IP.range.processing=IP 주소 범위를 삭제하는 중... +label.action.delete.IP.range=IP 주소 범위 ì‚­ì œ +label.action.delete.ISO.processing=ISO를 삭제하는 중... +label.action.delete.ISO=ISO ì‚­ì œ +label.action.delete.account.processing=계정 정보를 삭제하는 중... +label.action.delete.account=계정 ì •ë³´ ì‚­ì œ +label.action.delete.cluster.processing=í´ëŸ¬ìŠ¤í„°ë¥¼ 삭제하는 중... +label.action.delete.cluster=í´ëŸ¬ìŠ¤í„° ì‚­ì œ +label.action.delete.disk.offering.processing=ë””ìŠ¤í¬ ì œê³µì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.disk.offering=ë””ìŠ¤í¬ ì œê³µ ì‚­ì œ + +label.action.update.resource.count=ìžì› 수 ì—…ë°ì´íЏ +label.action.update.resource.count.processing=ìžì› 수를 ì—…ë°ì´íŠ¸í•˜ëŠ” 중... + +label.action.delete.domain=ë„ë©”ì¸ ì‚­ì œ +label.action.delete.domain.processing=ë„ë©”ì¸ì„ 삭제하는 중... + +label.action.delete.firewall.processing=방화벽(fire wall)를 삭제하는 중... +label.action.delete.firewall=방화벽(fire wall) 규칙 ì‚­ì œ +label.action.delete.ingress.rule.processing=수신 ê·œì¹™ì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.ingress.rule=수신 규칙 ì‚­ì œ +label.action.delete.load.balancer.processing=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치를 삭제하는 중... +label.action.delete.load.balancer=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 규칙 ì‚­ì œ +label.action.edit.network.processing=네트워í¬ë¥¼ 편집하는 중... +label.action.edit.network=ë„¤íŠ¸ì›Œí¬ íŽ¸ì§‘ +label.action.delete.network.processing=네트워í¬ë¥¼ 삭제하는 중... +label.action.delete.network=ë„¤íŠ¸ì›Œí¬ ì‚­ì œ +label.action.delete.pod.processing=Pod를 삭제하는 중... +label.action.delete.pod=Pod ì‚­ì œ +label.action.delete.primary.storage.processing=기본 스토리지를 삭제하는 중... +label.action.delete.primary.storage=기본 스토리지 ì‚­ì œ +label.action.delete.secondary.storage.processing=2ì°¨ 스토리지를 삭제하는 중... +label.action.delete.secondary.storage=2ì°¨ 스토리지 ì‚­ì œ +label.action.delete.security.group.processing=보안 ê·¸ë£¹ì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.security.group=보안 그룹 ì‚­ì œ +label.action.delete.service.offering.processing=ì„œë¹„ìŠ¤ì œê³µì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.service.offering=서비스제공 ì‚­ì œ +label.action.delete.snapshot.processing=ìŠ¤ëƒ…ìƒ·ì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.snapshot=스냅샷 ì‚­ì œ +label.action.delete.template.processing=í…œí”Œë¦¿ì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.template=템플릿 ì‚­ì œ +label.action.delete.user.processing=사용ìžë¥¼ 삭제하는 중... +label.action.delete.user=ì‚¬ìš©ìž ì‚­ì œ +label.action.delete.volume.processing=ë³¼ë¥¨ì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.volume=볼륨 ì‚­ì œ +label.action.delete.zone.processing=Zoneì„ ì‚­ì œí•˜ëŠ” 중... +label.action.delete.zone=Zone ì‚­ì œ +label.action.destroy.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ 파기하는 중... +label.action.destroy.instance=ì¸ìŠ¤í„´ìŠ¤ 파기 +label.action.destroy.systemvm.processing=시스템 VM를 파기하는 중... +label.action.destroy.systemvm=시스템 VM 파기 +label.action.detach.disk.processing=디스í¬ë¥¼ 분리 하는 중... +label.action.detach.disk=ë””ìŠ¤í¬ ë¶„ë¦¬ +label.action.detach.iso.processing=ISO를 분리 하는 중... +label.action.detach.iso=ISO 분리 +label.action.disable.account.processing=계정 정보를 중지하는 중... +label.action.disable.account=계정 ì •ë³´ 중지 +label.action.disable.static.NAT.processing=ì •ì  NAT를 중지하는 중... +label.action.disable.static.NAT=ì •ì  NAT 사용 안 함 +label.action.disable.user.processing=사용ìžë¥¼ 중지하는 중... +label.action.disable.user=ì‚¬ìš©ìž ì¤‘ì§€ +label.action.download.ISO=ISO 다운로드 +label.action.download.template=템플릿 다운로드 +label.action.download.volume.processing=ë³¼ë¥¨ì„ ë‹¤ìš´ë¡œë“œí•˜ëŠ” 중... +label.action.download.volume=볼륨 다운로드 +label.action.edit.ISO=ISO 편집 +label.action.edit.account=계정 ì •ë³´ 편집 +label.action.edit.disk.offering=ë””ìŠ¤í¬ ì œê³µ 편집 +label.action.edit.domain=ë„ë©”ì¸ íŽ¸ì§‘ +label.action.edit.global.setting=글로벌 설정 편집 +label.action.edit.instance=ì¸ìŠ¤í„´ìŠ¤ 편집 +label.action.edit.network.offering=ë„¤íŠ¸ì›Œí¬ ì œê³µ 편집 +label.action.edit.pod=Pod 편집 +label.action.edit.primary.storage=기본 스토리지 편집 +label.action.edit.resource.limits=ìžì› 제한 편집 +label.action.edit.service.offering=서비스 제공 편집 +label.action.edit.template=템플릿 편집 +label.action.edit.user=ì‚¬ìš©ìž íŽ¸ì§‘ +label.action.edit.zone=Zone 편집 +label.action.enable.account.processing=계정 정보를 사용 설정 중... +label.action.enable.account=계정 ì •ë³´ 사용함 +label.action.enable.maintenance.mode.processing=유지 보수 모드를 사용 설정 중... +label.action.enable.maintenance.mode=유지 보수 모드 사용함 +label.action.enable.static.NAT.processing=ì •ì  NAT를 사용 설정 중... +label.action.enable.static.NAT=ì •ì  NAT 사용함 +label.action.enable.user.processing=사용ìžë¥¼ 사용 설정 중... +label.action.enable.user=ì‚¬ìš©ìž ì‚¬ìš©í•¨ +label.action.force.reconnect.processing=재접ì†í•˜ëŠ” 중... +label.action.force.reconnect=ê°•ì œìž¬ì ‘ì† +label.action.generate.keys.processing=키를 ìƒì„±í•˜ëŠ” 중... +label.action.generate.keys=키 ìƒì„± +label.action.lock.account.processing=계정 정보를 잠그는 중... +label.action.lock.account=계정 ì •ë³´ 잠금 +label.action.migrate.instance=ì¸ìŠ¤í„´ìŠ¤ ì´ì „ +label.action.migrate.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ ì´ì „하는 중... +label.action.reboot.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ 재시작하는 중... +label.action.reboot.instance=ì¸ìŠ¤í„´ìŠ¤ 재시작 +label.action.reboot.router.processing=ë¼ìš°í„°ë¥¼ 재시작하는 중... +label.action.reboot.router=ë¼ìš°í„° 재시작 +label.action.reboot.systemvm.processing=시스템 VM를 재시작하는 중... +label.action.reboot.systemvm=시스템 VM 재시작 +label.action.recurring.snapshot=정기 스냅샷 +label.action.release.ip.processing=IP 주소를 해제하는 중... +label.action.release.ip=IP 주소 í•´ì œ +label.action.remove.host.processing=호스트를 삭제하는 중... +label.action.remove.host=호스트 ì‚­ì œ +label.action.reset.password.processing=암호를 재설정 하는 중... +label.action.reset.password=암호 재설정 +label.action.resource.limits=ìžì› 제한 +label.action.restore.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ ë³µì›í•˜ëŠ” 중... +label.action.restore.instance=ì¸ìŠ¤í„´ìŠ¤ ë³µì› +label.action.start.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ 시작하는 중... +label.action.start.instance=ì¸ìŠ¤í„´ìŠ¤ 시작 +label.action.start.router.processing=ë¼ìš°í„°ë¥¼ 시작하는 중... +label.action.start.router=ë¼ìš°í„° 시작 +label.action.start.systemvm.processing=시스템 VM를 시작하는 중... +label.action.start.systemvm=시스템 VM 시작 +label.action.stop.instance.processing=ì¸ìŠ¤í„´ìŠ¤ë¥¼ 정지하는 중... +label.action.stop.instance=ì¸ìŠ¤í„´ìŠ¤ ì •ì§€ +label.action.stop.router.processing=ë¼ìš°í„°ë¥¼ 정지하는 중... +label.action.stop.router=ë¼ìš°í„° ì •ì§€ +label.action.stop.systemvm.processing=시스템 VM를 정지하는 중... +label.action.stop.systemvm=시스템 VM ì •ì§€ +label.action.take.snapshot.processing=ìŠ¤ëƒ…ìƒ·ì„ ë§Œë“œëŠ” 중.... +label.action.take.snapshot=스냅샷 만들기 +label.action.update.OS.preference.processing=OS 기본 ì„¤ì •ì„ ì—…ë°ì´íŠ¸í•˜ëŠ” 중... +label.action.update.OS.preference=OS 기본 설정 ì—…ë°ì´íЏ +label.actions=작업 +label.active.sessions=활성 세션 +label.add.account=계정 ì •ë³´ 추가 +label.add.by.cidr=CIDR 로 추가 +label.add.by.group=그룹ì—서 추가 +label.add.cluster=í´ëŸ¬ìŠ¤í„° 추가 +label.add.direct.iprange=ì§ì ‘ IP 주소 범위 추가 +label.add.disk.offering=ë””ìŠ¤í¬ ì œê³µ 추가 +label.add.domain=ë„ë©”ì¸ ì¶”ê°€ +label.add.firewall=방화벽(fire wall) 규칙 추가 +label.add.host=호스트 추가 +label.add.ingress.rule=수신 규칙 추가 +label.add.ip.range=IP 주소 범위 추가 +label.add.load.balancer=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치 추가 +label.add.more=다른 항목 추가 +label.add.network=ë„¤íŠ¸ì›Œí¬ ì¶”ê°€ +label.add.pod=Pod 추가 +label.add.primary.storage=기본 스토리지 추가 +label.add.secondary.storage=2ì°¨ 스토리지 추가 +label.add.security.group=보안 그룹 추가 +label.add.service.offering=서비스제공 추가 +label.add.template=템플릿 추가 +label.add.user=ì‚¬ìš©ìž ì¶”ê°€ +label.add.vlan=VLAN 추가 +label.add.volume=볼륨 추가 +label.add.zone=Zone 추가 +label.add=추가 +label.adding.cluster=í´ëŸ¬ìŠ¤í„°ë¥¼ 추가중... +label.adding.failed=추가할 수 ì—†ìŒ +label.adding.pod=Pod를 추가 가능 +label.adding.processing=추가하는 중... +label.adding.succeeded=추가 완료 +label.adding.user=ì‚¬ìš©ìž ì¶”ê°€ +label.adding.zone=Zone 추가 +label.adding=ì •ë³´ 추가 +label.additional.networks=추가 ë„¤íŠ¸ì›Œí¬ +label.admin.accounts=ê´€ë¦¬ìž ê³„ì • ì •ë³´ +label.admin=ê´€ë¦¬ìž +label.advanced.mode=확장 모드 +label.advanced.search=ê³ ë„ ê²€ìƒ‰ +label.advanced=확장 +label.alert=알림 ì²´ì œ +label.algorithm=알고리즘 +label.allocated=할당 완료 ìƒíƒœ +label.api.key=API 키 +label.assign.to.load.balancer=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 ìž¥ì¹˜ì— ì¸ìŠ¤í„´ìŠ¤ë¥¼ 할당 +label.assign=할당 +label.associated.network.id=관련 ë„¤íŠ¸ì›Œí¬ ID +label.attached.iso=ì—°ê²° ISO +label.availability.zone=ì´ìš© 가능 Zone +label.availability=가용성 +label.available.public.ips=사용 가능 공개 IP 주소 +label.available=사용 가능 +label.back=뒤로 +label.basic.mode=기본 모드 +label.bootable=부팅 가능 +label.broadcast.domain.type=브로드ìºìŠ¤íŠ¸ ë„ë©”ì¸ ì¢…ë¥˜ +label.by.account=계정 ì •ë³´ +label.by.availability=가용성 +label.by.domain=ë„ë©”ì¸ +label.by.end.date=ì¢…ë£Œì¼ +label.by.level=레벨 +label.by.pod=Pod +label.by.role=ì—­í•  +label.by.start.date=ì‹œìž‘ì¼ +label.by.state=ìƒíƒœ +label.by.traffic.type=트래픽 종류 +label.by.type.id=종류 ID +label.by.type=종류 +label.by.zone=Zone +label.bytes.received=수신 ë°”ì´íЏ +label.bytes.sent=전송 ë°”ì´íЏ +label.cancel=취소 +label.certificate=ì¸ì¦ì„œ +label.privatekey=PKC#8 비밀 키 +label.domain.suffix=DNS ë„ë©”ì¸ (예: xyz.com) +label.character=ë¬¸ìž +label.cidr.account=CIDR ë˜ëŠ” 계정 ì •ë³´/보안 그룹 +label.close=닫기 +label.cloud.console=í´ë¼ìš°ë“œ 관리 콘솔 +label.cloud.managed=Cloud.com 관리 +label.cluster.type=í´ëŸ¬ìŠ¤í„° 종류 +label.cluster=í´ëŸ¬ìŠ¤í„° +label.code=코드 +label.confirmation=í™•ì¸ +label.cpu.allocated.for.VMs=VMì— í• ë‹¹ 완료 CPU +label.cpu.allocated=할당 완료 CPU +label.cpu.utilized=CPU 사용율 +label.cpu=CPU +label.created=ì¼ì‹œ 만들기 +label.cross.zones=í¬ë¡œìФ ì¡´ +label.custom.disk.size=맞춤 ë””ìŠ¤í¬ í¬ê¸° +label.daily=ë§¤ì¼ +label.data.disk.offering=ë°ì´íƒ€ ë””ìŠ¤í¬ ì œê³µ +label.date=ë‚ ì§œ +label.day.of.month=매월 ì§€ì •ì¼ +label.day.of.week=매주 ì§€ì •ì¼ +label.delete=ì‚­ì œ +label.deleting.failed=삭제할 수 ì—†ìŒ +label.deleting.processing=삭제하는 중... +label.description=설명 +label.detaching.disk=디스í¬ë¥¼ 분리함 +label.details=ìƒì„¸ +label.device.id=기기 ID +label.disabled=사용 안함 +label.disabling.vpn.access=VPN 접근를 사용 안 함으로 설정 중 +label.disk.allocated=할당 완료 ë””ìŠ¤í¬ +label.disk.offering=ë””ìŠ¤í¬ ì œê³µ +label.disk.size.gb=ë””ìŠ¤í¬ í¬ê¸°(GB 단위) +label.disk.size=ë””ìŠ¤í¬ í¬ê¸° +label.disk.total=ë””ìŠ¤í¬ í•©ê³„ +label.disk.volume=ë””ìŠ¤í¬ ë³¼ë¥¨ +label.display.text=표시 í…스트 +label.dns.1=DNS 1 +label.dns.2=DNS 2 +label.domain.admin=ë„ë©”ì¸ ê´€ë¦¬ìž +label.domain.id=ë„ë©”ì¸ ID +label.domain.name=ë„ë©”ì¸ëª… +label.domain=ë„ë©”ì¸ +label.double.quotes.are.not.allowed=í° ë”°ì˜´í‘œ 사용할 수 ì—†ìŒ +label.download.progress=다운로드 ì§„í–‰ 사항 +label.edit=편집 +label.email=ì „ìž ë©”ì¼ +label.enabling.vpn.access=VPN 접근를 사용 하고 ìžˆìŒ +label.enabling.vpn=VPN를 사용 하고 ìžˆìŒ +label.end.port=종료 í¬í†  +label.endpoint.or.operation=엔드 í¬ì¸íЏ ë˜ëŠ” 작업 +label.error.code=오류 코드 +label.error=오류 +label.esx.host=ESX/ESXi 호스트 +label.example=예 +label.failed=실패 +label.featured=추천 +label.firewall=방화벽(fire wall) +label.first.name=ì´ë¦„ +label.format=í˜•ì‹ +label.friday=ê¸ˆìš”ì¼ +label.full=ì „ì²´ +label.gateway=게ì´íŠ¸ì›¨ì´ +label.general.alerts=ì¼ë°˜ 알림 ì²´ì œ +label.generating.url=URL를 ìƒì„±í•˜ê³  ìžˆìŒ +label.go.step.2=단계 2으로 +label.go.step.3=단계 3으로 +label.go.step.4=단계 4으로 +label.go.step.5=단계 5으로 +label.group.optional=그룹(옵션) +label.group=그룹 +label.guest.cidr=게스트 CIDR +label.guest.gateway=게스트 게ì´íŠ¸ì›¨ì´ +label.guest.ip.range=게스트 IP 주소 범위 +label.guest.ip=게스트 IP 주소 +label.guest.netmask=게스트 ë„· ë§ˆìŠ¤í¬ +label.ha.enabled=고가용성 사용함 +label.help=ë„ì›€ë§ +label.host.alerts=호스트 알림 체계 +label.host.name=호스트명 +label.host=호스트 +label.hosts=호스트 +label.hourly=매시간 +label.hypervisor.type=하ì´í¼ ë°”ì´ì € 종류 +label.hypervisor=하ì´í¼ ë°”ì´ì € +label.id=ID +label.info=ì •ë³´ +label.ingress.rule=수신 규칙 +label.initiated.by=시작 ì‚¬ìš©ìž +label.instance.limits=ì¸ìŠ¤í„´ìŠ¤ 제한 +label.instance.name=ì¸ìŠ¤í„´ìŠ¤ëª… +label.instance=ì¸ìŠ¤í„´ìŠ¤ +label.instances=ì¸ìŠ¤í„´ìŠ¤ +label.internal.dns.1=ë‚´ë¶€ DNS 1 +label.internal.dns.2=ë‚´ë¶€ DNS 2 +label.interval.type=간격 종류 +label.invalid.integer=유효하지 ì•Šì€ ì •ìˆ˜ê°’ +label.invalid.number=유효하지 ì•Šì€ ìˆ«ìžê°’ +label.ip.address=IP 주소 +label.ip.allocations=IP 주소 할당 +label.ip.limits=공개 IP 주소 제한 +label.ip.or.fqdn=IP 주소 ë˜ëŠ” FQDN +label.ip.range=IP 주소 범위 +label.ip=IP +label.ips=IP +label.is.default=기본 +label.is.shared=공유 +label.is.system=시스템 +label.iscsi=iSCSI +label.iso.boot=ISO 시작 +label.iso=ISO +label.isolation.mode=분리 모드 +label.keep=유지 +label.lang.chinese=중국어(ê°„ì²´) +label.lang.english=ì˜ì–´ +label.lang.japanese=ì¼ë³¸ì–´ +label.lang.korean=한국어 +label.lang.spanish=스페ì¸ì–´ +label.last.disconnected=마지막 종료 ì‹œì  +label.last.name=성 +label.level=레벨 +label.linklocal.ip=ë§í¬ 로컬 IP 주소 +label.load.balancer=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치 +label.loading=로드 하는 중 +label.local=로컬 +label.login=ë¡œê·¸ì¸ +label.logout=로그아웃 +label.lun=LUN +label.manage=관리 +label.maximum=최대 +label.memory.allocated=할당완료 메모리 +label.memory.total=메모리 합계 +label.memory.used=메모리 사용량 +label.memory=메모리 +label.menu.accounts=계정 ì •ë³´ +label.menu.alerts=알림 체계 +label.menu.all.accounts=모든 계정 ì •ë³´ +label.menu.all.instances=모든 ì¸ìŠ¤í„´ìŠ¤ +label.menu.community.isos=커뮤니티 ISO +label.menu.community.templates=커뮤니티 템플릿 +label.menu.configuration=구성 +label.menu.dashboard=대시 보드 +label.menu.destroyed.instances=íŒŒê¸°ëœ ì¸ìŠ¤í„´ìŠ¤ +label.menu.disk.offerings=디스í¬ì œê³µ +label.menu.domains=ë„ë©”ì¸ +label.menu.events=ì´ë²¤íЏ +label.menu.featured.isos=추천 ISO +label.menu.featured.templates=추천 템플릿 +label.menu.global.settings=글로벌 설정 +label.menu.instances=ì¸ìŠ¤í„´ìŠ¤ +label.menu.ipaddresses=IP 주소 +label.menu.isos=ISO +label.menu.my.accounts=ë‚˜ì˜ ê³„ì • ì •ë³´ +label.menu.my.instances=ë‚˜ì˜ ì¸ìŠ¤í„´ìŠ¤ +label.menu.my.isos=ë‚˜ì˜ ISO +label.menu.my.templates=ë‚˜ì˜ í…œí”Œë¦¿ +label.menu.network.offerings=ë„¤íŠ¸ì›Œí¬ ì œê³µ +label.menu.network=ë„¤íŠ¸ì›Œí¬ +label.menu.physical.resources=물리 ìžì› +label.menu.running.instances=실행 중 ì¸ìŠ¤í„´ìŠ¤ +label.menu.security.groups=보안 그룹 +label.menu.service.offerings=서비스제공 +label.menu.snapshots=스냅샷 +label.menu.stopped.instances=ì •ì§€ëœ ì¸ìŠ¤í„´ìŠ¤ +label.menu.storage=스토리지 +label.menu.system.vms=시스템 VM +label.menu.system=시스템 +label.menu.templates=템플릿 +label.menu.virtual.appliances=ê°€ìƒ ì•„í”„ë¼ì´ì•ˆìФ +label.menu.virtual.resources=ê°€ìƒ ìžì› +label.menu.volumes=볼륨 +label.migrate.instance.to=ì¸ìŠ¤í„´ìŠ¤ ì´ì „ 위치: +label.minimum=최소 +label.minute.past.hour=ë¶„(매시) +label.monday=ì›”ìš”ì¼ +label.monthly=매월 +label.more.templates=다른 템플릿 +label.my.account=ë‚˜ì˜ ê³„ì • ì •ë³´ +label.name.optional=ì´ë¦„(옵션) +label.name=ì´ë¦„ +label.netmask=ë„· ë§ˆìŠ¤í¬ +label.network.desc=ë„¤íŠ¸ì›Œí¬ ì„¤ëª… +label.network.domain=ë„¤íŠ¸ì›Œí¬ ë„ë©”ì¸ +label.network.id=ë„¤íŠ¸ì›Œí¬ ID +label.network.name=네트워í¬ëª… +label.network.offering.display.text=ë„¤íŠ¸ì›Œí¬ ì œê³µ 표시 í…스트 +label.network.offering.id=ë„¤íŠ¸ì›Œí¬ ì œê³µ ID +label.network.offering.name=ë„¤íŠ¸ì›Œí¬ ì œê³µëª… +label.network.offering=ë„¤íŠ¸ì›Œí¬ ì œê³µ +label.network.rate=ë„¤íŠ¸ì›Œí¬ ì†ë„ +label.network.read=ë„¤íŠ¸ì›Œí¬ ì½ê¸° +label.network.type=ë„¤íŠ¸ì›Œí¬ ì¢…ë¥˜ +label.network.write=ë„¤íŠ¸ì›Œí¬ ê¸°ìž… +label.network=ë„¤íŠ¸ì›Œí¬ +label.new.password=새로운 암호 +label.next=ë‹¤ìŒ +label.nfs.server=NFS 서버 +label.nfs.storage=NFS 스토리지 +label.nfs=NFS +label.nics=NIC +label.no.actions=실행할 수 있는 작업 ì—†ìŒ +label.no.alerts=최근 알림 체계 ì—†ìŒ +label.no.errors=최근 오류는 ì—†ìŒ +label.no.isos=사용할 수 있는 ISO ì—†ìŒ +label.no.items=사용할 수 있는 항목 ì—†ìŒ +label.no.security.groups=사용할 수 있는 보안 그룹 ì—†ìŒ +label.no.thanks=설정 안 함 +label.no=아니오 +label.none=ì—†ìŒ +label.not.found=검색 ê²°ê³¼ ì—†ìŒ +label.num.cpu.cores=CPU 코어수 +label.numretries=재시행 회수 +label.offer.ha=고가용성 제공 +label.optional=옵션 +label.os.preference=OS 기본 설정 +label.os.type=OS 종류 +label.owned.public.ips=소유 공개 IP 주소 +label.owner.account=ì†Œìœ ìž ê³„ì • ì •ë³´ +label.owner.domain=ì†Œìœ ìž ë„ë©”ì¸ +label.parent.domain=부모 ë„ë©”ì¸ +label.password.enabled=암호 관리 사용 +label.password=암호 +label.path=경로 +label.please.wait=기다려 주십시오... +label.pod=Pod +label.port.forwarding=í¬í†  전송 +label.port.range=í¬í†  범위 +label.prev=뒤로 +label.primary.allocated=할당 완료 기본 스토리지 +label.primary.network=기본 ë„¤íŠ¸ì›Œí¬ +label.primary.storage=기본 스토리지 +label.primary.used=기본 스토리지 사용량 +label.private.interface=사설 ì¸í„°íŽ˜ì´ìФ +label.private.ip.range=사설 IP 주소 범위 +label.private.ip=사설 IP 주소 +label.private.ips=사설 IP 주소 +label.private.port=사설 í¬íЏ +label.private.zone=사설 Zone +label.protocol=프로토콜 +label.public.interface=공개 ì¸í„°íŽ˜ì´ìФ +label.public.ip=공개 IP 주소 +label.public.ips=공개 IP 주소 +label.public.port=공개 í¬íЏ +label.public.zone=공개 Zone +label.public=공개 +label.recent.errors=최근 오류 +label.refresh=ì—…ë°ì´íЏ +label.related=관련 +label.remove.from.load.balancer=ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치ì—서 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 삭제하는 중 +label.removing.user=사용ìžë¥¼ 삭제하는 중 +label.required=필수 사항 +label.reserved.system.ip=ì˜ˆì•½ëœ ì‹œìŠ¤í…œ IP 주소 +label.resource.limits=ìžì› 제한 +label.resource=ìžì› +label.resources=ìžì› +label.role=ì—­í•  +label.root.disk.offering=루트 디스í¬ì œê³µ +label.running.vms=실행중 VM +label.saturday=í† ìš”ì¼ +label.save=저장 +label.saving.processing=저장하는 중... +label.scope=범위 +label.search=검색 +label.secondary.storage=2ì°¨ 스토리지 +label.secondary.used=2ì°¨ 스토리지 사용량 +label.secret.key=비밀 키 +label.security.group.name=보안 그룹명 +label.security.group=보안 그룹 +label.security.groups.enabled=보안 그룹 유효 +label.security.groups=보안 그룹 +label.sent=ì „ì†¡ëœ ìƒíƒœ +label.server=서버 +label.service.offering=서비스제공 +label.system.service.offering=시스템 서비스 제공 +label.session.expired=세션 ìœ íš¨ê¸°ê°„ì´ ëŠì–´ì§ +label.shared=공유 +label.size=í¬ê¸° +label.snapshot.limits=스냅샷 제한 +label.snapshot.name=스냅샷 ì´ë¦„ +label.snapshot.s=스냅샷 +label.snapshot.schedule=정기 스냅샷 설정 +label.snapshot=스냅샷 +label.snapshots=스냅샷 +label.source.nat=ì „ì†¡ì› NAT +label.specify.vlan=VLAN 지정 +label.start.port=시작 í¬í†  +label.state=ìƒíƒœ +label.static.nat.to=ì •ì  NAT 설정 위치: +label.static.nat=ì •ì  NAT +label.statistics=통계 +label.status=ìƒíƒœ +label.step.1.title=단계 1. 템플릿 ì„ íƒ +label.step.1=단계 1 +label.step.2.title=단계 2. 서비스 제공 +label.step.2=단계 2 +label.step.3.title=단계 3. ë””ìŠ¤í¬ ì œê³µ ì„ íƒ +label.step.3=단계 3 +label.step.4.title=단계 4. ë„¤íŠ¸ì›Œí¬ +label.step.4=단계 4 +label.step.5.title=단계 5. 최종 í™•ì¸ +label.step.5=단계 5 +label.stopped.vms=ì •ì§€ 중 VM +label.storage.type=스토리지 종류 +label.storage=스토리지 +label.submit=보내기 +label.submitted.by=[사용ìž: ] +label.succeeded=완료 +label.sunday=ì¼ìš”ì¼ +label.system.capacity=시스템 처리 능력 +label.system.vm.type=시스템 VM 종류 +label.system.vm=시스템 VM +label.system.vms=시스템 VM +label.tagged=태그 +label.tags=태그 +label.target.iqn=타겟 IQN +label.template.limits=템플릿 제한 +label.template=템플릿 +label.theme.default=기본 테마 +label.theme.grey=맞춤- 회색조 +label.theme.lightblue=맞춤 - ë¼ì´íЏ 블루 +label.thursday=ëª©ìš”ì¼ +label.time.zone=시간대 +label.time=ì‹œê° +label.timeout.in.second = 시간 초과 (ì´ˆ) +label.timezone=시간대 +label.total.cpu=CPU 합계 +label.total.vms=VM 합계 +label.traffic.type=트래픽 종류 +label.tuesday=í™”ìš”ì¼ +label.type.id=종류 ID +label.type=종류 +label.unavailable=사용 불가 +label.unlimited=무제한 +label.untagged=태그 ì—†ìŒ +label.update.ssl.cert=SSL ì¸ì¦ì„œ ì—…ë°ì´íЏ +label.update.ssl=SSL ì¸ì¦ì„œ ì—…ë°ì´íЏ +label.updating=ì—…ë°ì´íŠ¸í•˜ê³  있는 중 +label.url=URL +label.usage.interface=사용 ìƒí™© 측정 ì¸í„°íŽ˜ì´ìФ +label.used=사용 중 +label.user=ì‚¬ìš©ìž +label.username=사용ìžëª… +label.users=ì‚¬ìš©ìž +label.value=ê°’ +label.vcenter.cluster=vCenter í´ëŸ¬ìŠ¤í„° +label.vcenter.datacenter=vCenter ë°ì´í„° 센터 +label.vcenter.datastore=vCenter ë°ì´í„° 스토어 +label.vcenter.host=vCenter 호스트 +label.vcenter.password=vCenter 암호 +label.vcenter.username=vCenter 사용ìžëª… +label.version=버전 +label.virtual.appliance=ê°€ìƒ ì–´í”Œë¼ì´ì–¸ìФ +label.virtual.appliances=ê°€ìƒ ì–´í”Œë¼ì´ì–¸ìФ +label.virtual.network=ê°€ìƒ ë„¤íŠ¸ì›Œí¬ +label.vlan.id=VLAN ID +label.vlan.range=VLAN 범위 +label.vm.add=ì¸ìŠ¤í„´ìŠ¤ 추가 +label.vm.destroy=파기 +label.vm.reboot=재시작 +label.vm.start=시작 +label.vm.stop=ì •ì§€ +label.vmfs=VMFS +label.vms=VM +label.volume.limits=볼륨 제한 +label.volume.name=볼륨명 +label.volume=볼륨 +label.volumes=볼륨 +label.vsphere.managed=vSphere 관리 +label.waiting=대기하는 중 +label.warn=경고 +label.wednesday=ìˆ˜ìš”ì¼ +label.weekly=매주 +label.welcome.cloud.console=관리 ì½˜ì†”ì— ì˜¤ì‹ ê²ƒì„ í™˜ì˜í•©ë‹ˆë‹¤! +label.welcome=어서 오십시오 +label.yes=예 +label.zone.id=Zone ID +label.zone.step.1.title=단계 1. ë„¤íŠ¸ì›Œí¬ ì„ íƒ +label.zone.step.2.title=단계 2. Zone 추가 +label.zone.step.3.title=단계 3. Pod 추가 +label.zone.step.4.title=단계 4. IP 주소 범위 추가 +label.zone.wide=Zone ì „ì²´ +label.zone=Zone + +#Messages +message.acquire.public.ip=새로운 IP 주소를 ì·¨ë“하는 Zoneì„ ì„ íƒí•´ 주십시오. +message.action.cancel.maintenance.mode=현재 유지 보수를 취소하시겠습니까? +message.action.cancel.maintenance=호스트 유지 보수는 ì •ìƒì ìœ¼ë¡œ 취소ë˜ì—ˆìŠµë‹ˆë‹¤. 처리ì—는 몇 ë¶„ ì •ë„ ê±¸ë¦´ 수 있습니다. +message.action.delete.ISO.for.all.zones=ì´ ISO는 모든 Zoneì—서 사용하고 있습니다. 모든 Zoneì—서 삭제하시겠습니까? +message.action.delete.ISO=현재 ISO를 삭제하시겠습니까? +message.action.delete.cluster=현재 í´ëŸ¬ìŠ¤í„°ë¥¼ 삭제하시겠습니까? +message.action.delete.disk.offering=현재 디스í¬ì œê³µì„ 삭제하시겠습니까? +message.action.delete.domain=현재 ë„ë©”ì¸ì„ 삭제하시겠습니까? +message.action.delete.external.firewall=현재 외부 방화벽(fire wall)를 삭제하시겠습니까? 경고: ê°™ì€ ì™¸ë¶€ 방화벽(fire wall)를 다시 추가할 경우는 기기 사용 ìƒí™© ë°ì´í„°ë¥¼ 재설정해야 합니다. +message.action.delete.external.load.balancer=현재 외부 ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치를 삭제하시겠습니까? 경고: ê°™ì€ ì™¸ë¶€ ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치를 다시 추가할 경우는 기기 사용 ìƒí™© ë°ì´í„°ë¥¼ 재설정해야 합니다. +message.action.delete.ingress.rule=현재 수신 ê·œì¹™ì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.network=현재 네트워í¬ë¥¼ 삭제하시겠습니까? +message.action.delete.pod=현재 Pod를 삭제하시겠습니까? +message.action.delete.primary.storage=현재 기본 스토리지를 삭제하시겠습니까? +message.action.delete.secondary.storage=현재 2ì°¨ 스토리지를 삭제하시겠습니까? +message.action.delete.security.group=현재 보안 ê·¸ë£¹ì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.service.offering=현재 ì„œë¹„ìŠ¤ì œê³µì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.snapshot=현재 ìŠ¤ëƒ…ìƒ·ì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.template.for.all.zones=ê·¸ í…œí”Œë¦¿ì€ ëª¨ë“  Zoneì—서 사용ë˜ì–´ 있습니다. 모든 Zoneì—서 삭제하시겠습니까? +message.action.delete.template=현재 í…œí”Œë¦¿ì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.volume=현재 ë³¼ë¥¨ì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.delete.zone=현재 Zoneì„ ì‚­ì œí•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.destroy.instance=현재 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 파기하시겠습니까? +message.action.destroy.systemvm=현재 시스템 VM를 파기하시겠습니까? +message.action.disable.static.NAT=ì •ì  NAT를 사용 안 함으로 설정하시겠습니까? +message.action.enable.maintenance=호스트를 유지 보수할 준비를 í•  수 있었습니다. ì´ í˜¸ìŠ¤íŠ¸ìƒ VM ìˆ˜ì— ë”°ë¼ì„œ ì²˜ë¦¬ì— ëª‡ ë¶„ ì´ìƒ 걸릴 ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤. +message.action.force.reconnect=호스트는 ê°•ì œì ìœ¼ë¡œ 재접ì†í–ˆìŠµë‹ˆë‹¤. ì´ ì²˜ë¦¬ì—는 몇 ë¶„ ì´ìƒ 걸릴 ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤ +message.action.host.enable.maintenance.mode=유지 보수 모드를 사용 하면, ì´ í˜¸ìŠ¤íŠ¸ë¡œ 실행 ì¤‘ì¸ ëª¨ë“  ì¸ìŠ¤í„´ìŠ¤ë¥¼ 다른 사용가능 호스트ì—게 실시간 ì´ì „ë©ë‹ˆë‹¤. +message.action.instance.reset.password=현재 ê°€ìƒ ë¨¸ì‹  루트 암호를 변경하시겠습니까? +message.action.primarystorage.enable.maintenance.mode=경고: 기본 스토리지를 유지 보수 모드로 하면 ê·¸ ìŠ¤í† ë¦¬ì§€ìƒ ë³¼ë¥¨ì„ ì‚¬ìš©í•˜ëŠ” 모든 VMê°€ 정지합니다. 실행하시겠습니까? +message.action.reboot.instance=현재 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 재시작하시겠습니까? +message.action.reboot.systemvm=현재 시스템 VMì„ ìž¬ì‹œìž‘í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.release.ip=현재 IP 주소를 해제하시겠습니까? +message.action.restore.instance=현재 ì¸ìŠ¤í„´ìŠ¤ë¥¼ ë³µì›í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.start.instance=현재 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 시작하시겠습니까? +message.action.start.router=현재 ë¼ìš°í„°ë¥¼ 시작하시겠습니까? +message.action.start.systemvm=현재 시스템 VMì„ ì‹œìž‘í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.stop.instance=현재 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 정지하시겠습니까? +message.action.stop.systemvm=현재 시스템 VMì„ ì •ì§€í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.action.take.snapshot=현재 볼륨 ìŠ¤ëƒ…ìƒ·ì„ ë§Œë“œì‹œê² ìŠµë‹ˆê¹Œ? +message.add.cluster.zone=Zone ì— í•˜ì´í¼ ë°”ì´ì €ë¡œ 관리ë˜ëŠ” í´ëŸ¬ìŠ¤í„°ë¥¼ 추가합니다. +message.add.cluster=Zone Pod ì— í•˜ì´í¼ ë°”ì´ì €ë¡œ 관리ë˜ëŠ” í´ëŸ¬ìŠ¤í„°ë¥¼ 추가합니다. +message.add.disk.offering=새로운 ë””ìŠ¤í¬ ì œê³µì„ ì¶”ê°€í•˜ê¸° 위해 ë‹¤ìŒ íŒŒë¼ë¯¸í„°ë¥¼ 지정해 주십시오. +message.add.firewall=Zoneì— ë°©í™”ë²½(fire wall)ì„ ì¶”ê°€í•©ë‹ˆë‹¤. +message.add.host=새로운 호스트를 추가하기 위해 아래 파ë¼ë¯¸í„°ë¥¼ 지정해 주십시오. +message.add.ip.range.direct.network=Zone ì§ì ‘ ë„¤íŠ¸ì›Œí¬ ì— IP 주소 범위를 추가합니다 +message.add.ip.range.to.pod=

Pod ì— IP 주소 범위를 추가합니다.

+message.add.ip.range=Zone 공개 네트워í¬ì— IP 주소 범위를 추가합니다. +message.add.load.balancer=Zoneì— ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치를 추가합니다. +message.add.network=Zone ì— ìƒˆë¡œìš´ 네트워í¬ë¥¼ 추가합니다. +message.add.pod=Zone ì— ìƒˆë¡œìš´ Pod를 추가합니다. +message.add.primary.storage=Zone Pod ì— ìƒˆë¡œìš´ 기본 스토리지를 추가합니다. +message.add.primary=새로운 기본 스토리지를 추가하기 위해 아래 파ë¼ë¯¸í„°ë¥¼ 지정해 주십시오. +message.add.secondary.storage=Zone ì— ìƒˆë¡œìš´ 스토리지를 추가합니다 +message.add.service.offering=새로운 컴퓨팅 ìžì› ì œê³µì„ ì¶”ê°€í•˜ê¸° 위해서, ë‹¤ìŒ ë°ì´í„°ë¥¼ 입력해 주십시오. +message.add.template=새로운 í…œí”Œë¦¿ì„ ë§Œë“¤ê¸°í•˜ê¸° 위해 아래 ë°ì´í„°ë¥¼ 입력해 주십시오. +message.add.volume=새로운 ë³¼ë¥¨ì„ ì¶”ê°€í•˜ê¸° 위해 아래 ë°ì´í„°ë¥¼ 입력해 주십시오. +message.additional.networks.desc=ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ê°€ ì ‘ì†í•˜ëŠ” 추가 네트워í¬ë¥¼ ì„ íƒí•´ 주십시오. +message.advanced.mode.desc=VLAN 기술 ì§€ì›ë¥¼ 사용 하는 경우는 ì´ ë„¤íŠ¸ì›Œí¬ ëª¨ë¸ì„ ì„ íƒí•´ 주십시오.ì´ ëª¨ë¸ì—서는 가장 유연하게 카스íƒë„¤íŠ¸ì›Œí¬ ì œê³µì„ ì œê³µí•  수 있어 방화벽(fire wall), VPN, ë„¤íŠ¸ì›Œí¬ ë¡œë“œ 공유 장치 기술 ì§€ì› ì™¸ì—, ì§ì ‘ 네트워í¬ì™€ ê°€ìƒ ë„¤íŠ¸ì›Œí¬ë„ 사용 í•  수 있습니다. +message.advanced.security.group=게스트 VM를 분리하기 위해서 보안 ê·¸ë£¹ì„ ì‚¬ìš©í•˜ëŠ” 경우는 ì´ ì˜µì…˜ì„ ì„ íƒí•´ 주십시오. +message.advanced.virtual=게스트 VM를 분리하기 위해서 ì¡´ ì „ì²´ VLAN를 사용하는 경우는 ì´ ì˜µì…˜ì„ ì„ íƒí•´ 주십시오. +message.allow.vpn.access=VPN 접근를 허가하는 ì‚¬ìš©ìž ì‚¬ìš©ìžëª…ê³¼ 암호를 입력해 주십시오. +message.attach.iso.confirm=현재 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ì— ISO 파ì¼ì„ ì—°ê²° 하시겠습니까? +message.attach.volume=새로운 ë³¼ë¥¨ì„ ì—°ê²° 하기 위해 아래 ë°ì´í„°ë¥¼ 입력해 주십시오.Windows ë² ì´ìФ ê°€ìƒ ë¨¸ì‹ ì— ë””ìŠ¤í¬ ë³¼ë¥¨ì„ ì—°ê²° 하는 경우는 ì—°ê²° 한 디스í¬ë¥¼ ì¸ì‹í•˜ê¸° 위해서 ì¸ìŠ¤í„´ìŠ¤ë¥¼ 재시작할 필요가 있습니다. +message.basic.mode.desc=VLAN 기술 ì§€ì›ê°€ë¶ˆí•„요한경우는 ì´ ë„¤íŠ¸ì›Œí¬ ëª¨ë¸ì„ ì„ íƒí•´ 주십시오.ì´ ë„¤íŠ¸ì›Œí¬ ëª¨ë¸ë¡œ 만들기ë˜ëŠ” 모든 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ì— ë„¤íŠ¸ì›Œí¬ì—서 ì§ì ‘ IP 주소를 할당할 수 있어 보안 ê·¸ë£¹ì„ ì‚¬ìš©í•´ 보안와 분리가 제공ë©ë‹ˆë‹¤. +message.change.offering.confirm=현재 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ ì„œë¹„ìŠ¤ì œê³µì„ ë³€ê²½í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.copy.iso.confirm=ISO를 ë‹¤ìŒ ìž¥ì†Œì— ë³µì‚¬í•˜ì‹œê² ìŠµë‹ˆê¹Œ? +message.copy.template=ì¡´ 으ì—서 템플릿 XXX를 ë‹¤ìŒ ìž¥ì†Œì— ë³µì‚¬í•©ë‹ˆë‹¤: +message.create.template.vm=템플릿 으ì—서 VM를 만들었습니다. +message.create.template.volume=ë””ìŠ¤í¬ ë³¼ë¥¨ í…œí”Œë¦¿ì„ ë§Œë“¤ê¸°í•˜ê¸° ì „ì—, ë‹¤ìŒ ì •ë³´ë¥¼ 지정해 주십시오.볼륨 í¬ê¸°ì— ë”°ë¼ì„œëŠ” 템플릿 만들기ì—는 몇분 ì´ìƒ 걸릴 ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤. +message.delete.account=현재 계정 정보를 삭제하시겠습니까? +message.detach.iso.confirm=현재 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ì—서 ISO 파ì¼ì„ 분리 하시겠습니까? +message.disable.account=현재 계정 정보를 사용 안 함으로 하시겠습니까?ì´ ê³„ì • ì •ë³´ 모든 사용ìžê°€ í´ë¼ìš°ë“œ ìžì›ì— ì ‘ê·¼ í•  수 없게 ë©ë‹ˆë‹¤. 실행중 모든 ê°€ìƒ ë¨¸ì‹ ì€ ê¸ˆë°©ì— ì¢…ë£Œ ë©ë‹ˆë‹¤. +message.disable.vpn.access=VPN 접근를 사용 안 함으로 하시겠습니까? +message.download.ISO=ISO를 다운로드하려면 00000ì„ í´ë¦­í•©ë‹ˆë‹¤. +message.download.template=í…œí”Œë¦¿ì„ ë‹¤ìš´ë¡œë“œí•˜ë ¤ë©´ 00000ì„ í´ë¦­í•©ë‹ˆë‹¤. +message.download.volume=ë³¼ë¥¨ì„ ë‹¤ìš´ë¡œë“œí•˜ë ¤ë©´ 00000ì„ í´ë¦­í•©ë‹ˆë‹¤. +message.edit.confirm=[저장]ì„ í´ë¦­í•˜ê¸° 전으로 변경 ë‚´ìš©ì„ í™•ì¸í•´ 주십시오. +message.edit.limits=ë‹¤ìŒ ìžì›ì— ì œí•œì„ ì§€ì •í•´ 주십시오.「-1ã€ì€ ìžì› ë§Œë“¤ê¸°ì— ì œí•œì´ ì—†ë‹¤ëŠ” ì˜ë¯¸ìž…니다. +message.enable.account=현재 계정 정보를 사용 하시겠습니까? +message.enable.vpn.access=í˜„ìž¬ì´ IP ì£¼ì†Œì— ëŒ€í•œ VPN는 유효하지 않ì€ìž…니다. VPN 접근를 사용 하시겠습니까? +message.enabled.vpn.ip.sec=IPSec 사전 공유 키: +message.enabled.vpn=현재 VPN ì ‘ê·¼ 사용 설정ë˜ì–´ 있습니다. ë‹¤ìŒ IP 주소 경유로 ì ‘ê·¼ í•  수 있습니다. +message.launch.vm.on.private.network=ì‚¬ì  ì „ìš© 네트워í¬ë¡œ ì¸ìŠ¤í„´ìŠ¤ë¥¼ 시작합니까? +message.lock.account=현재 계정 정보를 ìž ê·¸ì–´ë„ ì¢‹ìŠµë‹ˆê¹Œ? ì´ ê³„ì • ì •ë³´ 모든 사용ìžê°€ í´ë¼ìš°ë“œ ìžì›ì„ 관리할 수 없게 ë©ë‹ˆë‹¤. ê·¸ í›„ë„ ê¸°ì¡´ Zone ìžì›ì—는 ì ‘ê·¼ í•  수 있습니다. +message.migrate.instance.confirm=ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ ì´ì „ 위치는 ë‹¤ìŒ í˜¸ìŠ¤íŠ¸ë¡œ 하시겠습니까? +message.new.user=계정 ì •ë³´ì— ìƒˆë¡œìš´ 사용ìžë¥¼ 추가하기 위해 아래 정보를 지정해 주십시오. +message.no.network.support.configuration.not.true=보안 ê·¸ë£¹ì´ ìœ íš¨í•œ Zoneì´ ì—†ê¸° ë•Œë¬¸ì— ì¶”ê°€ ë„¤íŠ¸ì›Œí¬ ê¸°ëŠ¥ì€ ì—†ìŠµë‹ˆë‹¤. 단계 5로 진행해 주십시오. +message.no.network.support=하ì´í¼ ë°”ì´ì €ë¡œì„œ vSphere를 ì„ íƒí–ˆìœ¼ë‚˜ ì´ í•˜ì´í¼ ë°”ì´ì €ì— 추가 ë„¤íŠ¸ì›Œí¬ ê¸°ëŠ¥ì€ ì—†ìŠµë‹ˆë‹¤. 단계 5로 진행해 주십시오. +message.number.clusters=

í´ëŸ¬ìŠ¤í„°ìˆ˜

+message.number.hosts=

호스트수

+message.number.pods=

Pod수

+message.number.storage=

기본 스토리지 볼륨수

+message.number.zones=

Zone수

+message.remove.vpn.access=ë‹¤ìŒ ì‚¬ìš©ìžì—서 VPN 접근를 삭제하시겠습니까? +message.restart.mgmt.server=새로운 ì„¤ì •ì„ ì‚¬ìš© 하기 위해 관리 서버를 재시작해 주십시오. +message.restart.mgmt.usage.server=새로운 ì„¤ì •ì„ ì‚¬ìš© 하기 위해 관리 서버와 사용 ìƒí™© 측정 서버를 재시작해 주십시오. +message.security.group.usage=(해당하는 보안 ê·¸ë£¹ì„ ëª¨ë‘ ì„ íƒí•˜ë ¤ë©´ Ctrl 키를 누르면서 í´ë¦­í•´ 주십시오) +message.snapshot.schedule=ë‹¤ìŒ ì˜µì…˜ì—서 ì„ íƒí•œ ì •ì±… 기본 ì„¤ì •ì„ ì ìš©í•˜ì—¬ 정기 스냅샷 ìŠ¤ì¼€ì¤„ì„ ì„¤ì • í•  수 있습니다. +message.step.1.continue=실행하려면 템플릿 ë˜ëŠ” ISO를 ì„ íƒí•´ 주십시오. +message.step.1.desc=새로운 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ìš© í…œí”Œë¦¿ì„ ì„ íƒí•´ 주십시오.ISO를 설치 í•  수 있는 공백 í…œí”Œë¦¿ì„ ì„ íƒí•  ìˆ˜ë„ ìžˆìŠµë‹ˆë‹¤. +message.step.2.continue=실행하려면 ì„œë¹„ìŠ¤ì œê³µì„ ì„ íƒí•´ 주십시오. +message.step.2.desc= +message.step.3.continue=실행하려면 디스í¬ì œê³µì„ ì„ íƒí•´ 주십시오. +message.step.3.desc= +message.step.4.continue=실행하려면 네트워í¬ë¥¼ ì ì–´ë„ 한 ê°œ ì´ìƒ ì„ íƒí•´ 주십시오. +message.step.4.desc=ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ê°€ ì ‘ì†í•˜ëŠ” 기본 네트워í¬ë¥¼ ì„ íƒí•´ 주십시오. +message.update.os.preference=현재 호스트 OS 기본 ì„¤ì •ì„ ì„ íƒí•´ 주십시오.ê°™ì€ ê¸°ë³¸ ì„¤ì •ì„ ê°€ì§€ëŠ” 모든 ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ëŠ” 다른 호스트를 ì„ íƒí•˜ê¸° ì „ì— ìš°ì„ ì´ í˜¸ìŠ¤íŠ¸ê°€ 할당할 수 있습니다. +message.update.ssl=ê° ì½˜ì†” 프ë¡ì‹œ ê°€ìƒ ì¸ìŠ¤í„´ìŠ¤ë¡œ ì—…ë°ì´íŠ¸í•˜ëŠ” X.509 기반 새 SSL ì¸ì¦ì„œë¥¼ 전송해 주십시오: +message.virtual.network.desc=계정 ì •ë³´ ì „ìš© ê°€ìƒ ë„¤íŠ¸ì›Œí¬ìž…니다. 브로드ìºìŠ¤íŠ¸ ë„ë©”ì¸ì€ VLAN ë‚´ì— ë°°ì¹˜ë˜ì–´ 공개 네트워í¬ì— 접근는 ëª¨ë‘ ê°€ìƒ ë¼ìš°í„°ì— 해서 루팅 ë©ë‹ˆë‹¤. +message.volume.create.template.confirm=현재 ë””ìŠ¤í¬ ë³¼ë¥¨ í…œí”Œë¦¿ì„ ë§Œë“œì‹œê² ìŠµë‹ˆê¹Œ? 볼륨 í¬ê¸°ì— ë”°ë¼ í…œí”Œë¦¿ ë§Œë“¤ê¸°ì— ëª‡ ë¶„ ì´ìƒ 걸릴 ê°€ëŠ¥ì„±ì´ ìžˆìŠµë‹ˆë‹¤. +message.zone.step.1.desc=Zone ë„¤íŠ¸ì›Œí¬ ëª¨ë¸ì„ ì„ íƒí•´ 주십시오. +message.zone.step.2.desc=새 Zoneì„ ì¶”ê°€í•˜ê¸° 위해 아래 정보를 입력해 주십시오. +message.zone.step.3.desc=새 Pod를 추가하기 위해 아래 정보를 입력해 주십시오. +message.apply.snapshot.policy=현재 스냅샷 정책를 ì—…ë°ì´íŠ¸í–ˆìŠµë‹ˆë‹¤. +message.disable.snapshot.policy=현재 스냅샷 정책를 사용 안 함으로 설정했습니다. +message.action.change.service.warning.for.instance=현재 서비스 ì œê³µì„ ë³€ê²½í•˜ê¸° ì „ì— ì¸ìŠ¤í„´ìŠ¤ë¥¼ 정지해야 합니다. +message.action.change.service.warning.for.router=현재 서비스 ì œê³µì„ ë³€ê²½í•˜ê¸° ì „ì— ë¼ìš°í„°ë¥¼ 정지해야 합니다. +message.action.reset.password.warning=현재 암호를 변경하기 ì „ì— ì¸ìŠ¤í„´ìŠ¤ë¥¼ 정지해야 합니다. +message.action.reset.password.off=ì¸ìŠ¤í„´ìŠ¤ëŠ” 현재 ê¸°ëŠ¥ì„ ì§€ì› í•˜ì§€ 않습니다. + +#Errors +error.login=사용ìžëª…/암호가 기ë¡ê³¼ ì¼ì¹˜í•˜ì§€ 않습니다. +error.menu.select=í•­ëª©ì´ ì„ íƒë˜ì–´ 있지 않기 ë•Œë¬¸ì— ìž‘ì—…ì„ ì‹¤í–‰í•  수 없습니다. +error.mgmt.server.inaccessible=관리 ì„œë²„ì— ì ‘ê·¼ í•  수 없습니다. 다ìŒì— 재실행해 주십시오. +error.session.expired=세션 ìœ íš¨ê¸°ê°„ì´ ëŠì–´ì¡ŒìŠµë‹ˆë‹¤. + +#resizeVolumes +label.resize.new.size=새 í¬ê¸°(GB) +label.action.resize.volume=볼륨 í¬ê¸° 변경 +label.action.resize.volume.processing=볼륨 í¬ê¸° 변경 중... +label.resize.new.offering.id=새로 제공 +label.resize.shrink.ok=변경 완료 diff --git a/client/WEB-INF/classes/resources/messages_pt_BR.properties b/client/WEB-INF/classes/resources/messages_pt_BR.properties index 3bc435b9717..5202f562cba 100644 --- a/client/WEB-INF/classes/resources/messages_pt_BR.properties +++ b/client/WEB-INF/classes/resources/messages_pt_BR.properties @@ -1114,6 +1114,7 @@ label.keep=Manter label.lang.chinese=Chinese (Simplified) label.lang.english=English label.lang.japanese=Japanese +label.lang.korean=Coreano label.lang.spanish=Spanish label.last.disconnected=Last Disconnected label.last.name=Ã\u009altimo Nome @@ -1510,3 +1511,9 @@ error.menu.select=N error.mgmt.server.inaccessible=O servidor de gerenciamento está inacessível. Tente novamente mais tarde. error.session.expired=Sua sessão expirou. error.unresolved.internet.name=Impossível resolver DNS +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK diff --git a/client/WEB-INF/classes/resources/messages_ru_RU.properties b/client/WEB-INF/classes/resources/messages_ru_RU.properties index dd7e7460744..c6631192085 100644 --- a/client/WEB-INF/classes/resources/messages_ru_RU.properties +++ b/client/WEB-INF/classes/resources/messages_ru_RU.properties @@ -1114,6 +1114,7 @@ label.keep=Хранить label.lang.chinese=КитайÑкий (упрощённый) label.lang.english=ÐнглийÑкий label.lang.japanese=ЯпонÑкий +label.lang.korean=корейÑкий label.lang.spanish=ИÑпанÑкий label.last.disconnected=ПоÑледнее Ñоединение label.last.name=ПоÑледнее Ð¸Ð¼Ñ @@ -1510,3 +1511,11 @@ error.menu.select=Ðе удаетÑÑ Ð²Ñ‹Ð¿Ð¾Ð»Ð½Ð¸Ñ‚ÑŒ дейÑтвие из- error.mgmt.server.inaccessible=Сервер ÑƒÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð½ÐµÐ´Ð¾Ñтупна. Попробуйте обратитьÑÑ Ðº нему позже. error.session.expired=Ваша ÑеÑÑÐ¸Ñ Ð±Ñ‹Ð»Ð° завершена error.unresolved.internet.name=Ваше интернет-Ð¸Ð¼Ñ Ð¾Ð¿Ñ€ÐµÐ´ÐµÐ»Ð¸Ñ‚ÑŒ не удалоÑÑŒ + +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK + diff --git a/client/WEB-INF/classes/resources/messages_zh_CN.properties b/client/WEB-INF/classes/resources/messages_zh_CN.properties index 62160d98488..d49cefacff5 100644 --- a/client/WEB-INF/classes/resources/messages_zh_CN.properties +++ b/client/WEB-INF/classes/resources/messages_zh_CN.properties @@ -1116,6 +1116,7 @@ label.keep=ä¿ç•™ label.lang.chinese=简体中文 label.lang.english=英语 label.lang.japanese=日语 +label.lang.korean=韩国语 label.lang.spanish=西ç­ç‰™è¯­ label.last.disconnected=上次断开连接时间 label.last.name=å§“æ° @@ -1511,3 +1512,9 @@ error.mgmt.server.inaccessible=æ— æ³•è®¿é—®ç®¡ç†æœåŠ¡å™¨ã€‚è¯·ç¨åŽå†è¯•。 error.session.expired=您的会è¯å·²è¿‡æœŸã€‚ error.unresolved.internet.name=æ— æ³•è§£æžæ‚¨çš„ Internet å称。 +#resizeVolumes +label.resize.new.size=New Size(GB) +label.action.resize.volume=Resize Volume +label.action.resize.volume.processing=Resizing Volume.... +label.resize.new.offering.id=New Offering +label.resize.shrink.ok=Shrink OK diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml index 50f2455e848..626305b82fa 100644 --- a/client/WEB-INF/web.xml +++ b/client/WEB-INF/web.xml @@ -19,8 +19,23 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> + + + log4jConfigLocation + /WEB-INF/classes/log4j-cloud.xml + + + org.springframework.web.util.Log4jConfigListener + - + + org.springframework.web.context.ContextLoaderListener + + + contextConfigLocation + classpath:applicationContext.xml, classpath:componentContext.xml + + cloudStartupServlet com.cloud.servlet.CloudStartupServlet diff --git a/client/bindir/cloud-setup-management.in b/client/bindir/cloud-setup-management.in index ca1327ae725..aa9a46ba6ba 100755 --- a/client/bindir/cloud-setup-management.in +++ b/client/bindir/cloud-setup-management.in @@ -24,7 +24,7 @@ from cloudutils.globalEnv import globalEnv from cloudutils.serviceConfigServer import cloudManagementConfig from optparse import OptionParser if __name__ == '__main__': - initLoging("/var/log/cloud/setupManagement.log") + initLoging("@MSLOGDIR@/setupManagement.log") glbEnv = globalEnv() parser = OptionParser() diff --git a/client/cloudstack-ui.launch b/client/cloudstack-ui.launch deleted file mode 100644 index 1943d17aebd..00000000000 --- a/client/cloudstack-ui.launch +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/client/pom.xml b/client/pom.xml index 1bbae1f7d08..760923b2a16 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -17,7 +17,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT @@ -30,6 +30,11 @@ cloud-plugin-acl-static-role-based ${project.version} + + org.apache.cloudstack + cloud-plugin-api-limit-account-based + ${project.version} + org.apache.cloudstack cloud-plugin-api-discovery @@ -70,6 +75,11 @@ cloud-plugin-network-elb ${project.version} + + org.apache.cloudstack + cloud-plugin-network-vns + ${project.version} + org.apache.cloudstack cloud-plugin-hypervisor-xen @@ -80,6 +90,16 @@ cloud-plugin-hypervisor-ovm ${project.version} + + org.apache.cloudstack + cloud-plugin-hypervisor-baremetal + ${project.version} + + + org.apache.cloudstack + cloud-plugin-hypervisor-ucs + ${project.version} + org.apache.cloudstack cloud-plugin-hypervisor-kvm @@ -111,12 +131,89 @@ cloud-plugin-host-allocator-random ${project.version} + + org.apache.cloudstack + cloud-mom-rabbitmq + ${project.version} + mysql mysql-connector-java ${cs.mysql.version} runtime + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + org.apache.cloudstack + cloud-framework-rest + ${project.version} + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + + org.apache.cloudstack + cloud-engine-compute + ${project.version} + + + + org.apache.cloudstack + cloud-engine-network + ${project.version} + + + org.apache.cloudstack + cloud-engine-orchestration + ${project.version} + + + org.apache.cloudstack + cloud-engine-schema + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-backup + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-image + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-imagemotion + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-snapshot + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-volume + ${project.version} + install @@ -126,7 +223,7 @@ maven-war-plugin 2.3 - ./WEB-INF/web.xml + ./target/generated-webapp/WEB-INF/web.xml ./target/generated-webapp @@ -141,9 +238,13 @@ 60000 - /client - ${basedir}/WEB-INF/web.xml + -XX:MaxPermSize=512m -Xmx2g + ${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml ${project.build.directory}/${project.build.finalName} + + /client + ${project.build.directory}/utilities/scripts/db/;${project.build.directory}/utilities/scripts/db/db/ + @@ -167,19 +268,28 @@ + + + + + + - - - - - + + + + + + + + + @@ -263,6 +373,22 @@ + + process-nonoss-spring-context + process-resources + + run + + + + test + + + + @@ -282,14 +408,14 @@ org.jasypt jasypt - 1.9.0` + 1.9.0 false ${project.build.directory}/pythonlibs org.jasypt jasypt - 1.8` + 1.8 false ${project.build.directory}/pythonlibs diff --git a/client/tomcatconf/applicationContext.xml.in b/client/tomcatconf/applicationContext.xml.in new file mode 100644 index 00000000000..9503a6c137e --- /dev/null +++ b/client/tomcatconf/applicationContext.xml.in @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.cloudstack.framework + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/tomcatconf/commands.properties.in b/client/tomcatconf/commands.properties.in index 99cb874a55f..f03e8d50adb 100644 --- a/client/tomcatconf/commands.properties.in +++ b/client/tomcatconf/commands.properties.in @@ -60,6 +60,7 @@ rebootVirtualMachine=15 startVirtualMachine=15 stopVirtualMachine=15 resetPasswordForVirtualMachine=15 +resetSSHKeyForVirtualMachine=15 updateVirtualMachine=15 listVirtualMachines=15 getVMPassword=15 @@ -255,6 +256,7 @@ deleteVolume=15 listVolumes=15 extractVolume=15 migrateVolume=15 +resizeVolume=15 #### registration command: FIXME -- this really should be something in management server that #### generates a new key for the user and they just have to @@ -319,6 +321,11 @@ listNetworks=15 restartNetwork=15 updateNetwork=15 +#### nic commands #### +addNicToVirtualMachine=15 +removeNicFromVirtualMachine=15 +updateDefaultNicForVirtualMachine=15 + #### SSH key pair commands registerSSHKeyPair=15 createSSHKeyPair=15 @@ -344,6 +351,11 @@ createFirewallRule=15 deleteFirewallRule=15 listFirewallRules=15 +#### +createEgressFirewallRule=15 +deleteEgressFirewallRule=15 +listEgressFirewallRules=15 + #### hypervisor capabilities commands updateHypervisorCapabilities=1 listHypervisorCapabilities=1 @@ -501,6 +513,12 @@ listNiciraNvpDeviceNetworks=1 # Not implemented (yet) #configureNiciraNvpDevice=1 +#### bigswitch vns commands + +addBigSwitchVnsDevice=1 +deleteBigSwitchVnsDevice=1 +listBigSwitchVnsDevices=1 + #### host simulator commands configureSimulator=1 @@ -508,3 +526,23 @@ configureSimulator=1 #### api discovery commands listApis=15 + +#### API Rate Limit service command + +getApiLimit=15 +resetApiLimit=1 + +#### Region commands +addRegion=1 +updateRegion=1 +removeRegion=1 +listRegions=15 + +### VM Snapshot commands +listVMSnapshot=15 +createVMSnapshot=15 +deleteVMSnapshot=15 +revertToSnapshot=15 + +#### Baremetal commands +addBaremetalHost=1 diff --git a/client/tomcatconf/componentContext.xml.in b/client/tomcatconf/componentContext.xml.in new file mode 100644 index 00000000000..9c92764377c --- /dev/null +++ b/client/tomcatconf/componentContext.xml.in @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/tomcatconf/components.xml.in b/client/tomcatconf/components.xml.in index bb39839c820..c62abe8ff2a 100755 --- a/client/tomcatconf/components.xml.in +++ b/client/tomcatconf/components.xml.in @@ -54,6 +54,11 @@ under the License. true + + 1 + 25 + 50000 + @@ -101,6 +106,7 @@ under the License. + @@ -161,7 +167,62 @@ under the License. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -180,12 +241,15 @@ under the License. + + + @@ -212,6 +276,8 @@ under the License. + + diff --git a/client/tomcatconf/db.properties.in b/client/tomcatconf/db.properties.in index e38366706d4..e159907cb17 100644 --- a/client/tomcatconf/db.properties.in +++ b/client/tomcatconf/db.properties.in @@ -19,6 +19,7 @@ # in which the management server(Tomcat) is running cluster.node.IP=127.0.0.1 cluster.servlet.port=9090 +region.id=1 # CloudStack database settings db.cloud.username=@DBUSER@ @@ -65,6 +66,10 @@ db.usage.maxWait=10000 db.usage.autoReconnect=true # awsapi database settings +db.awsapi.username=@DBUSER@ +db.awsapi.password=@DBPW@ +db.awsapi.host=@DBHOST@ +db.awsapi.port=3306 db.awsapi.name=cloudbridge # Simulator database settings diff --git a/client/tomcatconf/environment.properties.in b/client/tomcatconf/environment.properties.in index 49544a1aed6..f2956cc4abb 100644 --- a/client/tomcatconf/environment.properties.in +++ b/client/tomcatconf/environment.properties.in @@ -19,4 +19,4 @@ paths.script=@COMMONLIBDIR@ mount.parent=@MSMNTDIR@ -cloud-stack-components-specification=@COMPONENTS-SPEC@ +cloud-stack-components-specification=components.xml diff --git a/client/tomcatconf/log4j-cloud.xml.in b/client/tomcatconf/log4j-cloud.xml.in index 02f70998d53..086669376aa 100755 --- a/client/tomcatconf/log4j-cloud.xml.in +++ b/client/tomcatconf/log4j-cloud.xml.in @@ -105,7 +105,7 @@ under the License. - + diff --git a/client/tomcatconf/nonossComponentContext.xml.in b/client/tomcatconf/nonossComponentContext.xml.in new file mode 100644 index 00000000000..89bd49be374 --- /dev/null +++ b/client/tomcatconf/nonossComponentContext.xml.in @@ -0,0 +1,319 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/client/tomcatconf/server-ssl.xml.in b/client/tomcatconf/server-ssl.xml.in index 6e8bf525ec6..5d68f1d3d8b 100755 --- a/client/tomcatconf/server-ssl.xml.in +++ b/client/tomcatconf/server-ssl.xml.in @@ -197,7 +197,6 @@ >>>>>> bcfd64a... CS-15373: Awsapi port change to 7080. maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreType="JKS" diff --git a/client/tomcatconf/tomcat6-nonssl.conf.in b/client/tomcatconf/tomcat6-nonssl.conf.in index c9342e0acae..4a9a70f619e 100644 --- a/client/tomcatconf/tomcat6-nonssl.conf.in +++ b/client/tomcatconf/tomcat6-nonssl.conf.in @@ -41,7 +41,7 @@ CATALINA_TMPDIR="@MSENVIRON@/temp" # Use JAVA_OPTS to set java.library.path for libtcnative.so #JAVA_OPTS="-Djava.library.path=/usr/lib64" -JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote.port=45219 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=@MSLOGDIR@ -XX:PermSize=128M" +JAVA_OPTS="-Djava.awt.headless=true -Dcom.sun.management.jmxremote.port=45219 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=@MSLOGDIR@ -XX:PermSize=512M -XX:MaxPermSize=800m" # What user should run tomcat TOMCAT_USER="@MSUSER@" diff --git a/client/tomcatconf/tomcat6-ssl.conf.in b/client/tomcatconf/tomcat6-ssl.conf.in index ddca44fb33e..84b6d6275bb 100644 --- a/client/tomcatconf/tomcat6-ssl.conf.in +++ b/client/tomcatconf/tomcat6-ssl.conf.in @@ -40,7 +40,7 @@ CATALINA_TMPDIR="@MSENVIRON@/temp" # Use JAVA_OPTS to set java.library.path for libtcnative.so #JAVA_OPTS="-Djava.library.path=/usr/lib64" -JAVA_OPTS="-Djava.awt.headless=true -Djavax.net.ssl.trustStore=/etc/cloud/management/cloudmanagementserver.keystore -Djavax.net.ssl.trustStorePassword=vmops.com -Dcom.sun.management.jmxremote.port=45219 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx1024m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=@MSLOGDIR@ -XX:PermSize=128M" +JAVA_OPTS="-Djava.awt.headless=true -Djavax.net.ssl.trustStore=/etc/cloud/management/cloudmanagementserver.keystore -Djavax.net.ssl.trustStorePassword=vmops.com -Dcom.sun.management.jmxremote.port=45219 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xmx2g -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=@MSLOGDIR@ -XX:MaxPermSize=800m -XX:PermSize=512M" # What user should run tomcat TOMCAT_USER="@MSUSER@" diff --git a/cloud.spec b/cloud.spec deleted file mode 100644 index 9f46dd6fe6c..00000000000 --- a/cloud.spec +++ /dev/null @@ -1,646 +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. - -%define __os_install_post %{nil} -%global debug_package %{nil} - -# DISABLE the post-percentinstall java repacking and line number stripping -# we need to find a way to just disable the java repacking and line number stripping, but not the autodeps - -Name: cloud -Summary: CloudStack IaaS Platform -Version: %{_ver} -#http://fedoraproject.org/wiki/PackageNamingGuidelines#Pre-Release_packages -%if "%{?_prerelease}" != "" -Release: 0.%{_build_number}%{dist}.%{_prerelease} -%else -Release: %{_rel}%{dist} -%endif -License: Apache License 2.0 -Vendor: CloudStack -Packager: CloudStack -Group: System Environment/Libraries -# FIXME do groups for every single one of the subpackages -Source0: %{name}-%{_ver}.tar.bz2 -BuildRoot: %{_tmppath}/%{name}-%{_ver}-%{release}-build - -%if 0%{?fedora} >= 17 -BuildRequires: java-1.7.0-openjdk-devel -%else -BuildRequires: java-1.6.0-openjdk-devel -%endif -BuildRequires: tomcat6 -BuildRequires: ws-commons-util -BuildRequires: jpackage-utils -BuildRequires: gcc -BuildRequires: glibc-devel -BuildRequires: /usr/bin/mkisofs -BuildRequires: MySQL-python - -%description -CloudStack is a highly-scalable elastic, open source, -intelligent IaaS cloud implementation. - -%package utils -Summary: CloudStack utility library -Requires: java >= 1.6.0 -Requires: python -Group: System Environment/Libraries -Obsoletes: vmops-utils < %{version}-%{release} -%description utils -Utility libraries and set of Java classes used -by CloudStack. - -%package client-ui -Summary: CloudStack management server UI -Requires: %{name}-client -Group: System Environment/Libraries -Obsoletes: vmops-client-ui < %{version}-%{release} -%description client-ui -The CloudStack management server is the central point of coordination, -management, and intelligence in CloudStack. This package -is a requirement of the %{name}-client package, which installs the -CloudStack management server. - -%package server -Summary: CloudStack server library -Requires: java >= 1.6.0 -Obsoletes: vmops-server < %{version}-%{release} -Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version}, %{name}-scripts = %{version}, tomcat6-servlet-2.5-api -Group: System Environment/Libraries -%description server -The CloudStack server libraries provide a set of Java classes for CloudStack. - -%package scripts -Summary: CloudStack scripts -# FIXME nuke the archdependency -Requires: python -Requires: bash -Requires: bzip2 -Requires: gzip -Requires: unzip -Requires: /sbin/mount.nfs -Requires: openssh-clients -Requires: nfs-utils -Requires: wget -# there is a fsimage.so in the source code, which adds xen-libs as a dependence, needs to supress it, as rhel doesn't have this pacakge -AutoReqProv: no -Provides: cloud-agent-scripts = %{version}-%{release} -Obsoletes: cloud-agent-scripts < %{version}-%{release} -Group: System Environment/Libraries -%description scripts -This package contains common scripts used by the Agent and Management server - -%package python -Summary: CloudStack Python library -# FIXME nuke the archdependency -Requires: python -Group: System Environment/Libraries -%description python -The CloudStack Python library contains a few Python modules that the -CloudStack uses. - -%package deps -Summary: CloudStack library dependencies -Requires: java >= 1.6.0 -Requires: mysql-connector-java -Obsoletes: vmops-deps < %{version}-%{release} -Group: System Environment/Libraries -%description deps -This package contains a number of third-party dependencies -not shipped by distributions, required to run CloudStack - - -%package core -Summary: CloudStack core library -Requires: java >= 1.6.0 -Requires: %{name}-utils = %{version}, %{name}-deps = %{version} -Group: System Environment/Libraries -Obsoletes: vmops-core < %{version}-%{release} -%description core -The CloudStack core libraries provide a set of Java classes used -in CloudStack. - -%package client -Summary: CloudStack management server -# If GCJ is present, a setPerformanceSomething method fails to load Catalina -Conflicts: java-1.5.0-gcj-devel -Obsoletes: vmops-client < %{version}-%{release} -Obsoletes: cloud-premium < %{version}-%{release} -Requires: java >= 1.6.0 -Requires: %{name}-deps = %{version}, %{name}-utils = %{version}, %{name}-server = %{version} -Requires: %{name}-client-ui = %{version} -Requires: %{name}-setup = %{version} -Requires: %{name}-scripts = %{version} -Requires: %{name}-python = %{version} -Requires: %{name}-aws-api = %{version} -# for consoleproxy -# Requires: %{name}-agent -Requires: tomcat6 -Requires: ws-commons-util -Requires: jpackage-utils -Requires: sudo -Requires: /sbin/service -Requires: /sbin/chkconfig -Requires: /usr/bin/ssh-keygen -Requires: mkisofs -Requires: MySQL-python -Requires: python-paramiko -Requires: ipmitool -Requires: %{name}-utils = %{version} -%if 0%{?fedora} > 14 -Requires: apache-commons-dbcp -Requires: apache-commons-collections -Requires: jakarta-commons-httpclient -Requires: jakarta-taglibs-standard -Requires: mysql-connector-java -%endif - -Group: System Environment/Libraries -%description client -The CloudStack management server is the central point of coordination, -management, and intelligence in CloudStack and installs the management server. - -%package setup -Summary: CloudStack setup tools -Obsoletes: vmops-setup < %{version}-%{release} -Requires: java >= 1.6.0 -Requires: python -Requires: MySQL-python -Requires: %{name}-utils = %{version} -Requires: %{name}-server = %{version} -Requires: %{name}-deps = %{version} -Requires: %{name}-python = %{version} -Group: System Environment/Libraries -%description setup -The CloudStack setup tools let you set up your Management Server and Usage Server. - -%package agent-libs -Summary: CloudStack agent libraries -Requires: java >= 1.6.0 -Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version} -Requires: commons-httpclient -Requires: jakarta-commons-logging -Requires: jpackage-utils -Group: System Environment/Libraries -%description agent-libs -The CloudStack agent libraries are used by the KVM Agent - -%package agent -Summary: CloudStack agent -Obsoletes: vmops-agent < %{version}-%{release} -Obsoletes: vmops-console < %{version}-%{release} -Obsoletes: cloud-console < %{version}-%{release} -Obsoletes: cloud-vnet < %{version}-%{release} -Obsoletes: cloud-premium-agent < %{version}-%{release} -Requires: java >= 1.6.0 -Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version} -Requires: %{name}-agent-libs = %{version} -Requires: %{name}-scripts = %{version} -Requires: python -Requires: %{name}-python = %{version} -Requires: commons-httpclient -Requires: jakarta-commons-logging -Requires: libvirt -Requires: /usr/sbin/libvirtd -Requires: jpackage-utils -Requires: /sbin/service -Requires: /sbin/chkconfig -Requires: jna -Requires: ebtables -Requires: jsvc -Requires: jakarta-commons-daemon -Requires: bridge-utils -Group: System Environment/Libraries - -Requires: kvm - -%if 0%{?fedora} >= 14 && 0%{?fedora} != 16 -Requires: cloud-qemu-kvm -Requires: cloud-qemu-img -%endif - -%if 0%{?rhel} >= 5 -Requires: qemu-img -%endif - -Requires: libcgroup -%if 0%{?fedora} >= 16 -Requires: libcgroup-tools -%endif -Requires: /usr/bin/uuidgen -Requires: rsync -Requires: /bin/egrep -Requires: /sbin/ip -Requires: vconfig -Group: System Environment/Libraries -%description agent -The CloudStack agent is in charge of managing KVM shared computing resources in -a CloudStack-powered cloud. Install this package if this computer -will participate in your cloud. - -%package baremetal-agent -Summary: CloudStack baremetal agent -Requires: PING -Requires: tftp-server -Requires: xinetd -Requires: syslinux -Requires: chkconfig -Requires: dhcp -Group: System Environment/Libraries -%description baremetal-agent -The CloudStack baremetal agent - -%package cli -Summary: CloudStack command line tools -Requires: python -Group: System Environment/Libraries -%description cli -The CloudStack command line tools contain a few Python modules that can call cloudStack APIs. - -%package usage -Summary: CloudStack usage monitor -Obsoletes: vmops-usage < %{version}-%{release} -Requires: java >= 1.6.0 -Requires: %{name}-utils = %{version}, %{name}-core = %{version}, %{name}-deps = %{version}, %{name}-server = %{version} -Requires: %{name}-setup = %{version} -Requires: %{name}-client = %{version} -Requires: jsvc -License: Apache License 2.0 -Group: System Environment/Libraries -%description usage -The CloudStack usage monitor provides usage accounting across the entire cloud for -cloud operators to charge based on usage parameters. - -%package aws-api -Summary: CloudStack CloudBridge -Group: System Environment/Libraries -Requires: java >= 1.6.0 -Requires: tomcat6 -Requires: %{name}-deps = %{version} -%if 0%{?fedora} > 15 -Requires: apache-commons-lang -%endif -%if 0%{?rhel} >= 5 -Requires: jakarta-commons-lang -%endif -Obsoletes: cloud-bridge < %{version}-%{release} -%description aws-api -This is the CloudStack CloudBridge - -%prep - -echo Doing CloudStack build - -%setup -q -n %{name}-%{_ver} - -%build - -# this fixes the /usr/com bug on centos5 -%define _localstatedir /var -%define _sharedstatedir /var/lib -./waf configure --prefix=%{_prefix} --libdir=%{_libdir} --bindir=%{_bindir} --javadir=%{_javadir} --sharedstatedir=%{_sharedstatedir} --localstatedir=%{_localstatedir} --sysconfdir=%{_sysconfdir} --mandir=%{_mandir} --docdir=%{_docdir}/%{name}-%{version} --with-tomcat=%{_datadir}/tomcat6 --tomcat-user=%{name} --fast --build-number=%{_ver}-%{release} --package-version=%{_ver} -./waf build --build-number=%{?_build_number} --package-version=%{_ver} - -%install -[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} -# we put the build number again here, otherwise state checking will cause an almost-full recompile -./waf install --destdir=$RPM_BUILD_ROOT --nochown --build-number=%{?_build_number} -rm $RPM_BUILD_ROOT/etc/rc.d/init.d/cloud-console-proxy -rm $RPM_BUILD_ROOT/usr/bin/cloud-setup-console-proxy -rm $RPM_BUILD_ROOT/usr/libexec/console-proxy-runner -ant deploy-rpm-install -Drpm.install.dir=$RPM_BUILD_ROOT - -%clean - -[ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} - - -%preun client -/sbin/service %{name}-management stop || true -if [ "$1" == "0" ] ; then - /sbin/chkconfig --del %{name}-management > /dev/null 2>&1 || true - /sbin/service %{name}-management stop > /dev/null 2>&1 || true -fi - -%pre aws-api -id %{name} > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ - -r -s /bin/sh -d %{_sharedstatedir}/%{name}/management %{name}|| true - -rm -rf %{_localstatedir}/cache/%{name} -# user harcoded here, also hardcoded on wscript - -%pre client-ui -if [ -d %{_datadir}/%{name}/management/webapps/client/ ]; then - pushd /tmp &>/dev/null - file=cloud-ui-backup-%(date +%%F).tar.bz2 - cp -r %{_datadir}/%{name}/management/webapps/client/ . - tar cjf "$file" client/ - rm -rf client/ - mkdir -p /usr/share/cloud/ui-backup/ - mv "$file" /usr/share/cloud/ui-backup/ - popd &>/dev/null -fi - -%preun usage -if [ "$1" == "0" ] ; then - /sbin/chkconfig --del %{name}-usage > /dev/null 2>&1 || true - /sbin/service %{name}-usage stop > /dev/null 2>&1 || true -fi - -%pre usage -id %{name} > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ - -r -s /bin/sh -d %{_sharedstatedir}/%{name}/management %{name}|| true -# user harcoded here, also hardcoded on wscript - -%post usage -if [ "$1" == "1" ] ; then - /sbin/chkconfig --add %{name}-usage > /dev/null 2>&1 || true - /sbin/chkconfig --level 345 %{name}-usage on > /dev/null 2>&1 || true -else - /sbin/service %{name}-usage condrestart >/dev/null 2>&1 || true -fi - -%preun agent -if [ "$1" == "0" ] ; then - /sbin/chkconfig --del %{name}-agent > /dev/null 2>&1 || true - /sbin/service %{name}-agent stop > /dev/null 2>&1 || true -fi - -%post agent -if [ "$1" == "1" ] ; then - /sbin/chkconfig --add %{name}-agent > /dev/null 2>&1 || true - /sbin/chkconfig --level 345 %{name}-agent on > /dev/null 2>&1 || true -else - /sbin/service %{name}-agent condrestart >/dev/null 2>&1 || true -fi - -if [ -x /etc/sysconfig/modules/kvm.modules ] ; then - /bin/sh /etc/sysconfig/modules/kvm.modules -fi - -%post client - /sbin/chkconfig --add %{name}-management > /dev/null 2>&1 || true - /sbin/chkconfig --level 345 %{name}-management on > /dev/null 2>&1 || true - - root=/usr/share/cloud/bridge - target=/usr/share/cloud/management - - mkdir -p $target/webapps7080 - if [ ! -h $target/webapps7080/awsapi ]; then - ln -sf $root/webapps7080/awsapi $target/webapps7080/awsapi - fi - -# jars=`ls $root/lib` -# for j in $jars -# do -# cp -f $root/lib/$j $root/webapps/awsapi/WEB-INF/lib/ -# done - - confs="cloud-bridge.properties ec2-service.properties" - for c in $confs - do - cp -f $root/conf/$c $target/conf - done - -%files utils -%defattr(0644,root,root,0755) -%{_javadir}/%{name}-utils.jar -%{_javadir}/%{name}-api.jar -%attr(0755,root,root) %{_bindir}/cloud-sccs -%attr(0755,root,root) %{_bindir}/cloud-gitrevs -%doc %{_docdir}/%{name}-%{version}/version-info -%doc LICENSE -%doc NOTICE - -%files client-ui -%defattr(0644,root,root,0755) -%{_datadir}/%{name}/management/webapps/client/* -%doc LICENSE -%doc NOTICE - -%files server -%defattr(0644,root,root,0755) -%{_javadir}/%{name}-server.jar -%{_javadir}/%{name}-ovm.jar -%{_javadir}/%{name}-dp-user-concentrated-pod.jar -%{_javadir}/%{name}-dp-user-dispersing.jar -%{_javadir}/%{name}-host-allocator-random.jar -%{_javadir}/%{name}-plugin-ovs.jar -%{_javadir}/%{name}-storage-allocator-random.jar -%{_javadir}/%{name}-user-authenticator-ldap.jar -%{_javadir}/%{name}-user-authenticator-md5.jar -%{_javadir}/%{name}-user-authenticator-plaintext.jar -%{_javadir}/%{name}-plugin-hypervisor-xen.jar -%{_javadir}/%{name}-plugin-elb.jar -%{_javadir}/%{name}-plugin-nicira-nvp.jar -%config(noreplace) %{_sysconfdir}/%{name}/server/* -%doc LICENSE -%doc NOTICE - -%files scripts -%defattr(-,root,root,-) -%{_libdir}/%{name}/common/scripts/* -# maintain the following list in sync with files scripts -%{_libdir}/%{name}/common/vms/systemvm.zip -%{_libdir}/%{name}/common/vms/systemvm.iso -%doc LICENSE -%doc NOTICE - -%files deps -%defattr(0644,root,root,0755) -%{_javadir}/axiom-*.jar -%{_javadir}/axis2-*.jar -%{_javadir}/antlr*.jar -%{_javadir}/XmlSchema-*.jar -%{_javadir}/json-simple*.jar -%{_javadir}/neethi*.jar -%{_javadir}/woden*.jar -%{_javadir}/xercesImpl*.jar -%{_javadir}/xml-apis*.jar -%{_javadir}/dom4j*.jar -%{_javadir}/javassist*.jar -%{_javadir}/commons-fileupload*.jar -%{_javadir}/commons-codec-1.6.jar -%{_javadir}/commons-dbcp-1.4.jar -%{_javadir}/commons-pool-1.6.jar -%{_javadir}/gson-1.7.1.jar -%{_javadir}/CAStorSDK-*.jar -%{_javadir}/backport-util-concurrent-3.1.jar -%{_javadir}/ehcache-1.5.0.jar -%{_javadir}/httpcore-4.0.jar -%{_javadir}/mail-1.4.jar -%{_javadir}/activation-1.1.jar -%{_javadir}/xapi-5.6.100-1-SNAPSHOT.jar -%{_javadir}/log4j-*.jar -%{_javadir}/apache-log4j-extras-1.1.jar -%{_javadir}/trilead-ssh2-build213-svnkit-1.3-patch.jar -%{_javadir}/cglib-nodep-2.2.2.jar -%{_javadir}/xmlrpc-common-3.*.jar -%{_javadir}/xmlrpc-client-3.*.jar -%{_javadir}/wsdl4j-1.6.2.jar -%{_javadir}/jsch-0.1.42.jar -%{_javadir}/jasypt-1.*.jar -%{_javadir}/commons-configuration-1.8.jar -%{_javadir}/ejb-api-3.0.jar -%{_javadir}/axis2-1.5.1.jar -%{_javadir}/commons-discovery-0.5.jar -%{_javadir}/jstl-1.2.jar -%{_javadir}/javax.persistence-2.0.0.jar -%{_javadir}/bcprov-jdk16-1.45.jar -%doc LICENSE -%doc NOTICE - -%files core -%defattr(0644,root,root,0755) -%{_javadir}/%{name}-core.jar -%doc LICENSE -%doc NOTICE - -%files python -%defattr(0644,root,root,0755) -%{_prefix}/lib*/python*/site-packages/%{name}* -%attr(0755,root,root) %{_bindir}/cloud-external-ipallocator.py -%attr(0755,root,root) %{_initrddir}/cloud-ipallocator -%dir %attr(0770,root,root) %{_localstatedir}/log/%{name}/ipallocator -%doc LICENSE -%doc NOTICE - -%files setup -%attr(0755,root,root) %{_bindir}/%{name}-setup-databases -%attr(0755,root,root) %{_bindir}/%{name}-migrate-databases -%attr(0755,root,root) %{_bindir}/%{name}-set-guest-password -%attr(0755,root,root) %{_bindir}/%{name}-set-guest-sshkey -%attr(0755,root,root) %{_bindir}/%{name}-sysvmadm -%attr(0755,root,root) %{_bindir}/%{name}-setup-encryption -%dir %{_datadir}/%{name}/setup -%{_datadir}/%{name}/setup/*.sql -%{_datadir}/%{name}/setup/db/*.sql -%{_datadir}/%{name}/setup/*.sh -%{_datadir}/%{name}/setup/server-setup.xml -%doc LICENSE -%doc NOTICE - -%files client -%defattr(0644,root,root,0775) -%config(noreplace) %{_sysconfdir}/%{name}/management -%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/%{name}/management/db.properties -%config(noreplace) %{_sysconfdir}/%{name}/management/log4j-%{name}.xml -%config(noreplace) %{_sysconfdir}/%{name}/management/tomcat6.conf -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina/localhost -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina/localhost/client -%config(noreplace) %{_sysconfdir}/sysconfig/%{name}-management -%attr(0755,root,root) %{_initrddir}/%{name}-management -%dir %{_datadir}/%{name}/management -%{_datadir}/%{name}/management/* -%attr(0755,root,root) %{_bindir}/%{name}-setup-management -%attr(0755,root,root) %{_bindir}/%{name}-update-xenserver-licenses -%dir %attr(0770,root,%{name}) %{_sharedstatedir}/%{name}/mnt -%dir %attr(0770,%{name},%{name}) %{_sharedstatedir}/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management/work -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management/temp -%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/agent -%doc LICENSE -%doc NOTICE - -%files agent-libs -%defattr(0644,root,root,0755) -%{_javadir}/%{name}-agent.jar -%{_javadir}/%{name}-plugin-hypervisor-kvm.jar -%{_javadir}/libvirt-0.4.9.jar -%doc LICENSE -%doc NOTICE - -%files agent -%defattr(0644,root,root,0755) -%config(noreplace) %{_sysconfdir}/%{name}/agent/agent.properties -%config(noreplace) %{_sysconfdir}/%{name}/agent/developer.properties.template -%config(noreplace) %{_sysconfdir}/%{name}/agent/environment.properties -%config(noreplace) %{_sysconfdir}/%{name}/agent/log4j-%{name}.xml -%attr(0755,root,root) %{_initrddir}/%{name}-agent -%attr(0755,root,root) %{_bindir}/%{name}-setup-agent -%attr(0755,root,root) %{_bindir}/%{name}-ssh -%dir %attr(0770,root,root) %{_localstatedir}/log/%{name}/agent -%doc LICENSE -%doc NOTICE - -%files cli -%{_bindir}/%{name}-tool -%{_bindir}/cloudvoladm -%{_bindir}/cloud-grab-dependent-library-versions -%config(noreplace) %{_sysconfdir}/%{name}/cli/commands.xml -%dir %{_prefix}/lib*/python*/site-packages/%{name}tool -%{_prefix}/lib*/python*/site-packages/%{name}tool/* -%{_prefix}/lib*/python*/site-packages/%{name}apis.py -%doc LICENSE -%doc NOTICE - -%files baremetal-agent -%attr(0755,root,root) %{_bindir}/cloud-setup-baremetal -%doc LICENSE -%doc NOTICE - -%files usage -%defattr(0644,root,root,0775) -%{_javadir}/%{name}-usage.jar -%attr(0755,root,root) %{_initrddir}/%{name}-usage -%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/usage -%config(noreplace) %{_sysconfdir}/%{name}/usage/usage-components.xml -%config(noreplace) %{_sysconfdir}/%{name}/usage/log4j-%{name}_usage.xml -%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/%{name}/usage/db.properties -%doc LICENSE -%doc NOTICE - -%files aws-api -%defattr(0644,cloud,cloud,0755) -%{_datadir}/cloud/bridge/conf/* -%{_datadir}/cloud/bridge/webapps7080/* -%attr(0644,root,root) %{_datadir}/cloud/setup/bridge/db/* -%attr(0755,root,root) %{_bindir}/cloudstack-aws-api-register -%attr(0755,root,root) %{_bindir}/cloud-setup-bridge -%doc LICENSE -%doc NOTICE - -%changelog -* Mon Nov 19 2012 Satoshi Kobayashi 4.0.1 -- adding dependency bridge-utils to fix a system requirement - -* Fri Sep 14 2012 Marcus Sorensen 4.0.1 -- adding dependency jakarta-commons-daemon to fix "cannot find daemon loader" - -* Thu Aug 16 2012 Marcus Sorensen 4.0 -- rearranged files sections to match currently built files - -* Mon May 3 2010 Manuel Amador (Rudd-O) 1.9.12 -- Bump version for RC4 release - -* Fri Apr 30 2010 Manuel Amador (Rudd-O) 1.9.11 -- Rename to CloudStack everywhere - -* Wed Apr 28 2010 Manuel Amador (Rudd-O) 1.9.10 -- FOSS release - -* Mon Apr 05 2010 Manuel Amador (Rudd-O) 1.9.8 -- RC3 branched - -* Wed Feb 17 2010 Manuel Amador (Rudd-O) 1.9.7 -- First initial broken-up release - - diff --git a/core/pom.xml b/core/pom.xml index 3d6356e561e..0da69529400 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT @@ -31,7 +31,11 @@ cloud-api ${project.version} - + + org.apache.cloudstack + cloud-engine-api + ${project.version} + commons-httpclient commons-httpclient diff --git a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java index 2dc7950b2b7..fc7f08f76a2 100755 --- a/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java +++ b/core/src/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java @@ -69,13 +69,16 @@ import com.cloud.agent.api.routing.SetStaticRouteCommand; import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand; import com.cloud.agent.api.routing.VmDataCommand; import com.cloud.agent.api.routing.VpnUsersCfgCommand; +import com.cloud.agent.api.to.FirewallRuleTO; import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.PortForwardingRuleTO; import com.cloud.agent.api.to.StaticNatRuleTO; import com.cloud.exception.InternalErrorException; import com.cloud.network.HAProxyConfigurator; import com.cloud.network.LoadBalancerConfigurator; +import com.cloud.network.rules.FirewallRule; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.ComponentLifecycle; import com.cloud.utils.component.Manager; import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.OutputInterpreter; @@ -214,11 +217,18 @@ public class VirtualRoutingResource implements Manager { return new SetFirewallRulesAnswer(cmd, false, results); } + FirewallRuleTO[] allrules = cmd.getRules(); + FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); + String[][] rules = cmd.generateFwRules(); final Script command = new Script(_firewallPath, _timeout, s_logger); command.add(routerIp); command.add("-F"); + if (trafficType == FirewallRule.TrafficType.Egress){ + command.add("-E"); + } + StringBuilder sb = new StringBuilder(); String[] fwRules = rules[0]; if (fwRules.length > 0) { @@ -569,7 +579,9 @@ public class VirtualRoutingResource implements Manager { protected synchronized Answer execute (final DhcpEntryCommand cmd) { final Script command = new Script(_dhcpEntryPath, _timeout, s_logger); command.add("-r", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP)); + if (cmd.getVmIpAddress() != null) { command.add("-v", cmd.getVmIpAddress()); + } command.add("-m", cmd.getVmMac()); command.add("-n", cmd.getVmName()); @@ -584,6 +596,11 @@ public class VirtualRoutingResource implements Manager { command.add("-N", cmd.getDefaultDns()); } + if (cmd.getVmIp6Address() != null) { + command.add("-6", cmd.getVmIp6Address()); + command.add("-u", cmd.getDuid()); + } + final String result = command.execute(); return new Answer(cmd, result==null, result); } @@ -720,7 +737,7 @@ public class VirtualRoutingResource implements Manager { args += " -N "; args += cmd.getPeerGuestCidrList(); } - String result = routerProxy("ipsectunnel", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); + String result = routerProxy("ipsectunnel.sh", cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP), args); if (result != null) { return new Answer(cmd, false, "Configure site to site VPN failed due to " + result); } @@ -1152,7 +1169,11 @@ public class VirtualRoutingResource implements Manager { public String getName() { return _name; } - + + @Override + public void setName(String name) { + _name = name; + } @Override @@ -1160,14 +1181,36 @@ public class VirtualRoutingResource implements Manager { return true; } - - @Override public boolean stop() { return true; } + @Override + public int getRunLevel() { + return ComponentLifecycle.RUN_LEVEL_COMPONENT; + } + + public void setRunLevel() { + } + @Override + public void setConfigParams(Map params) { + // TODO Auto-generated method stub + + } + + @Override + public Map getConfigParams() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setRunLevel(int level) { + // TODO Auto-generated method stub + + } } diff --git a/core/src/com/cloud/event/dao/EventDaoImpl.java b/core/src/com/cloud/event/dao/EventDaoImpl.java index abeefbe4ffd..44fbb030dcc 100644 --- a/core/src/com/cloud/event/dao/EventDaoImpl.java +++ b/core/src/com/cloud/event/dao/EventDaoImpl.java @@ -22,6 +22,7 @@ import java.util.List; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.event.Event.State; import com.cloud.event.EventVO; @@ -30,6 +31,7 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +@Component @Local(value={EventDao.class}) public class EventDaoImpl extends GenericDaoBase implements EventDao { public static final Logger s_logger = Logger.getLogger(EventDaoImpl.class.getName()); diff --git a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java b/core/src/com/cloud/event/dao/UsageEventDaoImpl.java index ea93d53e04b..dafc8d4d5ec 100644 --- a/core/src/com/cloud/event/dao/UsageEventDaoImpl.java +++ b/core/src/com/cloud/event/dao/UsageEventDaoImpl.java @@ -25,6 +25,7 @@ import java.util.TimeZone; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.dc.Vlan; import com.cloud.event.EventTypes; @@ -38,6 +39,7 @@ import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.Transaction; +@Component @Local(value={UsageEventDao.class}) public class UsageEventDaoImpl extends GenericDaoBase implements UsageEventDao { public static final Logger s_logger = Logger.getLogger(UsageEventDaoImpl.class.getName()); diff --git a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java b/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java index 56e8e0a734d..b525a2d05d5 100644 --- a/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java +++ b/core/src/com/cloud/hypervisor/HypervisorCapabilitiesVO.java @@ -59,6 +59,9 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities { @Column(name="max_data_volumes_limit") private Integer maxDataVolumesLimit; + @Column(name="max_hosts_per_cluster") + private Integer maxHostsPerCluster; + protected HypervisorCapabilitiesVO() { this.uuid = UUID.randomUUID().toString(); } @@ -157,6 +160,15 @@ public class HypervisorCapabilitiesVO implements HypervisorCapabilities { this.maxDataVolumesLimit = maxDataVolumesLimit; } + @Override + public Integer getMaxHostsPerCluster() { + return maxHostsPerCluster; + } + + public void setMaxHostsPerCluster(Integer maxHostsPerCluster) { + this.maxHostsPerCluster = maxHostsPerCluster; + } + @Override public boolean equals(Object obj) { if (obj instanceof HypervisorCapabilitiesVO) { diff --git a/core/src/com/cloud/hypervisor/hyperv/resource/HypervDummyResourceBase.java b/core/src/com/cloud/hypervisor/hyperv/resource/HypervDummyResourceBase.java index 6e52924db28..a66577a8a99 100644 --- a/core/src/com/cloud/hypervisor/hyperv/resource/HypervDummyResourceBase.java +++ b/core/src/com/cloud/hypervisor/hyperv/resource/HypervDummyResourceBase.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.hypervisor.hyperv.resource; +import java.util.Map; + import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.PingCommand; @@ -61,4 +63,34 @@ public class HypervDummyResourceBase extends ServerResourceBase implements 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/core/src/com/cloud/hypervisor/hyperv/resource/HypervResource.java b/core/src/com/cloud/hypervisor/hyperv/resource/HypervResource.java index ede6301d9c3..0f9b3dd9c6b 100755 --- a/core/src/com/cloud/hypervisor/hyperv/resource/HypervResource.java +++ b/core/src/com/cloud/hypervisor/hyperv/resource/HypervResource.java @@ -945,4 +945,34 @@ public class HypervResource extends ServerResourceBase implements ServerResource // TODO Auto-generated method stub 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/core/src/com/cloud/network/resource/TrafficSentinelResource.java b/core/src/com/cloud/network/resource/TrafficSentinelResource.java index a13e080b7e4..7edb67bf068 100644 --- a/core/src/com/cloud/network/resource/TrafficSentinelResource.java +++ b/core/src/com/cloud/network/resource/TrafficSentinelResource.java @@ -108,7 +108,7 @@ public class TrafficSentinelResource implements ServerResource { cmd.setPod(""); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(""); - cmd.setVersion(""); + cmd.setVersion(TrafficSentinelResource.class.getPackage().getImplementationVersion()); cmd.setGuid(_guid); return new StartupCommand[]{cmd}; } @@ -313,4 +313,34 @@ public class TrafficSentinelResource implements ServerResource { DateFormat dfDate = new SimpleDateFormat("yyyyMMdd HH:mm:ss"); return dfDate.format(date); } + + @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 + + } } \ No newline at end of file diff --git a/core/src/com/cloud/resource/storage/PrimaryStorageHeadResource.java b/core/src/com/cloud/resource/storage/PrimaryStorageHeadResource.java deleted file mode 100644 index 65297a39b96..00000000000 --- a/core/src/com/cloud/resource/storage/PrimaryStorageHeadResource.java +++ /dev/null @@ -1,52 +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.resource.storage; - -import com.cloud.agent.api.storage.CreateAnswer; -import com.cloud.agent.api.storage.CreateCommand; -import com.cloud.agent.api.storage.DestroyAnswer; -import com.cloud.agent.api.storage.DestroyCommand; -import com.cloud.agent.api.storage.DownloadAnswer; -import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; -import com.cloud.resource.ServerResource; - -/** - * a primary storage. - * - */ -public interface PrimaryStorageHeadResource extends ServerResource { - /** - * Downloads the template to the primary storage. - * @param cmd - * @return - */ - DownloadAnswer execute(PrimaryStorageDownloadCommand cmd); - - /** - * Creates volumes for the VM. - * @param cmd - * @return - */ - CreateAnswer execute(CreateCommand cmd); - - /** - * Destroys volumes for the VM. - * @param cmd - * @return - */ - DestroyAnswer execute(DestroyCommand cmd); -} diff --git a/core/src/com/cloud/storage/JavaStorageLayer.java b/core/src/com/cloud/storage/JavaStorageLayer.java index c4aa74a25ce..525d42997e1 100644 --- a/core/src/com/cloud/storage/JavaStorageLayer.java +++ b/core/src/com/cloud/storage/JavaStorageLayer.java @@ -250,6 +250,36 @@ public class JavaStorageLayer implements StorageLayer { File file = new File(path); return file.getTotalSpace() - file.getFreeSpace(); } + + @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/core/src/com/cloud/storage/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java index e5e36504ea6..78b96ec9779 100644 --- a/core/src/com/cloud/storage/SnapshotVO.java +++ b/core/src/com/cloud/storage/SnapshotVO.java @@ -16,23 +16,13 @@ // under the License. package com.cloud.storage; -import java.util.Date; -import java.util.UUID; - -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.EnumType; -import javax.persistence.Enumerated; -import javax.persistence.GeneratedValue; -import javax.persistence.GenerationType; -import javax.persistence.Id; -import javax.persistence.Table; - -import org.apache.cloudstack.api.Identity; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.utils.db.GenericDao; import com.google.gson.annotations.Expose; -import org.apache.cloudstack.api.InternalIdentity; + +import javax.persistence.*; +import java.util.Date; +import java.util.UUID; @Entity @Table(name="snapshots") @@ -41,7 +31,7 @@ public class SnapshotVO implements Snapshot { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) @Column(name="id") - private long id = -1; + private long id; @Column(name="data_center_id") long dataCenterId; @@ -69,7 +59,7 @@ public class SnapshotVO implements Snapshot { @Expose @Column(name="status", updatable = true, nullable=false) @Enumerated(value=EnumType.STRING) - private Status status; + private State state; @Column(name="snapshot_type") short snapshotType; @@ -113,7 +103,7 @@ public class SnapshotVO implements Snapshot { String uuid; public SnapshotVO() { - this.uuid = UUID.randomUUID().toString(); + this.uuid = UUID.randomUUID().toString(); } public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) { @@ -127,11 +117,11 @@ public class SnapshotVO implements Snapshot { this.snapshotType = snapshotType; this.typeDescription = typeDescription; this.size = size; - this.status = Status.Creating; + this.state = State.Allocated; this.prevSnapshotId = 0; this.hypervisorType = hypervisorType; this.version = "2.2"; - this.uuid = UUID.randomUUID().toString(); + this.uuid = UUID.randomUUID().toString(); } @Override @@ -148,6 +138,7 @@ public class SnapshotVO implements Snapshot { return accountId; } + @Override public long getDomainId() { return domainId; } @@ -171,7 +162,7 @@ public class SnapshotVO implements Snapshot { } public void setPath(String path) { - this.path = path; + this.path = path; } @Override @@ -184,7 +175,7 @@ public class SnapshotVO implements Snapshot { } @Override - public Type getType() { + public Type getRecurringType() { if (snapshotType < 0 || snapshotType >= Type.values().length) { return null; } @@ -209,7 +200,7 @@ public class SnapshotVO implements Snapshot { @Override public HypervisorType getHypervisorType() { - return hypervisorType; + return hypervisorType; } public void setSnapshotType(short snapshotType) { @@ -243,6 +234,7 @@ public class SnapshotVO implements Snapshot { this.version = version; } + @Override public Date getCreated() { return created; } @@ -251,30 +243,31 @@ public class SnapshotVO implements Snapshot { return removed; } - @Override - public Status getStatus() { - return status; - } + @Override + public State getState() { + return state; + } - public void setStatus(Status status) { - this.status = status; - } - public String getBackupSnapshotId(){ - return backupSnapshotId; - } + public void setState(State state) { + this.state = state; + } + + public String getBackupSnapshotId(){ + return backupSnapshotId; + } public long getPrevSnapshotId(){ - return prevSnapshotId; - } + return prevSnapshotId; + } - public void setBackupSnapshotId(String backUpSnapshotId){ - this.backupSnapshotId = backUpSnapshotId; - } + public void setBackupSnapshotId(String backUpSnapshotId){ + this.backupSnapshotId = backUpSnapshotId; + } - public void setPrevSnapshotId(long prevSnapshotId){ - this.prevSnapshotId = prevSnapshotId; - } + public void setPrevSnapshotId(long prevSnapshotId){ + this.prevSnapshotId = prevSnapshotId; + } public static Type getSnapshotType(String snapshotType) { for ( Type type : Type.values()) { @@ -287,11 +280,11 @@ public class SnapshotVO implements Snapshot { @Override public String getUuid() { - return this.uuid; + return this.uuid; } public void setUuid(String uuid) { - this.uuid = uuid; + this.uuid = uuid; } public Long getS3Id() { diff --git a/core/src/com/cloud/storage/StoragePoolDiscoverer.java b/core/src/com/cloud/storage/StoragePoolDiscoverer.java index 816e899f941..c7dd362a5c3 100644 --- a/core/src/com/cloud/storage/StoragePoolDiscoverer.java +++ b/core/src/com/cloud/storage/StoragePoolDiscoverer.java @@ -19,6 +19,8 @@ package com.cloud.storage; import java.net.URI; import java.util.Map; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; + import com.cloud.exception.DiscoveryException; import com.cloud.utils.component.Adapter; diff --git a/core/src/com/cloud/storage/VMTemplateHostVO.java b/core/src/com/cloud/storage/VMTemplateHostVO.java index 9eae1a00303..b8dfc41d51b 100755 --- a/core/src/com/cloud/storage/VMTemplateHostVO.java +++ b/core/src/com/cloud/storage/VMTemplateHostVO.java @@ -29,8 +29,10 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + import com.cloud.utils.db.GenericDaoBase; -import org.apache.cloudstack.api.InternalIdentity; /** * Join table for storage hosts and templates @@ -38,7 +40,7 @@ import org.apache.cloudstack.api.InternalIdentity; */ @Entity @Table(name="template_host_ref") -public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc { +public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc, DataObjectInStore { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) Long id; @@ -90,6 +92,18 @@ public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc { @Column(name="destroyed") boolean destroyed = false; + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + ObjectInDataStoreStateMachine.State state; + + @Override public String getInstallPath() { return installPath; @@ -162,6 +176,7 @@ public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc { super(); this.hostId = hostId; this.templateId = templateId; + this.state = ObjectInDataStoreStateMachine.State.Allocated; } public VMTemplateHostVO(long hostId, long templateId, Date lastUpdated, @@ -282,4 +297,26 @@ public class VMTemplateHostVO implements VMTemplateStorageResourceAssoc { return new StringBuilder("TmplHost[").append(id).append("-").append(templateId).append("-").append(hostId).append(installPath).append("]").toString(); } + @Override + public ObjectInDataStoreStateMachine.State getState() { + // TODO Auto-generated method stub + return this.state; + } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public Date getUpdated() { + return updated; + } + } diff --git a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java b/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java index 32c9dd2ece5..9b761764359 100644 --- a/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java +++ b/core/src/com/cloud/storage/VMTemplateStoragePoolVO.java @@ -29,8 +29,11 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; + import com.cloud.utils.db.GenericDaoBase; -import org.apache.cloudstack.api.InternalIdentity; /** * Join table for storage pools and templates @@ -38,7 +41,7 @@ import org.apache.cloudstack.api.InternalIdentity; */ @Entity @Table(name="template_spool_ref") -public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc { +public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc, DataObjectInStore { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) long id; @@ -69,7 +72,18 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc { @Column (name="template_size") long templateSize; @Column (name="marked_for_gc") boolean markedForGC; - + + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + ObjectInDataStoreStateMachine.State state; + @Override public String getInstallPath() { return installPath; @@ -148,6 +162,7 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc { this.poolId = poolId; this.templateId = templateId; this.downloadState = Status.NOT_DOWNLOADED; + this.state = ObjectInDataStoreStateMachine.State.Allocated; this.markedForGC = false; } @@ -235,4 +250,26 @@ public class VMTemplateStoragePoolVO implements VMTemplateStorageResourceAssoc { return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString(); } + @Override + public State getState() { + return this.state; + } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public Date getUpdated() { + return updated; + } + + } diff --git a/core/src/com/cloud/storage/VMTemplateVO.java b/core/src/com/cloud/storage/VMTemplateVO.java index fcfdd0067e1..e643d75bf1e 100755 --- a/core/src/com/cloud/storage/VMTemplateVO.java +++ b/core/src/com/cloud/storage/VMTemplateVO.java @@ -31,17 +31,18 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Transient; -import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState; + import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.TemplateType; import com.cloud.template.VirtualMachineTemplate; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.utils.fsm.StateObject; @Entity @Table(name="vm_template") -public class VMTemplateVO implements VirtualMachineTemplate { +public class VMTemplateVO implements VirtualMachineTemplate, StateObject { @Id @TableGenerator(name="vm_template_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_template_seq", allocationSize=1) @Column(name="id", nullable = false) @@ -127,6 +128,22 @@ public class VMTemplateVO implements VirtualMachineTemplate { @Column(name="enable_sshkey") private boolean enableSshKey; + + @Column(name = "image_data_store_id") + private long imageDataStoreId; + + @Column(name = "size") + private Long size; + + @Column(name = "state") + private TemplateState state; + + @Column(name="update_count", updatable = true) + protected long updatedCount; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; @Transient Map details; @@ -140,8 +157,9 @@ public class VMTemplateVO implements VirtualMachineTemplate { this.uniqueName = uniqueName; } - protected VMTemplateVO() { + public VMTemplateVO() { this.uuid = UUID.randomUUID().toString(); + this.state = TemplateState.Allocated; } /** @@ -150,12 +168,14 @@ public class VMTemplateVO implements VirtualMachineTemplate { public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, Map details) { this(id, generateUniqueName(id, accountId, name), name, format, isPublic, featured, isExtractable, type, url, null, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details); this.uuid = UUID.randomUUID().toString(); + this.state = TemplateState.Allocated; } public VMTemplateVO(long id, String name, ImageFormat format, boolean isPublic, boolean featured, boolean isExtractable, TemplateType type, String url, boolean requiresHvm, int bits, long accountId, String cksum, String displayText, boolean enablePassword, long guestOSId, boolean bootable, HypervisorType hyperType, String templateTag, Map details, boolean sshKeyEnabled) { this(id, name, format, isPublic, featured, isExtractable, type, url, requiresHvm, bits, accountId, cksum, displayText, enablePassword, guestOSId, bootable, hyperType, details); this.templateTag = templateTag; this.uuid = UUID.randomUUID().toString(); + this.state = TemplateState.Allocated; this.enableSshKey = sshKeyEnabled; } @@ -179,6 +199,7 @@ public class VMTemplateVO implements VirtualMachineTemplate { this.bootable = bootable; this.hypervisorType = hyperType; this.uuid = UUID.randomUUID().toString(); + this.state = TemplateState.Allocated; } // Has an extra attribute - isExtractable @@ -468,5 +489,46 @@ public class VMTemplateVO implements VirtualMachineTemplate { public void setEnableSshKey(boolean enable) { enableSshKey = enable; } + + public Long getImageDataStoreId() { + return this.imageDataStoreId; + } + + public void setImageDataStoreId(long dataStoreId) { + this.imageDataStoreId = dataStoreId; + } + + public void setSize(Long size) { + this.size = size; + } + + public Long getSize() { + return this.size; + } + + public TemplateState getState() { + return this.state; + } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public Date getUpdated() { + return updated; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + } diff --git a/core/src/com/cloud/storage/VolumeHostVO.java b/core/src/com/cloud/storage/VolumeHostVO.java index f4fc7abc4ee..40bae499122 100755 --- a/core/src/com/cloud/storage/VolumeHostVO.java +++ b/core/src/com/cloud/storage/VolumeHostVO.java @@ -29,11 +29,13 @@ import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -//import com.cloud.storage.VMVolumeStorageResourceAssoc.Status; +import org.apache.cloudstack.api.InternalIdentity; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.utils.db.GenericDaoBase; -import org.apache.cloudstack.api.InternalIdentity; /** * Join table for storage hosts and volumes @@ -41,7 +43,7 @@ import org.apache.cloudstack.api.InternalIdentity; */ @Entity @Table(name="volume_host_ref") -public class VolumeHostVO implements InternalIdentity { +public class VolumeHostVO implements InternalIdentity, DataObjectInStore { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) Long id; @@ -99,6 +101,16 @@ public class VolumeHostVO implements InternalIdentity { @Column(name="destroyed") boolean destroyed = false; + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + ObjectInDataStoreStateMachine.State state; public String getInstallPath() { return installPath; @@ -187,6 +199,7 @@ public class VolumeHostVO implements InternalIdentity { super(); this.hostId = hostId; this.volumeId = volumeId; + this.state = ObjectInDataStoreStateMachine.State.Allocated; } public VolumeHostVO(long hostId, long volumeId, long zoneId, Date lastUpdated, @@ -308,5 +321,27 @@ public class VolumeHostVO implements InternalIdentity { public String toString() { return new StringBuilder("VolumeHost[").append(id).append("-").append(volumeId).append("-").append(hostId).append(installPath).append("]").toString(); } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public Date getUpdated() { + return updated; + } + + @Override + public ObjectInDataStoreStateMachine.State getState() { + // TODO Auto-generated method stub + return this.state; + } } diff --git a/core/src/com/cloud/storage/VolumeVO.java b/core/src/com/cloud/storage/VolumeVO.java index aac82df80ce..a287c26348b 100755 --- a/core/src/com/cloud/storage/VolumeVO.java +++ b/core/src/com/cloud/storage/VolumeVO.java @@ -30,12 +30,11 @@ import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; +import javax.persistence.Transient; -import org.apache.cloudstack.api.Identity; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.NumbersUtil; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name = "volumes") @@ -68,7 +67,7 @@ public class VolumeVO implements Volume { Long deviceId = null; @Column(name = "size") - long size; + Long size; @Column(name = "folder") String folder; @@ -132,6 +131,10 @@ public class VolumeVO implements Volume { @Column(name = "uuid") String uuid; + @Transient + // @Column(name="reservation") + String reservationId; + // Real Constructor public VolumeVO(Type type, String name, long dcId, long domainId, long accountId, long diskOfferingId, long size) { this.volumeType = type; @@ -252,11 +255,11 @@ public class VolumeVO implements Volume { } @Override - public long getSize() { + public Long getSize() { return size; } - public void setSize(long size) { + public void setSize(Long size) { this.size = size; } @@ -430,6 +433,16 @@ public class VolumeVO implements Volume { } } + @Override + public String getReservationId() { + return this.reservationId; + } + + @Override + public void setReservationId(String reserv) { + this.reservationId = reserv; + } + @Override public String getUuid() { return this.uuid; diff --git a/core/src/com/cloud/storage/resource/CifsSecondaryStorageResource.java b/core/src/com/cloud/storage/resource/CifsSecondaryStorageResource.java index c606fca1fbf..285005a1c3a 100755 --- a/core/src/com/cloud/storage/resource/CifsSecondaryStorageResource.java +++ b/core/src/com/cloud/storage/resource/CifsSecondaryStorageResource.java @@ -40,8 +40,8 @@ import com.cloud.agent.api.PingStorageCommand; import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.SecStorageFirewallCfgCommand; -import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig; +import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.SecStorageVMSetupCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupStorageCommand; @@ -54,7 +54,6 @@ import com.cloud.agent.api.storage.UploadCommand; import com.cloud.agent.api.storage.ssCommand; import com.cloud.host.Host; import com.cloud.host.Host.Type; -import com.cloud.resource.ServerResource; import com.cloud.resource.ServerResourceBase; import com.cloud.storage.Storage; import com.cloud.storage.Storage.StoragePoolType; @@ -65,7 +64,7 @@ import com.cloud.storage.template.TemplateInfo; import com.cloud.storage.template.UploadManager; import com.cloud.storage.template.UploadManagerImpl; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.ComponentContext; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.utils.net.NfsUtils; @@ -81,10 +80,10 @@ import com.cloud.utils.script.Script; public class CifsSecondaryStorageResource extends ServerResourceBase implements SecondaryStorageResource { private static final Logger s_logger = Logger.getLogger(CifsSecondaryStorageResource.class); int _timeout; - + String _instance; String _parent; - + String _dc; String _pod; String _guid; @@ -94,27 +93,27 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements StorageLayer _storage; boolean _inSystemVM = false; boolean _sslCopy = false; - + Random _rand = new Random(System.currentTimeMillis()); - + DownloadManager _dlMgr; UploadManager _upldMgr; - private String _configSslScr; - private String _configAuthScr; - private String _configIpFirewallScr; - private String _publicIp; - private String _hostname; - private String _localgw; - private String _eth1mask; - private String _eth1ip; - + private String _configSslScr; + private String _configAuthScr; + private String _configIpFirewallScr; + private String _publicIp; + private String _hostname; + private String _localgw; + private String _eth1mask; + private String _eth1ip; + @Override public void disconnected() { if (_parent != null && !_inSystemVM) { Script script = new Script(!_inSystemVM, "umount", _timeout, s_logger); script.add(_parent); script.execute(); - + File file = new File(_parent); file.delete(); } @@ -133,104 +132,104 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements } else if(cmd instanceof DeleteEntityDownloadURLCommand){ return _upldMgr.handleDeleteEntityDownloadURLCommand((DeleteEntityDownloadURLCommand)cmd); } else if (cmd instanceof GetStorageStatsCommand) { - return execute((GetStorageStatsCommand)cmd); + return execute((GetStorageStatsCommand)cmd); } else if (cmd instanceof CheckHealthCommand) { return new CheckHealthAnswer((CheckHealthCommand)cmd, true); } else if (cmd instanceof DeleteTemplateCommand) { - return execute((DeleteTemplateCommand) cmd); + return execute((DeleteTemplateCommand) cmd); } else if (cmd instanceof ReadyCommand) { return new ReadyAnswer((ReadyCommand)cmd); } else if (cmd instanceof SecStorageFirewallCfgCommand){ - return execute((SecStorageFirewallCfgCommand)cmd); + return execute((SecStorageFirewallCfgCommand)cmd); } else if (cmd instanceof SecStorageVMSetupCommand){ - return execute((SecStorageVMSetupCommand)cmd); + return execute((SecStorageVMSetupCommand)cmd); } else if (cmd instanceof SecStorageSetupCommand){ return new Answer(cmd, true, "success"); } else { return Answer.createUnsupportedCommandAnswer(cmd); } } - + private Answer execute(SecStorageVMSetupCommand cmd) { - if (!_inSystemVM){ - return new Answer(cmd, true, null); - } - boolean success = true; - StringBuilder result = new StringBuilder(); - for (String cidr: cmd.getAllowedInternalSites()) { - String tmpresult = allowOutgoingOnPrivate(cidr); - if (tmpresult != null) { - result.append(", ").append(tmpresult); - success = false; - } - } - if (success) { - if (cmd.getCopyPassword() != null && cmd.getCopyUserName() != null) { - String tmpresult = configureAuth(cmd.getCopyUserName(), cmd.getCopyPassword()); - if (tmpresult != null) { - result.append("Failed to configure auth for copy ").append(tmpresult); - success = false; - } - } - } - return new Answer(cmd, success, result.toString()); + if (!_inSystemVM){ + return new Answer(cmd, true, null); + } + boolean success = true; + StringBuilder result = new StringBuilder(); + for (String cidr: cmd.getAllowedInternalSites()) { + String tmpresult = allowOutgoingOnPrivate(cidr); + if (tmpresult != null) { + result.append(", ").append(tmpresult); + success = false; + } + } + if (success) { + if (cmd.getCopyPassword() != null && cmd.getCopyUserName() != null) { + String tmpresult = configureAuth(cmd.getCopyUserName(), cmd.getCopyPassword()); + if (tmpresult != null) { + result.append("Failed to configure auth for copy ").append(tmpresult); + success = false; + } + } + } + return new Answer(cmd, success, result.toString()); + + } - } - private String allowOutgoingOnPrivate(String destCidr) { - - Script command = new Script("/bin/bash", s_logger); - String intf = "eth1"; - command.add("-c"); - command.add("iptables -I OUTPUT -o " + intf + " -d " + destCidr + " -p tcp -m state --state NEW -m tcp -j ACCEPT"); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in allowing outgoing to " + destCidr + ", err=" + result ); - return "Error in allowing outgoing to " + destCidr + ", err=" + result; - } - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr); - return null; - } - - + Script command = new Script("/bin/bash", s_logger); + String intf = "eth1"; + command.add("-c"); + command.add("iptables -I OUTPUT -o " + intf + " -d " + destCidr + " -p tcp -m state --state NEW -m tcp -j ACCEPT"); - private Answer execute(SecStorageFirewallCfgCommand cmd) { - if (!_inSystemVM){ - return new Answer(cmd, true, null); - } + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in allowing outgoing to " + destCidr + ", err=" + result ); + return "Error in allowing outgoing to " + destCidr + ", err=" + result; + } + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr); + return null; + } - List ipList = new ArrayList(); - - for (PortConfig pCfg:cmd.getPortConfigs()){ - if (pCfg.isAdd()) { - ipList.add(pCfg.getSourceIp()); - } - } - boolean success = true; - String result; - result = configureIpFirewall(ipList); - if (result !=null) - success = false; - return new Answer(cmd, success, result); - } - protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { + private Answer execute(SecStorageFirewallCfgCommand cmd) { + if (!_inSystemVM){ + return new Answer(cmd, true, null); + } + + List ipList = new ArrayList(); + + for (PortConfig pCfg:cmd.getPortConfigs()){ + if (pCfg.isAdd()) { + ipList.add(pCfg.getSourceIp()); + } + } + boolean success = true; + String result; + result = configureIpFirewall(ipList); + if (result !=null) + success = false; + + return new Answer(cmd, success, result); + } + + protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { final long usedSize = getUsedSize(); final long totalSize = getTotalSize(); if (usedSize == -1 || totalSize == -1) { - return new GetStorageStatsAnswer(cmd, "Unable to get storage stats"); + return new GetStorageStatsAnswer(cmd, "Unable to get storage stats"); } else { - return new GetStorageStatsAnswer(cmd, totalSize, usedSize) ; + return new GetStorageStatsAnswer(cmd, totalSize, usedSize) ; } } - + @Override public String getRootDir(ssCommand cmd){ return null; } - + protected Answer execute(final DeleteTemplateCommand cmd) { String relativeTemplatePath = cmd.getTemplatePath(); String parent = _parent; @@ -278,15 +277,15 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements } return new Answer(cmd, true, null); } - + protected long getUsedSize() { - return _storage.getUsedSpace(_parent); + return _storage.getUsedSpace(_parent); } - + protected long getTotalSize() { - return _storage.getTotalSpace(_parent); + return _storage.getTotalSpace(_parent); } - + protected long convertFilesystemSize(final String size) { if (size == null || size.isEmpty()) { return -1; @@ -305,25 +304,25 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements return (long)(Double.parseDouble(size.substring(0, size.length() - 1)) * multiplier); } - + @Override public Type getType() { return Host.Type.SecondaryStorage; } - + @Override public PingCommand getCurrentStatus(final long id) { return new PingStorageCommand(Host.Type.Storage, id, new HashMap()); } - + @Override public boolean configure(String name, Map params) throws ConfigurationException { - _eth1ip = (String)params.get("eth1ip"); + _eth1ip = (String)params.get("eth1ip"); if (_eth1ip != null) { //can only happen inside service vm - params.put("private.network.device", "eth1"); + params.put("private.network.device", "eth1"); } else { - s_logger.warn("Wait, what's going on? eth1ip is null!!"); + s_logger.warn("Wait, what's going on? eth1ip is null!!"); } String eth2ip = (String) params.get("eth2ip"); if (eth2ip != null) { @@ -331,23 +330,23 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements } _publicIp = (String) params.get("eth2ip"); _hostname = (String) params.get("name"); - + super.configure(name, params); - + _params = params; String value = (String)params.get("scripts.timeout"); _timeout = NumbersUtil.parseInt(value, 1440) * 1000; - + _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { value = (String)params.get(StorageLayer.ClassConfigKey); if (value == null) { value = "com.cloud.storage.JavaStorageLayer"; } - + try { Class clazz = Class.forName(value); - _storage = (StorageLayer)ComponentLocator.inject(clazz); + _storage = (StorageLayer)ComponentContext.inject(clazz); _storage.configure("StorageLayer", params); } catch (ClassNotFoundException e) { throw new ConfigurationException("Unable to find class " + value); @@ -362,30 +361,30 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements if (_configSslScr != null) { s_logger.info("config_auth.sh found in " + _configAuthScr); } - + _configIpFirewallScr = Script.findScript(getDefaultScriptsDir(), "ipfirewall.sh"); if (_configIpFirewallScr != null) { s_logger.info("_configIpFirewallScr found in " + _configIpFirewallScr); } - + _guid = (String)params.get("guid"); if (_guid == null) { throw new ConfigurationException("Unable to find the guid"); } - + _dc = (String)params.get("zone"); if (_dc == null) { throw new ConfigurationException("Unable to find the zone"); } _pod = (String)params.get("pod"); - + _instance = (String)params.get("instance"); _mountParent = (String)params.get("mount.parent"); if (_mountParent == null) { _mountParent = File.separator + "mnt"; } - + if (_instance != null) { _mountParent = _mountParent + File.separator + _instance; } @@ -394,63 +393,63 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements if (_nfsPath == null) { throw new ConfigurationException("Unable to find mount.path"); } - - + + String inSystemVM = (String)params.get("secondary.storage.vm"); if (inSystemVM == null || "true".equalsIgnoreCase(inSystemVM)) { - _inSystemVM = true; + _inSystemVM = true; _localgw = (String)params.get("localgw"); if (_localgw != null) { //can only happen inside service vm - _eth1mask = (String)params.get("eth1mask"); - String internalDns1 = (String)params.get("dns1"); - String internalDns2 = (String)params.get("dns2"); + _eth1mask = (String)params.get("eth1mask"); + String internalDns1 = (String)params.get("dns1"); + String internalDns2 = (String)params.get("dns2"); - if (internalDns1 == null) { - s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage"); - } else { - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1); - } - - String mgmtHost = (String)params.get("host"); - String nfsHost = NfsUtils.getHostPart(_nfsPath); - if (nfsHost == null) { - s_logger.error("Invalid or corrupt nfs url " + _nfsPath); - throw new CloudRuntimeException("Unable to determine host part of nfs path"); - } - try { - InetAddress nfsHostAddr = InetAddress.getByName(nfsHost); - nfsHost = nfsHostAddr.getHostAddress(); - } catch (UnknownHostException uhe) { - s_logger.error("Unable to resolve nfs host " + nfsHost); - throw new CloudRuntimeException("Unable to resolve nfs host to an ip address " + nfsHost); - } - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, nfsHost); - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost); - if (internalDns2 != null) { - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2); - } + if (internalDns1 == null) { + s_logger.warn("No DNS entry found during configuration of NfsSecondaryStorage"); + } else { + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns1); + } + + String mgmtHost = (String)params.get("host"); + String nfsHost = NfsUtils.getHostPart(_nfsPath); + if (nfsHost == null) { + s_logger.error("Invalid or corrupt nfs url " + _nfsPath); + throw new CloudRuntimeException("Unable to determine host part of nfs path"); + } + try { + InetAddress nfsHostAddr = InetAddress.getByName(nfsHost); + nfsHost = nfsHostAddr.getHostAddress(); + } catch (UnknownHostException uhe) { + s_logger.error("Unable to resolve nfs host " + nfsHost); + throw new CloudRuntimeException("Unable to resolve nfs host to an ip address " + nfsHost); + } + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, nfsHost); + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, mgmtHost); + if (internalDns2 != null) { + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, internalDns2); + } } String useSsl = (String)params.get("sslcopy"); if (useSsl != null) { - _sslCopy = Boolean.parseBoolean(useSsl); - if (_sslCopy) { - configureSSL(); - } + _sslCopy = Boolean.parseBoolean(useSsl); + if (_sslCopy) { + configureSSL(); + } } - startAdditionalServices(); - _params.put("install.numthreads", "50"); - _params.put("secondary.storage.vm", "true"); + startAdditionalServices(); + _params.put("install.numthreads", "50"); + _params.put("secondary.storage.vm", "true"); } _parent = mount(_nfsPath, _mountParent); if (_parent == null) { throw new ConfigurationException("Unable to create mount point"); } - - + + s_logger.info("Mount point established at " + _parent); - + try { _params.put("template.parent", _parent); _params.put(StorageLayer.InstanceConfigKey, _storage); @@ -464,98 +463,98 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements } return true; } - + private void startAdditionalServices() { - Script command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("if [ -f /etc/init.d/ssh ]; then service ssh restart; else service sshd restart; fi "); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in starting sshd service err=" + result ); - } - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("iptables -I INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT"); - result = command.execute(); - if (result != null) { - s_logger.warn("Error in opening up ssh port err=" + result ); - } - } - - private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) { - s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr); - if (destIpOrCidr == null) { - s_logger.debug("addRouteToInternalIp: destIp is null"); - return; - } - if (!NetUtils.isValidIp(destIpOrCidr) && !NetUtils.isValidCIDR(destIpOrCidr)){ - s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr); - return; - } - boolean inSameSubnet = false; - if (NetUtils.isValidIp(destIpOrCidr)) { - if (eth1ip != null && eth1mask != null) { - inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask); - } else { - s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask); - } - } else { - inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask)); - } - if (inSameSubnet) { - s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip); - return; - } - Script command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("ip route delete " + destIpOrCidr); - command.execute(); - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("ip route add " + destIpOrCidr + " via " + localgw); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in configuring route to internal ip err=" + result ); - } else { - s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw); - } + Script command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("if [ -f /etc/init.d/ssh ]; then service ssh restart; else service sshd restart; fi "); + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in starting sshd service err=" + result ); + } + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("iptables -I INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT"); + result = command.execute(); + if (result != null) { + s_logger.warn("Error in opening up ssh port err=" + result ); + } } - private void configureSSL() { - Script command = new Script(_configSslScr); - command.add(_publicIp); - command.add(_hostname); - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure httpd to use ssl"); - } - } - - private String configureAuth(String user, String passwd) { - Script command = new Script(_configAuthScr); - command.add(user); - command.add(passwd); - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure httpd to use auth"); - } - return result; - } - - private String configureIpFirewall(List ipList){ - Script command = new Script(_configIpFirewallScr); - for (String ip : ipList){ - command.add(ip); - } - - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure firewall for command : " +command); - } - return result; - } - - protected String mount(String path, String parent) { + private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) { + s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr); + if (destIpOrCidr == null) { + s_logger.debug("addRouteToInternalIp: destIp is null"); + return; + } + if (!NetUtils.isValidIp(destIpOrCidr) && !NetUtils.isValidCIDR(destIpOrCidr)){ + s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr); + return; + } + boolean inSameSubnet = false; + if (NetUtils.isValidIp(destIpOrCidr)) { + if (eth1ip != null && eth1mask != null) { + inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask); + } else { + s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask); + } + } else { + inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask)); + } + if (inSameSubnet) { + s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip); + return; + } + Script command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("ip route delete " + destIpOrCidr); + command.execute(); + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("ip route add " + destIpOrCidr + " via " + localgw); + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in configuring route to internal ip err=" + result ); + } else { + s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw); + } + } + + private void configureSSL() { + Script command = new Script(_configSslScr); + command.add(_publicIp); + command.add(_hostname); + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure httpd to use ssl"); + } + } + + private String configureAuth(String user, String passwd) { + Script command = new Script(_configAuthScr); + command.add(user); + command.add(passwd); + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure httpd to use auth"); + } + return result; + } + + private String configureIpFirewall(List ipList){ + Script command = new Script(_configIpFirewallScr); + for (String ip : ipList){ + command.add(ip); + } + + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure firewall for command : " +command); + } + return result; + } + + protected String mount(String path, String parent) { String mountPoint = null; for (int i = 0; i < 10; i++) { String mntPt = parent + File.separator + Integer.toHexString(_rand.nextInt(Integer.MAX_VALUE)); @@ -568,29 +567,29 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements } s_logger.debug("Unable to create mount: " + mntPt); } - + if (mountPoint == null) { s_logger.warn("Unable to create a mount point"); return null; } - + Script script = null; String result = null; script = new Script(!_inSystemVM, "umount", _timeout, s_logger); script.add(path); result = script.execute(); - + if( _parent != null ) { script = new Script("rmdir", _timeout, s_logger); script.add(_parent); result = script.execute(); } - + Script command = new Script(!_inSystemVM, "mount", _timeout, s_logger); command.add("-t", "cifs"); if (_inSystemVM) { - //Fedora Core 12 errors out with any -o option executed from java - //command.add("-o", "soft,timeo=133,retrans=2147483647,tcp,acdirmax=0,acdirmin=0"); + //Fedora Core 12 errors out with any -o option executed from java + //command.add("-o", "soft,timeo=133,retrans=2147483647,tcp,acdirmax=0,acdirmin=0"); } String tok[] = path.split(":"); //command.add(path); @@ -601,25 +600,25 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements s_logger.warn("Unable to mount " + path + " due to " + result); File file = new File(mountPoint); if (file.exists()) - file.delete(); + file.delete(); return null; } - - - + + + // XXX: Adding the check for creation of snapshots dir here. Might have to move it somewhere more logical later. if (!checkForSnapshotsDir(mountPoint)) { - return null; + return null; } - + // Create the volumes dir if (!checkForVolumesDir(mountPoint)) { - return null; + return null; } - + return mountPoint; } - + @Override public boolean start() { return true; @@ -633,14 +632,14 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements @Override public StartupCommand[] initialize() { /*disconnected(); - + _parent = mount(_nfsPath, _mountParent); - + if( _parent == null ) { s_logger.warn("Unable to mount the nfs server"); return null; } - + try { _params.put("template.parent", _parent); _params.put(StorageLayer.InstanceConfigKey, _storage); @@ -650,12 +649,12 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements s_logger.warn("Caught problem while configuring folers", e); return null; }*/ - + final StartupStorageCommand cmd = new StartupStorageCommand(_parent, StoragePoolType.NetworkFilesystem, getTotalSize(), new HashMap()); - + cmd.setResourceType(Storage.StorageResourceType.SECONDARY_STORAGE); cmd.setIqn(null); - + fillNetworkInformation(cmd); cmd.setDataCenter(_dc); cmd.setPod(_pod); @@ -687,40 +686,70 @@ public class CifsSecondaryStorageResource extends ServerResourceBase implements String snapshotsDirLocation = mountPoint + File.separator + "snapshots"; return createDir("snapshots", snapshotsDirLocation, mountPoint); } - - protected boolean checkForVolumesDir(String mountPoint) { - String volumesDirLocation = mountPoint + "/" + "volumes"; - return createDir("volumes", volumesDirLocation, mountPoint); - } - - protected boolean createDir(String dirName, String dirLocation, String mountPoint) { - boolean dirExists = false; - - File dir = new File(dirLocation); - if (dir.exists()) { - if (dir.isDirectory()) { - s_logger.debug(dirName + " already exists on secondary storage, and is mounted at " + mountPoint); - dirExists = true; - } else { - if (dir.delete() && _storage.mkdir(dirLocation)) { - dirExists = true; - } - } - } else if (_storage.mkdir(dirLocation)) { - dirExists = true; - } - if (dirExists) { - s_logger.info(dirName + " directory created/exists on Secondary Storage."); - } else { - s_logger.info(dirName + " directory does not exist on Secondary Storage."); - } - - return dirExists; + protected boolean checkForVolumesDir(String mountPoint) { + String volumesDirLocation = mountPoint + "/" + "volumes"; + return createDir("volumes", volumesDirLocation, mountPoint); } - + + protected boolean createDir(String dirName, String dirLocation, String mountPoint) { + boolean dirExists = false; + + File dir = new File(dirLocation); + if (dir.exists()) { + if (dir.isDirectory()) { + s_logger.debug(dirName + " already exists on secondary storage, and is mounted at " + mountPoint); + dirExists = true; + } else { + if (dir.delete() && _storage.mkdir(dirLocation)) { + dirExists = true; + } + } + } else if (_storage.mkdir(dirLocation)) { + dirExists = true; + } + + if (dirExists) { + s_logger.info(dirName + " directory created/exists on Secondary Storage."); + } else { + s_logger.info(dirName + " directory does not exist on Secondary Storage."); + } + + return dirExists; + } + @Override protected String getDefaultScriptsDir() { return "./scripts/storage/secondary"; } + + @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/core/src/com/cloud/storage/resource/LocalSecondaryStorageResource.java b/core/src/com/cloud/storage/resource/LocalSecondaryStorageResource.java index d9c69f8b151..c638c5d874e 100644 --- a/core/src/com/cloud/storage/resource/LocalSecondaryStorageResource.java +++ b/core/src/com/cloud/storage/resource/LocalSecondaryStorageResource.java @@ -19,7 +19,6 @@ package com.cloud.storage.resource; import java.util.HashMap; import java.util.Map; - import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -36,11 +35,11 @@ import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupStorageCommand; +import com.cloud.agent.api.storage.DownloadCommand; +import com.cloud.agent.api.storage.DownloadProgressCommand; import com.cloud.agent.api.storage.ListTemplateAnswer; import com.cloud.agent.api.storage.ListTemplateCommand; import com.cloud.agent.api.storage.ssCommand; -import com.cloud.agent.api.storage.DownloadCommand; -import com.cloud.agent.api.storage.DownloadProgressCommand; import com.cloud.host.Host; import com.cloud.host.Host.Type; import com.cloud.resource.ServerResourceBase; @@ -50,39 +49,38 @@ import com.cloud.storage.StorageLayer; import com.cloud.storage.template.DownloadManager; import com.cloud.storage.template.DownloadManagerImpl; import com.cloud.storage.template.TemplateInfo; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.component.ComponentContext; public class LocalSecondaryStorageResource extends ServerResourceBase implements SecondaryStorageResource { private static final Logger s_logger = Logger.getLogger(LocalSecondaryStorageResource.class); int _timeout; - + String _instance; String _parent; - + String _dc; String _pod; String _guid; - + StorageLayer _storage; - + DownloadManager _dlMgr; - + @Override public void disconnected() { } - + @Override public String getRootDir(ssCommand cmd){ return getRootDir(); - + } - + public String getRootDir() { return _parent; } - + @Override public Answer executeRequest(Command cmd) { if (cmd instanceof DownloadProgressCommand) { @@ -103,7 +101,7 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements return Answer.createUnsupportedCommandAnswer(cmd); } } - + private Answer execute(ComputeChecksumCommand cmd) { return new Answer(cmd, false, null); } @@ -119,13 +117,13 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements public Type getType() { return Host.Type.LocalSecondaryStorage; } - + @Override public PingCommand getCurrentStatus(final long id) { return new PingStorageCommand(Host.Type.Storage, id, new HashMap()); } - - + + @Override @SuppressWarnings("unchecked") public boolean configure(String name, Map params) throws ConfigurationException { @@ -135,30 +133,30 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements if (_guid == null) { throw new ConfigurationException("Unable to find the guid"); } - + _dc = (String)params.get("zone"); if (_dc == null) { throw new ConfigurationException("Unable to find the zone"); } _pod = (String)params.get("pod"); - + _instance = (String)params.get("instance"); _parent = (String)params.get("mount.path"); if (_parent == null) { throw new ConfigurationException("No directory specified."); } - + _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { String value = (String)params.get(StorageLayer.ClassConfigKey); if (value == null) { value = "com.cloud.storage.JavaStorageLayer"; } - + try { Class clazz = (Class)Class.forName(value); - _storage = ComponentLocator.inject(clazz); + _storage = ComponentContext.inject(clazz); } catch (ClassNotFoundException e) { throw new ConfigurationException("Unable to find class " + value); } @@ -168,15 +166,15 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements s_logger.warn("Unable to create the directory " + _parent); throw new ConfigurationException("Unable to create the directory " + _parent); } - + s_logger.info("Mount point established at " + _parent); params.put("template.parent", _parent); params.put(StorageLayer.InstanceConfigKey, _storage); - + _dlMgr = new DownloadManagerImpl(); _dlMgr.configure("DownloadManager", params); - + return true; } @@ -192,7 +190,7 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements @Override public StartupCommand[] initialize() { - + final StartupStorageCommand cmd = new StartupStorageCommand(_parent, StoragePoolType.Filesystem, 1024l*1024l*1024l*1024l, _dlMgr.gatherTemplateInfo(_parent)); cmd.setResourceType(Storage.StorageResourceType.LOCAL_SECONDARY_STORAGE); cmd.setIqn("local://"); @@ -202,12 +200,47 @@ public class LocalSecondaryStorageResource extends ServerResourceBase implements cmd.setGuid(_guid); cmd.setName(_guid); cmd.setVersion(LocalSecondaryStorageResource.class.getPackage().getImplementationVersion()); - + return new StartupCommand [] {cmd}; } - + @Override protected String getDefaultScriptsDir() { return "scripts/storage/secondary"; } + + + @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/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java index a4bea9df2b4..e65cbe1312e 100755 --- a/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java +++ b/core/src/com/cloud/storage/resource/NfsSecondaryStorageResource.java @@ -71,7 +71,6 @@ import com.cloud.agent.api.SecStorageFirewallCfgCommand.PortConfig; import com.cloud.agent.api.SecStorageSetupAnswer; import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.SecStorageSetupCommand.Certificates; -import com.cloud.agent.api.StartupSecondaryStorageCommand; import com.cloud.agent.api.SecStorageVMSetupCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupSecondaryStorageCommand; @@ -109,7 +108,7 @@ import com.cloud.utils.NumbersUtil; import com.cloud.utils.S3Utils; import com.cloud.utils.S3Utils.FileNamingStrategy; import com.cloud.utils.S3Utils.ObjectNamingStrategy; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.ComponentContext; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.OutputInterpreter; @@ -117,7 +116,7 @@ import com.cloud.utils.script.Script; import com.cloud.vm.SecondaryStorageVm; public class NfsSecondaryStorageResource extends ServerResourceBase implements - SecondaryStorageResource { +SecondaryStorageResource { private static final Logger s_logger = Logger .getLogger(NfsSecondaryStorageResource.class); @@ -126,7 +125,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements private static final String SNAPSHOT_ROOT_DIR = "snapshots"; int _timeout; - + String _instance; String _dc; String _pod; @@ -136,23 +135,23 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements StorageLayer _storage; boolean _inSystemVM = false; boolean _sslCopy = false; - + DownloadManager _dlMgr; UploadManager _upldMgr; - private String _configSslScr; - private String _configAuthScr; - private String _configIpFirewallScr; - private String _publicIp; - private String _hostname; - private String _localgw; - private String _eth1mask; - private String _eth1ip; - private String _storageIp; - private String _storageNetmask; - private String _storageGateway; - private List nfsIps = new ArrayList(); - final private String _parent = "/mnt/SecStorage"; - final private String _tmpltDir = "/var/cloudstack/template"; + private String _configSslScr; + private String _configAuthScr; + private String _configIpFirewallScr; + private String _publicIp; + private String _hostname; + private String _localgw; + private String _eth1mask; + private String _eth1ip; + private String _storageIp; + private String _storageNetmask; + private String _storageGateway; + private final List nfsIps = new ArrayList(); + final private String _parent = "/mnt/SecStorage"; + final private String _tmpltDir = "/var/cloudstack/template"; final private String _tmpltpp = "template.properties"; @Override public void disconnected() { @@ -171,19 +170,19 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } else if(cmd instanceof DeleteEntityDownloadURLCommand){ return _upldMgr.handleDeleteEntityDownloadURLCommand((DeleteEntityDownloadURLCommand)cmd); } else if (cmd instanceof GetStorageStatsCommand) { - return execute((GetStorageStatsCommand)cmd); + return execute((GetStorageStatsCommand)cmd); } else if (cmd instanceof CheckHealthCommand) { return new CheckHealthAnswer((CheckHealthCommand)cmd, true); } else if (cmd instanceof DeleteTemplateCommand) { - return execute((DeleteTemplateCommand) cmd); + return execute((DeleteTemplateCommand) cmd); } else if (cmd instanceof DeleteVolumeCommand) { - return execute((DeleteVolumeCommand) cmd); + return execute((DeleteVolumeCommand) cmd); }else if (cmd instanceof ReadyCommand) { return new ReadyAnswer((ReadyCommand)cmd); } else if (cmd instanceof SecStorageFirewallCfgCommand){ - return execute((SecStorageFirewallCfgCommand)cmd); + return execute((SecStorageFirewallCfgCommand)cmd); } else if (cmd instanceof SecStorageVMSetupCommand){ - return execute((SecStorageVMSetupCommand)cmd); + return execute((SecStorageVMSetupCommand)cmd); } else if (cmd instanceof SecStorageSetupCommand){ return execute((SecStorageSetupCommand)cmd); } else if (cmd instanceof ComputeChecksumCommand){ @@ -218,7 +217,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements return Answer.createUnsupportedCommandAnswer(cmd); } } - + @SuppressWarnings("unchecked") private String determineS3TemplateDirectory(final Long accountId, final Long templateId) { @@ -254,7 +253,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements "Unable to create directory " + "download directory %1$s for download of template id " + "%2$s from S3.", downloadDirectory.getName(), - templateId); + templateId); s_logger.error(errMsg); return new Answer(cmd, false, errMsg); } @@ -262,11 +261,11 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements getDirectory(s3, s3.getBucketName(), determineS3TemplateDirectory(accountId, templateId), downloadDirectory, new FileNamingStrategy() { - @Override - public String determineFileName(final String key) { - return substringAfterLast(key, S3Utils.SEPARATOR); - } - }); + @Override + public String determineFileName(final String key) { + return substringAfterLast(key, S3Utils.SEPARATOR); + } + }); return new Answer(cmd, true, format("Successfully downloaded " + "template id %1$s from S3 to directory %2$s", templateId, @@ -395,23 +394,24 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements final String bucket = s3.getBucketName(); putDirectory(s3, bucket, _storage.getFile(templatePath), new FilenameFilter() { - @Override - public boolean accept(final File directory, - final String fileName) { - return !fileName.startsWith("."); - } - }, new ObjectNamingStrategy() { - @Override - public String determineKey(final File file) { - s_logger.debug(String - .format("Determining key using account id %1$s and template id %2$s", - accountId, templateId)); - return join( - asList(determineS3TemplateDirectory( - accountId, templateId), file - .getName()), S3Utils.SEPARATOR); - } - }); + @Override + public boolean accept(final File directory, + final String fileName) { + File fileToUpload = new File(directory.getAbsolutePath() + "/" + fileName); + return !fileName.startsWith(".") && !fileToUpload.isDirectory(); + } + }, new ObjectNamingStrategy() { + @Override + public String determineKey(final File file) { + s_logger.debug(String + .format("Determining key using account id %1$s and template id %2$s", + accountId, templateId)); + return join( + asList(determineS3TemplateDirectory( + accountId, templateId), file + .getName()), S3Utils.SEPARATOR); + } + }); return new Answer( cmd, @@ -623,7 +623,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements command.add("-c"); command.add("/usr/bin/python /usr/local/cloud/systemvm/scripts/storage/secondary/swift -A " + swift.getUrl() + " -U " + swift.getAccount() + ":" + swift.getUserName() + " -K " + swift.getKey() - + " delete " + container + " " + object); + + " delete " + container + " " + object); OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser(); String result = command.execute(parser); if (result != null) { @@ -678,61 +678,61 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements executeWithNoWaitLock(determineSnapshotLockId(accountId, volumeId), new Callable() { + @Override + public Void call() throws Exception { + + final String directoryName = determineSnapshotLocalDirectory( + secondaryStorageUrl, accountId, volumeId); + + String result = createLocalDir(directoryName); + if (result != null) { + throw new InternalErrorException( + format("Failed to create directory %1$s during S3 snapshot download.", + directoryName)); + } + + final String snapshotFileName = determineSnapshotBackupFilename(cmd + .getSnapshotUuid()); + final String key = determineSnapshotS3Key( + accountId, volumeId, snapshotFileName); + final File targetFile = S3Utils.getFile(s3, + s3.getBucketName(), key, + _storage.getFile(directoryName), + new FileNamingStrategy() { + @Override - public Void call() throws Exception { - - final String directoryName = determineSnapshotLocalDirectory( - secondaryStorageUrl, accountId, volumeId); - - String result = createLocalDir(directoryName); - if (result != null) { - throw new InternalErrorException( - format("Failed to create directory %1$s during S3 snapshot download.", - directoryName)); - } - - final String snapshotFileName = determineSnapshotBackupFilename(cmd - .getSnapshotUuid()); - final String key = determineSnapshotS3Key( - accountId, volumeId, snapshotFileName); - final File targetFile = S3Utils.getFile(s3, - s3.getBucketName(), key, - _storage.getFile(directoryName), - new FileNamingStrategy() { - - @Override - public String determineFileName( - String key) { - return snapshotFileName; - } - - }); - - if (cmd.getParent() != null) { - - final String parentPath = join( - File.pathSeparator, directoryName, - determineSnapshotBackupFilename(cmd - .getParent())); - result = setVhdParent( - targetFile.getAbsolutePath(), - parentPath); - if (result != null) { - throw new InternalErrorException( - format("Failed to set the parent for backup %1$s to %2$s due to %3$s.", - targetFile - .getAbsolutePath(), - parentPath, result)); - } - - } - - return null; - + public String determineFileName( + String key) { + return snapshotFileName; } }); + if (cmd.getParent() != null) { + + final String parentPath = join( + File.pathSeparator, directoryName, + determineSnapshotBackupFilename(cmd + .getParent())); + result = setVhdParent( + targetFile.getAbsolutePath(), + parentPath); + if (result != null) { + throw new InternalErrorException( + format("Failed to set the parent for backup %1$s to %2$s due to %3$s.", + targetFile + .getAbsolutePath(), + parentPath, result)); + } + + } + + return null; + + } + + }); + return new Answer( cmd, true, @@ -820,7 +820,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } private Answer execute(ComputeChecksumCommand cmd) { - + String relativeTemplatePath = cmd.getTemplatePath(); String parent = getRootDir(cmd); @@ -841,8 +841,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements if(s_logger.isDebugEnabled()){ s_logger.debug("parent path " +parent+ " relative template path " +relativeTemplatePath ); } - - + + try { digest = MessageDigest.getInstance("MD5"); is = new FileInputStream(f); @@ -855,7 +855,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements if(s_logger.isDebugEnabled()){ s_logger.debug("Successfully calculated checksum for file " +absoluteTemplatePath+ " - " +checksum ); } - + }catch(IOException e) { String logMsg = "Unable to process file for MD5 - " + absoluteTemplatePath; s_logger.error(logMsg); @@ -865,11 +865,11 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } finally { try { - if(is != null) - is.close(); + if(is != null) + is.close(); } catch (IOException e) { if(s_logger.isDebugEnabled()){ - s_logger.debug("Could not close the file " +absoluteTemplatePath); + s_logger.debug("Could not close the file " +absoluteTemplatePath); } return new Answer(cmd, false, checksum); } @@ -879,38 +879,38 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } private void configCerts(Certificates certs) { - if (certs == null) { - configureSSL(); - } else { - String prvKey = certs.getPrivKey(); - String pubCert = certs.getPrivCert(); - String certChain = certs.getCertChain(); - - try { - File prvKeyFile = File.createTempFile("prvkey", null); - String prvkeyPath = prvKeyFile.getAbsolutePath(); - BufferedWriter out = new BufferedWriter(new FileWriter(prvKeyFile)); - out.write(prvKey); - out.close(); - - File pubCertFile = File.createTempFile("pubcert", null); - String pubCertFilePath = pubCertFile.getAbsolutePath(); - - out = new BufferedWriter(new FileWriter(pubCertFile)); - out.write(pubCert); - out.close(); - - configureSSL(prvkeyPath, pubCertFilePath, null); - - prvKeyFile.delete(); - pubCertFile.delete(); - - } catch (IOException e) { - s_logger.debug("Failed to config ssl: " + e.toString()); - } - } + if (certs == null) { + configureSSL(); + } else { + String prvKey = certs.getPrivKey(); + String pubCert = certs.getPrivCert(); + String certChain = certs.getCertChain(); + + try { + File prvKeyFile = File.createTempFile("prvkey", null); + String prvkeyPath = prvKeyFile.getAbsolutePath(); + BufferedWriter out = new BufferedWriter(new FileWriter(prvKeyFile)); + out.write(prvKey); + out.close(); + + File pubCertFile = File.createTempFile("pubcert", null); + String pubCertFilePath = pubCertFile.getAbsolutePath(); + + out = new BufferedWriter(new FileWriter(pubCertFile)); + out.write(pubCert); + out.close(); + + configureSSL(prvkeyPath, pubCertFilePath, null); + + prvKeyFile.delete(); + pubCertFile.delete(); + + } catch (IOException e) { + s_logger.debug("Failed to config ssl: " + e.toString()); + } + } } - + private Answer execute(SecStorageSetupCommand cmd) { if (!_inSystemVM){ return new Answer(cmd, true, null); @@ -930,7 +930,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements mount(root, nfsPath); configCerts(cmd.getCerts()); - + nfsIps.add(nfsHostIp); return new SecStorageSetupAnswer(dir); } catch (Exception e) { @@ -940,7 +940,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } } - + private String deleteSnapshotBackupFromLocalFileSystem( final String secondaryStorageUrl, final Long accountId, final Long volumeId, final String name, final Boolean deleteAllFlag) { @@ -1072,7 +1072,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements return new Answer(cmd, false, errMsg); } } - + Map swiftListTemplate(SwiftTO swift) { String[] containers = swiftList(swift, "", ""); if (containers == null) { @@ -1103,9 +1103,9 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } } return tmpltInfos; - + } - + private Answer execute(ListTemplateCommand cmd) { if (!_inSystemVM){ return new Answer(cmd, true, null); @@ -1119,50 +1119,50 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos); } } - + private Answer execute(ListVolumeCommand cmd) { if (!_inSystemVM){ return new Answer(cmd, true, null); } - + String root = getRootDir(cmd.getSecUrl()); Map templateInfos = _dlMgr.gatherVolumeInfo(root); return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos); - - } - - private Answer execute(SecStorageVMSetupCommand cmd) { - if (!_inSystemVM){ - return new Answer(cmd, true, null); - } - boolean success = true; - StringBuilder result = new StringBuilder(); - for (String cidr: cmd.getAllowedInternalSites()) { - if (nfsIps.contains(cidr)) { - /* - * if the internal download ip is the same with secondary storage ip, adding internal sites will flush - * ip route to nfs through storage ip. - */ - continue; - } - String tmpresult = allowOutgoingOnPrivate(cidr); - if (tmpresult != null) { - result.append(", ").append(tmpresult); - success = false; - } - } - if (success) { - if (cmd.getCopyPassword() != null && cmd.getCopyUserName() != null) { - String tmpresult = configureAuth(cmd.getCopyUserName(), cmd.getCopyPassword()); - if (tmpresult != null) { - result.append("Failed to configure auth for copy ").append(tmpresult); - success = false; - } - } - } - return new Answer(cmd, success, result.toString()); - } + } + + private Answer execute(SecStorageVMSetupCommand cmd) { + if (!_inSystemVM){ + return new Answer(cmd, true, null); + } + boolean success = true; + StringBuilder result = new StringBuilder(); + for (String cidr: cmd.getAllowedInternalSites()) { + if (nfsIps.contains(cidr)) { + /* + * if the internal download ip is the same with secondary storage ip, adding internal sites will flush + * ip route to nfs through storage ip. + */ + continue; + } + String tmpresult = allowOutgoingOnPrivate(cidr); + if (tmpresult != null) { + result.append(", ").append(tmpresult); + success = false; + } + } + if (success) { + if (cmd.getCopyPassword() != null && cmd.getCopyUserName() != null) { + String tmpresult = configureAuth(cmd.getCopyUserName(), cmd.getCopyPassword()); + if (tmpresult != null) { + result.append("Failed to configure auth for copy ").append(tmpresult); + success = false; + } + } + } + return new Answer(cmd, success, result.toString()); + + } private String setVhdParent(String lFullPath, String pFullPath) { Script command = new Script("/bin/bash", s_logger); @@ -1217,55 +1217,55 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } public String allowOutgoingOnPrivate(String destCidr) { - - Script command = new Script("/bin/bash", s_logger); - String intf = "eth1"; - command.add("-c"); - command.add("iptables -I OUTPUT -o " + intf + " -d " + destCidr + " -p tcp -m state --state NEW -m tcp -j ACCEPT"); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in allowing outgoing to " + destCidr + ", err=" + result ); - return "Error in allowing outgoing to " + destCidr + ", err=" + result; - } - - addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr); - - return null; - } - - private Answer execute(SecStorageFirewallCfgCommand cmd) { - if (!_inSystemVM){ - return new Answer(cmd, true, null); - } + Script command = new Script("/bin/bash", s_logger); + String intf = "eth1"; + command.add("-c"); + command.add("iptables -I OUTPUT -o " + intf + " -d " + destCidr + " -p tcp -m state --state NEW -m tcp -j ACCEPT"); - List ipList = new ArrayList(); - - for (PortConfig pCfg:cmd.getPortConfigs()){ - if (pCfg.isAdd()) { - ipList.add(pCfg.getSourceIp()); - } - } - boolean success = true; - String result; - result = configureIpFirewall(ipList, cmd.getIsAppendAIp()); - if (result !=null) - success = false; + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in allowing outgoing to " + destCidr + ", err=" + result ); + return "Error in allowing outgoing to " + destCidr + ", err=" + result; + } - return new Answer(cmd, success, result); - } + addRouteToInternalIpOrCidr(_localgw, _eth1ip, _eth1mask, destCidr); - protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { - String rootDir = getRootDir(cmd.getSecUrl()); + return null; + } + + private Answer execute(SecStorageFirewallCfgCommand cmd) { + if (!_inSystemVM){ + return new Answer(cmd, true, null); + } + + List ipList = new ArrayList(); + + for (PortConfig pCfg:cmd.getPortConfigs()){ + if (pCfg.isAdd()) { + ipList.add(pCfg.getSourceIp()); + } + } + boolean success = true; + String result; + result = configureIpFirewall(ipList, cmd.getIsAppendAIp()); + if (result !=null) + success = false; + + return new Answer(cmd, success, result); + } + + protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { + String rootDir = getRootDir(cmd.getSecUrl()); final long usedSize = getUsedSize(rootDir); final long totalSize = getTotalSize(rootDir); if (usedSize == -1 || totalSize == -1) { - return new GetStorageStatsAnswer(cmd, "Unable to get storage stats"); + return new GetStorageStatsAnswer(cmd, "Unable to get storage stats"); } else { - return new GetStorageStatsAnswer(cmd, totalSize, usedSize) ; + return new GetStorageStatsAnswer(cmd, totalSize, usedSize) ; } } - + protected Answer execute(final DeleteTemplateCommand cmd) { String relativeTemplatePath = cmd.getTemplatePath(); String parent = getRootDir(cmd); @@ -1313,7 +1313,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } return new Answer(cmd, true, null); } - + protected Answer execute(final DeleteVolumeCommand cmd) { String relativeVolumePath = cmd.getVolumePath(); String parent = getRootDir(cmd); @@ -1361,7 +1361,7 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } return new Answer(cmd, true, null); } - + Answer execute(CleanupSnapshotBackupCommand cmd) { String parent = getRootDir(cmd.getSecondaryStoragePoolURL()); if (!parent.endsWith(File.separator)) { @@ -1409,22 +1409,22 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements throw new CloudRuntimeException(msg); } } - - + + @Override public String getRootDir(ssCommand cmd){ return getRootDir(cmd.getSecUrl()); - + } - + protected long getUsedSize(String rootDir) { return _storage.getUsedSpace(rootDir); } - + protected long getTotalSize(String rootDir) { - return _storage.getTotalSpace(rootDir); + return _storage.getTotalSpace(rootDir); } - + protected long convertFilesystemSize(final String size) { if (size == null || size.isEmpty()) { return -1; @@ -1443,29 +1443,29 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements return (long)(Double.parseDouble(size.substring(0, size.length() - 1)) * multiplier); } - + @Override public Type getType() { - if(SecondaryStorageVm.Role.templateProcessor.toString().equals(_role)) - return Host.Type.SecondaryStorage; - - return Host.Type.SecondaryStorageCmdExecutor; + if(SecondaryStorageVm.Role.templateProcessor.toString().equals(_role)) + return Host.Type.SecondaryStorage; + + return Host.Type.SecondaryStorageCmdExecutor; } - + @Override public PingCommand getCurrentStatus(final long id) { return new PingStorageCommand(Host.Type.Storage, id, new HashMap()); } - + @Override public boolean configure(String name, Map params) throws ConfigurationException { - _eth1ip = (String)params.get("eth1ip"); + _eth1ip = (String)params.get("eth1ip"); _eth1mask = (String)params.get("eth1mask"); if (_eth1ip != null) { //can only happen inside service vm - params.put("private.network.device", "eth1"); + params.put("private.network.device", "eth1"); } else { - s_logger.warn("Wait, what's going on? eth1ip is null!!"); + s_logger.warn("Wait, what's going on? eth1ip is null!!"); } String eth2ip = (String) params.get("eth2ip"); if (eth2ip != null) { @@ -1473,32 +1473,36 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } _publicIp = (String) params.get("eth2ip"); _hostname = (String) params.get("name"); - + _storageIp = (String) params.get("storageip"); if (_storageIp == null) { - s_logger.warn("Wait, there is no storageip in /proc/cmdline, something wrong!"); + s_logger.warn("Wait, there is no storageip in /proc/cmdline, something wrong!"); } _storageNetmask = (String) params.get("storagenetmask"); _storageGateway = (String) params.get("storagegateway"); super.configure(name, params); - + _params = params; String value = (String)params.get("scripts.timeout"); _timeout = NumbersUtil.parseInt(value, 1440) * 1000; - + _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { value = (String)params.get(StorageLayer.ClassConfigKey); if (value == null) { value = "com.cloud.storage.JavaStorageLayer"; } - + try { Class clazz = Class.forName(value); - _storage = (StorageLayer)ComponentLocator.inject(clazz); + _storage = (StorageLayer)clazz.newInstance(); _storage.configure("StorageLayer", params); } catch (ClassNotFoundException e) { throw new ConfigurationException("Unable to find class " + value); + } catch (InstantiationException e) { + throw new ConfigurationException("Unable to find class " + value); + } catch (IllegalAccessException e) { + throw new ConfigurationException("Unable to find class " + value); } } _storage.mkdirs(_parent); @@ -1511,34 +1515,34 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements if (_configSslScr != null) { s_logger.info("config_auth.sh found in " + _configAuthScr); } - + _configIpFirewallScr = Script.findScript(getDefaultScriptsDir(), "ipfirewall.sh"); if (_configIpFirewallScr != null) { s_logger.info("_configIpFirewallScr found in " + _configIpFirewallScr); } - + _role = (String)params.get("role"); if(_role == null) - _role = SecondaryStorageVm.Role.templateProcessor.toString(); + _role = SecondaryStorageVm.Role.templateProcessor.toString(); s_logger.info("Secondary storage runs in role " + _role); - + _guid = (String)params.get("guid"); if (_guid == null) { throw new ConfigurationException("Unable to find the guid"); } - + _dc = (String)params.get("zone"); if (_dc == null) { throw new ConfigurationException("Unable to find the zone"); } _pod = (String)params.get("pod"); - + _instance = (String)params.get("instance"); - - + + String inSystemVM = (String)params.get("secondary.storage.vm"); if (inSystemVM == null || "true".equalsIgnoreCase(inSystemVM)) { - _inSystemVM = true; + _inSystemVM = true; _localgw = (String)params.get("localgw"); if (_localgw != null) { // can only happen inside service vm String mgmtHost = (String) params.get("host"); @@ -1557,12 +1561,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } } - - startAdditionalServices(); - _params.put("install.numthreads", "50"); - _params.put("secondary.storage.vm", "true"); + + startAdditionalServices(); + _params.put("install.numthreads", "50"); + _params.put("secondary.storage.vm", "true"); } - + try { _params.put(StorageLayer.InstanceConfigKey, _storage); _dlMgr = new DownloadManagerImpl(); @@ -1575,114 +1579,114 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements } return true; } - + private void startAdditionalServices() { - Script command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("if [ -f /etc/init.d/ssh ]; then service ssh restart; else service sshd restart; fi "); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in starting sshd service err=" + result ); - } - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("iptables -I INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT"); - result = command.execute(); - if (result != null) { - s_logger.warn("Error in opening up ssh port err=" + result ); - } - } - - private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) { - s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr); - if (destIpOrCidr == null) { - s_logger.debug("addRouteToInternalIp: destIp is null"); - return; - } - if (!NetUtils.isValidIp(destIpOrCidr) && !NetUtils.isValidCIDR(destIpOrCidr)){ - s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr); - return; - } - boolean inSameSubnet = false; - if (NetUtils.isValidIp(destIpOrCidr)) { - if (eth1ip != null && eth1mask != null) { - inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask); - } else { - s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask); - } - } else { - inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask)); - } - if (inSameSubnet) { - s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip); - return; - } - Script command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("ip route delete " + destIpOrCidr); - command.execute(); - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("ip route add " + destIpOrCidr + " via " + localgw); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in configuring route to internal ip err=" + result ); - } else { - s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw); - } + Script command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("if [ -f /etc/init.d/ssh ]; then service ssh restart; else service sshd restart; fi "); + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in starting sshd service err=" + result ); + } + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("iptables -I INPUT -i eth1 -p tcp -m state --state NEW -m tcp --dport 3922 -j ACCEPT"); + result = command.execute(); + if (result != null) { + s_logger.warn("Error in opening up ssh port err=" + result ); + } } - private void configureSSL() { - Script command = new Script(_configSslScr); - command.add("-i", _publicIp); - command.add("-h", _hostname); - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure httpd to use ssl"); - } - } - - private void configureSSL(String prvkeyPath, String prvCertPath, String certChainPath) { - Script command = new Script(_configSslScr); - command.add("-i", _publicIp); - command.add("-h", _hostname); - command.add("-k", prvkeyPath); - command.add("-p", prvCertPath); - if (certChainPath != null) { - command.add("-t", certChainPath); - } - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure httpd to use ssl"); - } - } - - private String configureAuth(String user, String passwd) { - Script command = new Script(_configAuthScr); - command.add(user); - command.add(passwd); - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure httpd to use auth"); - } - return result; - } - - private String configureIpFirewall(List ipList, boolean isAppend){ - Script command = new Script(_configIpFirewallScr); - command.add(String.valueOf(isAppend)); - for (String ip : ipList){ - command.add(ip); - } - - String result = command.execute(); - if (result != null) { - s_logger.warn("Unable to configure firewall for command : " +command); - } - return result; - } - - protected String mount(String root, String nfsPath) { + private void addRouteToInternalIpOrCidr(String localgw, String eth1ip, String eth1mask, String destIpOrCidr) { + s_logger.debug("addRouteToInternalIp: localgw=" + localgw + ", eth1ip=" + eth1ip + ", eth1mask=" + eth1mask + ",destIp=" + destIpOrCidr); + if (destIpOrCidr == null) { + s_logger.debug("addRouteToInternalIp: destIp is null"); + return; + } + if (!NetUtils.isValidIp(destIpOrCidr) && !NetUtils.isValidCIDR(destIpOrCidr)){ + s_logger.warn(" destIp is not a valid ip address or cidr destIp=" + destIpOrCidr); + return; + } + boolean inSameSubnet = false; + if (NetUtils.isValidIp(destIpOrCidr)) { + if (eth1ip != null && eth1mask != null) { + inSameSubnet = NetUtils.sameSubnet(eth1ip, destIpOrCidr, eth1mask); + } else { + s_logger.warn("addRouteToInternalIp: unable to determine same subnet: _eth1ip=" + eth1ip + ", dest ip=" + destIpOrCidr + ", _eth1mask=" + eth1mask); + } + } else { + inSameSubnet = NetUtils.isNetworkAWithinNetworkB(destIpOrCidr, NetUtils.ipAndNetMaskToCidr(eth1ip, eth1mask)); + } + if (inSameSubnet) { + s_logger.debug("addRouteToInternalIp: dest ip " + destIpOrCidr + " is in the same subnet as eth1 ip " + eth1ip); + return; + } + Script command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("ip route delete " + destIpOrCidr); + command.execute(); + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("ip route add " + destIpOrCidr + " via " + localgw); + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in configuring route to internal ip err=" + result ); + } else { + s_logger.debug("addRouteToInternalIp: added route to internal ip=" + destIpOrCidr + " via " + localgw); + } + } + + private void configureSSL() { + Script command = new Script(_configSslScr); + command.add("-i", _publicIp); + command.add("-h", _hostname); + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure httpd to use ssl"); + } + } + + private void configureSSL(String prvkeyPath, String prvCertPath, String certChainPath) { + Script command = new Script(_configSslScr); + command.add("-i", _publicIp); + command.add("-h", _hostname); + command.add("-k", prvkeyPath); + command.add("-p", prvCertPath); + if (certChainPath != null) { + command.add("-t", certChainPath); + } + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure httpd to use ssl"); + } + } + + private String configureAuth(String user, String passwd) { + Script command = new Script(_configAuthScr); + command.add(user); + command.add(passwd); + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure httpd to use auth"); + } + return result; + } + + private String configureIpFirewall(List ipList, boolean isAppend){ + Script command = new Script(_configIpFirewallScr); + command.add(String.valueOf(isAppend)); + for (String ip : ipList){ + command.add(ip); + } + + String result = command.execute(); + if (result != null) { + s_logger.warn("Unable to configure firewall for command : " +command); + } + return result; + } + + protected String mount(String root, String nfsPath) { File file = new File(root); if (!file.exists()) { if (_storage.mkdir(root)) { @@ -1691,8 +1695,8 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements s_logger.debug("Unable to create mount point: " + root); return null; } - } - + } + Script script = null; String result = null; script = new Script(!_inSystemVM, "mount", _timeout, s_logger); @@ -1705,12 +1709,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements return root; } } - + Script command = new Script(!_inSystemVM, "mount", _timeout, s_logger); command.add("-t", "nfs"); if (_inSystemVM) { - //Fedora Core 12 errors out with any -o option executed from java - command.add("-o", "soft,timeo=133,retrans=2147483647,tcp,acdirmax=0,acdirmin=0"); + //Fedora Core 12 errors out with any -o option executed from java + command.add("-o", "soft,timeo=133,retrans=2147483647,tcp,acdirmax=0,acdirmin=0"); } command.add(nfsPath); command.add(root); @@ -1719,23 +1723,23 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements s_logger.warn("Unable to mount " + nfsPath + " due to " + result); file = new File(root); if (file.exists()) - file.delete(); + file.delete(); return null; } - + // XXX: Adding the check for creation of snapshots dir here. Might have to move it somewhere more logical later. if (!checkForSnapshotsDir(root)) { - return null; + return null; } - + // Create the volumes dir if (!checkForVolumesDir(root)) { - return null; + return null; } - + return root; } - + @Override public boolean start() { return true; @@ -1748,12 +1752,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements @Override public StartupCommand[] initialize() { - + final StartupSecondaryStorageCommand cmd = new StartupSecondaryStorageCommand(); fillNetworkInformation(cmd); if(_publicIp != null) cmd.setPublicIpAddress(_publicIp); - + Script command = new Script("/bin/bash", s_logger); command.add("-c"); command.add("ln -sf " + _parent + " /var/www/html/copy"); @@ -1769,40 +1773,70 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements String snapshotsDirLocation = mountPoint + File.separator + "snapshots"; return createDir("snapshots", snapshotsDirLocation, mountPoint); } - - protected boolean checkForVolumesDir(String mountPoint) { - String volumesDirLocation = mountPoint + "/" + "volumes"; - return createDir("volumes", volumesDirLocation, mountPoint); - } - - protected boolean createDir(String dirName, String dirLocation, String mountPoint) { - boolean dirExists = false; - - File dir = new File(dirLocation); - if (dir.exists()) { - if (dir.isDirectory()) { - s_logger.debug(dirName + " already exists on secondary storage, and is mounted at " + mountPoint); - dirExists = true; - } else { - if (dir.delete() && _storage.mkdir(dirLocation)) { - dirExists = true; - } - } - } else if (_storage.mkdir(dirLocation)) { - dirExists = true; - } - if (dirExists) { - s_logger.info(dirName + " directory created/exists on Secondary Storage."); - } else { - s_logger.info(dirName + " directory does not exist on Secondary Storage."); - } - - return dirExists; + protected boolean checkForVolumesDir(String mountPoint) { + String volumesDirLocation = mountPoint + "/" + "volumes"; + return createDir("volumes", volumesDirLocation, mountPoint); } - + + protected boolean createDir(String dirName, String dirLocation, String mountPoint) { + boolean dirExists = false; + + File dir = new File(dirLocation); + if (dir.exists()) { + if (dir.isDirectory()) { + s_logger.debug(dirName + " already exists on secondary storage, and is mounted at " + mountPoint); + dirExists = true; + } else { + if (dir.delete() && _storage.mkdir(dirLocation)) { + dirExists = true; + } + } + } else if (_storage.mkdir(dirLocation)) { + dirExists = true; + } + + if (dirExists) { + s_logger.info(dirName + " directory created/exists on Secondary Storage."); + } else { + s_logger.info(dirName + " directory does not exist on Secondary Storage."); + } + + return dirExists; + } + @Override protected String getDefaultScriptsDir() { return "./scripts/storage/secondary"; } + + @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/core/src/com/cloud/storage/template/DownloadManagerImpl.java b/core/src/com/cloud/storage/template/DownloadManagerImpl.java index ab81bed7995..22e78a081c1 100755 --- a/core/src/com/cloud/storage/template/DownloadManagerImpl.java +++ b/core/src/com/cloud/storage/template/DownloadManagerImpl.java @@ -29,8 +29,8 @@ import java.security.NoSuchAlgorithmException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; -import java.util.Enumeration; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.UUID; @@ -43,7 +43,6 @@ import javax.naming.ConfigurationException; import org.apache.log4j.Logger; -import com.cloud.agent.api.Answer; import com.cloud.agent.api.storage.DownloadAnswer; import com.cloud.agent.api.storage.DownloadCommand; import com.cloud.agent.api.storage.DownloadCommand.Proxy; @@ -60,19 +59,16 @@ import com.cloud.storage.template.Processor.FormatInfo; import com.cloud.storage.template.TemplateDownloader.DownloadCompleteCallback; import com.cloud.storage.template.TemplateDownloader.Status; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Adapter; -import com.cloud.utils.component.Adapters; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.component.ComponentLocator.ComponentInfo; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.OutputInterpreter; import com.cloud.utils.script.Script; @Local(value = DownloadManager.class) -public class DownloadManagerImpl implements DownloadManager { +public class DownloadManagerImpl extends ManagerBase implements DownloadManager { private String _name; StorageLayer _storage; - Adapters _processors; + Map _processors; public class Completion implements DownloadCompleteCallback { private final String jobId; @@ -94,14 +90,14 @@ public class DownloadManagerImpl implements DownloadManager { private final boolean hvm; private final ImageFormat format; private String tmpltPath; - private String description; + private final String description; private String checksum; - private Long accountId; - private String installPathPrefix; + private final Long accountId; + private final String installPathPrefix; private long templatesize; private long templatePhysicalSize; - private long id; - private ResourceType resourceType; + private final long id; + private final ResourceType resourceType; public DownloadJob(TemplateDownloader td, String jobId, long id, String tmpltName, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix, ResourceType resourceType) { super(); @@ -160,10 +156,10 @@ public class DownloadManagerImpl implements DownloadManager { } public ResourceType getResourceType() { - return resourceType; - } + return resourceType; + } - public void setTmpltPath(String tmpltPath) { + public void setTmpltPath(String tmpltPath) { this.tmpltPath = tmpltPath; } @@ -205,9 +201,9 @@ public class DownloadManagerImpl implements DownloadManager { public long getTemplatePhysicalSize() { return templatePhysicalSize; } - + public void setCheckSum(String checksum) { - this.checksum = checksum; + this.checksum = checksum; } } @@ -216,7 +212,7 @@ public class DownloadManagerImpl implements DownloadManager { private String _volumeDir; private String createTmpltScr; private String createVolScr; - private Adapters processors; + private List processors; private ExecutorService threadPool; @@ -278,9 +274,9 @@ public class DownloadManagerImpl implements DownloadManager { break; } } - + private String computeCheckSum(File f) { - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[8192]; int read = 0; MessageDigest digest; String checksum = null; @@ -296,16 +292,16 @@ public class DownloadManagerImpl implements DownloadManager { checksum = String.format("%032x",bigInt); return checksum; }catch(IOException e) { - return null; + return null; }catch (NoSuchAlgorithmException e) { - return null; + return null; } finally { try { - if(is != null) - is.close(); + if(is != null) + is.close(); } catch (IOException e) { - return null; + return null; } } } @@ -320,17 +316,17 @@ public class DownloadManagerImpl implements DownloadManager { TemplateDownloader td = dnld.getTemplateDownloader(); String resourcePath = null; ResourceType resourceType = dnld.getResourceType(); - + // once template path is set, remove the parent dir so that the template is installed with a relative path String finalResourcePath = ""; if (resourceType == ResourceType.TEMPLATE){ - finalResourcePath += _templateDir + File.separator + dnld.getAccountId() + File.separator + dnld.getId() + File.separator; - resourcePath = dnld.getInstallPathPrefix() + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;// dnld.getTmpltName(); + finalResourcePath += _templateDir + File.separator + dnld.getAccountId() + File.separator + dnld.getId() + File.separator; + resourcePath = dnld.getInstallPathPrefix() + dnld.getAccountId() + File.separator + dnld.getId() + File.separator;// dnld.getTmpltName(); }else { - finalResourcePath += _volumeDir + File.separator + dnld.getId() + File.separator; - resourcePath = dnld.getInstallPathPrefix() + dnld.getId() + File.separator;// dnld.getTmpltName(); + finalResourcePath += _volumeDir + File.separator + dnld.getId() + File.separator; + resourcePath = dnld.getInstallPathPrefix() + dnld.getId() + File.separator;// dnld.getTmpltName(); } - + _storage.mkdirs(resourcePath); dnld.setTmpltPath(finalResourcePath); @@ -389,9 +385,9 @@ public class DownloadManagerImpl implements DownloadManager { // Set permissions for template/volume.properties String propertiesFile = resourcePath; if (resourceType == ResourceType.TEMPLATE){ - propertiesFile += "/template.properties"; + propertiesFile += "/template.properties"; }else{ - propertiesFile += "/volume.properties"; + propertiesFile += "/volume.properties"; } File templateProperties = new File(propertiesFile); _storage.setWorldReadableAndWriteable(templateProperties); @@ -405,9 +401,9 @@ public class DownloadManagerImpl implements DownloadManager { return "Unable to download due to " + e.getMessage(); } - Enumeration en = _processors.enumeration(); - while (en.hasMoreElements()) { - Processor processor = en.nextElement(); + Iterator en = _processors.values().iterator(); + while (en.hasNext()) { + Processor processor = en.next(); FormatInfo info = null; try { @@ -423,7 +419,7 @@ public class DownloadManagerImpl implements DownloadManager { break; } } - + if (!loc.save()) { s_logger.warn("Cleaning up because we're unable to save the formats"); loc.purge(); @@ -450,9 +446,9 @@ public class DownloadManagerImpl implements DownloadManager { String jobId = uuid.toString(); String tmpDir = ""; if(resourceType == ResourceType.TEMPLATE){ - tmpDir = installPathPrefix + File.separator + accountId + File.separator + id; + tmpDir = installPathPrefix + File.separator + accountId + File.separator + id; }else { - tmpDir = installPathPrefix + File.separator + id; + tmpDir = installPathPrefix + File.separator + id; } try { @@ -463,7 +459,7 @@ public class DownloadManagerImpl implements DownloadManager { } // TO DO - define constant for volume properties. File file = ResourceType.TEMPLATE == resourceType ? _storage.getFile(tmpDir + File.separator + TemplateLocation.Filename) : - _storage.getFile(tmpDir + File.separator + "volume.properties"); + _storage.getFile(tmpDir + File.separator + "volume.properties"); if ( file.exists() ) { file.delete(); } @@ -524,9 +520,9 @@ public class DownloadManagerImpl implements DownloadManager { } return 0; } - + public String getDownloadCheckSum(String jobId) { - DownloadJob dj = jobs.get(jobId); + DownloadJob dj = jobs.get(jobId); if (dj != null) { return dj.getChecksum(); } @@ -589,7 +585,7 @@ public class DownloadManagerImpl implements DownloadManager { @Override public DownloadAnswer handleDownloadCommand(SecondaryStorageResource resource, DownloadCommand cmd) { - ResourceType resourceType = cmd.getResourceType(); + ResourceType resourceType = cmd.getResourceType(); if (cmd instanceof DownloadProgressCommand) { return handleDownloadProgressCmd( resource, (DownloadProgressCommand) cmd); } @@ -604,9 +600,9 @@ public class DownloadManagerImpl implements DownloadManager { String installPathPrefix = null; if (ResourceType.TEMPLATE == resourceType){ - installPathPrefix = resource.getRootDir(cmd) + File.separator + _templateDir; + installPathPrefix = resource.getRootDir(cmd) + File.separator + _templateDir; }else { - installPathPrefix = resource.getRootDir(cmd) + File.separator + _volumeDir; + installPathPrefix = resource.getRootDir(cmd) + File.separator + _volumeDir; } String user = null; @@ -693,10 +689,10 @@ public class DownloadManagerImpl implements DownloadManager { } - + private List listVolumes(String rootdir) { List result = new ArrayList(); - + Script script = new Script(listVolScr, s_logger); script.add("-r", rootdir); ZfsPathParser zpp = new ZfsPathParser(rootdir); @@ -705,12 +701,12 @@ public class DownloadManagerImpl implements DownloadManager { s_logger.info("found " + zpp.getPaths().size() + " volumes" + zpp.getPaths()); return result; } - - - + + + private List listTemplates(String rootdir) { List result = new ArrayList(); - + Script script = new Script(listTmpltScr, s_logger); script.add("-r", rootdir); ZfsPathParser zpp = new ZfsPathParser(rootdir); @@ -724,11 +720,11 @@ public class DownloadManagerImpl implements DownloadManager { public Map gatherTemplateInfo(String rootDir) { Map result = new HashMap(); String templateDir = rootDir + File.separator + _templateDir; - + if (! _storage.exists(templateDir)) { _storage.mkdirs(templateDir); } - + List publicTmplts = listTemplates(templateDir); for (String tmplt : publicTmplts) { String path = tmplt.substring(0, tmplt.lastIndexOf(File.separator)); @@ -746,18 +742,18 @@ public class DownloadManagerImpl implements DownloadManager { } TemplateInfo tInfo = loc.getTemplateInfo(); - + if ((tInfo.size == tInfo.physicalSize) && (tInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) { - try { - Processor processor = _processors.get("VMDK Processor"); - VmdkProcessor vmdkProcessor = (VmdkProcessor)processor; - long vSize = vmdkProcessor.getTemplateVirtualSize(path, tInfo.installPath.substring(tInfo.installPath.lastIndexOf(File.separator) + 1)); - tInfo.size = vSize; - loc.updateVirtualSize(vSize); - loc.save(); - } catch (Exception e) { - s_logger.error("Unable to get the virtual size of the template: " + tInfo.installPath + " due to " + e.getMessage()); - } + try { + Processor processor = _processors.get("VMDK Processor"); + VmdkProcessor vmdkProcessor = (VmdkProcessor)processor; + long vSize = vmdkProcessor.getTemplateVirtualSize(path, tInfo.installPath.substring(tInfo.installPath.lastIndexOf(File.separator) + 1)); + tInfo.size = vSize; + loc.updateVirtualSize(vSize); + loc.save(); + } catch (Exception e) { + s_logger.error("Unable to get the virtual size of the template: " + tInfo.installPath + " due to " + e.getMessage()); + } } result.put(tInfo.templateName, tInfo); @@ -777,52 +773,52 @@ public class DownloadManagerImpl implements DownloadManager { return result; } - @Override - public Map gatherVolumeInfo(String rootDir) { - Map result = new HashMap(); - String volumeDir = rootDir + File.separator + _volumeDir; - - if (! _storage.exists(volumeDir)) { - _storage.mkdirs(volumeDir); - } - - List vols = listVolumes(volumeDir); - for (String vol : vols) { - String path = vol.substring(0, vol.lastIndexOf(File.separator)); - TemplateLocation loc = new TemplateLocation(_storage, path); - try { - if (!loc.load()) { - s_logger.warn("Post download installation was not completed for " + path); - //loc.purge(); - _storage.cleanup(path, volumeDir); - continue; - } - } catch (IOException e) { - s_logger.warn("Unable to load volume location " + path, e); - continue; - } + @Override + public Map gatherVolumeInfo(String rootDir) { + Map result = new HashMap(); + String volumeDir = rootDir + File.separator + _volumeDir; - TemplateInfo vInfo = loc.getTemplateInfo(); - - if ((vInfo.size == vInfo.physicalSize) && (vInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) { - try { - Processor processor = _processors.get("VMDK Processor"); - VmdkProcessor vmdkProcessor = (VmdkProcessor)processor; - long vSize = vmdkProcessor.getTemplateVirtualSize(path, vInfo.installPath.substring(vInfo.installPath.lastIndexOf(File.separator) + 1)); - vInfo.size = vSize; - loc.updateVirtualSize(vSize); - loc.save(); - } catch (Exception e) { - s_logger.error("Unable to get the virtual size of the volume: " + vInfo.installPath + " due to " + e.getMessage()); - } - } + if (! _storage.exists(volumeDir)) { + _storage.mkdirs(volumeDir); + } + + List vols = listVolumes(volumeDir); + for (String vol : vols) { + String path = vol.substring(0, vol.lastIndexOf(File.separator)); + TemplateLocation loc = new TemplateLocation(_storage, path); + try { + if (!loc.load()) { + s_logger.warn("Post download installation was not completed for " + path); + //loc.purge(); + _storage.cleanup(path, volumeDir); + continue; + } + } catch (IOException e) { + s_logger.warn("Unable to load volume location " + path, e); + continue; + } + + TemplateInfo vInfo = loc.getTemplateInfo(); + + if ((vInfo.size == vInfo.physicalSize) && (vInfo.installPath.endsWith(ImageFormat.OVA.getFileExtension()))) { + try { + Processor processor = _processors.get("VMDK Processor"); + VmdkProcessor vmdkProcessor = (VmdkProcessor)processor; + long vSize = vmdkProcessor.getTemplateVirtualSize(path, vInfo.installPath.substring(vInfo.installPath.lastIndexOf(File.separator) + 1)); + vInfo.size = vSize; + loc.updateVirtualSize(vSize); + loc.save(); + } catch (Exception e) { + s_logger.error("Unable to get the virtual size of the volume: " + vInfo.installPath + " due to " + e.getMessage()); + } + } + + result.put(vInfo.getId(), vInfo); + s_logger.debug("Added volume name: " + vInfo.templateName + ", path: " + vol); + } + return result; + } - result.put(vInfo.getId(), vInfo); - s_logger.debug("Added volume name: " + vInfo.templateName + ", path: " + vol); - } - return result; - } - private int deleteDownloadDirectories(File downloadPath, int deleted) { try { if (downloadPath.exists()) { @@ -881,7 +877,7 @@ public class DownloadManagerImpl implements DownloadManager { String value = null; - _storage = (StorageLayer) params.get(StorageLayer.InstanceConfigKey); + _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { value = (String) params.get(StorageLayer.ClassConfigKey); if (value == null) { @@ -891,10 +887,14 @@ public class DownloadManagerImpl implements DownloadManager { Class clazz; try { clazz = (Class) Class.forName(value); + _storage = clazz.newInstance(); } catch (ClassNotFoundException e) { throw new ConfigurationException("Unable to instantiate " + value); + } catch (InstantiationException e) { + throw new ConfigurationException("Unable to instantiate " + value); + } catch (IllegalAccessException e) { + throw new ConfigurationException("Unable to instantiate " + value); } - _storage = ComponentLocator.inject(clazz); } String useSsl = (String)params.get("sslcopy"); if (useSsl != null) { @@ -943,29 +943,27 @@ public class DownloadManagerImpl implements DownloadManager { } s_logger.info("createvolume.sh found in " + createVolScr); - List> processors = new ArrayList>(); + _processors = new HashMap(); Processor processor = new VhdProcessor(); processor.configure("VHD Processor", params); - processors.add(new ComponentInfo("VHD Processor", VhdProcessor.class, processor)); + _processors.put("VHD Processor", processor); processor = new IsoProcessor(); processor.configure("ISO Processor", params); - processors.add(new ComponentInfo("ISO Processor", IsoProcessor.class, processor)); + _processors.put("ISO Processor", processor); processor = new QCOW2Processor(); processor.configure("QCOW2 Processor", params); - processors.add(new ComponentInfo("QCOW2 Processor", QCOW2Processor.class, processor)); + _processors.put("QCOW2 Processor", processor); processor = new VmdkProcessor(); processor.configure("VMDK Processor", params); - processors.add(new ComponentInfo("VMDK Processor", VmdkProcessor.class, processor)); + _processors.put("VMDK Processor", processor); processor = new RawImageProcessor(); processor.configure("Raw Image Processor", params); - processors.add(new ComponentInfo("Raw Image Processor", RawImageProcessor.class, processor)); - - _processors = new Adapters("processors", processors); + _processors.put("Raw Image Processor", processor); _templateDir = (String) params.get("public.templates.root.dir"); if (_templateDir == null) { @@ -1047,5 +1045,5 @@ public class DownloadManagerImpl implements DownloadManager { return; } } - + } diff --git a/core/src/com/cloud/storage/template/IsoProcessor.java b/core/src/com/cloud/storage/template/IsoProcessor.java index 112002a641d..c8cde65738d 100644 --- a/core/src/com/cloud/storage/template/IsoProcessor.java +++ b/core/src/com/cloud/storage/template/IsoProcessor.java @@ -26,12 +26,12 @@ import org.apache.log4j.Logger; import com.cloud.storage.StorageLayer; import com.cloud.storage.Storage.ImageFormat; +import com.cloud.utils.component.AdapterBase; @Local(value=Processor.class) -public class IsoProcessor implements Processor { +public class IsoProcessor extends AdapterBase implements Processor { private static final Logger s_logger = Logger.getLogger(IsoProcessor.class); - String _name; StorageLayer _storage; @Override @@ -59,26 +59,10 @@ public class IsoProcessor implements Processor { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { throw new ConfigurationException("Unable to get storage implementation"); } return true; } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } } diff --git a/core/src/com/cloud/storage/template/QCOW2Processor.java b/core/src/com/cloud/storage/template/QCOW2Processor.java index 15af8490ea9..09dcfe2ea1c 100644 --- a/core/src/com/cloud/storage/template/QCOW2Processor.java +++ b/core/src/com/cloud/storage/template/QCOW2Processor.java @@ -29,11 +29,11 @@ import org.apache.log4j.Logger; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageLayer; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.AdapterBase; @Local(value=Processor.class) -public class QCOW2Processor implements Processor { +public class QCOW2Processor extends AdapterBase implements Processor { private static final Logger s_logger = Logger.getLogger(QCOW2Processor.class); - String _name; StorageLayer _storage; @Override @@ -85,7 +85,6 @@ public class QCOW2Processor implements Processor { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { throw new ConfigurationException("Unable to get storage implementation"); @@ -93,22 +92,4 @@ public class QCOW2Processor implements Processor { return true; } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - // TODO Auto-generated method stub - return true; - } - - @Override - public boolean stop() { - // TODO Auto-generated method stub - return true; - } - } diff --git a/core/src/com/cloud/storage/template/RawImageProcessor.java b/core/src/com/cloud/storage/template/RawImageProcessor.java index 694c76a7074..7833eabcabf 100644 --- a/core/src/com/cloud/storage/template/RawImageProcessor.java +++ b/core/src/com/cloud/storage/template/RawImageProcessor.java @@ -28,17 +28,16 @@ import com.cloud.exception.InternalErrorException; import com.cloud.storage.StorageLayer; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.template.Processor.FormatInfo; +import com.cloud.utils.component.AdapterBase; @Local(value=Processor.class) -public class RawImageProcessor implements Processor { +public class RawImageProcessor extends AdapterBase implements Processor { private static final Logger s_logger = Logger.getLogger(RawImageProcessor.class); - String _name; StorageLayer _storage; @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { throw new ConfigurationException("Unable to get storage implementation"); @@ -47,21 +46,6 @@ public class RawImageProcessor implements Processor { return true; } - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - @Override public FormatInfo process(String templatePath, ImageFormat format, String templateName) throws InternalErrorException { diff --git a/core/src/com/cloud/storage/template/UploadManagerImpl.java b/core/src/com/cloud/storage/template/UploadManagerImpl.java index 2dd1751aeaa..2492a1be2b2 100755 --- a/core/src/com/cloud/storage/template/UploadManagerImpl.java +++ b/core/src/com/cloud/storage/template/UploadManagerImpl.java @@ -21,6 +21,7 @@ import java.net.URI; import java.net.URISyntaxException; import java.text.SimpleDateFormat; import java.util.Date; +import java.util.List; import java.util.Map; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -46,15 +47,14 @@ import com.cloud.storage.resource.SecondaryStorageResource; import com.cloud.storage.template.TemplateUploader.Status; import com.cloud.storage.template.TemplateUploader.UploadCompleteCallback; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Adapters; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; -public class UploadManagerImpl implements UploadManager { +public class UploadManagerImpl extends ManagerBase implements UploadManager { - public class Completion implements UploadCompleteCallback { + public class Completion implements UploadCompleteCallback { private final String jobId; public Completion(String jobId) { @@ -66,180 +66,179 @@ public class UploadManagerImpl implements UploadManager { setUploadStatus(jobId, status); } } - - private static class UploadJob { - private final TemplateUploader tu; - private final String jobId; - private final String name; - private final ImageFormat format; - private String tmpltPath; - private String description; - private String checksum; - private Long accountId; - private String installPathPrefix; - private long templatesize; - private long id; - public UploadJob(TemplateUploader tu, String jobId, long id, String name, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix) { - super(); - this.tu = tu; - this.jobId = jobId; - this.name = name; - this.format = format; - this.accountId = accountId; - this.description = descr; - this.checksum = cksum; - this.installPathPrefix = installPathPrefix; - this.templatesize = 0; - this.id = id; - } + private static class UploadJob { + private final TemplateUploader tu; + private final String jobId; + private final String name; + private final ImageFormat format; + private String tmpltPath; + private String description; + private String checksum; + private Long accountId; + private String installPathPrefix; + private long templatesize; + private long id; - public TemplateUploader getTd() { - return tu; - } + public UploadJob(TemplateUploader tu, String jobId, long id, String name, ImageFormat format, boolean hvm, Long accountId, String descr, String cksum, String installPathPrefix) { + super(); + this.tu = tu; + this.jobId = jobId; + this.name = name; + this.format = format; + this.accountId = accountId; + this.description = descr; + this.checksum = cksum; + this.installPathPrefix = installPathPrefix; + this.templatesize = 0; + this.id = id; + } - public String getDescription() { - return description; - } + public TemplateUploader getTd() { + return tu; + } - public String getChecksum() { - return checksum; - } + public String getDescription() { + return description; + } - public UploadJob(TemplateUploader td, String jobId, UploadCommand cmd) { - this.tu = td; - this.jobId = jobId; - this.name = cmd.getName(); - this.format = cmd.getFormat(); - } + public String getChecksum() { + return checksum; + } - public TemplateUploader getTemplateUploader() { - return tu; - } + public UploadJob(TemplateUploader td, String jobId, UploadCommand cmd) { + this.tu = td; + this.jobId = jobId; + this.name = cmd.getName(); + this.format = cmd.getFormat(); + } - public String getJobId() { - return jobId; - } + public TemplateUploader getTemplateUploader() { + return tu; + } - public String getTmpltName() { - return name; - } + public String getJobId() { + return jobId; + } - public ImageFormat getFormat() { - return format; - } + public String getTmpltName() { + return name; + } - public Long getAccountId() { - return accountId; - } + public ImageFormat getFormat() { + return format; + } - public long getId() { - return id; - } + public Long getAccountId() { + return accountId; + } - public void setTmpltPath(String tmpltPath) { - this.tmpltPath = tmpltPath; - } + public long getId() { + return id; + } - public String getTmpltPath() { - return tmpltPath; - } + public void setTmpltPath(String tmpltPath) { + this.tmpltPath = tmpltPath; + } - public String getInstallPathPrefix() { - return installPathPrefix; - } + public String getTmpltPath() { + return tmpltPath; + } - public void cleanup() { - if (tu != null) { - String upldPath = tu.getUploadLocalPath(); - if (upldPath != null) { - File f = new File(upldPath); - f.delete(); - } - } - } + public String getInstallPathPrefix() { + return installPathPrefix; + } - public void setTemplatesize(long templatesize) { - this.templatesize = templatesize; - } + public void cleanup() { + if (tu != null) { + String upldPath = tu.getUploadLocalPath(); + if (upldPath != null) { + File f = new File(upldPath); + f.delete(); + } + } + } + + public void setTemplatesize(long templatesize) { + this.templatesize = templatesize; + } + + public long getTemplatesize() { + return templatesize; + } + } + public static final Logger s_logger = Logger.getLogger(UploadManagerImpl.class); + private ExecutorService threadPool; + private final Map jobs = new ConcurrentHashMap(); + private String parentDir; + private List _processors; + private String publicTemplateRepo; + private final String extractMountPoint = "/mnt/SecStorage/extractmnt"; + private StorageLayer _storage; + private int installTimeoutPerGig; + private boolean _sslCopy; + private boolean hvm; + + + @Override + public String uploadPublicTemplate(long id, String url, String name, + ImageFormat format, Long accountId, String descr, + String cksum, String installPathPrefix, String userName, + String passwd, long templateSizeInBytes) { - public long getTemplatesize() { - return templatesize; - } - } - public static final Logger s_logger = Logger.getLogger(UploadManagerImpl.class); - private ExecutorService threadPool; - private final Map jobs = new ConcurrentHashMap(); - private String parentDir; - private Adapters _processors; - private String publicTemplateRepo; - private String extractMountPoint = "/mnt/SecStorage/extractmnt"; - private StorageLayer _storage; - private int installTimeoutPerGig; - private boolean _sslCopy; - private String _name; - private boolean hvm; - - - @Override - public String uploadPublicTemplate(long id, String url, String name, - ImageFormat format, Long accountId, String descr, - String cksum, String installPathPrefix, String userName, - String passwd, long templateSizeInBytes) { - UUID uuid = UUID.randomUUID(); String jobId = uuid.toString(); String completePath = parentDir + File.separator + installPathPrefix; s_logger.debug("Starting upload from " + completePath); - + URI uri; - try { - uri = new URI(url); - } catch (URISyntaxException e) { - s_logger.error("URI is incorrect: " + url); - throw new CloudRuntimeException("URI is incorrect: " + url); - } - TemplateUploader tu; - if ((uri != null) && (uri.getScheme() != null)) { - if (uri.getScheme().equalsIgnoreCase("ftp")) { - tu = new FtpTemplateUploader(completePath, url, new Completion(jobId), templateSizeInBytes); - } else { - s_logger.error("Scheme is not supported " + url); - throw new CloudRuntimeException("Scheme is not supported " + url); - } - } else { - s_logger.error("Unable to download from URL: " + url); - throw new CloudRuntimeException("Unable to download from URL: " + url); - } - UploadJob uj = new UploadJob(tu, jobId, id, name, format, hvm, accountId, descr, cksum, installPathPrefix); - jobs.put(jobId, uj); - threadPool.execute(tu); + try { + uri = new URI(url); + } catch (URISyntaxException e) { + s_logger.error("URI is incorrect: " + url); + throw new CloudRuntimeException("URI is incorrect: " + url); + } + TemplateUploader tu; + if ((uri != null) && (uri.getScheme() != null)) { + if (uri.getScheme().equalsIgnoreCase("ftp")) { + tu = new FtpTemplateUploader(completePath, url, new Completion(jobId), templateSizeInBytes); + } else { + s_logger.error("Scheme is not supported " + url); + throw new CloudRuntimeException("Scheme is not supported " + url); + } + } else { + s_logger.error("Unable to download from URL: " + url); + throw new CloudRuntimeException("Unable to download from URL: " + url); + } + UploadJob uj = new UploadJob(tu, jobId, id, name, format, hvm, accountId, descr, cksum, installPathPrefix); + jobs.put(jobId, uj); + threadPool.execute(tu); - return jobId; - - } + return jobId; - @Override - public String getUploadError(String jobId) { + } + + @Override + public String getUploadError(String jobId) { UploadJob uj = jobs.get(jobId); if (uj != null) { return uj.getTemplateUploader().getUploadError(); } return null; - } + } - @Override - public int getUploadPct(String jobId) { - UploadJob uj = jobs.get(jobId); + @Override + public int getUploadPct(String jobId) { + UploadJob uj = jobs.get(jobId); if (uj != null) { return uj.getTemplateUploader().getUploadPercent(); } return 0; - } + } - @Override - public Status getUploadStatus(String jobId) { + @Override + public Status getUploadStatus(String jobId) { UploadJob job = jobs.get(jobId); if (job != null) { TemplateUploader tu = job.getTemplateUploader(); @@ -248,8 +247,8 @@ public class UploadManagerImpl implements UploadManager { } } return Status.UNKNOWN; - } - + } + public static UploadVO.Status convertStatus(Status tds) { switch (tds) { case ABORTED: @@ -277,11 +276,11 @@ public class UploadManagerImpl implements UploadManager { public com.cloud.storage.UploadVO.Status getUploadStatus2(String jobId) { return convertStatus(getUploadStatus(jobId)); } - @Override - public String getPublicTemplateRepo() { - // TODO Auto-generated method stub - return null; - } + @Override + public String getPublicTemplateRepo() { + // TODO Auto-generated method stub + return null; + } private UploadAnswer handleUploadProgressCmd(UploadProgressCommand cmd) { String jobId = cmd.getJobId(); @@ -290,7 +289,7 @@ public class UploadManagerImpl implements UploadManager { if (jobId != null) uj = jobs.get(jobId); if (uj == null) { - return new UploadAnswer(null, 0, "Cannot find job", com.cloud.storage.UploadVO.Status.UNKNOWN, "", "", 0); + return new UploadAnswer(null, 0, "Cannot find job", com.cloud.storage.UploadVO.Status.UNKNOWN, "", "", 0); } TemplateUploader td = uj.getTemplateUploader(); switch (cmd.getRequest()) { @@ -300,7 +299,7 @@ public class UploadManagerImpl implements UploadManager { td.stopUpload(); sleep(); break; - /*case RESTART: + /*case RESTART: td.stopUpload(); sleep(); threadPool.execute(td); @@ -316,10 +315,10 @@ public class UploadManagerImpl implements UploadManager { return new UploadAnswer(jobId, getUploadPct(jobId), getUploadError(jobId), getUploadStatus2(jobId), getUploadLocalPath(jobId), getInstallPath(jobId), getUploadTemplateSize(jobId)); } - + @Override public UploadAnswer handleUploadCommand(SecondaryStorageResource resource, UploadCommand cmd) { - s_logger.warn("Handling the upload " +cmd.getInstallPath() + " " + cmd.getId()); + s_logger.warn("Handling the upload " +cmd.getInstallPath() + " " + cmd.getId()); if (cmd instanceof UploadProgressCommand) { return handleUploadProgressCmd((UploadProgressCommand) cmd); } @@ -327,9 +326,9 @@ public class UploadManagerImpl implements UploadManager { String user = null; String password = null; String jobId = uploadPublicTemplate(cmd.getId(), cmd.getUrl(), cmd.getName(), - cmd.getFormat(), cmd.getAccountId(), cmd.getDescription(), - cmd.getChecksum(), cmd.getInstallPath(), user, password, - cmd.getTemplateSizeInBytes()); + cmd.getFormat(), cmd.getAccountId(), cmd.getDescription(), + cmd.getChecksum(), cmd.getInstallPath(), user, password, + cmd.getTemplateSizeInBytes()); sleep(); if (jobId == null) { return new UploadAnswer(null, 0, "Internal Error", com.cloud.storage.UploadVO.Status.UPLOAD_ERROR, "", "", 0); @@ -337,18 +336,18 @@ public class UploadManagerImpl implements UploadManager { return new UploadAnswer(jobId, getUploadPct(jobId), getUploadError(jobId), getUploadStatus2(jobId), getUploadLocalPath(jobId), getInstallPath(jobId), getUploadTemplateSize(jobId)); } - + @Override public CreateEntityDownloadURLAnswer handleCreateEntityURLCommand(CreateEntityDownloadURLCommand cmd){ - - boolean isApacheUp = checkAndStartApache(); - if (!isApacheUp){ - String errorString = "Error in starting Apache server "; + + boolean isApacheUp = checkAndStartApache(); + if (!isApacheUp){ + String errorString = "Error in starting Apache server "; s_logger.error(errorString); return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); - } + } // Create the directory structure so that its visible under apache server root - String extractDir = "/var/www/html/userdata/"; + String extractDir = "/var/www/html/userdata/"; Script command = new Script("mkdir", s_logger); command.add("-p"); command.add(extractDir); @@ -358,19 +357,19 @@ public class UploadManagerImpl implements UploadManager { s_logger.error(errorString); return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); } - + // Create a random file under the directory for security reasons. String uuid = cmd.getExtractLinkUUID(); - command = new Script("touch", s_logger); - command.add(extractDir + uuid); - result = command.execute(); - if (result != null) { - String errorString = "Error in creating file " +uuid+ " ,error: " + result; - s_logger.warn(errorString); - return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); - } + command = new Script("touch", s_logger); + command.add(extractDir + uuid); + result = command.execute(); + if (result != null) { + String errorString = "Error in creating file " +uuid+ " ,error: " + result; + s_logger.warn(errorString); + return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); + } + - // Create a symbolic link from the actual directory to the template location. The entity would be directly visible under /var/www/html/userdata/cmd.getInstallPath(); command = new Script("/bin/bash", s_logger); command.add("-c"); @@ -381,11 +380,11 @@ public class UploadManagerImpl implements UploadManager { s_logger.error(errorString); return new CreateEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); } - + return new CreateEntityDownloadURLAnswer("", CreateEntityDownloadURLAnswer.RESULT_SUCCESS); - + } - + @Override public DeleteEntityDownloadURLAnswer handleDeleteEntityDownloadURLCommand(DeleteEntityDownloadURLCommand cmd){ @@ -394,8 +393,8 @@ public class UploadManagerImpl implements UploadManager { String path = cmd.getPath(); Script command = new Script("/bin/bash", s_logger); command.add("-c"); - - //We just need to remove the UUID.vhd + + //We just need to remove the UUID.vhd String extractUrl = cmd.getExtractUrl(); command.add("unlink /var/www/html/userdata/" +extractUrl.substring(extractUrl.lastIndexOf(File.separator) + 1)); String result = command.execute(); @@ -404,7 +403,7 @@ public class UploadManagerImpl implements UploadManager { s_logger.warn(errorString); return new DeleteEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); } - + // If its a volume also delete the Hard link since it was created only for the purpose of download. if(cmd.getType() == Upload.Type.VOLUME){ command = new Script("/bin/bash", s_logger); @@ -418,32 +417,31 @@ public class UploadManagerImpl implements UploadManager { return new DeleteEntityDownloadURLAnswer(errorString, CreateEntityDownloadURLAnswer.RESULT_FAILURE); } } - + return new DeleteEntityDownloadURLAnswer("", CreateEntityDownloadURLAnswer.RESULT_SUCCESS); } - private String getInstallPath(String jobId) { - // TODO Auto-generated method stub - return null; - } + private String getInstallPath(String jobId) { + // TODO Auto-generated method stub + return null; + } - private String getUploadLocalPath(String jobId) { - // TODO Auto-generated method stub - return null; - } + private String getUploadLocalPath(String jobId) { + // TODO Auto-generated method stub + return null; + } - private long getUploadTemplateSize(String jobId){ - UploadJob uj = jobs.get(jobId); + private long getUploadTemplateSize(String jobId){ + UploadJob uj = jobs.get(jobId); if (uj != null) { return uj.getTemplatesize(); } return 0; - } + } - @Override - public boolean configure(String name, Map params) - throws ConfigurationException { - _name = name; + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { String value = null; @@ -457,21 +455,25 @@ public class UploadManagerImpl implements UploadManager { Class clazz; try { clazz = (Class) Class.forName(value); + _storage = clazz.newInstance(); } catch (ClassNotFoundException e) { throw new ConfigurationException("Unable to instantiate " + value); + } catch (InstantiationException e) { + throw new ConfigurationException("Unable to instantiate " + value); + } catch (IllegalAccessException e) { + throw new ConfigurationException("Unable to instantiate " + value); } - _storage = ComponentLocator.inject(clazz); } String useSsl = (String)params.get("sslcopy"); if (useSsl != null) { - _sslCopy = Boolean.parseBoolean(useSsl); - + _sslCopy = Boolean.parseBoolean(useSsl); + } String inSystemVM = (String)params.get("secondary.storage.vm"); if (inSystemVM != null && "true".equalsIgnoreCase(inSystemVM)) { - s_logger.info("UploadManager: starting additional services since we are inside system vm"); - startAdditionalServices(); - //blockOutgoingOnPrivate(); + s_logger.info("UploadManager: starting additional services since we are inside system vm"); + startAdditionalServices(); + //blockOutgoingOnPrivate(); } value = (String) params.get("install.timeout.pergig"); @@ -489,53 +491,38 @@ public class UploadManagerImpl implements UploadManager { threadPool = Executors.newFixedThreadPool(numInstallThreads); return true; - } - - private void startAdditionalServices() { - - - Script command = new Script("rm", s_logger); - command.add("-rf"); - command.add(extractMountPoint); - String result = command.execute(); - if (result != null) { - s_logger.warn("Error in creating file " +extractMountPoint+ " ,error: " + result ); - return; - } - - command = new Script("touch", s_logger); - command.add(extractMountPoint); - result = command.execute(); - if (result != null) { - s_logger.warn("Error in creating file " +extractMountPoint+ " ,error: " + result ); - return; - } - - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("ln -sf " + parentDir + " " +extractMountPoint); - result = command.execute(); - if (result != null) { - s_logger.warn("Error in linking err=" + result ); - return; - } - - } + } - @Override - public String getName() { - return _name; - } + private void startAdditionalServices() { - @Override - public boolean start() { - return true; - } - @Override - public boolean stop() { - return true; - } + Script command = new Script("rm", s_logger); + command.add("-rf"); + command.add(extractMountPoint); + String result = command.execute(); + if (result != null) { + s_logger.warn("Error in creating file " +extractMountPoint+ " ,error: " + result ); + return; + } + + command = new Script("touch", s_logger); + command.add(extractMountPoint); + result = command.execute(); + if (result != null) { + s_logger.warn("Error in creating file " +extractMountPoint+ " ,error: " + result ); + return; + } + + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("ln -sf " + parentDir + " " +extractMountPoint); + result = command.execute(); + if (result != null) { + s_logger.warn("Error in linking err=" + result ); + return; + } + + } /** * Get notified of change of job status. Executed in context of uploader thread @@ -582,7 +569,7 @@ public class UploadManagerImpl implements UploadManager { tu.setStatus(Status.UNRECOVERABLE_ERROR); tu.setUploadError("Failed post upload script: " + result); } else { - s_logger.warn("Upload completed successfully at " + new SimpleDateFormat().format(new Date())); + s_logger.warn("Upload completed successfully at " + new SimpleDateFormat().format(new Date())); tu.setStatus(Status.POST_UPLOAD_FINISHED); tu.setUploadError("Upload completed successfully at " + new SimpleDateFormat().format(new Date())); } @@ -596,9 +583,9 @@ public class UploadManagerImpl implements UploadManager { } } - private String postUpload(String jobId) { - return null; - } + private String postUpload(String jobId) { + return null; + } private void sleep() { try { @@ -608,21 +595,21 @@ public class UploadManagerImpl implements UploadManager { } } - private boolean checkAndStartApache() { - - //Check whether the Apache server is running - Script command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("if [ -d /etc/apache2 ] ; then service apache2 status | grep pid; else service httpd status | grep pid; fi "); - String result = command.execute(); - - //Apache Server is not running. Try to start it. - if (result != null) { - - /*s_logger.warn("Apache server not running, trying to start it"); + private boolean checkAndStartApache() { + + //Check whether the Apache server is running + Script command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("if [ -d /etc/apache2 ] ; then service apache2 status | grep pid; else service httpd status | grep pid; fi "); + String result = command.execute(); + + //Apache Server is not running. Try to start it. + if (result != null) { + + /*s_logger.warn("Apache server not running, trying to start it"); String port = Integer.toString(TemplateConstants.DEFAULT_TMPLT_COPY_PORT); String intf = TemplateConstants.DEFAULT_TMPLT_COPY_INTF; - + command = new Script("/bin/bash", s_logger); command.add("-c"); command.add("iptables -D INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j DROP;" + @@ -636,23 +623,23 @@ public class UploadManagerImpl implements UploadManager { "iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j DROP;" + "iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + port + " -j HTTP;" + "iptables -I INPUT -i " + intf + " -p tcp -m state --state NEW -m tcp --dport " + "443" + " -j HTTP;"); - + result = command.execute(); if (result != null) { s_logger.warn("Error in opening up httpd port err=" + result ); return false; }*/ - - command = new Script("/bin/bash", s_logger); - command.add("-c"); - command.add("if [ -d /etc/apache2 ] ; then service apache2 start; else service httpd start; fi "); - result = command.execute(); - if (result != null) { - s_logger.warn("Error in starting httpd service err=" + result ); - return false; - } - } - - return true; - } + + command = new Script("/bin/bash", s_logger); + command.add("-c"); + command.add("if [ -d /etc/apache2 ] ; then service apache2 start; else service httpd start; fi "); + result = command.execute(); + if (result != null) { + s_logger.warn("Error in starting httpd service err=" + result ); + return false; + } + } + + return true; + } } diff --git a/core/src/com/cloud/storage/template/VhdProcessor.java b/core/src/com/cloud/storage/template/VhdProcessor.java index b65b1dc876d..cabc74b40a6 100644 --- a/core/src/com/cloud/storage/template/VhdProcessor.java +++ b/core/src/com/cloud/storage/template/VhdProcessor.java @@ -31,6 +31,7 @@ import com.cloud.exception.InternalErrorException; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageLayer; import com.cloud.utils.NumbersUtil; +import com.cloud.utils.component.AdapterBase; /** * VhdProcessor processes the downloaded template for VHD. It @@ -39,10 +40,9 @@ import com.cloud.utils.NumbersUtil; * */ @Local(value=Processor.class) -public class VhdProcessor implements Processor { +public class VhdProcessor extends AdapterBase implements Processor { private static final Logger s_logger = Logger.getLogger(VhdProcessor.class); - String _name; StorageLayer _storage; private int vhd_footer_size = 512; private int vhd_footer_creator_app_offset = 28; @@ -110,21 +110,6 @@ public class VhdProcessor implements Processor { return true; } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } private void imageSignatureCheck(byte[] creatorApp) throws InternalErrorException { boolean findKnownCreator = false; diff --git a/core/src/com/cloud/storage/template/VmdkProcessor.java b/core/src/com/cloud/storage/template/VmdkProcessor.java index ec7f014b4fd..e0740411b56 100644 --- a/core/src/com/cloud/storage/template/VmdkProcessor.java +++ b/core/src/com/cloud/storage/template/VmdkProcessor.java @@ -32,13 +32,13 @@ import org.apache.log4j.Logger; import com.cloud.exception.InternalErrorException; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.StorageLayer; +import com.cloud.utils.component.AdapterBase; import com.cloud.utils.script.Script; @Local(value=Processor.class) -public class VmdkProcessor implements Processor { +public class VmdkProcessor extends AdapterBase implements Processor { private static final Logger s_logger = Logger.getLogger(VmdkProcessor.class); - String _name; StorageLayer _storage; @Override @@ -137,7 +137,6 @@ public class VmdkProcessor implements Processor { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { throw new ConfigurationException("Unable to get storage implementation"); @@ -145,19 +144,4 @@ public class VmdkProcessor implements Processor { return true; } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } } diff --git a/core/src/com/cloud/user/AccountVO.java b/core/src/com/cloud/user/AccountVO.java index 922c8b99eb5..fd37c772d11 100644 --- a/core/src/com/cloud/user/AccountVO.java +++ b/core/src/com/cloud/user/AccountVO.java @@ -28,9 +28,7 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import org.apache.cloudstack.api.Identity; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name="account") @@ -68,6 +66,9 @@ public class AccountVO implements Account { @Column(name="default_zone_id") private Long defaultZoneId = null; + @Column(name="region_id") + private int regionId; + public AccountVO() { this.uuid = UUID.randomUUID().toString(); } @@ -76,14 +77,15 @@ public class AccountVO implements Account { this.id = id; this.uuid = UUID.randomUUID().toString(); } - - public AccountVO(String accountName, long domainId, String networkDomain, short type) { + + public AccountVO(String accountName, long domainId, String networkDomain, short type, String uuid, int regionId) { this.accountName = accountName; this.domainId = domainId; this.networkDomain = networkDomain; this.type = type; this.state = State.enabled; - this.uuid = UUID.randomUUID().toString(); + this.uuid = uuid; + this.regionId = regionId; } public void setNeedsCleanup(boolean value) { @@ -99,7 +101,11 @@ public class AccountVO implements Account { return id; } - @Override + public void setId(long id) { + this.id = id; + } + + @Override public String getAccountName() { return accountName; } @@ -176,4 +182,12 @@ public class AccountVO implements Account { public void setUuid(String uuid) { this.uuid = uuid; } + + public int getRegionId() { + return regionId; + } + + public void setRegionId(int regionId) { + this.regionId = regionId; + } } diff --git a/core/src/com/cloud/user/UserVO.java b/core/src/com/cloud/user/UserVO.java index 919f4134e06..de7f31bd2be 100644 --- a/core/src/com/cloud/user/UserVO.java +++ b/core/src/com/cloud/user/UserVO.java @@ -93,6 +93,9 @@ public class UserVO implements User, Identity, InternalIdentity { @Column(name="uuid") private String uuid; + @Column(name="region_id") + private int regionId; + public UserVO() { this.uuid = UUID.randomUUID().toString(); } @@ -101,8 +104,8 @@ public class UserVO implements User, Identity, InternalIdentity { this.id = id; this.uuid = UUID.randomUUID().toString(); } - - public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone) { + + public UserVO(long accountId, String username, String password, String firstName, String lastName, String email, String timezone, String uuid, int regionId) { this.accountId = accountId; this.username = username; this.password = password; @@ -111,9 +114,10 @@ public class UserVO implements User, Identity, InternalIdentity { this.email = email; this.timezone = timezone; this.state = State.enabled; - this.uuid = UUID.randomUUID().toString(); + this.uuid = uuid; + this.regionId = regionId; } - + @Override public long getId() { return id; @@ -261,4 +265,12 @@ public class UserVO implements User, Identity, InternalIdentity { public void setUuid(String uuid) { this.uuid = uuid; } + + public int getRegionId() { + return regionId; + } + + public void setRegionId(int regionId) { + this.regionId = regionId; + } } diff --git a/core/src/com/cloud/vm/DomainRouterVO.java b/core/src/com/cloud/vm/DomainRouterVO.java index 052d2054f6c..2cc936470d7 100755 --- a/core/src/com/cloud/vm/DomainRouterVO.java +++ b/core/src/com/cloud/vm/DomainRouterVO.java @@ -36,45 +36,45 @@ import com.cloud.network.router.VirtualRouter; public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { @Column(name="element_id") private long elementId; - + @Column(name="public_ip_address") private String publicIpAddress; - + @Column(name="public_mac_address") private String publicMacAddress; - + @Column(name="public_netmask") private String publicNetmask; @Column(name="is_redundant_router") boolean isRedundantRouter; - + @Column(name="priority") int priority; - + @Column(name="is_priority_bumpup") boolean isPriorityBumpUp; - + @Column(name="redundant_state") @Enumerated(EnumType.STRING) private RedundantState redundantState; - + @Column(name="stop_pending") boolean stopPending; - + @Column(name="role") @Enumerated(EnumType.STRING) private Role role = Role.VIRTUAL_ROUTER; - + @Column(name="template_version") private String templateVersion; - + @Column(name="scripts_version") private String scriptsVersion; - + @Column(name="vpc_id") private Long vpcId; - + public DomainRouterVO(long id, long serviceOfferingId, long elementId, @@ -99,7 +99,7 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { this.stopPending = stopPending; this.vpcId = vpcId; } - + public DomainRouterVO(long id, long serviceOfferingId, long elementId, @@ -143,97 +143,97 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { } @Override - public long getDataCenterIdToDeployIn() { - return dataCenterIdToDeployIn; + public long getDataCenterId() { + return dataCenterId; } - + public String getPublicNetmask() { return publicNetmask; } - + public String getPublicMacAddress() { return publicMacAddress; } - + protected DomainRouterVO() { super(); } - + @Override public String getPublicIpAddress() { return publicIpAddress; } - - @Override - public Role getRole() { - return role; - } - - public void setRole(Role role) { - this.role = role; - } - - @Override - public boolean getIsRedundantRouter() { - return this.isRedundantRouter; - } - - public void setIsRedundantRouter(boolean isRedundantRouter) { - this.isRedundantRouter = isRedundantRouter; - } - - @Override - public long getServiceOfferingId() { - return serviceOfferingId; - } - - public int getPriority() { - return this.priority; - } - - public void setPriority(int priority) { - this.priority = priority; - } - - @Override - public RedundantState getRedundantState() { - return this.redundantState; - } - - public void setRedundantState(RedundantState redundantState) { - this.redundantState = redundantState; - } - - public boolean getIsPriorityBumpUp() { - return this.isPriorityBumpUp; - } - - public void setIsPriorityBumpUp(boolean isPriorityBumpUp) { - this.isPriorityBumpUp = isPriorityBumpUp; - } @Override - public boolean isStopPending() { - return this.stopPending; - } + public Role getRole() { + return role; + } + + public void setRole(Role role) { + this.role = role; + } @Override - public void setStopPending(boolean stopPending) { - this.stopPending = stopPending; - } - + public boolean getIsRedundantRouter() { + return this.isRedundantRouter; + } + + public void setIsRedundantRouter(boolean isRedundantRouter) { + this.isRedundantRouter = isRedundantRouter; + } + + @Override + public long getServiceOfferingId() { + return serviceOfferingId; + } + + public int getPriority() { + return this.priority; + } + + public void setPriority(int priority) { + this.priority = priority; + } + + @Override + public RedundantState getRedundantState() { + return this.redundantState; + } + + public void setRedundantState(RedundantState redundantState) { + this.redundantState = redundantState; + } + + public boolean getIsPriorityBumpUp() { + return this.isPriorityBumpUp; + } + + public void setIsPriorityBumpUp(boolean isPriorityBumpUp) { + this.isPriorityBumpUp = isPriorityBumpUp; + } + + @Override + public boolean isStopPending() { + return this.stopPending; + } + + @Override + public void setStopPending(boolean stopPending) { + this.stopPending = stopPending; + } + public String getTemplateVersion() { return this.templateVersion; } - + public void setTemplateVersion(String templateVersion) { this.templateVersion = templateVersion; } - + public String getScriptsVersion() { return this.scriptsVersion; } - + public void setScriptsVersion(String scriptsVersion) { this.scriptsVersion = scriptsVersion; } @@ -242,9 +242,5 @@ public class DomainRouterVO extends VMInstanceVO implements VirtualRouter { public Long getVpcId() { return vpcId; } - - @Override - public boolean canPlugNics() { - return true; - } + } diff --git a/core/src/com/cloud/vm/UserVmCloneSettingVO.java b/core/src/com/cloud/vm/UserVmCloneSettingVO.java new file mode 100644 index 00000000000..24bb1e87c3b --- /dev/null +++ b/core/src/com/cloud/vm/UserVmCloneSettingVO.java @@ -0,0 +1,50 @@ +// 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 javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + +@Entity +@Table(name="user_vm_clone_setting") +public class UserVmCloneSettingVO { + + @Column(name="vm_id") + private Long vmId; + + @Column(name="clone_type") + private String cloneType; + + public UserVmCloneSettingVO() { + + } + + public UserVmCloneSettingVO(long id, + String cloneType) { + this.vmId = id; + this.cloneType = cloneType; + } + + public long getVmId() { + return this.vmId; + } + + public String getCloneType() { + return this.cloneType; + } +} diff --git a/core/src/com/cloud/vm/UserVmVO.java b/core/src/com/cloud/vm/UserVmVO.java index 05a4bd1a636..a16eaf9dca0 100755 --- a/core/src/com/cloud/vm/UserVmVO.java +++ b/core/src/com/cloud/vm/UserVmVO.java @@ -78,8 +78,8 @@ public class UserVmVO extends VMInstanceVO implements UserVm { long accountId, long serviceOfferingId, String userData, - String name) { - super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled, limitCpuUse); + String name, Long diskOfferingId) { + super(id, serviceOfferingId, name, instanceName, Type.User, templateId, hypervisorType, guestOsId, domainId, accountId, haEnabled, limitCpuUse, diskOfferingId); this.userData = userData; this.displayName = displayName; this.details = new HashMap(); diff --git a/core/src/com/cloud/vm/VMInstanceVO.java b/core/src/com/cloud/vm/VMInstanceVO.java index 13c1cf35902..6149e43f8fa 100644 --- a/core/src/com/cloud/vm/VMInstanceVO.java +++ b/core/src/com/cloud/vm/VMInstanceVO.java @@ -42,28 +42,27 @@ import com.cloud.utils.db.GenericDao; import com.cloud.utils.db.StateMachine; import com.cloud.utils.fsm.FiniteStateObject; import com.cloud.vm.VirtualMachine.State; -import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name="vm_instance") @Inheritance(strategy=InheritanceType.JOINED) @DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) public class VMInstanceVO implements VirtualMachine, FiniteStateObject { - @Id + @Id @TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1) @Column(name="id", updatable=false, nullable = false) - protected long id; + protected long id; @Column(name="name", updatable=false, nullable=false, length=255) - protected String hostName = null; + protected String hostName = null; @Encrypt @Column(name="vnc_password", updatable=true, nullable=false, length=255) protected String vncPassword; - + @Column(name="proxy_id", updatable=true, nullable=true) protected Long proxyId; - + @Temporal(TemporalType.TIMESTAMP) @Column(name="proxy_assign_time", updatable=true, nullable=true) protected Date proxyAssignTime; @@ -79,20 +78,20 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject details; @Column(name="uuid") protected String uuid = UUID.randomUUID().toString(); ; + + @Column(name="disk_offering_id") + protected Long diskOfferingId; public VMInstanceVO(long id, - long serviceOfferingId, - String name, - String instanceName, - Type type, - Long vmTemplateId, - HypervisorType hypervisorType, - long guestOSId, - long domainId, - long accountId, - boolean haEnabled) { + long serviceOfferingId, + String name, + String instanceName, + Type type, + Long vmTemplateId, + HypervisorType hypervisorType, + long guestOSId, + long domainId, + long accountId, + boolean haEnabled) { this.id = id; this.hostName = name != null ? name : this.uuid; if (vmTemplateId != null) { @@ -191,178 +198,179 @@ public class VMInstanceVO implements VirtualMachine, FiniteStateObject getDetails() { return details; } - + public void setDetail(String name, String value) { assert (details != null) : "Did you forget to load the details?"; - + details.put(name, value); } - + public void setDetails(Map details) { this.details = details; } - transient String toString; + transient String toString; @Override - public String toString() { + public String toString() { if (toString == null) { toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString(); } return toString; } - + @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (int) (id ^ (id >>> 32)); - return result; - } + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (id ^ (id >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + VMInstanceVO other = (VMInstanceVO) obj; + if (id != other.id) + return false; + return true; + } + - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - VMInstanceVO other = (VMInstanceVO) obj; - if (id != other.id) - return false; - return true; - } - - public void setServiceOfferingId(long serviceOfferingId) { this.serviceOfferingId = serviceOfferingId; } - - @Override - public boolean canPlugNics() { - return false; - } -} + @Override + public Long getDiskOfferingId() { + return diskOfferingId; + } + +} diff --git a/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java b/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java new file mode 100644 index 00000000000..03d4945fda0 --- /dev/null +++ b/core/src/com/cloud/vm/snapshot/VMSnapshotVO.java @@ -0,0 +1,224 @@ +// 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 java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = "vm_snapshots") +public class VMSnapshotVO implements VMSnapshot { + @Id + @TableGenerator(name = "vm_snapshots_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "vm_snapshots_seq", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.TABLE) + @Column(name = "id") + long id; + + @Column(name = "uuid") + String uuid = UUID.randomUUID().toString(); + + @Column(name = "name") + String name; + + @Column(name = "display_name") + String displayName; + + @Column(name = "description") + String description; + + @Column(name = "vm_id") + long vmId; + + @Column(name = "account_id") + long accountId; + + @Column(name = "domain_id") + long domainId; + + @Column(name = "vm_snapshot_type") + @Enumerated(EnumType.STRING) + VMSnapshot.Type type; + + @Column(name = "state", updatable = true, nullable = false) + @Enumerated(value = EnumType.STRING) + private State state; + + @Column(name = GenericDao.CREATED_COLUMN) + Date created; + + @Column(name = GenericDao.REMOVED_COLUMN) + Date removed; + + @Column(name = "current") + Boolean current; + + @Column(name = "parent") + Long parent; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + public Long getParent() { + return parent; + } + + public void setParent(Long parent) { + this.parent = parent; + } + + public VMSnapshotVO() { + + } + + public Date getRemoved() { + return removed; + } + + public VMSnapshotVO(Long accountId, Long domainId, Long vmId, + String description, String vmSnapshotName, String vsDisplayName, + Long serviceOfferingId, Type type, Boolean current) { + this.accountId = accountId; + this.domainId = domainId; + this.vmId = vmId; + this.state = State.Allocated; + this.description = description; + this.name = vmSnapshotName; + this.displayName = vsDisplayName; + this.type = type; + this.current = current; + } + + public String getDescription() { + return description; + } + + @Override + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + @Override + public long getId() { + return id; + } + + @Override + public Long getVmId() { + return vmId; + } + + public void setVmId(Long vmId) { + this.vmId = vmId; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public State getState() { + return state; + } + + public void setState(State state) { + this.state = state; + } + + @Override + public String getUuid() { + return uuid; + } + + @Override + public long getAccountId() { + return accountId; + } + + @Override + public long getDomainId() { + return domainId; + } + + @Override + public String getDisplayName() { + return displayName; + } + + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + public Boolean getCurrent() { + return current; + } + + public void setCurrent(Boolean current) { + this.current = current; + } + + @Override + public long getUpdatedCount() { + return updatedCount; + } + + @Override + public void incrUpdatedCount() { + this.updatedCount++; + } + + @Override + public Date getUpdated() { + return updated; + } + + @Override + public Type getType() { + return type; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } +} diff --git a/debian/cloud-server.install b/debian/cloud-server.install index 9cd1eebb5ff..f792cc2f7cd 100644 --- a/debian/cloud-server.install +++ b/debian/cloud-server.install @@ -24,6 +24,7 @@ /usr/share/java/cloud-plugin-elb.jar /usr/share/java/cloud-plugin-ovs.jar /usr/share/java/cloud-plugin-nicira-nvp.jar +/usr/share/java/cloud-plugin-bigswitch-vns.jar /usr/share/java/cloud-storage-allocator-random.jar /usr/share/java/cloud-user-authenticator-ldap.jar /usr/share/java/cloud-user-authenticator-md5.jar diff --git a/debian/control b/debian/control index 380b2e4a78d..e9697ea5e26 100644 --- a/debian/control +++ b/debian/control @@ -48,7 +48,7 @@ Description: CloudStack server library Package: cloud-scripts Replaces: cloud-agent-scripts Architecture: any -Depends: openjdk-6-jre, python, bash, bzip2, gzip, unzip, nfs-common, openssh-client +Depends: openjdk-6-jre, python, bash, bzip2, gzip, unzip, nfs-common, openssh-client, lsb-release Description: CloudStack scripts This package contains a number of scripts needed for the CloudStack Agent and Management Server. Both the CloudStack Agent and Management server depend on this package diff --git a/debian/rules b/debian/rules index 36b611ddc04..69fba7a07ba 100755 --- a/debian/rules +++ b/debian/rules @@ -60,7 +60,7 @@ install: mkdir -p debian/tmp/usr/share/cloud/management/webapps/client cp -r client/target/utilities/scripts/db/* debian/tmp/usr/share/cloud/setup/ - cp -r client/target/cloud-client-ui-4.1.0-SNAPSHOT/* debian/tmp/usr/share/cloud/management/webapps/client/ + cp -r client/target/cloud-client-ui-*-SNAPSHOT/* debian/tmp/usr/share/cloud/management/webapps/client/ dh_installdirs -s dh_install -s diff --git a/deps/XenServerJava/pom.xml b/deps/XenServerJava/pom.xml index 18ba54f56a3..0f2cdf427c8 100644 --- a/deps/XenServerJava/pom.xml +++ b/deps/XenServerJava/pom.xml @@ -21,7 +21,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml xapi diff --git a/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java b/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java index 416aad94b9e..e2ee9d6ed9e 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/Marshalling.java @@ -1,32 +1,15 @@ -/* Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 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 HOLDER 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. - */ - +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 package com.xensource.xenapi; import java.util.*; diff --git a/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java b/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java index b678a7fa1ec..700e3299604 100644 --- a/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java +++ b/deps/XenServerJava/src/com/xensource/xenapi/XenAPIObject.java @@ -1,32 +1,15 @@ -/* Copyright (c) Citrix Systems, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1) Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2) Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * - * 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 HOLDER 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. - */ - +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 package com.xensource.xenapi; public abstract class XenAPIObject diff --git a/deps/install-non-oss.sh b/deps/install-non-oss.sh index 28eb03e1562..af495e7cc21 100755 --- a/deps/install-non-oss.sh +++ b/deps/install-non-oss.sh @@ -8,7 +8,7 @@ # 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 @@ -19,13 +19,17 @@ mvn install:install-file -Dfile=cloud-iControl.jar -DgroupId=com.cloud.com.f5 -DartifactId=icontrol -Dversion=1.0 -Dpackaging=jar mvn install:install-file -Dfile=cloud-netscaler.jar -DgroupId=com.cloud.com.citrix -DartifactId=netscaler -Dversion=1.0 -Dpackaging=jar mvn install:install-file -Dfile=cloud-netscaler-sdx.jar -DgroupId=com.cloud.com.citrix -DartifactId=netscaler-sdx -Dversion=1.0 -Dpackaging=jar -# + # From http://support.netapp.com/ (not available online, contact your support representative) # Version: 4.0 +if [ -e cloud-manageontap.jar ]; then mv cloud-manageontap.jar manageontap.jar; fi mvn install:install-file -Dfile=manageontap.jar -DgroupId=com.cloud.com.netapp -DartifactId=manageontap -Dversion=4.0 -Dpackaging=jar -# + # From https://my.vmware.com/group/vmware/get-download?downloadGroup=VSDK41 -# Version: 4.1, Release-date: 2010-07-13, Build: 257238 +# Version: 4.1, Release-date: 2010-07-13, Build: 257238 +if [ -e vmware-apputils.jar ]; then mv vmware-apputils.jar apputils.jar; fi +if [ -e vmware-vim.jar ]; then mv vmware-vim.jar vim.jar; fi +if [ -e vmware-vim25.jar ]; then mv vmware-vim25.jar vim25.jar; fi mvn install:install-file -Dfile=vim25.jar -DgroupId=com.cloud.com.vmware -DartifactId=vmware-vim25 -Dversion=4.1 -Dpackaging=jar mvn install:install-file -Dfile=apputils.jar -DgroupId=com.cloud.com.vmware -DartifactId=vmware-apputils -Dversion=4.1 -Dpackaging=jar mvn install:install-file -Dfile=vim.jar -DgroupId=com.cloud.com.vmware -DartifactId=vmware-vim -Dversion=4.1 -Dpackaging=jar diff --git a/developer/pom.xml b/developer/pom.xml index 684eb0cf683..ff47b143093 100644 --- a/developer/pom.xml +++ b/developer/pom.xml @@ -1,4 +1,4 @@ - org.codehaus.mojo - sql-maven-plugin - 1.5 + exec-maven-plugin + 1.2.1 @@ -100,350 +107,91 @@ mysql-connector-java ${cs.mysql.version} + + commons-dbcp + commons-dbcp + ${cs.dbcp.version} + + + commons-pool + commons-pool + ${cs.pool.version} + + + org.jasypt + jasypt + ${cs.jasypt.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-server + ${project.version} + - - - org.gjt.mm.mysql.Driver - jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud - ${db.cloud.username} - ${db.cloud.password} - - ${maven.test.skip} - true - - drop-database - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - drop database if exists `cloud` - - - - create-database - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - create database `cloud` - - - - grant-user-cloud - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloud.* to - ${db.cloud.username}@`localhost` identified by - '${db.cloud.password}'; - - - - grant-user-cloud-all - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloud.* to - ${db.cloud.username}@`%` identified by - '${db.cloud.password}'; - - - - drop-database-usage - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - drop database if exists `cloud_usage` - - - - create-database-usage - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - create database `cloud_usage` - - - - grant-user-cloud-usage - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloud_usage.* to - ${db.cloud.username}@`localhost` identified by - '${db.cloud.password}'; - - - - grant-user-cloud-usage-all - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloud_usage.* to - ${db.cloud.username}@`%` identified by - '${db.cloud.password}'; - - - - drop-database-cloudbridge - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - drop database if exists `cloudbridge` - - - - create-database-cloudbridge - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - create database `cloudbridge` - - - - grant-user-cloud-bridge - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloudbridge.* to - ${db.cloud.username}@`localhost` identified by - '${db.cloud.password}'; - - - - grant-user-cloud-bridge-all - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.cloud.host}:${db.cloud.port} - GRANT ALL ON cloudbridge.* to - ${db.cloud.username}@`%` identified by - '${db.cloud.password}'; - - - + process-resources create-schema - process-test-resources - execute + java - - - ${basedir}/target/db/create-schema.sql - ${basedir}/target/db/create-schema-view.sql - ${basedir}/target/db/create-schema-premium.sql - ${basedir}/target/db/templates.sql - ${basedir}/target/db/create-index-fk.sql - ${basedir}/target/db/cloudbridge_schema.sql - ${basedir}/target/db/cloudbridge_multipart.sql - ${basedir}/target/db/cloudbridge_index.sql - ${basedir}/target/db/cloudbridge_multipart_alter.sql - ${basedir}/target/db/cloudbridge_bucketpolicy.sql - ${basedir}/target/db/cloudbridge_policy_alter.sql - ${basedir}/target/db/cloudbridge_offering.sql - ${basedir}/target/db/cloudbridge_offering_alter.sql - - - - - prefill-developer-schema - process-test-resources - - execute - - - true - - ${basedir}/developer-prefill.sql - - + + false + true + + org.apache.cloudstack + cloud-server + + com.cloud.upgrade.DatabaseCreator + + + ${project.parent.basedir}/utils/conf/db.properties + ${project.parent.basedir}/utils/conf/db.properties.override + + ${basedir}/target/db/create-schema.sql + ${basedir}/target/db/create-schema-premium.sql + + ${basedir}/target/db/templates.sql + + ${basedir}/target/db/cloudbridge_schema.sql + ${basedir}/target/db/cloudbridge_multipart.sql + ${basedir}/target/db/cloudbridge_index.sql + ${basedir}/target/db/cloudbridge_multipart_alter.sql + ${basedir}/target/db/cloudbridge_bucketpolicy.sql + ${basedir}/target/db/cloudbridge_policy_alter.sql + ${basedir}/target/db/cloudbridge_offering.sql + ${basedir}/target/db/cloudbridge_offering_alter.sql + + ${basedir}/developer-prefill.sql + + com.cloud.upgrade.DatabaseUpgradeChecker + --database=cloud,usage,awsapi + --rootpassword=${db.root.password} + + + + + + + catalina.home + ${project.parent.basedir}/utils + + + paths.script + ${basedir}/target/db + + + - - - - simulator - - deploydb-simulator - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - initialize - - read-project-properties - - - - ${project.parent.basedir}/utils/conf/db.properties - ${project.parent.basedir}/utils/conf/db.properties.override - - true - - - - - - org.codehaus.mojo - sql-maven-plugin - 1.5 - - - mysql - mysql-connector-java - ${cs.mysql.version} - - - - org.gjt.mm.mysql.Driver - jdbc:mysql://${db.simulator.host}:3306/simulator - ${db.simulator.username} - ${db.simulator.password} - ${maven.test.skip} - true - - - - drop-database - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.simulator.host}:3306 - drop database if exists `simulator` - - - - create-database - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.simulator.host}:3306 - create database `simulator` - - - - grant-user-cloud - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.simulator.host}:3306 - GRANT ALL ON simulator.* to - ${db.simulator.username}@`localhost` identified by - '${db.simulator.password}'; - - - - grant-user-cloud-all - process-test-resources - - execute - - - root - ${db.root.password} - jdbc:mysql://${db.simulator.host}:3306 - GRANT ALL ON simulator.* to - ${db.simulator.username}@`%` identified by - '${db.simulator.password}'; - - - - create-schema - process-test-resources - - execute - - - - ${basedir}/target/db/create-schema-simulator.sql - ${basedir}/target/db/templates.simulator.sql - - - - - - - - diff --git a/docs/.tx/config b/docs/.tx/config index 9b02286ea66..ec3df862093 100644 --- a/docs/.tx/config +++ b/docs/.tx/config @@ -1,25 +1,106 @@ -# 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. - +#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. [main] -host = https://www.transifex.net +host = https://www.transifex.com + +[ACS_DOCS.Admin_Guide] +file_filter = /Admin_Guide.po +source_file = pot/Admin_Guide.pot +source_lang = en +type = PO + +[ACS_DOCS.Author_Group] +file_filter = /Author_Group.po +source_file = pot/Author_Group.pot +source_lang = en +type = PO + +[ACS_DOCS.Book_Info] +file_filter = /Book_Info.po +source_file = pot/Book_Info.pot +source_lang = en +type = PO + +[ACS_DOCS.Book_Info_Release_Notes_4-0] +file_filter = /Book_Info_Release_Notes_4-0.po +source_file = pot/Book_Info_Release_Notes_4-0.pot +source_lang = en +type = PO + +[ACS_DOCS.CloudStack_Nicira_NVP_Guide] +file_filter = /CloudStack_Nicira_NVP_Guide.po +source_file = pot/CloudStack_Nicira_NVP_Guide.pot +source_lang = en +type = PO + +[ACS_DOCS.Developers_Guide] +file_filter = /Developers_Guide.po +source_file = pot/Developers_Guide.pot +source_lang = en +type = PO + +[ACS_DOCS.Installation_Guide] +file_filter = /Installation_Guide.po +source_file = pot/Installation_Guide.pot +source_lang = en +type = PO + +[ACS_DOCS.LDAPserver-for-user-authentication] +file_filter = /LDAPserver-for-user-authentication.po +source_file = pot/LDAPserver-for-user-authentication.pot +source_lang = en +type = PO + +[ACS_DOCS.Preface] +file_filter = /Preface.po +source_file = pot/Preface.pot +source_lang = en +type = PO + +[ACS_DOCS.Release_Notes] +file_filter = /Release_Notes.po +source_file = pot/Release_Notes.pot +source_lang = en +type = PO + +[ACS_DOCS.Revision_History] +file_filter = /Revision_History.po +source_file = pot/Revision_History.pot +source_lang = en +type = PO + +[ACS_DOCS.Revision_History_Install_Guide] +file_filter = /Revision_History_Install_Guide.po +source_file = pot/Revision_History_Install_Guide.pot +source_lang = en +type = PO + +[ACS_DOCS.SSL-keystore-path-and-password] +file_filter = /SSL-keystore-path-and-password.po +source_file = pot/SSL-keystore-path-and-password.pot +source_lang = en +type = PO + +[ACS_DOCS.VPN-user-usage-record-format] +file_filter = /VPN-user-usage-record-format.po +source_file = pot/VPN-user-usage-record-format.pot +source_lang = en +type = PO [ACS_DOCS.about-clusters] -file_filter = /about-cluster.po +file_filter = /about-clusters.po source_file = pot/about-clusters.pot source_lang = en type = PO @@ -30,14 +111,18 @@ source_file = pot/about-hosts.pot source_lang = en type = PO +[ACS_DOCS.about-password-encryption] +file_filter = /about-password-encryption.po +source_file = pot/about-password-encryption.pot +source_lang = en +type = PO + [ACS_DOCS.about-physical-networks] file_filter = /about-physical-networks.po source_file = pot/about-physical-networks.pot source_lang = en type = PO - - [ACS_DOCS.about-pods] file_filter = /about-pods.po source_file = pot/about-pods.pot @@ -56,6 +141,12 @@ source_file = pot/about-secondary-storage.pot source_lang = en type = PO +[ACS_DOCS.about-security-groups] +file_filter = /about-security-groups.po +source_file = pot/about-security-groups.pot +source_lang = en +type = PO + [ACS_DOCS.about-virtual-networks] file_filter = /about-virtual-networks.po source_file = pot/about-virtual-networks.pot @@ -86,45 +177,57 @@ source_file = pot/accessing-vms.pot source_lang = en type = PO -[ACS_DOCS.accounts] -file_filter = /accounts.po -source_file = pot/accounts.pot -source_lang = en -type = PO - [ACS_DOCS.accounts-users-domains] file_filter = /accounts-users-domains.po source_file = pot/accounts-users-domains.pot source_lang = en type = PO +[ACS_DOCS.accounts] +file_filter = /accounts.po +source_file = pot/accounts.pot +source_lang = en +type = PO + [ACS_DOCS.acquire-new-ip-address] file_filter = /acquire-new-ip-address.po source_file = pot/acquire-new-ip-address.pot source_lang = en type = PO +[ACS_DOCS.acquire-new-ip-for-vpc] +file_filter = /acquire-new-ip-for-vpc.po +source_file = pot/acquire-new-ip-for-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.add-additional-guest-network] file_filter = /add-additional-guest-network.po source_file = pot/add-additional-guest-network.pot source_lang = en type = PO -[ACS_DOCS.added-API-commands] -file_filter = /added-API-commands.po -source_file = pot/added-API-commands.pot +[ACS_DOCS.add-clusters-kvm-xenserver] +file_filter = /add-clusters-kvm-xenserver.po +source_file = pot/add-clusters-kvm-xenserver.pot source_lang = en type = PO -[ACS_DOCS.added-cloudPlatform-error-codes] -file_filter = /added-cloudPlatform-error-codes.po -source_file = pot/added-cloudPlatform-error-codes.pot +[ACS_DOCS.add-clusters-ovm] +file_filter = /add-clusters-ovm.po +source_file = pot/add-clusters-ovm.pot source_lang = en type = PO -[ACS_DOCS.adding-IP-addresses-for-the-public-network] -file_filter = /adding-IP-addresses-for-the-public-network.po -source_file = pot/adding-IP-addresses-for-the-public-network.pot +[ACS_DOCS.add-clusters-vsphere] +file_filter = /add-clusters-vsphere.po +source_file = pot/add-clusters-vsphere.pot +source_lang = en +type = PO + +[ACS_DOCS.add-gateway-vpc] +file_filter = /add-gateway-vpc.po +source_file = pot/add-gateway-vpc.pot source_lang = en type = PO @@ -146,6 +249,12 @@ source_file = pot/add-load-balancer-rule.pot source_lang = en type = PO +[ACS_DOCS.add-loadbalancer-rule-vpc] +file_filter = /add-loadbalancer-rule-vpc.po +source_file = pot/add-loadbalancer-rule-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.add-members-to-projects] file_filter = /add-members-to-projects.po source_file = pot/add-members-to-projects.pot @@ -164,6 +273,12 @@ source_file = pot/add-password-management-to-templates.pot source_lang = en type = PO +[ACS_DOCS.add-portforward-rule-vpc] +file_filter = /add-portforward-rule-vpc.po +source_file = pot/add-portforward-rule-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.add-primary-storage] file_filter = /add-primary-storage.po source_file = pot/add-primary-storage.pot @@ -188,6 +303,54 @@ source_file = pot/add-security-group.pot source_lang = en type = PO +[ACS_DOCS.add-tier] +file_filter = /add-tier.po +source_file = pot/add-tier.pot +source_lang = en +type = PO + +[ACS_DOCS.add-vm-to-tier] +file_filter = /add-vm-to-tier.po +source_file = pot/add-vm-to-tier.pot +source_lang = en +type = PO + +[ACS_DOCS.add-vpc] +file_filter = /add-vpc.po +source_file = pot/add-vpc.pot +source_lang = en +type = PO + +[ACS_DOCS.added-API-commands-4-0] +file_filter = /added-API-commands-4-0.po +source_file = pot/added-API-commands-4-0.pot +source_lang = en +type = PO + +[ACS_DOCS.added-API-commands] +file_filter = /added-API-commands.po +source_file = pot/added-API-commands.pot +source_lang = en +type = PO + +[ACS_DOCS.added-error-codes] +file_filter = /added-error-codes.po +source_file = pot/added-error-codes.pot +source_lang = en +type = PO + +[ACS_DOCS.adding-IP-addresses-for-the-public-network] +file_filter = /adding-IP-addresses-for-the-public-network.po +source_file = pot/adding-IP-addresses-for-the-public-network.pot +source_lang = en +type = PO + +[ACS_DOCS.additional-installation-options] +file_filter = /additional-installation-options.po +source_file = pot/additional-installation-options.pot +source_lang = en +type = PO + [ACS_DOCS.admin-alerts] file_filter = /admin-alerts.po source_file = pot/admin-alerts.pot @@ -200,6 +363,12 @@ source_file = pot/admin-guide.pot source_lang = en type = PO +[ACS_DOCS.adv-zone-topology-req] +file_filter = /adv-zone-topology-req.po +source_file = pot/adv-zone-topology-req.pot +source_lang = en +type = PO + [ACS_DOCS.advanced-zone-configuration] file_filter = /advanced-zone-configuration.po source_file = pot/advanced-zone-configuration.pot @@ -242,15 +411,21 @@ source_file = pot/allocators.pot source_lang = en type = PO -[ACS_DOCS.api-reference] -file_filter = /api-reference.po -source_file = pot/api-reference.pot +[ACS_DOCS.api-calls] +file_filter = /api-calls.po +source_file = pot/api-calls.pot source_lang = en type = PO -[ACS_DOCS.appendix-a-time-zones] -file_filter = /appendix-a-time-zones.po -source_file = pot/appendix-a-time-zones.pot +[ACS_DOCS.api-overview] +file_filter = /api-overview.po +source_file = pot/api-overview.pot +source_lang = en +type = PO + +[ACS_DOCS.api-reference] +file_filter = /api-reference.po +source_file = pot/api-reference.pot source_lang = en type = PO @@ -266,21 +441,15 @@ source_file = pot/asynchronous-commands.pot source_lang = en type = PO -[ACS_DOCS.attaching-volume] -file_filter = /attaching-volume.po -source_file = pot/attaching-volume.pot -source_lang = en -type = PO - [ACS_DOCS.attach-iso-to-vm] file_filter = /attach-iso-to-vm.po source_file = pot/attach-iso-to-vm.pot source_lang = en type = PO -[ACS_DOCS.Author_Group] -file_filter = /Author_Group.po -source_file = pot/Author_Group.pot +[ACS_DOCS.attaching-volume] +file_filter = /attaching-volume.po +source_file = pot/attaching-volume.pot source_lang = en type = PO @@ -290,6 +459,18 @@ source_file = pot/automatic-snapshot-creation-retention.pot source_lang = en type = PO +[ACS_DOCS.autoscale] +file_filter = /autoscale.po +source_file = pot/autoscale.pot +source_lang = en +type = PO + +[ACS_DOCS.aws-api-examples] +file_filter = /aws-api-examples.po +source_file = pot/aws-api-examples.pot +source_lang = en +type = PO + [ACS_DOCS.aws-ec2-configuration] file_filter = /aws-ec2-configuration.po source_file = pot/aws-ec2-configuration.pot @@ -314,15 +495,27 @@ source_file = pot/aws-ec2-supported-commands.pot source_lang = en type = PO +[ACS_DOCS.aws-ec2-timeouts] +file_filter = /aws-ec2-timeouts.po +source_file = pot/aws-ec2-timeouts.pot +source_lang = en +type = PO + [ACS_DOCS.aws-ec2-user-setup] file_filter = /aws-ec2-user-setup.po source_file = pot/aws-ec2-user-setup.pot source_lang = en type = PO -[ACS_DOCS.aws-interface-guide] -file_filter = /aws-interface-guide.po -source_file = pot/aws-interface-guide.pot +[ACS_DOCS.aws-interface-compatibility] +file_filter = /aws-interface-compatibility.po +source_file = pot/aws-interface-compatibility.pot +source_lang = en +type = PO + +[ACS_DOCS.basic-adv-networking] +file_filter = /basic-adv-networking.po +source_file = pot/basic-adv-networking.pot source_lang = en type = PO @@ -380,15 +573,57 @@ source_file = pot/best-practices-virtual-router.pot source_lang = en type = PO -[ACS_DOCS.Book_Info_Build_All] -file_filter = /Book_Info_Build_All.po -source_file = pot/Book_Info_Build_All.pot +[ACS_DOCS.build-deb] +file_filter = /build-deb.po +source_file = pot/build-deb.pot source_lang = en type = PO -[ACS_DOCS.Book_Info] -file_filter = /Book_Info.po -source_file = pot/Book_Info.pot +[ACS_DOCS.build-rpm] +file_filter = /build-rpm.po +source_file = pot/build-rpm.pot +source_lang = en +type = PO + +[ACS_DOCS.building-devcloud] +file_filter = /building-devcloud.po +source_file = pot/building-devcloud.pot +source_lang = en +type = PO + +[ACS_DOCS.building-marvin] +file_filter = /building-marvin.po +source_file = pot/building-marvin.pot +source_lang = en +type = PO + +[ACS_DOCS.building-prerequisites] +file_filter = /building-prerequisites.po +source_file = pot/building-prerequisites.pot +source_lang = en +type = PO + +[ACS_DOCS.building-with-maven-deploy] +file_filter = /building-with-maven-deploy.po +source_file = pot/building-with-maven-deploy.pot +source_lang = en +type = PO + +[ACS_DOCS.building-with-maven-steps] +file_filter = /building-with-maven-steps.po +source_file = pot/building-with-maven-steps.pot +source_lang = en +type = PO + +[ACS_DOCS.building-with-maven] +file_filter = /building-with-maven.po +source_file = pot/building-with-maven.pot +source_lang = en +type = PO + +[ACS_DOCS.castor-with-cs] +file_filter = /castor-with-cs.po +source_file = pot/castor-with-cs.pot source_lang = en type = PO @@ -398,6 +633,18 @@ source_file = pot/change-console-proxy-ssl-certificate-domain.pot source_lang = en type = PO +[ACS_DOCS.change-database-config] +file_filter = /change-database-config.po +source_file = pot/change-database-config.pot +source_lang = en +type = PO + +[ACS_DOCS.change-database-password] +file_filter = /change-database-password.po +source_file = pot/change-database-password.pot +source_lang = en +type = PO + [ACS_DOCS.change-host-password] file_filter = /change-host-password.po source_file = pot/change-host-password.pot @@ -416,6 +663,12 @@ source_file = pot/change-to-behavior-of-list-commands.pot source_lang = en type = PO +[ACS_DOCS.changed-apicommands-4-0] +file_filter = /changed-apicommands-4-0.po +source_file = pot/changed-apicommands-4-0.pot +source_lang = en +type = PO + [ACS_DOCS.changing-root-password] file_filter = /changing-root-password.po source_file = pot/changing-root-password.pot @@ -434,12 +687,6 @@ source_file = pot/changing-secondary-storage-servers.pot source_lang = en type = PO -[ACS_DOCS.changing-secondary-storage-serversp] -file_filter = /changing-secondary-storage-serversp.po -source_file = pot/changing-secondary-storage-serversp.pot -source_lang = en -type = PO - [ACS_DOCS.changing-service-offering-for-vm] file_filter = /changing-service-offering-for-vm.po source_file = pot/changing-service-offering-for-vm.pot @@ -452,9 +699,21 @@ source_file = pot/changing-vm-name-os-group.pot source_lang = en type = PO -[ACS_DOCS.choosing_a_deployment_architecture] -file_filter = /choosing_a_deployment_architecture.po -source_file = pot/choosing_a_deployment_architecture.pot +[ACS_DOCS.choosing-a-deployment-architecture] +file_filter = /choosing-a-deployment-architecture.po +source_file = pot/choosing-a-deployment-architecture.pot +source_lang = en +type = PO + +[ACS_DOCS.cisco3750-hardware] +file_filter = /cisco3750-hardware.po +source_file = pot/cisco3750-hardware.pot +source_lang = en +type = PO + +[ACS_DOCS.cisco3750-layer2] +file_filter = /cisco3750-layer2.po +source_file = pot/cisco3750-layer2.pot source_lang = en type = PO @@ -476,33 +735,9 @@ source_file = pot/cloud-infrastructure-overview.pot source_lang = en type = PO -[ACS_DOCS.cloudplatform-api] -file_filter = /cloudplatform-api.po -source_file = pot/cloudplatform-api.pot -source_lang = en -type = PO - -[ACS_DOCS.cloudstack_admin] -file_filter = /cloudstack_admin.po -source_file = pot/cloudstack_admin.pot -source_lang = en -type = PO - -[ACS_DOCS.cloudstack_developers] -file_filter = /cloudstack_developers.po -source_file = pot/cloudstack_developers.pot -source_lang = en -type = PO - -[ACS_DOCS.cloudstack_features] -file_filter = /cloudstack_features.po -source_file = pot/cloudstack_features.pot -source_lang = en -type = PO - -[ACS_DOCS.cloudstack_installation] -file_filter = /cloudstack_installation.po -source_file = pot/cloudstack_installation.pot +[ACS_DOCS.cloudstack-api] +file_filter = /cloudstack-api.po +source_file = pot/cloudstack-api.pot source_lang = en type = PO @@ -512,18 +747,6 @@ source_file = pot/cloudstack.pot source_lang = en type = PO -[ACS_DOCS.cloudstack_system_requirements] -file_filter = /cloudstack_system_requirements.po -source_file = pot/cloudstack_system_requirements.pot -source_lang = en -type = PO - -[ACS_DOCS.cloudstack_whatis] -file_filter = /cloudstack_whatis.po -source_file = pot/cloudstack_whatis.pot -source_lang = en -type = PO - [ACS_DOCS.cluster-add] file_filter = /cluster-add.po source_file = pot/cluster-add.pot @@ -548,18 +771,36 @@ source_file = pot/concepts.pot source_lang = en type = PO +[ACS_DOCS.configure-acl] +file_filter = /configure-acl.po +source_file = pot/configure-acl.pot +source_lang = en +type = PO + [ACS_DOCS.configure-guest-traffic-in-advanced-zone] file_filter = /configure-guest-traffic-in-advanced-zone.po source_file = pot/configure-guest-traffic-in-advanced-zone.pot source_lang = en type = PO +[ACS_DOCS.configure-package-repository] +file_filter = /configure-package-repository.po +source_file = pot/configure-package-repository.pot +source_lang = en +type = PO + [ACS_DOCS.configure-public-traffic-in-an-advanced-zone] file_filter = /configure-public-traffic-in-an-advanced-zone.po source_file = pot/configure-public-traffic-in-an-advanced-zone.pot source_lang = en type = PO +[ACS_DOCS.configure-snmp-rhel] +file_filter = /configure-snmp-rhel.po +source_file = pot/configure-snmp-rhel.pot +source_lang = en +type = PO + [ACS_DOCS.configure-usage-server] file_filter = /configure-usage-server.po source_file = pot/configure-usage-server.pot @@ -572,6 +813,12 @@ source_file = pot/configure-virtual-router.pot source_lang = en type = PO +[ACS_DOCS.configure-vpc] +file_filter = /configure-vpc.po +source_file = pot/configure-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.configure-vpn] file_filter = /configure-vpn.po source_file = pot/configure-vpn.pot @@ -584,12 +831,6 @@ source_file = pot/configure-xenserver-dom0-memory.pot source_lang = en type = PO -[ACS_DOCS.configure-xenserver-dom-memory] -file_filter = /configure-xenserver-dom-memory.po -source_file = pot/configure-xenserver-dom-memory.pot -source_lang = en -type = PO - [ACS_DOCS.configuring-projects] file_filter = /configuring-projects.po source_file = pot/configuring-projects.pot @@ -656,6 +897,12 @@ source_file = pot/create-vpn-gateway-for-vpc.pot source_lang = en type = PO +[ACS_DOCS.create-vr-network-offering] +file_filter = /create-vr-network-offering.po +source_file = pot/create-vr-network-offering.pot +source_lang = en +type = PO + [ACS_DOCS.create-windows-template] file_filter = /create-windows-template.po source_file = pot/create-windows-template.pot @@ -704,6 +951,12 @@ source_file = pot/customizing-dns.pot source_lang = en type = PO +[ACS_DOCS.database-replication] +file_filter = /database-replication.po +source_file = pot/database-replication.pot +source_lang = en +type = PO + [ACS_DOCS.dates-in-usage-record] file_filter = /dates-in-usage-record.po source_file = pot/dates-in-usage-record.pot @@ -728,6 +981,12 @@ source_file = pot/default-template.pot source_lang = en type = PO +[ACS_DOCS.delete-reset-vpn] +file_filter = /delete-reset-vpn.po +source_file = pot/delete-reset-vpn.pot +source_lang = en +type = PO + [ACS_DOCS.delete-templates] file_filter = /delete-templates.po source_file = pot/delete-templates.pot @@ -740,6 +999,18 @@ source_file = pot/deleting-vms.pot source_lang = en type = PO +[ACS_DOCS.dell62xx-hardware] +file_filter = /dell62xx-hardware.po +source_file = pot/dell62xx-hardware.pot +source_lang = en +type = PO + +[ACS_DOCS.dell62xx-layer2] +file_filter = /dell62xx-layer2.po +source_file = pot/dell62xx-layer2.pot +source_lang = en +type = PO + [ACS_DOCS.deployment-architecture-overview] file_filter = /deployment-architecture-overview.po source_file = pot/deployment-architecture-overview.pot @@ -752,24 +1023,24 @@ source_file = pot/detach-move-volumes.pot source_lang = en type = PO +[ACS_DOCS.devcloud-usage-mode] +file_filter = /devcloud-usage-mode.po +source_file = pot/devcloud-usage-mode.pot +source_lang = en +type = PO + +[ACS_DOCS.devcloud] +file_filter = /devcloud.po +source_file = pot/devcloud.pot +source_lang = en +type = PO + [ACS_DOCS.developer-getting-started] file_filter = /developer-getting-started.po source_file = pot/developer-getting-started.pot source_lang = en type = PO -[ACS_DOCS.developer_guide] -file_filter = /developer_guide.po -source_file = pot/developer_guide.pot -source_lang = en -type = PO - -[ACS_DOCS.developer-guide] -file_filter = /developer-guide.po -source_file = pot/developer-guide.pot -source_lang = en -type = PO - [ACS_DOCS.developer-introduction] file_filter = /developer-introduction.po source_file = pot/developer-introduction.pot @@ -800,6 +1071,12 @@ source_file = pot/domains.pot source_lang = en type = PO +[ACS_DOCS.enable-disable-static-nat-vpc] +file_filter = /enable-disable-static-nat-vpc.po +source_file = pot/enable-disable-static-nat-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.enable-disable-static-nat] file_filter = /enable-disable-static-nat.po source_file = pot/enable-disable-static-nat.pot @@ -842,6 +1119,12 @@ source_file = pot/event-log-queries.pot source_lang = en type = PO +[ACS_DOCS.event-types] +file_filter = /event-types.po +source_file = pot/event-types.pot +source_lang = en +type = PO + [ACS_DOCS.events-log] file_filter = /events-log.po source_file = pot/events-log.pot @@ -854,12 +1137,6 @@ source_file = pot/events.pot source_lang = en type = PO -[ACS_DOCS.event-types] -file_filter = /event-types.po -source_file = pot/event-types.pot -source_lang = en -type = PO - [ACS_DOCS.example-LDAP-configuration-commands] file_filter = /example-LDAP-configuration-commands.po source_file = pot/example-LDAP-configuration-commands.pot @@ -884,6 +1161,30 @@ source_file = pot/external-firewalls-and-load-balancers.pot source_lang = en type = PO +[ACS_DOCS.external-fw-topology-req] +file_filter = /external-fw-topology-req.po +source_file = pot/external-fw-topology-req.pot +source_lang = en +type = PO + +[ACS_DOCS.external-guest-firewall-integration] +file_filter = /external-guest-firewall-integration.po +source_file = pot/external-guest-firewall-integration.pot +source_lang = en +type = PO + +[ACS_DOCS.external-guest-lb-integration] +file_filter = /external-guest-lb-integration.po +source_file = pot/external-guest-lb-integration.pot +source_lang = en +type = PO + +[ACS_DOCS.extracting-source] +file_filter = /extracting-source.po +source_file = pot/extracting-source.pot +source_lang = en +type = PO + [ACS_DOCS.feature-overview] file_filter = /feature-overview.po source_file = pot/feature-overview.pot @@ -902,9 +1203,21 @@ source_file = pot/first_ms_node_install.pot source_lang = en type = PO -[ACS_DOCS.globally-configured-limit] -file_filter = /globally-configured-limit.po -source_file = pot/globally-configured-limit.pot +[ACS_DOCS.generic-firewall-provisions] +file_filter = /generic-firewall-provisions.po +source_file = pot/generic-firewall-provisions.pot +source_lang = en +type = PO + +[ACS_DOCS.getting-release] +file_filter = /getting-release.po +source_file = pot/getting-release.pot +source_lang = en +type = PO + +[ACS_DOCS.global-config] +file_filter = /global-config.po +source_file = pot/global-config.pot source_lang = en type = PO @@ -926,6 +1239,12 @@ source_file = pot/guest-network.pot source_lang = en type = PO +[ACS_DOCS.guest-nw-usage-with-traffic-sentinel] +file_filter = /guest-nw-usage-with-traffic-sentinel.po +source_file = pot/guest-nw-usage-with-traffic-sentinel.pot +source_lang = en +type = PO + [ACS_DOCS.guest-traffic] file_filter = /guest-traffic.po source_file = pot/guest-traffic.pot @@ -950,6 +1269,30 @@ source_file = pot/ha-management-server.pot source_lang = en type = PO +[ACS_DOCS.hardware-config-eg] +file_filter = /hardware-config-eg.po +source_file = pot/hardware-config-eg.pot +source_lang = en +type = PO + +[ACS_DOCS.hardware-firewall] +file_filter = /hardware-firewall.po +source_file = pot/hardware-firewall.pot +source_lang = en +type = PO + +[ACS_DOCS.host-add-vsphere] +file_filter = /host-add-vsphere.po +source_file = pot/host-add-vsphere.pot +source_lang = en +type = PO + +[ACS_DOCS.host-add-xenserver-kvm-ovm] +file_filter = /host-add-xenserver-kvm-ovm.po +source_file = pot/host-add-xenserver-kvm-ovm.pot +source_lang = en +type = PO + [ACS_DOCS.host-add] file_filter = /host-add.po source_file = pot/host-add.pot @@ -968,24 +1311,30 @@ source_file = pot/hypervisor-host-install-agent.pot source_lang = en type = PO +[ACS_DOCS.hypervisor-host-install-finish] +file_filter = /hypervisor-host-install-finish.po +source_file = pot/hypervisor-host-install-finish.pot +source_lang = en +type = PO + [ACS_DOCS.hypervisor-host-install-firewall] file_filter = /hypervisor-host-install-firewall.po source_file = pot/hypervisor-host-install-firewall.pot source_lang = en type = PO -[ACS_DOCS.hypervisor-host-install-flow] -file_filter = /hypervisor-host-install-flow.po -source_file = pot/hypervisor-host-install-flow.pot -source_lang = en -type = PO - [ACS_DOCS.hypervisor-host-install-libvirt] file_filter = /hypervisor-host-install-libvirt.po source_file = pot/hypervisor-host-install-libvirt.pot source_lang = en type = PO +[ACS_DOCS.hypervisor-host-install-network-openvswitch] +file_filter = /hypervisor-host-install-network-openvswitch.po +source_file = pot/hypervisor-host-install-network-openvswitch.pot +source_lang = en +type = PO + [ACS_DOCS.hypervisor-host-install-network] file_filter = /hypervisor-host-install-network.po source_file = pot/hypervisor-host-install-network.pot @@ -1010,6 +1359,24 @@ source_file = pot/hypervisor-host-install-security-policies.pot source_lang = en type = PO +[ACS_DOCS.hypervisor-installation] +file_filter = /hypervisor-installation.po +source_file = pot/hypervisor-installation.pot +source_lang = en +type = PO + +[ACS_DOCS.hypervisor-kvm-install-flow] +file_filter = /hypervisor-kvm-install-flow.po +source_file = pot/hypervisor-kvm-install-flow.pot +source_lang = en +type = PO + +[ACS_DOCS.hypervisor-kvm-requirements] +file_filter = /hypervisor-kvm-requirements.po +source_file = pot/hypervisor-kvm-requirements.pot +source_lang = en +type = PO + [ACS_DOCS.hypervisor-support-for-primarystorage] file_filter = /hypervisor-support-for-primarystorage.po source_file = pot/hypervisor-support-for-primarystorage.pot @@ -1034,15 +1401,21 @@ source_file = pot/incremental-snapshots-backup.pot source_lang = en type = PO +[ACS_DOCS.initial-setup-of-external-firewalls-loadbalancers] +file_filter = /initial-setup-of-external-firewalls-loadbalancers.po +source_file = pot/initial-setup-of-external-firewalls-loadbalancers.pot +source_lang = en +type = PO + [ACS_DOCS.initialize-and-test] file_filter = /initialize-and-test.po source_file = pot/initialize-and-test.pot source_lang = en type = PO -[ACS_DOCS.initial-setup-of-external-firewalls-loadbalancers] -file_filter = /initial-setup-of-external-firewalls-loadbalancers.po -source_file = pot/initial-setup-of-external-firewalls-loadbalancers.pot +[ACS_DOCS.install-usage-server] +file_filter = /install-usage-server.po +source_file = pot/install-usage-server.pot source_lang = en type = PO @@ -1052,9 +1425,9 @@ source_file = pot/installation-complete.pot source_lang = en type = PO -[ACS_DOCS.installation_overview] -file_filter = /installation_overview.po -source_file = pot/installation_overview.pot +[ACS_DOCS.installation-steps-overview] +file_filter = /installation-steps-overview.po +source_file = pot/installation-steps-overview.pot source_lang = en type = PO @@ -1070,9 +1443,9 @@ source_file = pot/installation_steps_overview.pot source_lang = en type = PO -[ACS_DOCS.installation-steps-overview] -file_filter = /installation-steps-overview.po -source_file = pot/installation-steps-overview.pot +[ACS_DOCS.inter-vlan-routing] +file_filter = /inter-vlan-routing.po +source_file = pot/inter-vlan-routing.pot source_lang = en type = PO @@ -1082,12 +1455,6 @@ source_file = pot/introduction.pot source_lang = en type = PO -[ACS_DOCS.ipaddress-usage-record-format] -file_filter = /ipaddress-usage-record-format.po -source_file = pot/ipaddress-usage-record-format.pot -source_lang = en -type = PO - [ACS_DOCS.ip-forwarding-firewalling] file_filter = /ip-forwarding-firewalling.po source_file = pot/ip-forwarding-firewalling.pot @@ -1100,6 +1467,12 @@ source_file = pot/ip-load-balancing.pot source_lang = en type = PO +[ACS_DOCS.ipaddress-usage-record-format] +file_filter = /ipaddress-usage-record-format.po +source_file = pot/ipaddress-usage-record-format.pot +source_lang = en +type = PO + [ACS_DOCS.isolated-networks] file_filter = /isolated-networks.po source_file = pot/isolated-networks.pot @@ -1112,15 +1485,27 @@ source_file = pot/job-status.pot source_lang = en type = PO +[ACS_DOCS.kvm-topology-req] +file_filter = /kvm-topology-req.po +source_file = pot/kvm-topology-req.pot +source_lang = en +type = PO + [ACS_DOCS.large_scale_redundant_setup] file_filter = /large_scale_redundant_setup.po source_file = pot/large_scale_redundant_setup.pot source_lang = en type = PO -[ACS_DOCS.LDAPserver-for-user-authentication] -file_filter = /LDAPserver-for-user-authentication.po -source_file = pot/LDAPserver-for-user-authentication.pot +[ACS_DOCS.layer2-switch] +file_filter = /layer2-switch.po +source_file = pot/layer2-switch.pot +source_lang = en +type = PO + +[ACS_DOCS.lb-policy-pfwd-rule-usage-record-format] +file_filter = /lb-policy-pfwd-rule-usage-record-format.po +source_file = pot/lb-policy-pfwd-rule-usage-record-format.pot source_lang = en type = PO @@ -1130,30 +1515,24 @@ source_file = pot/linux-installation.pot source_lang = en type = PO -[ACS_DOCS.loadbal-policy-port-fwd-rule-usage-record-fmt] -file_filter = /loadbalancer-policy-port-forwarding-rule-usage-record-format.po -source_file = pot/loadbalancer-policy-port-forwarding-rule-usage-record-format.pot -source_lang = en -type = PO - [ACS_DOCS.load-balancer-rules] file_filter = /load-balancer-rules.po source_file = pot/load-balancer-rules.pot source_lang = en type = PO -[ACS_DOCS.log-in] -file_filter = /log-in.po -source_file = pot/log-in.pot -source_lang = en -type = PO - [ACS_DOCS.log-in-root-admin] file_filter = /log-in-root-admin.po source_file = pot/log-in-root-admin.pot source_lang = en type = PO +[ACS_DOCS.log-in] +file_filter = /log-in.po +source_file = pot/log-in.pot +source_lang = en +type = PO + [ACS_DOCS.long-running-job-events] file_filter = /long-running-job-events.po source_file = pot/long-running-job-events.pot @@ -1196,12 +1575,6 @@ source_file = pot/management-server-install-complete.pot source_lang = en type = PO -[ACS_DOCS.management-server-install-db] -file_filter = /management-server-install-db.po -source_file = pot/management-server-install-db.pot -source_lang = en -type = PO - [ACS_DOCS.management-server-install-db-external] file_filter = /management-server-install-db-external.po source_file = pot/management-server-install-db-external.pot @@ -1214,6 +1587,12 @@ source_file = pot/management-server-install-db-local.pot source_lang = en type = PO +[ACS_DOCS.management-server-install-db] +file_filter = /management-server-install-db.po +source_file = pot/management-server-install-db.pot +source_lang = en +type = PO + [ACS_DOCS.management-server-install-flow] file_filter = /management-server-install-flow.po source_file = pot/management-server-install-flow.pot @@ -1250,6 +1629,12 @@ source_file = pot/management-server-install-systemvm.pot source_lang = en type = PO +[ACS_DOCS.management-server-lb] +file_filter = /management-server-lb.po +source_file = pot/management-server-lb.pot +source_lang = en +type = PO + [ACS_DOCS.management-server-overview] file_filter = /management-server-overview.po source_file = pot/management-server-overview.pot @@ -1262,6 +1647,12 @@ source_file = pot/manual-live-migration.pot source_lang = en type = PO +[ACS_DOCS.marvin] +file_filter = /marvin.po +source_file = pot/marvin.pot +source_lang = en +type = PO + [ACS_DOCS.max-result-page-returned] file_filter = /max-result-page-returned.po source_file = pot/max-result-page-returned.pot @@ -1304,15 +1695,51 @@ source_file = pot/multi_node_overview.pot source_lang = en type = PO +[ACS_DOCS.multi_site_deployment] +file_filter = /multi_site_deployment.po +source_file = pot/multi_site_deployment.pot +source_lang = en +type = PO + [ACS_DOCS.multiple-system-vm-vmware] file_filter = /multiple-system-vm-vmware.po source_file = pot/multiple-system-vm-vmware.pot source_lang = en type = PO -[ACS_DOCS.multi_site_deployment] -file_filter = /multi_site_deployment.po -source_file = pot/multi_site_deployment.pot +[ACS_DOCS.network-offering-usage-record-format] +file_filter = /network-offering-usage-record-format.po +source_file = pot/network-offering-usage-record-format.pot +source_lang = en +type = PO + +[ACS_DOCS.network-offerings] +file_filter = /network-offerings.po +source_file = pot/network-offerings.pot +source_lang = en +type = PO + +[ACS_DOCS.network-rate] +file_filter = /network-rate.po +source_file = pot/network-rate.pot +source_lang = en +type = PO + +[ACS_DOCS.network-service-providers] +file_filter = /network-service-providers.po +source_file = pot/network-service-providers.pot +source_lang = en +type = PO + +[ACS_DOCS.network-setup] +file_filter = /network-setup.po +source_file = pot/network-setup.pot +source_lang = en +type = PO + +[ACS_DOCS.network-usage-record-format] +file_filter = /network-usage-record-format.po +source_file = pot/network-usage-record-format.pot source_lang = en type = PO @@ -1328,39 +1755,27 @@ source_file = pot/networking-in-a-zone.pot source_lang = en type = PO -[ACS_DOCS.networking_overview] -file_filter = /networking_overview.po -source_file = pot/networking-overview.pot -source_lang = en -type = PO - [ACS_DOCS.networking-overview] file_filter = /networking-overview.po source_file = pot/networking-overview.pot source_lang = en type = PO -[ACS_DOCS.network-offerings] -file_filter = /network-offerings.po -source_file = pot/network-offerings.pot +[ACS_DOCS.networking_overview] +file_filter = /networking_overview.po +source_file = pot/networking_overview.pot source_lang = en type = PO -[ACS_DOCS.network-offering-usage-record-format] -file_filter = /network-offering-usage-record-format.po -source_file = pot/network-offering-usage-record-format.pot +[ACS_DOCS.networks-for-users-overview] +file_filter = /networks-for-users-overview.po +source_file = pot/networks-for-users-overview.pot source_lang = en type = PO -[ACS_DOCS.network-service-providers] -file_filter = /network-service-providers.po -source_file = pot/network-service-providers.pot -source_lang = en -type = PO - -[ACS_DOCS.network-usage-record-format] -file_filter = /network-usage-record-format.po -source_file = pot/network-usage-record-format.pot +[ACS_DOCS.networks] +file_filter = /networks.po +source_file = pot/networks.pot source_lang = en type = PO @@ -1376,9 +1791,15 @@ source_file = pot/nfs-shares-on-separate-server.pot source_lang = en type = PO -[ACS_DOCS.ongoing-config-of-external-firewall-loadbalancer] -file_filter = /ongoing-configuration-of-external-firewalls-loadbalancer.po -source_file = pot/ongoing-configuration-of-external-firewalls-loadbalancer.pot +[ACS_DOCS.offerings] +file_filter = /offerings.po +source_file = pot/offerings.pot +source_lang = en +type = PO + +[ACS_DOCS.ongoing-config-of-external-firewalls-lb] +file_filter = /ongoing-config-of-external-firewalls-lb.po +source_file = pot/ongoing-config-of-external-firewalls-lb.pot source_lang = en type = PO @@ -1388,6 +1809,18 @@ source_file = pot/over-provisioning-service-offering-limits.pot source_lang = en type = PO +[ACS_DOCS.ovm-install] +file_filter = /ovm-install.po +source_file = pot/ovm-install.pot +source_lang = en +type = PO + +[ACS_DOCS.ovm-requirements] +file_filter = /ovm-requirements.po +source_file = pot/ovm-requirements.pot +source_lang = en +type = PO + [ACS_DOCS.per-domain-limits] file_filter = /per-domain-limits.po source_file = pot/per-domain-limits.pot @@ -1406,6 +1839,84 @@ source_file = pot/physical-network-configuration-settings.pot source_lang = en type = PO +[ACS_DOCS.plugin-niciranvp-about] +file_filter = /plugin-niciranvp-about.po +source_file = pot/plugin-niciranvp-about.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-devicemanagement] +file_filter = /plugin-niciranvp-devicemanagement.po +source_file = pot/plugin-niciranvp-devicemanagement.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-features] +file_filter = /plugin-niciranvp-features.po +source_file = pot/plugin-niciranvp-features.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-guide] +file_filter = /plugin-niciranvp-guide.po +source_file = pot/plugin-niciranvp-guide.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-introduction] +file_filter = /plugin-niciranvp-introduction.po +source_file = pot/plugin-niciranvp-introduction.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-preparations] +file_filter = /plugin-niciranvp-preparations.po +source_file = pot/plugin-niciranvp-preparations.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-provider] +file_filter = /plugin-niciranvp-provider.po +source_file = pot/plugin-niciranvp-provider.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-revisions] +file_filter = /plugin-niciranvp-revisions.po +source_file = pot/plugin-niciranvp-revisions.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-tables] +file_filter = /plugin-niciranvp-tables.po +source_file = pot/plugin-niciranvp-tables.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-troubleshooting] +file_filter = /plugin-niciranvp-troubleshooting.po +source_file = pot/plugin-niciranvp-troubleshooting.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-ui] +file_filter = /plugin-niciranvp-ui.po +source_file = pot/plugin-niciranvp-ui.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-usage] +file_filter = /plugin-niciranvp-usage.po +source_file = pot/plugin-niciranvp-usage.pot +source_lang = en +type = PO + +[ACS_DOCS.plugin-niciranvp-uuidreferences] +file_filter = /plugin-niciranvp-uuidreferences.po +source_file = pot/plugin-niciranvp-uuidreferences.pot +source_lang = en +type = PO + [ACS_DOCS.pod-add] file_filter = /pod-add.po source_file = pot/pod-add.pot @@ -1418,18 +1929,6 @@ source_file = pot/port-forwarding.pot source_lang = en type = PO -[ACS_DOCS.Preface] -file_filter = /Preface.po -source_file = pot/Preface.pot -source_lang = en -type = PO - -[ACS_DOCS.prepare_os] -file_filter = /prepare_os.po -source_file = pot/prepare_os.pot -source_lang = en -type = PO - [ACS_DOCS.prepare-system-vm-template] file_filter = /prepare-system-vm-template.po source_file = pot/prepare-system-vm-template.pot @@ -1460,6 +1959,12 @@ source_file = pot/private-public-template.pot source_lang = en type = PO +[ACS_DOCS.projects-overview] +file_filter = /projects-overview.po +source_file = pot/projects-overview.pot +source_lang = en +type = PO + [ACS_DOCS.projects] file_filter = /projects.po source_file = pot/projects.pot @@ -1472,12 +1977,6 @@ source_file = pot/provisioning-auth-api.pot source_lang = en type = PO -[ACS_DOCS.provisioning] -file_filter = /provisioning.po -source_file = pot/provisioning.pot -source_lang = en -type = PO - [ACS_DOCS.provisioning-steps-overview] file_filter = /provisioning-steps-overview.po source_file = pot/provisioning-steps-overview.pot @@ -1496,21 +1995,51 @@ source_file = pot/query-filter.pot source_lang = en type = PO +[ACS_DOCS.re-install-hosts] +file_filter = /re-install-hosts.po +source_file = pot/re-install-hosts.pot +source_lang = en +type = PO + [ACS_DOCS.release-ip-address] file_filter = /release-ip-address.po source_file = pot/release-ip-address.pot source_lang = en type = PO +[ACS_DOCS.release-ip-for-vpc] +file_filter = /release-ip-for-vpc.po +source_file = pot/release-ip-for-vpc.pot +source_lang = en +type = PO + +[ACS_DOCS.remove-member-from-project] +file_filter = /remove-member-from-project.po +source_file = pot/remove-member-from-project.pot +source_lang = en +type = PO + +[ACS_DOCS.remove-tier] +file_filter = /remove-tier.po +source_file = pot/remove-tier.pot +source_lang = en +type = PO + +[ACS_DOCS.remove-vpc] +file_filter = /remove-vpc.po +source_file = pot/remove-vpc.pot +source_lang = en +type = PO + [ACS_DOCS.removed-API-commands] file_filter = /removed-API-commands.po source_file = pot/removed-API-commands.pot source_lang = en type = PO -[ACS_DOCS.remove-member-from-project] -file_filter = /remove-member-from-project.po -source_file = pot/remove-member-from-project.pot +[ACS_DOCS.removing-hosts] +file_filter = /removing-hosts.po +source_file = pot/removing-hosts.pot source_lang = en type = PO @@ -1550,12 +2079,6 @@ source_file = pot/responses.pot source_lang = en type = PO -[ACS_DOCS.Revision_History] -file_filter = /Revision_History.po -source_file = pot/Revision_History.pot -source_lang = en -type = PO - [ACS_DOCS.roles] file_filter = /roles.po source_file = pot/roles.pot @@ -1580,6 +2103,12 @@ source_file = pot/runtime-behavior-of-primary-storage.pot source_lang = en type = PO +[ACS_DOCS.runtime-internal-comm-req] +file_filter = /runtime-internal-comm-req.po +source_file = pot/runtime-internal-comm-req.pot +source_lang = en +type = PO + [ACS_DOCS.scheduled-maintenance-maintenance-mode-hosts] file_filter = /scheduled-maintenance-maintenance-mode-hosts.po source_file = pot/scheduled-maintenance-maintenance-mode-hosts.pot @@ -1610,24 +2139,30 @@ source_file = pot/secondary-storage-outage-and-data-loss.pot source_lang = en type = PO -[ACS_DOCS.secondary-storage] -file_filter = /secondary-storage.po -source_file = pot/secondary-storage.pot -source_lang = en -type = PO - [ACS_DOCS.secondary-storage-vm] file_filter = /secondary-storage-vm.po source_file = pot/secondary-storage-vm.pot source_lang = en type = PO +[ACS_DOCS.secondary-storage] +file_filter = /secondary-storage.po +source_file = pot/secondary-storage.pot +source_lang = en +type = PO + [ACS_DOCS.security-groups] file_filter = /security-groups.po source_file = pot/security-groups.pot source_lang = en type = PO +[ACS_DOCS.security-req] +file_filter = /security-req.po +source_file = pot/security-req.pot +source_lang = en +type = PO + [ACS_DOCS.send-projects-membership-invitation] file_filter = /send-projects-membership-invitation.po source_file = pot/send-projects-membership-invitation.pot @@ -1652,12 +2187,24 @@ source_file = pot/set-database-buffer-pool-size.pot source_lang = en type = PO +[ACS_DOCS.set-global-project-resource-limits] +file_filter = /set-global-project-resource-limits.po +source_file = pot/set-global-project-resource-limits.pot +source_lang = en +type = PO + [ACS_DOCS.set-monitor-total-vm-limits-per-host] file_filter = /set-monitor-total-vm-limits-per-host.po source_file = pot/set-monitor-total-vm-limits-per-host.pot source_lang = en type = PO +[ACS_DOCS.set-per-project-resource-limits] +file_filter = /set-per-project-resource-limits.po +source_file = pot/set-per-project-resource-limits.pot +source_lang = en +type = PO + [ACS_DOCS.set-projects-creator-permissions] file_filter = /set-projects-creator-permissions.po source_file = pot/set-projects-creator-permissions.pot @@ -1688,6 +2235,12 @@ source_file = pot/set-usage-limit.pot source_lang = en type = PO +[ACS_DOCS.set-zone-vlan-run-vm-max] +file_filter = /set-zone-vlan-run-vm-max.po +source_file = pot/set-zone-vlan-run-vm-max.pot +source_lang = en +type = PO + [ACS_DOCS.shared-networks] file_filter = /shared-networks.po source_file = pot/shared-networks.pot @@ -1718,9 +2271,27 @@ source_file = pot/snapshot-restore.pot source_lang = en type = PO -[ACS_DOCS.SSL-keystore-path-and-password] -file_filter = /SSL-keystore-path-and-password.po -source_file = pot/SSL-keystore-path-and-password.pot +[ACS_DOCS.source-build] +file_filter = /source-build.po +source_file = pot/source-build.pot +source_lang = en +type = PO + +[ACS_DOCS.source-prereqs] +file_filter = /source-prereqs.po +source_file = pot/source-prereqs.pot +source_lang = en +type = PO + +[ACS_DOCS.source] +file_filter = /source.po +source_file = pot/source.pot +source_lang = en +type = PO + +[ACS_DOCS.ssl] +file_filter = /ssl.po +source_file = pot/ssl.pot source_lang = en type = PO @@ -1742,6 +2313,12 @@ source_file = pot/sticky-session-policies-for-lb-rules.pot source_lang = en type = PO +[ACS_DOCS.stop-restart-management-server] +file_filter = /stop-restart-management-server.po +source_file = pot/stop-restart-management-server.pot +source_lang = en +type = PO + [ACS_DOCS.stopped-vm] file_filter = /stopped-vm.po source_file = pot/stopped-vm.pot @@ -1754,15 +2331,15 @@ source_file = pot/stopping-and-starting-vms.pot source_lang = en type = PO -[ACS_DOCS.stop-restart-management-server] -file_filter = /stop-restart-management-server.po -source_file = pot/stop-restart-management-server.pot +[ACS_DOCS.storage-nw-topology-req] +file_filter = /storage-nw-topology-req.po +source_file = pot/storage-nw-topology-req.pot source_lang = en type = PO -[ACS_DOCS.storage] -file_filter = /storage.po -source_file = pot/storage.pot +[ACS_DOCS.storage-overview] +file_filter = /storage-overview.po +source_file = pot/storage-overview.pot source_lang = en type = PO @@ -1772,12 +2349,30 @@ source_file = pot/storage-tags.pot source_lang = en type = PO +[ACS_DOCS.storage] +file_filter = /storage.po +source_file = pot/storage.pot +source_lang = en +type = PO + [ACS_DOCS.suspend-project] file_filter = /suspend-project.po source_file = pot/suspend-project.pot source_lang = en type = PO +[ACS_DOCS.sys-offering-sysvm] +file_filter = /sys-offering-sysvm.po +source_file = pot/sys-offering-sysvm.pot +source_lang = en +type = PO + +[ACS_DOCS.sys-reliability-and-ha] +file_filter = /sys-reliability-and-ha.po +source_file = pot/sys-reliability-and-ha.pot +source_lang = en +type = PO + [ACS_DOCS.sysprep-for-windows-server-2003R2] file_filter = /sysprep-for-windows-server-2003R2.po source_file = pot/sysprep-for-windows-server-2003R2.pot @@ -1790,12 +2385,6 @@ source_file = pot/sysprep-windows-server-2008R2.pot source_lang = en type = PO -[ACS_DOCS.sys-reliability-and-ha] -file_filter = /sys-reliability-and-ha.po -source_file = pot/sys-reliability-and-ha.pot -source_lang = en -type = PO - [ACS_DOCS.system-reserved-ip-addresses] file_filter = /system-reserved-ip-addresses.po source_file = pot/system-reserved-ip-addresses.pot @@ -1814,6 +2403,12 @@ source_file = pot/system-vm-template.pot source_lang = en type = PO +[ACS_DOCS.tagging-resources] +file_filter = /tagging-resources.po +source_file = pot/tagging-resources.pot +source_lang = en +type = PO + [ACS_DOCS.template-iso-snapshot-usage-record-format] file_filter = /template-iso-snapshot-usage-record-format.po source_file = pot/template-iso-snapshot-usage-record-format.pot @@ -1832,36 +2427,30 @@ source_file = pot/time-zones.pot source_lang = en type = PO +[ACS_DOCS.tools] +file_filter = /tools.po +source_file = pot/tools.pot +source_lang = en +type = PO + +[ACS_DOCS.topology-req] +file_filter = /topology-req.po +source_file = pot/topology-req.pot +source_lang = en +type = PO + [ACS_DOCS.troubleshooting-alerts] file_filter = /troubleshooting-alerts.po source_file = pot/troubleshooting-alerts.pot source_lang = en type = PO -[ACS_DOCS.troubleshoot-dataloss-on-exported-primary-storage] -file_filter = /troubleshooting-dataloss-on-exported-primary-storage.po -source_file = pot/troubleshooting-dataloss-on-exported-primary-storage.pot -source_lang = en -type = PO - [ACS_DOCS.troubleshooting-lb-rules-fails] file_filter = /troubleshooting-lb-rules-fails.po source_file = pot/troubleshooting-lb-rules-fails.pot source_lang = en type = PO -[ACS_DOCS.troubleshoot-maint-mode-not-working-on-vCenter] -file_filter = /troubleshooting-maintenance-mode-not-working-on-vCenter.po -source_file = pot/troubleshooting-maintenance-mode-not-working-on-vCenter.pot -source_lang = en -type = PO - -[ACS_DOCS.troubleshooting] -file_filter = /troubleshooting.po -source_file = pot/troubleshooting.pot -source_lang = en -type = PO - [ACS_DOCS.troubleshooting-recover-lost-virtual-router] file_filter = /troubleshooting-recover-lost-virtual-router.po source_file = pot/troubleshooting-recover-lost-virtual-router.pot @@ -1886,6 +2475,24 @@ source_file = pot/troubleshooting-working-with-server-logs.pot source_lang = en type = PO +[ACS_DOCS.troubleshooting] +file_filter = /troubleshooting.po +source_file = pot/troubleshooting.pot +source_lang = en +type = PO + +[ACS_DOCS.troublesht-dataloss-on-exp-primary-storage] +file_filter = /troublesht-dataloss-on-exp-primary-storage.po +source_file = pot/troublesht-dataloss-on-exp-primary-storage.pot +source_lang = en +type = PO + +[ACS_DOCS.troublesht-mtn-mode-not-working-on-vCenter] +file_filter = /troublesht-mtn-mode-not-working-on-vCenter.po +source_file = pot/troublesht-mtn-mode-not-working-on-vCenter.pot +source_lang = en +type = PO + [ACS_DOCS.tuning] file_filter = /tuning.po source_file = pot/tuning.pot @@ -1988,18 +2595,36 @@ source_file = pot/vcenter-maintenance-mode.pot source_lang = en type = PO +[ACS_DOCS.verifying-source] +file_filter = /verifying-source.po +source_file = pot/verifying-source.pot +source_lang = en +type = PO + [ACS_DOCS.virtual-machine-usage-record-format] file_filter = /virtual-machine-usage-record-format.po source_file = pot/virtual-machine-usage-record-format.pot source_lang = en type = PO +[ACS_DOCS.virtual-machines] +file_filter = /virtual-machines.po +source_file = pot/virtual-machines.pot +source_lang = en +type = PO + [ACS_DOCS.virtual-router] file_filter = /virtual-router.po source_file = pot/virtual-router.pot source_lang = en type = PO +[ACS_DOCS.vlan-allocation-eg] +file_filter = /vlan-allocation-eg.po +source_file = pot/vlan-allocation-eg.pot +source_lang = en +type = PO + [ACS_DOCS.vlan-provisioning] file_filter = /vlan-provisioning.po source_file = pot/vlan-provisioning.pot @@ -2018,6 +2643,24 @@ source_file = pot/vm-storage-migration.pot source_lang = en type = PO +[ACS_DOCS.vmware-install] +file_filter = /vmware-install.po +source_file = pot/vmware-install.pot +source_lang = en +type = PO + +[ACS_DOCS.vmware-requirements] +file_filter = /vmware-requirements.po +source_file = pot/vmware-requirements.pot +source_lang = en +type = PO + +[ACS_DOCS.vmware-topology-req] +file_filter = /vmware-topology-req.po +source_file = pot/vmware-topology-req.pot +source_lang = en +type = PO + [ACS_DOCS.volume-deletion-garbage-collection] file_filter = /volume-deletion-garbage-collection.po source_file = pot/volume-deletion-garbage-collection.pot @@ -2042,12 +2685,6 @@ source_file = pot/vpn.pot source_lang = en type = PO -[ACS_DOCS.VPN-user-usage-record-format] -file_filter = /VPN-user-usage-record-format.po -source_file = pot/VPN-user-usage-record-format.pot -source_lang = en -type = PO - [ACS_DOCS.whatis] file_filter = /whatis.po source_file = pot/whatis.pot @@ -2078,6 +2715,12 @@ source_file = pot/windows-installation.pot source_lang = en type = PO +[ACS_DOCS.work-with-usage] +file_filter = /work-with-usage.po +source_file = pot/work-with-usage.pot +source_lang = en +type = PO + [ACS_DOCS.working-with-hosts] file_filter = /working-with-hosts.po source_file = pot/working-with-hosts.pot @@ -2120,20 +2763,21 @@ source_file = pot/working-with-volumes.pot source_lang = en type = PO -[ACS_DOCS.work-with-usage] -file_filter = /work-with-usage.po -source_file = pot/work-with-usage.pot -source_lang = en -type = PO - [ACS_DOCS.xenserver-maintenance-mode] file_filter = /xenserver-maintenance-mode.po source_file = pot/xenserver-maintenance-mode.pot source_lang = en type = PO +[ACS_DOCS.xenserver-topology-req] +file_filter = /xenserver-topology-req.po +source_file = pot/xenserver-topology-req.pot +source_lang = en +type = PO + [ACS_DOCS.zone-add] file_filter = /zone-add.po source_file = pot/zone-add.pot source_lang = en type = PO + diff --git a/docs/en-US/Developers_Guide.xml b/docs/en-US/Developers_Guide.xml index 6c09354f6a8..e753f9bcb33 100644 --- a/docs/en-US/Developers_Guide.xml +++ b/docs/en-US/Developers_Guide.xml @@ -50,6 +50,7 @@ + diff --git a/docs/en-US/LDAPserver-for-user-authentication.xml b/docs/en-US/LDAPserver-for-user-authentication.xml index 5fcb300af65..376631cbbc2 100644 --- a/docs/en-US/LDAPserver-for-user-authentication.xml +++ b/docs/en-US/LDAPserver-for-user-authentication.xml @@ -5,23 +5,22 @@ ]> -
Using an LDAP Server for User Authentication You can use an external LDAP server such as Microsoft Active Directory or ApacheDS to authenticate &PRODUCT; end-users. Just map &PRODUCT; accounts to the corresponding LDAP accounts using a query filter. The query filter is written using the query syntax of the particular LDAP server, and can include special wildcard characters provided by &PRODUCT; for matching common values such as the user’s email address and name. &PRODUCT; will search the external LDAP directory tree starting at a specified base directory and return the distinguished name (DN) and password of the matching user. This information along with the given password is used to authenticate the user.. @@ -37,4 +36,4 @@ -
+ diff --git a/docs/en-US/Release_Notes.xml b/docs/en-US/Release_Notes.xml index c8cc6869737..4d1f62fb713 100644 --- a/docs/en-US/Release_Notes.xml +++ b/docs/en-US/Release_Notes.xml @@ -1291,6 +1291,15 @@ Done restarting router(s). appropriate calls to the Nicira NVP Controller. The plug-in has been tested with Nicira NVP versions 2.1.0, 2.2.0 and 2.2.1. +
+ The BigSwitch Controller Plugin + The BigSwitch Controller plug-in adds OpenFlow based solution for network virtualization + to CloudStack. The plugin supports both BigSwitch commercial controller and the opensource + Floodlight controller. The plugin functions as a provider for CloudStack networks and Connectivity + service. This service is responsible for creating Layer 2 networks supporting the networks + created by guests. When a tenant creates a new network, a virutal network segment will be + created by sending the appropriate calls to the BigSwitch Controller. +
Support for CAStor Cluster CloudStack 4.0.0-incubating supports using a CAStor cluster as the back-end storage diff --git a/docs/en-US/about-clusters.xml b/docs/en-US/about-clusters.xml index 745ad89d118..aa8604ccd52 100644 --- a/docs/en-US/about-clusters.xml +++ b/docs/en-US/about-clusters.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> diff --git a/docs/en-US/about-hosts.xml b/docs/en-US/about-hosts.xml index 49694b25647..87b6bab1ee1 100644 --- a/docs/en-US/about-hosts.xml +++ b/docs/en-US/about-hosts.xml @@ -1,25 +1,25 @@ - %BOOK_ENTITIES; ]>
diff --git a/docs/en-US/about-physical-networks.xml b/docs/en-US/about-physical-networks.xml index 8edb9e060c2..b22e48b7779 100644 --- a/docs/en-US/about-physical-networks.xml +++ b/docs/en-US/about-physical-networks.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> -
- About Physical Networks + About Physical Networks Part of adding a zone is setting up the physical network. One or (in an advanced zone) more physical networks can be associated with each zone. The network corresponds to a NIC on the hypervisor host. Each physical network can carry one or more types of network traffic. The choices of traffic type for each network vary depending on whether you are creating a zone with basic networking or advanced networking. A physical network is the actual network hardware and wiring in a zone. A zone can have multiple physical networks. An administrator can: @@ -33,8 +32,7 @@ Configure the service providers (firewalls, load balancers, etc.) available on a physical network Configure the IP addresses trunked to a physical network Specify what type of traffic is carried on the physical network, as well as other properties like network speed - - + diff --git a/docs/en-US/about-pods.xml b/docs/en-US/about-pods.xml index ed3520c6451..57ae1a319b3 100644 --- a/docs/en-US/about-pods.xml +++ b/docs/en-US/about-pods.xml @@ -1,33 +1,34 @@ - %BOOK_ENTITIES; ]>
About Pods - A pod often represents a single rack. Hosts in the same pod are in the same subnet. - A pod is the second-largest organizational unit within a &PRODUCT; deployment. Pods are contained within zones. Each zone can contain one or more pods. - Pods are not visible to the end user. - A pod consists of one or more clusters of hosts and one or more primary storage servers. + A pod often represents a single rack. Hosts in the same pod are in the same subnet. + A pod is the second-largest organizational unit within a &PRODUCT; deployment. Pods are contained within zones. Each zone can contain one or more pods. + A pod consists of one or more clusters of hosts and one or more primary storage servers. + Pods are not visible to the end user. + diff --git a/docs/en-US/about-primary-storage.xml b/docs/en-US/about-primary-storage.xml index 68d7a25ba5a..a9cf05486c6 100644 --- a/docs/en-US/about-primary-storage.xml +++ b/docs/en-US/about-primary-storage.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> diff --git a/docs/en-US/about-secondary-storage.xml b/docs/en-US/about-secondary-storage.xml index c4df0b8c6e8..c5b4f5d5a2f 100644 --- a/docs/en-US/about-secondary-storage.xml +++ b/docs/en-US/about-secondary-storage.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> diff --git a/docs/en-US/about-security-groups.xml b/docs/en-US/about-security-groups.xml index 85e8477cfb1..6a31b25ef48 100644 --- a/docs/en-US/about-security-groups.xml +++ b/docs/en-US/about-security-groups.xml @@ -24,7 +24,12 @@
About Security Groups - Security groups provide a way to isolate traffic to VMs. A security group is a group of VMs that filter their incoming and outgoing traffic according to a set of rules, called ingress and egress rules. These rules filter network traffic according to the IP address that is attempting to communicate with the VM. Security groups are particularly useful in zones that use basic networking, because there is a single guest network for all guest VMs. In &PRODUCT; 3.0.3 - 3.0.5, security groups are supported only in zones that use basic networking. + Security groups provide a way to isolate traffic to VMs. A security group is a group of + VMs that filter their incoming and outgoing traffic according to a set of rules, called + ingress and egress rules. These rules filter network traffic according to the IP address + that is attempting to communicate with the VM. Security groups are particularly useful in + zones that use basic networking, because there is a single guest network for all guest VMs. + In advanced zones, security groups are supported only on the KVM hypervisor. In a zone that uses advanced networking, you can instead define multiple guest networks to isolate traffic to VMs. diff --git a/docs/en-US/about-virtual-networks.xml b/docs/en-US/about-virtual-networks.xml index 2797423d24d..4dbd2018b27 100644 --- a/docs/en-US/about-virtual-networks.xml +++ b/docs/en-US/about-virtual-networks.xml @@ -5,23 +5,22 @@ ]> -
About Virtual Networks A virtual network is a logical construct that enables multi-tenancy on a single physical network. In &PRODUCT; a virtual network can be shared or isolated. diff --git a/docs/en-US/about-working-with-vms.xml b/docs/en-US/about-working-with-vms.xml index 47153e2f374..259c61bc814 100644 --- a/docs/en-US/about-working-with-vms.xml +++ b/docs/en-US/about-working-with-vms.xml @@ -5,35 +5,35 @@ ]>
- About Working with Virtual Machines - &PRODUCT; provides administrators with complete control over the lifecycle of all guest VMs executing in the cloud. &PRODUCT; provides several guest management operations for end users and administrators. VMs may be stopped, started, rebooted, and destroyed. - Guest VMs have a name and group. VM names and groups are opaque to &PRODUCT; and are available for end users to organize their VMs. Each VM can have three names for use in different contexts. Only two of these names can be controlled by the user: - - Instance name – a unique, immutable ID that is generated by &PRODUCT; and can not be modified by the user. This name conforms to the requirements in IETF RFC 1123. - Display name – the name displayed in the &PRODUCT; web UI. Can be set by the user. Defaults to instance name. - Name – host name that the DHCP server assigns to the VM. Can be set by the user. Defaults to instance name - - Guest VMs can be configured to be Highly Available (HA). An HA-enabled VM is monitored by the system. If the system detects that the VM is down, it will attempt to restart the VM, possibly on a different host. For more information, see HA-Enabled Virtual Machines on - Each new VM is allocated one public IP address. When the VM is started, &PRODUCT; automatically creates a static NAT between this public IP address and the private IP address of the VM. - If elastic IP is in use (with the NetScaler load balancer), the IP address initially allocated to the new VM is not marked as elastic. The user must replace the automatically configured IP with a specifically acquired elastic IP, and set up the static NAT mapping between this new IP and the guest VM’s private IP. The VM’s original IP address is then released and returned to the pool of available public IPs. - &PRODUCT; cannot distinguish a guest VM that was shut down by the user (such as with the “shutdown†command in Linux) from a VM that shut down unexpectedly. If an HA-enabled VM is shut down from inside the VM, &PRODUCT; will restart it. To shut down an HA-enabled VM, you must go through the &PRODUCT; UI or API. + About Working with Virtual Machines + &PRODUCT; provides administrators with complete control over the lifecycle of all guest VMs executing in the cloud. &PRODUCT; provides several guest management operations for end users and administrators. VMs may be stopped, started, rebooted, and destroyed. + Guest VMs have a name and group. VM names and groups are opaque to &PRODUCT; and are available for end users to organize their VMs. Each VM can have three names for use in different contexts. Only two of these names can be controlled by the user: + + Instance name – a unique, immutable ID that is generated by &PRODUCT;, and can not be modified by the user. This name conforms to the requirements in IETF RFC 1123. + Display name – the name displayed in the &PRODUCT; web UI. Can be set by the user. Defaults to instance name. + Name – host name that the DHCP server assigns to the VM. Can be set by the user. Defaults to instance name + + Guest VMs can be configured to be Highly Available (HA). An HA-enabled VM is monitored by the system. If the system detects that the VM is down, it will attempt to restart the VM, possibly on a different host. For more information, see HA-Enabled Virtual Machines on + Each new VM is allocated one public IP address. When the VM is started, &PRODUCT; automatically creates a static NAT between this public IP address and the private IP address of the VM. + If elastic IP is in use (with the NetScaler load balancer), the IP address initially allocated to the new VM is not marked as elastic. The user must replace the automatically configured IP with a specifically acquired elastic IP, and set up the static NAT mapping between this new IP and the guest VM’s private IP. The VM’s original IP address is then released and returned to the pool of available public IPs. + &PRODUCT; cannot distinguish a guest VM that was shut down by the user (such as with the “shutdown†command in Linux) from a VM that shut down unexpectedly. If an HA-enabled VM is shut down from inside the VM, &PRODUCT; will restart it. To shut down an HA-enabled VM, you must go through the &PRODUCT; UI or API.
diff --git a/docs/en-US/about-zones.xml b/docs/en-US/about-zones.xml index a05a9a6e517..5385df05088 100644 --- a/docs/en-US/about-zones.xml +++ b/docs/en-US/about-zones.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> -
- About Zones + About Zones A zone is the largest organizational unit within a &PRODUCT; deployment. A zone typically corresponds to a single datacenter, although it is permissible to have multiple zones in a datacenter. The benefit of organizing infrastructure into zones is to provide physical isolation and redundancy. For example, each zone can have its own power supply and network uplink, and the zones can be widely separated geographically (though this is not required). A zone consists of: @@ -34,7 +33,7 @@ - zone-overview.png: Nested structure of a simple zone + zone-overview.png: Nested structure of a simple zone. Zones are visible to the end user. When a user starts a guest VM, the user must select a zone for their guest. Users might also be required to copy their private templates to additional zones to enable creation of guest VMs using their templates in those zones. Zones can be public or private. Public zones are visible to all users. This means that any user may create a guest in that zone. Private zones are reserved for a specific domain. Only users in that domain or its subdomains may create guests in that zone. diff --git a/docs/en-US/accessing-vms.xml b/docs/en-US/accessing-vms.xml index c77ad4eee52..ce780cff080 100644 --- a/docs/en-US/accessing-vms.xml +++ b/docs/en-US/accessing-vms.xml @@ -5,23 +5,22 @@ ]> -
Accessing VMs Any user can access their own virtual machines. The administrator can access all VMs running in the cloud. diff --git a/docs/en-US/accounts-users-domains.xml b/docs/en-US/accounts-users-domains.xml index 85491295218..a3f5837db8e 100644 --- a/docs/en-US/accounts-users-domains.xml +++ b/docs/en-US/accounts-users-domains.xml @@ -5,23 +5,22 @@ ]> -
Accounts, Users, and Domains diff --git a/docs/en-US/accounts.xml b/docs/en-US/accounts.xml index e5056866801..aa62f680452 100644 --- a/docs/en-US/accounts.xml +++ b/docs/en-US/accounts.xml @@ -5,21 +5,21 @@ ]> diff --git a/docs/en-US/add-load-balancer-rule.xml b/docs/en-US/add-load-balancer-rule.xml index 8cd0da4b7da..2d911feaf75 100644 --- a/docs/en-US/add-load-balancer-rule.xml +++ b/docs/en-US/add-load-balancer-rule.xml @@ -4,19 +4,19 @@ %BOOK_ENTITIES; ]>
Adding a Load Balancer Rule @@ -70,6 +70,10 @@ the algorithm for the stickiness policy. See Sticky Session Policies for Load Balancer Rules. + + AutoScale: Click Configure and complete the + AutoScale configuration as explained in . + diff --git a/docs/en-US/added-API-commands-4-1.xml b/docs/en-US/added-API-commands-4-1.xml new file mode 100644 index 00000000000..f635e9dfdd8 --- /dev/null +++ b/docs/en-US/added-API-commands-4-1.xml @@ -0,0 +1,41 @@ + + +%BOOK_ENTITIES; +]> + +
+ Added API Commands in 4.1-incubating + + + createEgressFirewallRules (creates an egress firewall rule on the guest network.) + + + deleteEgressFirewallRules (deletes a egress firewall rule on the guest network.) + + + listEgressFirewallRules (lists the egress firewall rules configured for a guest + network.) + + + resetSSHKeyForVirtualMachine (Resets the SSHkey for virtual machine.) + + + addBaremetalHost (Adds a new host.) + + +
diff --git a/docs/en-US/admin-alerts.xml b/docs/en-US/admin-alerts.xml index 4e47032c77a..5354c5e9b8e 100644 --- a/docs/en-US/admin-alerts.xml +++ b/docs/en-US/admin-alerts.xml @@ -31,6 +31,5 @@ The Management Server cluster runs low on CPU, memory, or storage resources The Management Server loses heartbeat from a Host for more than 3 minutes The Host cluster runs low on CPU, memory, or storage resources - - +
diff --git a/docs/en-US/advanced-zone-guest-ip-addresses.xml b/docs/en-US/advanced-zone-guest-ip-addresses.xml index b5d10a02d05..fbc6144bec1 100644 --- a/docs/en-US/advanced-zone-guest-ip-addresses.xml +++ b/docs/en-US/advanced-zone-guest-ip-addresses.xml @@ -1,27 +1,26 @@ - %BOOK_ENTITIES; ]> -
Advanced Zone Guest IP Addresses When advanced networking is used, the administrator can create additional networks for use by the guests. These networks can span the zone and be available to all accounts, or they can be scoped to a single account, in which case only the named account may create guests that attach to these networks. The networks are defined by a VLAN ID, IP range, and gateway. The administrator may provision thousands of these networks if desired. diff --git a/docs/en-US/advanced-zone-network-traffic-types.xml b/docs/en-US/advanced-zone-network-traffic-types.xml index 9f475cf3f80..d8035929374 100644 --- a/docs/en-US/advanced-zone-network-traffic-types.xml +++ b/docs/en-US/advanced-zone-network-traffic-types.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> -
- Advanced Zone Network Traffic Types + Advanced Zone Network Traffic Types When advanced networking is used, there can be multiple physical networks in the zone. Each physical network can carry one or more traffic types, and you need to let &PRODUCT; know which type of network traffic you want each network to carry. The traffic types in an advanced zone are: Guest. When end users run VMs, they generate guest traffic. The guest VMs communicate with each other over a network that can be referred to as the guest network. This network can be isolated or shared. In an isolated guest network, the administrator needs to reserve VLAN ranges to provide isolation for each &PRODUCT; account’s network (potentially a large number of VLANs). In a shared guest network, all guest VMs share a single network. diff --git a/docs/en-US/advanced-zone-physical-network-configuration.xml b/docs/en-US/advanced-zone-physical-network-configuration.xml index 2c3d9b3542a..e47c0fd6da9 100644 --- a/docs/en-US/advanced-zone-physical-network-configuration.xml +++ b/docs/en-US/advanced-zone-physical-network-configuration.xml @@ -26,4 +26,4 @@ xmlns:xi="http://www.w3.org/2001/XInclude"/> -
\ No newline at end of file +
diff --git a/docs/en-US/advanced-zone-public-ip-addresses.xml b/docs/en-US/advanced-zone-public-ip-addresses.xml index eeb94045e08..82b71d1f23a 100644 --- a/docs/en-US/advanced-zone-public-ip-addresses.xml +++ b/docs/en-US/advanced-zone-public-ip-addresses.xml @@ -1,27 +1,26 @@ - %BOOK_ENTITIES; ]> -
Advanced Zone Public IP Addresses When advanced networking is used, the administrator can create additional networks for use by the guests. These networks can span the zone and be available to all accounts, or they can be scoped to a single account, in which case only the named account may create guests that attach to these networks. The networks are defined by a VLAN ID, IP range, and gateway. The administrator may provision thousands of these networks if desired. diff --git a/docs/en-US/alerts.xml b/docs/en-US/alerts.xml index b7f34d02a56..ebea4b808a4 100644 --- a/docs/en-US/alerts.xml +++ b/docs/en-US/alerts.xml @@ -4,50 +4,50 @@ %BOOK_ENTITIES; ]> - Alerts - The following is the list of alert type numbers. The current alerts can be found by calling listAlerts. - MEMORY = 0 - CPU = 1 - STORAGE =2 - STORAGE_ALLOCATED = 3 - PUBLIC_IP = 4 - PRIVATE_IP = 5 - HOST = 6 - USERVM = 7 - DOMAIN_ROUTER = 8 - CONSOLE_PROXY = 9 - ROUTING = 10// lost connection to default route (to the gateway) - STORAGE_MISC = 11 // lost connection to default route (to the gateway) - USAGE_SERVER = 12 // lost connection to default route (to the gateway) - MANAGMENT_NODE = 13 // lost connection to default route (to the gateway) - DOMAIN_ROUTER_MIGRATE = 14 - CONSOLE_PROXY_MIGRATE = 15 - USERVM_MIGRATE = 16 - VLAN = 17 - SSVM = 18 - USAGE_SERVER_RESULT = 19 - STORAGE_DELETE = 20; - UPDATE_RESOURCE_COUNT = 21; //Generated when we fail to update the resource count - USAGE_SANITY_RESULT = 22; - DIRECT_ATTACHED_PUBLIC_IP = 23; - LOCAL_STORAGE = 24; - RESOURCE_LIMIT_EXCEEDED = 25; //Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only - \ No newline at end of file + Alerts + The following is the list of alert type numbers. The current alerts can be found by calling listAlerts. + MEMORY = 0 + CPU = 1 + STORAGE =2 + STORAGE_ALLOCATED = 3 + PUBLIC_IP = 4 + PRIVATE_IP = 5 + HOST = 6 + USERVM = 7 + DOMAIN_ROUTER = 8 + CONSOLE_PROXY = 9 + ROUTING = 10// lost connection to default route (to the gateway) + STORAGE_MISC = 11 // lost connection to default route (to the gateway) + USAGE_SERVER = 12 // lost connection to default route (to the gateway) + MANAGMENT_NODE = 13 // lost connection to default route (to the gateway) + DOMAIN_ROUTER_MIGRATE = 14 + CONSOLE_PROXY_MIGRATE = 15 + USERVM_MIGRATE = 16 + VLAN = 17 + SSVM = 18 + USAGE_SERVER_RESULT = 19 + STORAGE_DELETE = 20; + UPDATE_RESOURCE_COUNT = 21; //Generated when we fail to update the resource count + USAGE_SANITY_RESULT = 22; + DIRECT_ATTACHED_PUBLIC_IP = 23; + LOCAL_STORAGE = 24; + RESOURCE_LIMIT_EXCEEDED = 25; //Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only + diff --git a/docs/en-US/api-calls.xml b/docs/en-US/api-calls.xml index 1fe6f02678b..3b97893d81d 100644 --- a/docs/en-US/api-calls.xml +++ b/docs/en-US/api-calls.xml @@ -5,21 +5,21 @@ ]> diff --git a/docs/en-US/attach-iso-to-vm.xml b/docs/en-US/attach-iso-to-vm.xml index 30e5d51947d..8e0d4247f9b 100644 --- a/docs/en-US/attach-iso-to-vm.xml +++ b/docs/en-US/attach-iso-to-vm.xml @@ -5,35 +5,36 @@ ]> -
- Attaching an ISO to a VM - - In the left navigation, click Instances. - Choose the virtual machine you want to work with. - Click the Attach ISO button - - - - iso.png: Depicts adding an iso image - - In the Attach ISO dialog box, select the desired ISO. - Click OK - + Attaching an ISO to a VM + + In the left navigation, click Instances. + Choose the virtual machine you want to work with. + Click the Attach ISO button. + + + + + iso.png: depicts adding an iso image + + + In the Attach ISO dialog box, select the desired ISO. + Click OK. +
diff --git a/docs/en-US/basic-zone-configuration.xml b/docs/en-US/basic-zone-configuration.xml index e0c67d81af0..eb8b5068f76 100644 --- a/docs/en-US/basic-zone-configuration.xml +++ b/docs/en-US/basic-zone-configuration.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> -
- Basic Zone Configuration + Basic Zone Configuration After you select Basic in the Add Zone wizard and click Next, you will be asked to enter the following details. Then click Next. @@ -66,7 +65,7 @@ Choose which traffic types will be carried by the physical network. The traffic types are management, public, guest, and storage traffic. For more information about the types, roll over the icons to display their tool tips, or see Basic Zone Network Traffic Types. This screen starts out with some traffic types already assigned. To add more, drag and drop traffic types onto the network. You can also change the network name if desired. - (Introduced in version 3.0.1) Assign a network traffic label to each traffic type on the physical network. These labels must match the labels you have already defined on the hypervisor host. To assign each label, click the Edit button under the traffic type icon. A popup dialog appears where you can type the label, then click OK. + 3. (Introduced in version 3.0.1) Assign a network traffic label to each traffic type on the physical network. These labels must match the labels you have already defined on the hypervisor host. To assign each label, click the Edit button under the traffic type icon. A popup dialog appears where you can type the label, then click OK. These traffic labels will be defined only for the hypervisor selected for the first cluster. For all other hypervisors, the labels can be configured after the zone is created. Click Next. diff --git a/docs/en-US/basic-zone-guest-ip-addresses.xml b/docs/en-US/basic-zone-guest-ip-addresses.xml index 57ef9e7c20c..5143f71f17e 100644 --- a/docs/en-US/basic-zone-guest-ip-addresses.xml +++ b/docs/en-US/basic-zone-guest-ip-addresses.xml @@ -1,27 +1,26 @@ - %BOOK_ENTITIES; ]> -
Basic Zone Guest IP Addresses When basic networking is used, &PRODUCT; will assign IP addresses in the CIDR of the pod to the guests in that pod. The administrator must add a Direct IP range on the pod for this purpose. These IPs are in the same VLAN as the hosts. diff --git a/docs/en-US/basic-zone-network-traffic-types.xml b/docs/en-US/basic-zone-network-traffic-types.xml index fa3be0f442b..70789d0fa1a 100644 --- a/docs/en-US/basic-zone-network-traffic-types.xml +++ b/docs/en-US/basic-zone-network-traffic-types.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> -
- Basic Zone Network Traffic Types + Basic Zone Network Traffic Types When basic networking is used, there can be only one physical network in the zone. That physical network carries the following traffic types: Guest. When end users run VMs, they generate guest traffic. The guest VMs communicate with each other over a network that can be referred to as the guest network. Each pod in a basic zone is a broadcast domain, and therefore each pod has a different IP range for the guest network. The administrator must configure the IP range for each pod. diff --git a/docs/en-US/basic-zone-physical-network-configuration.xml b/docs/en-US/basic-zone-physical-network-configuration.xml index 32aeb847d56..4b1d24f2657 100644 --- a/docs/en-US/basic-zone-physical-network-configuration.xml +++ b/docs/en-US/basic-zone-physical-network-configuration.xml @@ -5,25 +5,24 @@ ]> -
- Basic Zone Physical Network Configuration - In a basic network, configuring the physical network is fairly straightforward. You only need to configure one guest network to carry traffic that is generated by guest VMs. When you first add a zone to &PRODUCT;, you set up the guest network through the Add Zone screens. + Basic Zone Physical Network Configuration + In a basic network, configuring the physical network is fairly straightforward. You only need to configure one guest network to carry traffic that is generated by guest VMs. When you first add a zone to &PRODUCT;, you set up the guest network through the Add Zone screens.
diff --git a/docs/en-US/best-practices-for-vms.xml b/docs/en-US/best-practices-for-vms.xml index 04c3c0aa276..bba20c6fce3 100644 --- a/docs/en-US/best-practices-for-vms.xml +++ b/docs/en-US/best-practices-for-vms.xml @@ -4,36 +4,36 @@ %BOOK_ENTITIES; ]>
- Best Practices for Virtual Machines - The &PRODUCT; administrator should monitor the total number of VM instances in each - cluster, and disable allocation to the cluster if the total is approaching the maximum that - the hypervisor can handle. Be sure to leave a safety margin to allow for the possibility of - one or more hosts failing, which would increase the VM load on the other hosts as the VMs - are automatically redeployed. Consult the documentation for your chosen hypervisor to find - the maximum permitted number of VMs per host, then use &PRODUCT; global configuration - settings to set this as the default limit. Monitor the VM activity in each cluster at all - times. Keep the total number of VMs below a safe level that allows for the occasional host - failure. For example, if there are N hosts in the cluster, and you want to allow for one - host in the cluster to be down at any given time, the total number of VM instances you can - permit in the cluster is at most (N-1) * (per-host-limit). Once a cluster reaches this - number of VMs, use the &PRODUCT; UI to disable allocation of more VMs to the - cluster. -
\ No newline at end of file + Best Practices for Virtual Machines + The &PRODUCT; administrator should monitor the total number of VM instances in each + cluster, and disable allocation to the cluster if the total is approaching the maximum that + the hypervisor can handle. Be sure to leave a safety margin to allow for the possibility of + one or more hosts failing, which would increase the VM load on the other hosts as the VMs + are automatically redeployed. Consult the documentation for your chosen hypervisor to find + the maximum permitted number of VMs per host, then use &PRODUCT; global configuration + settings to set this as the default limit. Monitor the VM activity in each cluster at all + times. Keep the total number of VMs below a safe level that allows for the occasional host + failure. For example, if there are N hosts in the cluster, and you want to allow for one + host in the cluster to be down at any given time, the total number of VM instances you can + permit in the cluster is at most (N-1) * (per-host-limit). Once a cluster reaches this + number of VMs, use the &PRODUCT; UI to disable allocation of more VMs to the + cluster. +
diff --git a/docs/en-US/building-documentation.xml b/docs/en-US/building-documentation.xml new file mode 100644 index 00000000000..484826604fa --- /dev/null +++ b/docs/en-US/building-documentation.xml @@ -0,0 +1,40 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Building &PRODUCT; Documentation + To build a specific guide, go to the source tree of the documentation in /docs and identify the guide you want to build. + Currenlty there are four guides plus the release notes, all defined in publican configuration files: + + publican-adminguide.cfg + publican-devguide.cfg + publican-installation.cfg + publican-plugin-niciranvp.cfg + publican-release-notes.cfg + + To build the Developer guide for example, do the following: + publican build --config=publican-devguide.cfg --formats=pdf --langs=en-US + A pdf file will be created in tmp/en-US/pdf, you may choose to build the guide in a different format like html. In that case just replace the format value. + +
diff --git a/docs/en-US/building-translation.xml b/docs/en-US/building-translation.xml new file mode 100644 index 00000000000..659c55ffc5e --- /dev/null +++ b/docs/en-US/building-translation.xml @@ -0,0 +1,75 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Translating &PRODUCT; Documentation + Now that you know how to build the documentation with Publican, let's move on to building it in different languages. Publican helps us + build the documentation in various languages by using Portable Object Template (POT) files and Portable Objects (PO) files for each language. + + The POT files are generated by parsing all the DocBook files in the language of origin, en-US for us, and creating a long list of strings + for each file that needs to be translated. The translation can be done by hand directly in the PO files of each target language or via the + transifex service. + + + Transifex is a free service to help translate documents and organize distributed teams + of translators. Anyone interested in helping with the translation should get an account on Transifex + + + Three &PRODUCT; projects exist on Transifex. It is recommended to tour those projects to become familiar with Transifex: + + https://www.transifex.com/projects/p/ACS_DOCS/ + https://www.transifex.com/projects/p/ACS_Runbook/ + https://www.transifex.com/projects/p/CloudStackUI/ + + + + + The pot directory should already exist in the source tree. If you want to build an up to date translation, you might have to update it to include any pot file that was not previously generated. + To register new resources on transifex, you will need to be an admin of the transifex &PRODUCT; site. Send an email to the developer list if you want access. + + First we need to generate the .pot files for all the DocBook xml files needed for a particular guide. This is well explained at the publican website in a section on + how to prepare a document for translation. + The basic command to execute to build the pot files for the developer guide is: + publican update_pot --config=publican-devguide.cfg + This will create a pot directory with pot files in it, one for each corresponding xml files needed to build the guide. Once genereated, all pots files need to be configured for translation using transifex this is best done by using the transifex client that you can install with the following command (For RHEL and its derivatives): + yum install transifex-client + The transifex client is also available via PyPi and you can install it like this: + easy_install transifex-client + Once you have installed the transifex client you can run the settx.sh script in the docs directory. This will create the .tx/config file used by transifex to push and pull all translation strings. + All the resource files need to be uploaded to transifex, this is done with the transifex client like so: + tx push -s + Once the translators have completed translation of the documentation, the translated strings can be pulled from transifex like so: + tx pull -a + If you wish to push specific resource files or pull specific languages translation strings, you can do so with the transifex client. A complete documentation of + the client is available on the client website + When you pull new translation strings a directory will be created corresponding to the language of the translation. This directory will contain PO files that will be used by Publican to create the documentation in that specific language. For example assuming that you pull the French translation whose language code is fr-FR, you will build the documentation with publican: + publican build --config=publican-devguide.cfg --formats=html --langs=fr-FR + + + Some languages like Chinese or Japanese will not render well in pdf format and html should be used. + + + + +
diff --git a/docs/en-US/change-network-offering-on-guest-network.xml b/docs/en-US/change-network-offering-on-guest-network.xml index 98f1b63f484..2c7db3e9176 100644 --- a/docs/en-US/change-network-offering-on-guest-network.xml +++ b/docs/en-US/change-network-offering-on-guest-network.xml @@ -5,40 +5,49 @@ ]> - + 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. +-->
- Changing the Network Offering on a Guest Network - A user or administrator can change the network offering that is associated with an existing guest network. - - Log in to the &PRODUCT; UI as an administrator or end user. - If you are changing from a network offering that uses the &PRODUCT; virtual router to one that uses external devices as network service providers, you must first stop all the VMs on the network. See Stopping and Starting VMs. Then return here and continue to the next step - In the left navigation, choose Network - Click the name of the network you want to modify - - - - AttachDiskButton.png: button to attach a volume - . - In Network Offering, choose the new network offering, then click Apply. - A prompt appears asking whether you want to keep the existing CIDR. This is to let you know that if you change the network offering, the CIDR will be affected. Choose No to proceed with the change. - Wait for the update to complete. Don’t try to restart VMs until after the network change is complete. - If you stopped any VMs in step 2, restart them. - + Changing the Network Offering on a Guest Network + A user or administrator can change the network offering that is associated with an existing guest network. + + Log in to the &PRODUCT; UI as an administrator or end user. + If you are changing from a network offering that uses the &PRODUCT; virtual router to one + that uses external devices as network service providers, you must first stop all the + VMs on the network. + See "Stopping and Starting Virtual Machines" in the Administrator's Guide. + See . + In the left navigation, choose Network. + Click the name of the network you want to modify. + In the Details tab, click Edit. + + + + + EditButton.png: button to edit a network + + + In Network Offering, choose the new network offering, then click Apply. + A prompt is displayed asking whether you want to keep the existing CIDR. This is to let you + know that if you change the network offering, the CIDR will be affected. Choose No + to proceed with the change. + Wait for the update to complete. Don’t try to restart VMs until the network change is + complete. + If you stopped any VMs, restart them. + +
-
diff --git a/docs/en-US/changed-apicommands-4.1.xml b/docs/en-US/changed-apicommands-4.1.xml new file mode 100644 index 00000000000..42bd088afb3 --- /dev/null +++ b/docs/en-US/changed-apicommands-4.1.xml @@ -0,0 +1,106 @@ + + +%BOOK_ENTITIES; +]> + +
+ Changed API Commands in 4.1-incubating + + + + + + + API Commands + Description + + + + + + createNetworkOffering + listNetworkOfferings + listNetworks + + + The following request parameters is added: isPersistent. + This parameter determines if the network or network offering created or listed by + using this offering are persistent or not. + + + + + addF5LoadBalancer + configureNetscalerLoadBalancer + addNetscalerLoadBalancer + listF5LoadBalancers + configureF5LoadBalancer + listNetscalerLoadBalancers + + + The following response parameter is removed: inline. + + + + listFirewallRules + createFirewallRule + + The following request parameter is added: traffictype (optional). + + + + listUsageRecords + The following response parameter is added: virtualsize. + + + + + deleteIso + + + The following request parameter is added: forced (optional). + + + + + createStoragePool + + + The following request parameters are made mandatory: + + + podid + + + clusterid + + + + + + + listZones + + + The following request parameters is added: securitygroupenabled + + + + + +
diff --git a/docs/en-US/changing-root-password.xml b/docs/en-US/changing-root-password.xml index 0d2333a2a67..880f50fcf22 100644 --- a/docs/en-US/changing-root-password.xml +++ b/docs/en-US/changing-root-password.xml @@ -1,29 +1,28 @@ - %BOOK_ENTITIES; ]> - + 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. +-->
- Changing the Root Password + Changing the Root Password During installation and ongoing cloud administration, you will need to log in to the UI as the root administrator. The root administrator account manages the &PRODUCT; deployment, including physical infrastructure. The root administrator can modify configuration settings to change basic functionality, create or delete user accounts, and take many actions that should be performed only by an authorized person. diff --git a/docs/en-US/changing-secondary-storage-ip.xml b/docs/en-US/changing-secondary-storage-ip.xml index 7e146de812f..34f93e32c61 100644 --- a/docs/en-US/changing-secondary-storage-ip.xml +++ b/docs/en-US/changing-secondary-storage-ip.xml @@ -2,43 +2,43 @@ %BOOK_ENTITIES; -]> +]> - + 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. +-->
- Making API Requests - You can change the secondary storage IP address after it has been provisioned. After changing the IP address on the host, log in to your management server and execute the following commands. Replace HOSTID below with your own value, and change the URL to use the appropriate IP address and path for your server: - - # mysql -p - mysql> use cloud; - mysql> select id from host where type = 'SecondaryStorage'; - mysql> update host_details set value = 'nfs://192.168.160.20/export/mike-ss1' - where host_id = HOSTID and name = 'orig.url'; - mysql> update host set name = 'nfs://192.168.160.20/export/mike-ss1' where type - = 'SecondaryStorage' and id = #; - mysql> update host set url = 'nfs://192.168.160.20/export/mike-ss1' where type - = 'SecondaryStorage' and id = #; - mysql> update host set guid = 'nfs://192.168.160.20/export/mike-ss1' where type - = 'SecondaryStorage' and id = #; - - When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text. - Then log in to the cloud console UI and stop and start (not reboot) the Secondary Storage VM for that Zone. - -
+ Changing the Secondary Storage IP Address + You can change the secondary storage IP address after it has been provisioned. After changing the IP address on the host, log in to your management server and execute the following commands. Replace HOSTID below with your own value, and change the URL to use the appropriate IP address and path for your server: + + # mysql -p + mysql> use cloud; + mysql> select id from host where type = 'SecondaryStorage'; + mysql> update host_details set value = 'nfs://192.168.160.20/export/mike-ss1' + where host_id = HOSTID and name = 'orig.url'; + mysql> update host set name = 'nfs://192.168.160.20/export/mike-ss1' where type + = 'SecondaryStorage' and id = #; + mysql> update host set url = 'nfs://192.168.160.20/export/mike-ss1' where type + = 'SecondaryStorage' and id = #; + mysql> update host set guid = 'nfs://192.168.160.20/export/mike-ss1' where type + = 'SecondaryStorage' and id = #; + + When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text. + Then log in to the cloud console UI and stop and start (not reboot) the Secondary Storage VM for that Zone. + +
+ diff --git a/docs/en-US/changing-service-offering-for-vm.xml b/docs/en-US/changing-service-offering-for-vm.xml index 5a42912e130..4fc9ef4270b 100644 --- a/docs/en-US/changing-service-offering-for-vm.xml +++ b/docs/en-US/changing-service-offering-for-vm.xml @@ -5,45 +5,50 @@ ]> -
- Changing the Service Offering for a VM - To upgrade or downgrade the level of compute resources available to a virtual machine, you can change the VM's compute offering. - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation, click Instances. - Choose the VM that you want to work with. - Click the Stop button to stop the VM - - - - StopButton.png: button to stop a VM - - - Click the Change Service button - - - - ChangeServiceButton.png: button to change the service of a VM - . The Change service dialog box is displayed. - Select the offering you want. - Click OK. - -
+ Changing the Service Offering for a VM + To upgrade or downgrade the level of compute resources available to a virtual machine, you can change the VM's compute offering. + + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation, click Instances. + Choose the VM that you want to work with. + Click the Stop button to stop the VM. + + + + + StopButton.png: button to stop a VM + + + + Click the Change Service button. + + + + + ChangeServiceButton.png: button to change the service of a + VM + + + The Change service dialog box is displayed. + Select the offering you want to apply to the selected VM. + Click OK. + +
diff --git a/docs/en-US/changing-vm-name-os-group.xml b/docs/en-US/changing-vm-name-os-group.xml index f16ffdab059..daf78bca107 100644 --- a/docs/en-US/changing-vm-name-os-group.xml +++ b/docs/en-US/changing-vm-name-os-group.xml @@ -5,50 +5,55 @@ ]> -
- Changing the VM Name, OS, or Group - After a VM is created, you can modify the display name, operating system, and the group it belongs to. - To access a VM through the &PRODUCT; UI: - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation, click Instances. - Select the VM that you want to modify. - Click the Stop button to stop the VM - - - - StopButton.png: button to stop a VM - - - Click Edit - - - - StopButton.png: button to edit the properties of a VM - . - Make the desired changes to the following: - - Display name: Enter a new display name if you want to change the name of the VM. - OS Type: Select the desired operating system. - Group: Enter the group name for the VM. - - Click Apply. - -
+ Changing the VM Name, OS, or Group + After a VM is created, you can modify the display name, operating system, and the group it belongs to. + To access a VM through the &PRODUCT; UI: + + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation, click Instances. + Select the VM that you want to modify. + Click the Stop button to stop the VM. + + + + + StopButton.png: button to stop a VM + + + + Click Edit. + + + + + EditButton.png: button to edit the properties of a VM + + + Make the desired changes to the following: + + Display name: Enter a new display name if you want to change + the name of the VM. + OS Type: Select the desired operating system. + Group: Enter the group name for the VM. + + Click Apply. + +
+ diff --git a/docs/en-US/cloud-infrastructure-concepts.xml b/docs/en-US/cloud-infrastructure-concepts.xml index 1e1865e04f4..7a7098a4b47 100644 --- a/docs/en-US/cloud-infrastructure-concepts.xml +++ b/docs/en-US/cloud-infrastructure-concepts.xml @@ -1,25 +1,25 @@ - %BOOK_ENTITIES; ]> diff --git a/docs/en-US/concepts.xml b/docs/en-US/concepts.xml index 1912c23a8c9..e20f442a935 100644 --- a/docs/en-US/concepts.xml +++ b/docs/en-US/concepts.xml @@ -1,30 +1,29 @@ - %BOOK_ENTITIES; ]> - - Concepts - - - + Concepts + + + diff --git a/docs/en-US/configure-usage-server.xml b/docs/en-US/configure-usage-server.xml index af7bd4522f6..173f4a5306d 100644 --- a/docs/en-US/configure-usage-server.xml +++ b/docs/en-US/configure-usage-server.xml @@ -5,23 +5,22 @@ ]> -
Configuring the Usage Server To configure the usage server: @@ -54,7 +53,7 @@ usage.aggregation.timezone Time zone of usage records. Set this if the usage records and daily job execution are in different time zones. For example, with the following settings, the usage job will run at PST 00:15 and generate usage records for the 24 hours from 00:00:00 GMT to 23:59:59 GMT: - usage.stats.job.exec.time = 00:15 + usage.stats.job.exec.time = 00:15 usage.execution.timezone = PST usage.aggregation.timezone = GMT @@ -75,13 +74,13 @@ usage.aggregation.timezone = GMT usage.stats.job.aggregation.range The time period in minutes between Usage Server processing jobs. For example, if you set it to 1440, the Usage Server will run once per day. If you set it to 600, it will run every ten hours. In general, when a Usage Server job runs, it processes all events generated since usage was last run. - There is special handling for the case of 1440 (once per day). In this case the Usage Server does not necessarily process all records since Usage was last run. &PRODUCT; assumes that you require processing once per day for the previous, complete day’s records. For example, if the current day is October 7, then it is assumed you would like to process records for October 6, from midnight to midnight. &PRODUCT; assumes this "midnight to midnight" is relative to the usage.execution.timezone. + There is special handling for the case of 1440 (once per day). In this case the Usage Server does not necessarily process all records since Usage was last run. &PRODUCT; assumes that you require processing once per day for the previous, complete day’s records. For example, if the current day is October 7, then it is assumed you would like to process records for October 6, from midnight to midnight. &PRODUCT; assumes this “midnight to midnight†is relative to the usage.execution.timezone. Default: 1440 usage.stats.job.exec.time - The time when the Usage Server processing will start. It is specified in 24-hour format (HH:MM) in the time zone of the server, which should be GMT. For example, to start the Usage job at 10:30 GMT, enter "10:30". + The time when the Usage Server processing will start. It is specified in 24-hour format (HH:MM) in the time zone of the server, which should be GMT. For example, to start the Usage job at 10:30 GMT, enter “10:30â€. If usage.stats.job.aggregation.range is also set, and its value is not 1440, then its value will be added to usage.stats.job.exec.time to get the time to run the Usage Server job again. This is repeated until 24 hours have elapsed, and the next day's processing begins again at usage.stats.job.exec.time. Default: 00:15. @@ -97,5 +96,9 @@ usage.aggregation.timezone = GMT usage.stats.job.aggregation.range = 1440 With this configuration, the Usage job will run every night at 2 AM EST and will process records for the previous day’s midnight-midnight as defined by the EST (America/New_York) time zone. - Because the special value 1440 has been used for usage.stats.job.aggregation.range, the Usage Server will ignore the data between midnight and 2 AM. That data will be included in the next day's run + Because the special value 1440 has been used for usage.stats.job.aggregation.range, the Usage + Server will ignore the data between midnight and 2 AM. That data will be included in the + next day's run. + +
diff --git a/docs/en-US/configure-vpn.xml b/docs/en-US/configure-vpn.xml index 9e059f7aaba..87b4e65b56f 100644 --- a/docs/en-US/configure-vpn.xml +++ b/docs/en-US/configure-vpn.xml @@ -5,48 +5,49 @@ ]> - + 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. +-->
- Configuring VPN - To set up VPN for the cloud: - - Log in to the &PRODUCT; UI as an administrator or end user. - In the left navigation, click Global Settings. - Set the following global configuration parameters. - - remote.access.vpn.client.ip.range – The range of IP addressess to be allocated to remote access VPN clients. The first IP in the range is used by the VPN server. - remote.access.vpn.psk.length – Length of the IPSec key. - remote.access.vpn.user.limit – Maximum number of VPN users per account. - - To enable VPN for a particular network: - - Log in as a user or administrator to the &PRODUCT; UI. - In the left navigation, click Network. - Click the name of the network you want to work with. - Click View IP Addresses. - Click one of the displayed IP address names. - Click the Enable VPN button - - - - AttachDiskButton.png: button to attach a volume - . - The IPsec key is displayed in a popup window. - + Configuring VPN + To set up VPN for the cloud: + + Log in to the &PRODUCT; UI as an administrator or end user. + In the left navigation, click Global Settings. + Set the following global configuration parameters. + + remote.access.vpn.client.ip.range – The range of IP addressess to be allocated to remote access VPN clients. The first IP in the range is used by the VPN server. + remote.access.vpn.psk.length – Length of the IPSec key. + remote.access.vpn.user.limit – Maximum number of VPN users per account. + + To enable VPN for a particular network: + + Log in as a user or administrator to the &PRODUCT; UI. + In the left navigation, click Network. + Click the name of the network you want to work with. + Click View IP Addresses. + Click one of the displayed IP address names. + Click the Enable VPN button. + + + + + AttachDiskButton.png: button to attach a volume + + + The IPsec key is displayed in a popup window. +
diff --git a/docs/en-US/console-proxy.xml b/docs/en-US/console-proxy.xml index df29c428ad2..697ee2e2146 100644 --- a/docs/en-US/console-proxy.xml +++ b/docs/en-US/console-proxy.xml @@ -3,7 +3,6 @@ %BOOK_ENTITIES; ]> - -
- Console Proxy - The Console Proxy is a type of System Virtual Machine that has a role in presenting a console view via the web UI. It connects the user’s browser to the VNC port made available via the hypervisor for the console of the guest. Both the administrator and end user web UIs offer a console connection. - Clicking on a console icon brings up a new window. The AJAX code downloaded into that window refers to the public IP address of a console proxy VM. There is exactly one public IP address allocated per console proxy VM. The AJAX application connects to this IP. The console proxy then proxies the connection to the VNC port for the requested VM on the Host hosting the guest. . - The hypervisors will have many ports assigned to VNC usage so that multiple VNC sessions can occur simultaneously. - There is never any traffic to the guest virtual IP, and there is no need to enable VNC within the guest. - The console proxy VM will periodically report its active session count to the Management Server. The default reporting interval is five seconds. This can be changed through standard Management Server configuration with the parameter consoleproxy.loadscan.interval. - Assignment of guest VM to console proxy is determined by first determining if the guest VM has a previous session associated with a console proxy. If it does, the Management Server will assign the guest VM to the target Console Proxy VM regardless of the load on the proxy VM. Failing that, the first available running Console Proxy VM that has the capacity to handle new sessions is used. - Console proxies can be restarted by administrators but this will interrupt existing console sessions for users. - The console viewing functionality uses a dynamic DNS service under the domain name realhostip.com to assist in providing SSL security to console sessions. The console proxy is assigned a public IP address. In order to avoid browser warnings for mismatched SSL certificates, the URL for the new console window is set to the form of https://aaa-bbb-ccc-ddd.realhostip.com. Customers will see this URL during console session creation. &PRODUCT; includes the realhostip.com SSL certificate in the console proxy VM. Of course, &PRODUCT; cannot know about DNS A records for our customers' public IPs prior to shipping the software. &PRODUCT; therefore runs a dynamic DNS server that is authoritative for the realhostip.com domain. It maps the aaa-bbb-ccc-ddd part of the DNS name to the IP address aaa.bbb.ccc.ddd on lookups. This allows the browser to correctly connect to the console proxy's public IP, where it then expects and receives a SSL certificate for realhostip.com, and SSL is set up without browser warnings. -
+ Console Proxy + The Console Proxy is a type of System Virtual Machine that has a role in presenting a + console view via the web UI. It connects the user’s browser to the VNC port made available via + the hypervisor for the console of the guest. Both the administrator and end user web UIs offer a + console connection. + Clicking a console icon brings up a new window. The AJAX code downloaded into that window + refers to the public IP address of a console proxy VM. There is exactly one public IP address + allocated per console proxy VM. The AJAX application connects to this IP. The console proxy then + proxies the connection to the VNC port for the requested VM on the Host hosting the + guest. + + The hypervisors will have many ports assigned to VNC usage so that multiple VNC sessions + can occur simultaneously. + + There is never any traffic to the guest virtual IP, and there is no need to enable VNC + within the guest. + The console proxy VM will periodically report its active session count to the Management + Server. The default reporting interval is five seconds. This can be changed through standard + Management Server configuration with the parameter consoleproxy.loadscan.interval. + Assignment of guest VM to console proxy is determined by first determining if the guest VM + has a previous session associated with a console proxy. If it does, the Management Server will + assign the guest VM to the target Console Proxy VM regardless of the load on the proxy VM. + Failing that, the first available running Console Proxy VM that has the capacity to handle new + sessions is used. + Console proxies can be restarted by administrators but this will interrupt existing console + sessions for users. +
+ Using a SSL Certificate for the Console Proxy + The console viewing functionality uses a dynamic DNS service under the domain name + realhostip.com to assist in providing SSL security to console sessions. The console proxy is + assigned a public IP address. In order to avoid browser warnings for mismatched SSL + certificates, the URL for the new console window is set to the form of + https://aaa-bbb-ccc-ddd.realhostip.com. You will see this URL during console session creation. + &PRODUCT; includes the realhostip.com SSL certificate in the console proxy VM. Of course, + &PRODUCT; cannot know about the DNS A records for our customers' public IPs prior to shipping + the software. &PRODUCT; therefore runs a dynamic DNS server that is authoritative for the + realhostip.com domain. It maps the aaa-bbb-ccc-ddd part of the DNS name to the IP address + aaa.bbb.ccc.ddd on lookups. This allows the browser to correctly connect to the console + proxy's public IP, where it then expects and receives a SSL certificate for realhostip.com, + and SSL is set up without browser warnings. +
+
+ Changing the Console Proxy SSL Certificate and Domain + If the administrator prefers, it is possible for the URL of the customer's console session + to show a domain other than realhostip.com. The administrator can customize the displayed + domain by selecting a different domain and uploading a new SSL certificate and private key. + The domain must run a DNS service that is capable of resolving queries for addresses of the + form aaa-bbb-ccc-ddd.your.domain to an IPv4 IP address in the form aaa.bbb.ccc.ddd, for + example, 202.8.44.1. To change the console proxy domain, SSL certificate, and private + key: + + + Set up dynamic name resolution or populate all possible DNS names in your public IP + range into your existing DNS server with the format aaa-bbb-ccc-ddd.company.com -> + aaa.bbb.ccc.ddd. + + + Generate the private key and certificate signing request (CSR). When you are using + openssl to generate private/public key pairs and CSRs, for the private key that you are + going to paste into the &PRODUCT; UI, be sure to convert it into PKCS#8 format. + + + Generate a new 2048-bit private key + openssl genrsa -des3 -out yourprivate.key 2048 + + + Generate a new certificate CSR + openssl req -new -key yourprivate.key -out yourcertificate.csr + + + Head to the website of your favorite trusted Certificate Authority, purchase an + SSL certificate, and submit the CSR. You should receive a valid certificate in + return + + + Convert your private key format into PKCS#8 encrypted format. + openssl pkcs8 -topk8 -in yourprivate.key -out yourprivate.pkcs8.encryped.key + + + Convert your PKCS#8 encrypted private key into the PKCS#8 format that is compliant + with &PRODUCT; + openssl pkcs8 -in yourprivate.pkcs8.encrypted.key -out yourprivate.pkcs8.key + + + + + In the Update SSL Certificate screen of the &PRODUCT; UI, paste the following: + + + Certificate from step 1(c). + + + Private key from step 1(e). + + + The desired new domain name; for example, company.com + + + + + + + + updatessl.png: Updating Console Proxy SSL Certificate + + + + + The desired new domain name; for example, company.com + This stops all currently running console proxy VMs, then restarts them with the new + certificate and key. Users might notice a brief interruption in console + availability. + + + The Management Server generates URLs of the form "aaa-bbb-ccc-ddd.company.com" after this + change is made. The new console requests will be served with the new DNS domain name, + certificate, and key. +
+
diff --git a/docs/en-US/convert-hyperv-vm-to-template.xml b/docs/en-US/convert-hyperv-vm-to-template.xml index c6294d4443c..df388234d1f 100644 --- a/docs/en-US/convert-hyperv-vm-to-template.xml +++ b/docs/en-US/convert-hyperv-vm-to-template.xml @@ -5,64 +5,65 @@ ]> -
- Converting a Hyper-V VM to a Template - To convert a Hyper-V VM to a XenServer-compatible &PRODUCT; template, you will need a standalone XenServer host with an attached NFS VHD SR. Use whatever XenServer version you are using with &PRODUCT;, but use XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6). Additionally, it may help to have an attached NFS ISO SR. - For Linux VMs, you may need to do some preparation in Hyper-V before trying to get the VM to work in XenServer. Clone the VM and work on the clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V Integration Components and check for any references to device names in /etc/fstab: - - From the linux_ic/drivers/dist directory, run make uninstall (where "linux_ic" is the path to the copied Hyper-V Integration Components files). - Restore the original initrd from backup in /boot/ (the backup is named *.backup0). - Remove the "hdX=noprobe" entries from /boot/grub/menu.lst. - Check /etc/fstab for any partitions mounted by device name. Change those entries (if any) to mount by LABEL or UUID (get that information with the "blkid" command).. - - The next step is make sure the VM is not running in Hyper-V, then get the VHD into XenServer. There are two options for doing this. - Option one: - - Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual Appliance Tools>Disk Image Import. - Choose the VHD, then click Next. - Name the VM, choose the NFS VHD SR under Storage, enable "Run Operating System Fixups" and choose the NFS ISO SR. - Click Next, then Finish. A VM should be created. - - Option two - - Run XenConvert, under From choose VHD, under To choose XenServer. Click Next. - Choose the VHD, then click Next. - Input the XenServer host info, then click Next. - Name the VM, then click Next, then Convert. A VM should be created - - Once you have a VM created from the Hyper-V VHD, prepare it using the following steps: - - Boot the VM, uninstall Hyper-V Integration Services, and reboot. - Install XenServer Tools, then reboot. - Prepare the VM as desired. For example, run sysprep on Windows VMs. See - - Either option above will create a VM in HVM mode. This is fine for Windows VMs, but Linux VMs may not perform optimally. Converting a Linux VM to PV mode will require additional steps and will vary by distribution. - - Shut down the VM and copy the VHD from the NFS storage to a web server; for example, mount the NFS share on the web server and copy it, or from the XenServer host use sftp or scp to upload it to the web server. - In &PRODUCT;, create a new template using the following values: - - URL. Give the URL for the VHD - OS Type. Use the appropriate OS. For PV mode on CentOS, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServer. - Hypervisor. XenServer - Format. VHD - - - The template will be created, and you can create instances from it. + Converting a Hyper-V VM to a Template + To convert a Hyper-V VM to a XenServer-compatible &PRODUCT; template, you will need a standalone XenServer host with an attached NFS VHD SR. Use whatever XenServer version you are using with &PRODUCT;, but use XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6). Additionally, it may help to have an attached NFS ISO SR. + For Linux VMs, you may need to do some preparation in Hyper-V before trying to get the VM to work in XenServer. Clone the VM and work on the clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V Integration Components and check for any references to device names in /etc/fstab: + + From the linux_ic/drivers/dist directory, run make uninstall (where "linux_ic" is the path to the copied Hyper-V Integration Components files). + Restore the original initrd from backup in /boot/ (the backup is named *.backup0). + Remove the "hdX=noprobe" entries from /boot/grub/menu.lst. + Check /etc/fstab for any partitions mounted by device name. Change those entries (if any) to + mount by LABEL or UUID. You can get that information with the blkid command. + + The next step is make sure the VM is not running in Hyper-V, then get the VHD into XenServer. There are two options for doing this. + Option one: + + Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual Appliance Tools>Disk Image Import. + Choose the VHD, then click Next. + Name the VM, choose the NFS VHD SR under Storage, enable "Run Operating System Fixups" and choose the NFS ISO SR. + Click Next, then Finish. A VM should be created. + + Option two: + + Run XenConvert, under From choose VHD, under To choose XenServer. Click Next. + Choose the VHD, then click Next. + Input the XenServer host info, then click Next. + Name the VM, then click Next, then Convert. A VM should be created. + + Once you have a VM created from the Hyper-V VHD, prepare it using the following steps: + + Boot the VM, uninstall Hyper-V Integration Services, and reboot. + Install XenServer Tools, then reboot. + Prepare the VM as desired. For example, run sysprep on Windows VMs. See . + + Either option above will create a VM in HVM mode. This is fine for Windows VMs, but Linux VMs may not perform optimally. Converting a Linux VM to PV mode will require additional steps and will vary by distribution. + + Shut down the VM and copy the VHD from the NFS storage to a web server; for example, mount the NFS share on the web server and copy it, or from the XenServer host use sftp or scp to upload it to the web server. + In &PRODUCT;, create a new template using the following values: + + URL. Give the URL for the VHD + OS Type. Use the appropriate OS. For PV mode on CentOS, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServer. + Hypervisor. XenServer + Format. VHD + + + + The template will be created, and you can create instances from it.
diff --git a/docs/en-US/create-template-from-existing-vm.xml b/docs/en-US/create-template-from-existing-vm.xml index c22b7ec7f5c..35788fdfcc1 100644 --- a/docs/en-US/create-template-from-existing-vm.xml +++ b/docs/en-US/create-template-from-existing-vm.xml @@ -5,45 +5,52 @@ ]> - + 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. +-->
- Creating a Template from an Existing Virtual Machine - Once you have at least one VM set up in the way you want, you can use it as the prototype for other VMs. - - Create and start a virtual machine using any of the techniques given in . - Make any desired configuration changes on the running VM, then click Stop. - Wait for the VM to stop. When the status shows Stopped, go to the next step. - Click Create Template and provide the following: - - Name and Display Text. These will be shown in the UI, so choose something descriptive. - OS Type. This helps &PRODUCT; and the hypervisor perform certain operations and make assumptions that improve the performance of the guest. Select one of the following. - - If the operating system of the stopped VM is listed, choose it. - If the OS type of the stopped VM is not listed, choose Other. - If you want to boot from this template in PV mode, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServere: - Note: Generally you should not choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will in general not work. In those cases you should choose Other. - - - Public. Choose Yes to make this template accessible to all users of this &PRODUCT; installation. The template will appear in the Community Templates list. See . - Password Enabled. Choose Yes if your template has the &PRODUCT; password change script installed. See Adding Password Management to Your Templates. - - Click Add. - - The new template will be visible in the Templates section when the template creation process has been completed. The template is then available when creating a new VM + Creating a Template from an Existing Virtual Machine + Once you have at least one VM set up in the way you want, you can use it as the prototype for other VMs. + + Create and start a virtual machine using any of the techniques given in . + Make any desired configuration changes on the running VM, then click Stop. + Wait for the VM to stop. When the status shows Stopped, go to the next step. + Click Create Template and provide the following: + + Name and Display Text. These will be shown in the UI, so + choose something descriptive. + OS Type. This helps &PRODUCT; and the hypervisor perform + certain operations and make assumptions that improve the performance of the + guest. Select one of the following. + + If the operating system of the stopped VM is listed, choose it. + If the OS type of the stopped VM is not listed, choose Other. + If you want to boot from this template in PV mode, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServere: + Note: Generally you should not choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will in general not work. In those cases you should choose Other. + + + Public. Choose Yes to make this template accessible to all + users of this &PRODUCT; installation. The template will appear in the + Community Templates list. See . + Password Enabled. Choose Yes if your template has the + &PRODUCT; password change script installed. See . + + Click Add. + + The new template will be visible in the Templates section when the template creation process + has been completed. The template is then available when creating a new VM.
diff --git a/docs/en-US/create-template-from-snapshot.xml b/docs/en-US/create-template-from-snapshot.xml index 80e660fe7c1..d9684226671 100644 --- a/docs/en-US/create-template-from-snapshot.xml +++ b/docs/en-US/create-template-from-snapshot.xml @@ -5,23 +5,22 @@ ]> -
Creating a Template from a Snapshot diff --git a/docs/en-US/create-templates-overview.xml b/docs/en-US/create-templates-overview.xml index 818b42d1068..900165f482f 100644 --- a/docs/en-US/create-templates-overview.xml +++ b/docs/en-US/create-templates-overview.xml @@ -5,31 +5,33 @@ ]> -
- Creating Templates: Overview - &PRODUCT; ships with a default template for the CentOS operating system. There are a variety of ways to add more templates. Administrators and end users can add templates. The typical sequence of events is: - - Launch a VM instance that has the operating system you want. Make any other desired configuration changes to the VM. - Stop the VM. - Convert the volume into a template. - - There are other ways to add templates to &PRODUCT;. For example, you can take a snapshot of the VM's volume and create a template from the snapshot, or import a VHD from another system into &PRODUCT; - The various techniques for creating templates are described in the next few sections. + Creating Templates: Overview + &PRODUCT; ships with a default template for the CentOS operating system. There are a variety of ways to add more templates. Administrators and end users can add templates. The typical sequence of events is: + + Launch a VM instance that has the operating system you want. Make any other desired configuration changes to the VM. + Stop the VM. + Convert the volume into a template. + + There are other ways to add templates to &PRODUCT;. For example, you can take a snapshot + of the VM's volume and create a template from the snapshot, or import a VHD from another + system into &PRODUCT;. + The various techniques for creating templates are described in the next few sections. +
diff --git a/docs/en-US/create-windows-template.xml b/docs/en-US/create-windows-template.xml index f8dbc79bce9..d02f0678444 100644 --- a/docs/en-US/create-windows-template.xml +++ b/docs/en-US/create-windows-template.xml @@ -5,34 +5,36 @@ ]>
- Creating a Windows Template - Windows templates must be prepared with Sysprep before they can be provisioned on multiple machines. Sysprep allows you to create a generic Windows template and avoid any possible SID conflicts. - (XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown. - An overview of the procedure is as follows: - - Upload your Windows ISO. For more information, see - Create a VM Instance with this ISO. For more information, see - Follow the steps in Sysprep for Windows Server 2008 R2 (below) or Sysprep for Windows Server 2003 R2, depending on your version of Windows Server - The preparation steps are complete. Now you can actually create the template as described in Creating the Windows Template. - - - -
+ Creating a Windows Template + Windows templates must be prepared with Sysprep before they can be provisioned on multiple machines. Sysprep allows you to create a generic Windows template and avoid any possible SID conflicts. + (XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown. + + + An overview of the procedure is as follows: + + Upload your Windows ISO. For more information, see . + Create a VM Instance with this ISO. For more information, see . + Follow the steps in Sysprep for Windows Server 2008 R2 (below) or Sysprep for Windows Server 2003 R2, depending on your version of Windows Server + The preparation steps are complete. Now you can actually create the template as described in Creating the Windows Template. + + + +
diff --git a/docs/en-US/creating-network-offerings.xml b/docs/en-US/creating-network-offerings.xml index ab569200641..1f79fb166ce 100644 --- a/docs/en-US/creating-network-offerings.xml +++ b/docs/en-US/creating-network-offerings.xml @@ -5,113 +5,225 @@ ]> -
- Creating a New Network Offering - To create a network offering: - - Log in with admin privileges to the &PRODUCT; UI. - In the left navigation bar, click Service Offerings. - In Select Offering, choose Network Offering. - Click Add Network Offering. - In the dialog, make the following choices: - - Name. Any desired name for the network offering - Description. A short description of the offering that can be displayed to users - Network Rate. Allowed data transfer rate in MB per second - Traffic Type. The type of network traffic that will be carried on the network - Guest Type. Choose whether the guest network is isolated or shared. For a description of these terms, see - Specify VLAN. (Isolated guest networks only) Indicate whether a VLAN should be specified when this offering is used - Supported Services. Select one or more of the possible network services. For some services, you must also choose the service provider; for example, if you select Load Balancer, you can choose the &PRODUCT; virtual router or any other load balancers that have been configured in the cloud. Depending on which services you choose, additional fields may appear in the rest of the dialog box.Based on the guest network type selected, you can see the following supported services: - - - - Supported Services - Description - Isolated - Shared - - - - - DHCP - - Supported - Supported - - - DNS - - Supported - Supported - - - Load Balancer - If you select Load Balancer, you can choose the &PRODUCT; virtual router or any other load balancers that have been configured in the cloud. - Supported - Supported - - - Source NAT - If you select Source NAT, you can choose the &PRODUCT; virtual router or any other Source NAT providers that have been configured in the cloud. - Supported - Supported - - - Static NAT - If you select Static NAT, you can choose the &PRODUCT; virtual router or any other Static NAT providers that have been configured in the cloud. - Supported - Supported - - - Port Forwarding - If you select Port Forwarding, you can choose the &PRODUCT; virtual router or any other Port Forwarding providers that have been configured in the cloud. - Supported - Not Supported - - - VPN - - Supported - Not Supported - - - User Data - - Not Supported - Supported - - - Security Groups - See . - Not Supported - Supported - - - - - - System Offering. If the service provider for any of the services selected in Supported Services is a virtual router, the System Offering field appears. Choose the system service offering that you want virtual routers to use in this network. For example, if you selected Load Balancer in Supported Services and selected a virtual router to provide load balancing, the System Offering field appears so you can choose between the &PRODUCT; default system service offering and any custom system service offerings that have been defined by the &PRODUCT; root administrator. For more information, see System Service Offerings. - Redundant router capability. (v3.0.3 and greater) Available only when Virtual Router is selected as the Source NAT provider. Select this option if you want to use two virtual routers in the network for uninterrupted connection: one operating as the master virtual router and the other as the backup. The master virtual router receives requests from and sends responses to the user’s VM. The backup virtual router is activated only when the master is down. After the failover, the backup becomes the master virtual router. &PRODUCT; deploys the routers on different hosts to ensure reliability if one host is down. - Conserve mode. Indicate whether to use conserve mode. In this mode, network resources are allocated only when the first virtual machine starts in the network - Tags. Network tag to specify which physical network to use - - Click Add. - + Creating a New Network Offering + To create a network offering: + + + Log in with admin privileges to the &PRODUCT; UI. + + + In the left navigation bar, click Service Offerings. + + + In Select Offering, choose Network Offering. + + + Click Add Network Offering. + + + In the dialog, make the following choices: + + + Name. Any desired name for the network + offering. + + + Description. A short description of the offering + that can be displayed to users. + + + Network Rate. Allowed data transfer rate in MB per + second. + + + Guest Type. Choose whether the guest network is + isolated or shared. + For a description of this term, see . + For a description of this term, see the Administration Guide. + + + + Persistent. Indicate whether the guest network is + persistent or not. The network that you can provision without having to deploy a VM on + it is termed persistent network. For more information, see . + + + Specify VLAN. (Isolated guest networks only) + Indicate whether a VLAN should be specified when this offering is used. + + + VPC. This option indicate whether the guest network + is Virtual Private Cloud-enabled. A Virtual Private Cloud (VPC) is a private, isolated + part of &PRODUCT;. A VPC can have its own virtual network topology that resembles a + traditional physical network. For more information on VPCs, see . + + + Supported Services. Select one or more of the + possible network services. For some services, you must also choose the service provider; + for example, if you select Load Balancer, you can choose the &PRODUCT; virtual router or + any other load balancers that have been configured in the cloud. Depending on which + services you choose, additional fields may appear in the rest of the dialog box. + Based on the guest network type selected, you can see the following supported + services: + + + + + Supported Services + Description + Isolated + Shared + + + + + DHCP + For more information, see . + Supported + Supported + + + DNS + For more information, see . + Supported + Supported + + + Load Balancer + If you select Load Balancer, you can choose the &PRODUCT; virtual + router or any other load balancers that have been configured in the + cloud. + Supported + Supported + + + Firewall + For more information, see . + For more information, see the Administration + Guide. + Supported + Supported + + + Source NAT + If you select Source NAT, you can choose the &PRODUCT; virtual router + or any other Source NAT providers that have been configured in the + cloud. + Supported + Supported + + + Static NAT + If you select Static NAT, you can choose the &PRODUCT; virtual router + or any other Static NAT providers that have been configured in the + cloud. + Supported + Supported + + + Port Forwarding + If you select Port Forwarding, you can choose the &PRODUCT; virtual + router or any other Port Forwarding providers that have been configured in the + cloud. + Supported + Not Supported + + + VPN + For more information, see . + Supported + Not Supported + + + User Data + For more information, see . + For more information, see the Administration + Guide. + Not Supported + Supported + + + Network ACL + For more information, see . + Supported + Not Supported + + + Security Groups + For more information, see . + Not Supported + Supported + + + + + + + System Offering. If the service provider for any of + the services selected in Supported Services is a virtual router, the System Offering + field appears. Choose the system service offering that you want virtual routers to use + in this network. For example, if you selected Load Balancer in Supported Services and + selected a virtual router to provide load balancing, the System Offering field appears + so you can choose between the &PRODUCT; default system service offering and any custom + system service offerings that have been defined by the &PRODUCT; root + administrator. + For more information, see . + For more information, see the Administration Guide. + + + Redundant router capability. Available only when + Virtual Router is selected as the Source NAT provider. Select this option if you want to + use two virtual routers in the network for uninterrupted connection: one operating as + the master virtual router and the other as the backup. The master virtual router + receives requests from and sends responses to the user’s VM. The backup virtual router + is activated only when the master is down. After the failover, the backup becomes the + master virtual router. &PRODUCT; deploys the routers on different hosts to ensure + reliability if one host is down. + + + Conserve mode. Indicate whether to use conserve + mode. In this mode, network resources are allocated only when the first virtual machine + starts in the network. When conservative mode is off, the public IP can only be used for + a single service. For example, a public IP used for a port forwarding rule cannot be + used for defining other services, such as SaticNAT or load balancing. When the conserve + mode is on, you can define more than one service on the same public IP. + + If StaticNAT is enabled, irrespective of the status of the conserve mode, no port + forwarding or load balancing rule can be created for the IP. However, you can add the + firewall rules by using the createFirewallRule command. + + + + Tags. Network tag to specify which physical network + to use. + + + + + Click Add. + +
diff --git a/docs/en-US/creating-new-volumes.xml b/docs/en-US/creating-new-volumes.xml index 62181b9ea36..5a12d7f5783 100644 --- a/docs/en-US/creating-new-volumes.xml +++ b/docs/en-US/creating-new-volumes.xml @@ -5,37 +5,59 @@ ]> - + 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. +-->
- Creating a New Volume - You can add more data disk volumes to a guest VM at any time, up to the limits of your storage capacity. Both &PRODUCT; administrators and users can add volumes to VM instances. When you create a new volume, it is stored as an entity in &PRODUCT;, but the actual storage resources are not allocated on the physical storage device until you attach the volume. This optimization allows the &PRODUCT; to provision the volume nearest to the guest that will use it when the first attachment is made. - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation bar, click Storage. - In Select View, choose Volumes. - To create a new volume, click Add Volume, provide the following details, and click OK. - - Name. Give the volume a unique name so you can find it later. - Availability Zone. Where do you want the storage to reside? This should be close to the VM that will use the volume. - Disk Offering. Choose the characteristics of the storage. - - The new volume appears in the list of volumes with the state “Allocated.†The volume data is stored in &PRODUCT;, but the volume is not yet ready for use - To start using the volume, continue to Attaching a Volume - -
+ Creating a New Volume + You can add more data disk volumes to a guest VM at any time, up to the limits of your storage capacity. Both &PRODUCT; administrators and users can add volumes to VM instances. When you create a new volume, it is stored as an entity in &PRODUCT;, but the actual storage resources are not allocated on the physical storage device until you attach the volume. This optimization allows the &PRODUCT; to provision the volume nearest to the guest that will use it when the first attachment is made. +
+ Using Local Storage for Data Volumes + You can create data volumes on local storage (supported with XenServer, KVM, and VMware). + The data volume is placed on the same + host as the VM instance that is attached to the data volume. These + local data volumes can be attached to virtual machines, detached, re-attached, + and deleted just as with the other types of data volume. + Local storage is ideal for scenarios where persistence of data volumes and HA + is not required. Some of the benefits include reduced disk I/O latency and cost + reduction from using inexpensive local disks. + In order for local volumes to be used, the feature must be enabled for the + zone. + You can create a data disk offering for local storage. When a user creates a + new VM, they can select this disk offering in order to cause the data disk + volume to be placed in local storage. + You can not migrate a VM that has a volume in local storage to a different + host, nor migrate the volume itself away to a different host. If you want to put + a host into maintenance mode, you must first stop any VMs with local data + volumes on that host. +
+
+ To Create a New Volume + + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation bar, click Storage. + In Select View, choose Volumes. + To create a new volume, click Add Volume, provide the following details, and click OK. + + Name. Give the volume a unique name so you can find it later. + Availability Zone. Where do you want the storage to reside? This should be close to the VM that will use the volume. + Disk Offering. Choose the characteristics of the storage. + + The new volume appears in the list of volumes with the state “Allocated.†The volume data is stored in &PRODUCT;, but the volume is not yet ready for use + To start using the volume, continue to Attaching a Volume + +
+
diff --git a/docs/en-US/creating-vms.xml b/docs/en-US/creating-vms.xml index 9da4aea94ea..86d89fd2e92 100644 --- a/docs/en-US/creating-vms.xml +++ b/docs/en-US/creating-vms.xml @@ -3,47 +3,53 @@ %BOOK_ENTITIES; ]> - -
- Creating VMs - Virtual machines are usually created from a template. Users can also create blank virtual machines. A blank virtual machine is a virtual machine without an OS template. Users can attach an ISO file and install the OS from the CD/DVD-ROM. - To create a VM from a template: - - Log in to the &PRODUCT; UI as an administrator or user. - In the left navigation bar, click Instances. - Click Add Instance. - Select a template, then follow the steps in the wizard. (For more information about how the templates came to be in this list, see Working with Templates. - Be sure that the hardware you have allows starting the selected service offering. - Click Submit and your VM will be created and started. - For security reason, the internal name of the VM is visible only to the root admin. - - Starting with v3.0.3, you can create a VM without starting it. You can determine whether the VM needs to be started as part of the VM deployment. A new request parameter, startVM, is introduced in the deployVm API to support this feature. For more information, see the Developer's Guide - To create a VM from an ISO: - (XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown. - - Log in to the &PRODUCT; UI as an administrator or user. - In the left navigation bar, click Instances. - Click Add Instance. - Select ISO Boot, and follow the steps in the wizard. - Click Submit and your VM will be created and started. + Creating VMs + Virtual machines are usually created from a template. Users can also create blank virtual machines. A blank virtual machine is a virtual machine without an OS template. Users can attach an ISO file and install the OS from the CD/DVD-ROM. + Starting with v3.0.3, you can create a VM without starting it. You can determine whether the VM needs to be started as part of the VM deployment. A new request parameter, startVM, is introduced in the deployVm API to support this feature. For more information, see the Developer's Guide + To create a VM from a template: + + Log in to the &PRODUCT; UI as an administrator or user. + In the left navigation bar, click Instances. + + Click Add Instance. + + + Select a zone. + + Select a template, then follow the steps in the wizard. For more information about how the templates came to be in this list, see . + Be sure that the hardware you have allows starting the selected service offering. + Click Submit and your VM will be created and started. + For security reason, the internal name of the VM is visible only to the root admin. + + + To create a VM from an ISO: + (XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown. + + Log in to the &PRODUCT; UI as an administrator or user. + In the left navigation bar, click Instances. + Click Add Instance. + Select a zone. + Select ISO Boot, and follow the steps in the wizard. + Click Submit and your VM will be created and started. - +
+ diff --git a/docs/en-US/default-account-resource-limit.xml b/docs/en-US/default-account-resource-limit.xml index abc313f46bf..5134e508c11 100644 --- a/docs/en-US/default-account-resource-limit.xml +++ b/docs/en-US/default-account-resource-limit.xml @@ -5,36 +5,41 @@ ]> -
Default Account Resource Limits - You can limit resource use by accounts. The default limits are set using global configuration parameters, and they affect all accounts within a cloud. The relevant parameters are those beginning with max.account (max.account.snapshots, etc.).. + You can limit resource use by accounts. The default limits are set by using global + configuration parameters, and they affect all accounts within a cloud. The relevant + parameters are those beginning with max.account, for example: max.account.snapshots. To override a default limit for a particular account, set a per-account resource limit. Log in to the &PRODUCT; UI. In the left navigation tree, click Accounts. - Select the account you want to modify. The current limits are displayed. A value of -1 shows that there is no limit in place - Click the Edit button - - - - editbutton.png: edits the settings. - + Select the account you want to modify. The current limits are displayed. A value of -1 shows + that there is no limit in place. + Click the Edit button. + + + + + editbutton.png: edits the settings + + +
diff --git a/docs/en-US/deleting-vms.xml b/docs/en-US/deleting-vms.xml index 1f1ee959f57..97245c81ef4 100644 --- a/docs/en-US/deleting-vms.xml +++ b/docs/en-US/deleting-vms.xml @@ -5,37 +5,39 @@ ]> -
- Deleting VMs - Users can delete their own virtual machines. A running virtual machine will be abruptly stopped before it is deleted. Administrators can delete any virtual machines. - To delete a virtual machine: - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation, click Instances. - Choose the VM that you want to delete. - Click the Destroy Instance button - - - - Destroyinstance.png: button to destroy an instance - - - -
+ Deleting VMs + Users can delete their own virtual machines. A running virtual machine will be abruptly stopped before it is deleted. Administrators can delete any virtual machines. + To delete a virtual machine: + + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation, click Instances. + Choose the VM that you want to delete. + Click the Destroy Instance button. + + + + + Destroyinstance.png: button to destroy an instance + + + + +
+ diff --git a/docs/en-US/deployment-architecture-overview.xml b/docs/en-US/deployment-architecture-overview.xml index 2c5f30ec06b..fba36eb85a3 100644 --- a/docs/en-US/deployment-architecture-overview.xml +++ b/docs/en-US/deployment-architecture-overview.xml @@ -1,57 +1,56 @@ - %BOOK_ENTITIES; ]> -
- Deployment Architecture Overview - + Deployment Architecture Overview + A &PRODUCT; installation consists of two parts: the Management Server and the cloud infrastructure that it manages. When you set up and manage a &PRODUCT; cloud, you provision resources such as hosts, storage devices, and IP addresses into the Management Server, and the Management Server manages those resources. - - + + The minimum production installation consists of one machine running the &PRODUCT; Management Server and another machine to act as the cloud infrastructure (in this case, a very simple infrastructure consisting of one host running hypervisor software). In its smallest deployment, a single machine can act as both the Management Server and the hypervisor host (using the KVM hypervisor). - - - - - - basic-deployment.png: Basic two-machine deployment - + + + + + + basic-deployment.png: Basic two-machine deployment + A more full-featured installation consists of a highly-available multi-node Management Server installation and up to tens of thousands of hosts using any of several advanced networking setups. For information about deployment options, see Choosing a Deployment Architecture. - - - - + + + +
diff --git a/docs/en-US/detach-move-volumes.xml b/docs/en-US/detach-move-volumes.xml index 25323c928ee..fda6e66cede 100644 --- a/docs/en-US/detach-move-volumes.xml +++ b/docs/en-US/detach-move-volumes.xml @@ -5,39 +5,42 @@ ]> -
- Attaching a Volume - This procedure is different from moving disk volumes from one storage pool to another. See VM Storage Migration - A volume can be detached from a guest VM and attached to another guest. Both &PRODUCT; administrators and users can detach volumes from VMs and move them to other VMs. - If the two VMs are in different clusters, and the volume is large, it may take several minutes for the volume to be moved to the new VM. + Detaching and Moving Volumes + This procedure is different from moving disk volumes from one storage pool to another. See VM Storage Migration + A volume can be detached from a guest VM and attached to another guest. Both &PRODUCT; administrators and users can detach volumes from VMs and move them to other VMs. + If the two VMs are in different clusters, and the volume is large, it may take several minutes for the volume to be moved to the new VM. - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation bar, click Storage, and choose Volumes in Select View. Alternatively, if you know which VM the volume is attached to, you can click Instances, click the VM name, and click View Volumes. - Click the name of the volume you want to detach, then click the Detach Disk button - - - - DetachDiskButton.png: button to detach a volume - - - To move the volume to another VM, follow the steps in Attaching a Volume . - -
+ + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation bar, click Storage, and choose Volumes in Select View. Alternatively, if you know which VM the volume is attached to, you can click Instances, click the VM name, and click View Volumes. + Click the name of the volume you want to detach, then click the Detach Disk button. + + + + + DetachDiskButton.png: button to detach a volume + + + + To move the volume to another VM, follow the steps in . + +
+ diff --git a/docs/en-US/egress-firewall-rule.xml b/docs/en-US/egress-firewall-rule.xml new file mode 100644 index 00000000000..ef0e25efd03 --- /dev/null +++ b/docs/en-US/egress-firewall-rule.xml @@ -0,0 +1,98 @@ + + +%BOOK_ENTITIES; +]> + +
+ Creating Egress Firewall Rules in an Advanced Zone + + The egress firewall rules are supported only on virtual routers. + + + The egress traffic originates from a private network to a public network, such as the + Internet. By default, the egress traffic is blocked, so no outgoing traffic is allowed from a + guest network to the Internet. However, you can control the egress traffic in an Advanced zone + by creating egress firewall rules. When an egress firewall rule is applied, the traffic specific + to the rule is allowed and the remaining traffic is blocked. When all the firewall rules are + removed the default policy, Block, is applied. + Consider the following scenarios to apply egress firewall rules: + + + Allow the egress traffic from specified source CIDR. The Source CIDR is part of guest + network CIDR. + + + Allow the egress traffic with destination protocol TCP,UDP,ICMP, or ALL. + + + Allow the egress traffic with destination protocol and port range. The port range is + specified for TCP, UDP or for ICMP type and code. + + + To configure an egress firewall rule: + + + Log in to the &PRODUCT; UI as an administrator or end user. + + + In the left navigation, choose Network. + + + In Select view, choose Guest networks, then click the Guest network you want. + + + To add an egress rule, click the Egress rules tab and fill out the following fields to + specify what type of traffic is allowed to be sent out of VM instances in this guest + network: + + + + + + egress-firewall-rule.png: adding an egress firewall rule + + + + + CIDR: (Add by CIDR only) To send traffic only to + the IP addresses within a particular address block, enter a CIDR or a comma-separated + list of CIDRs. The CIDR is the base IP address of the destination. For example, + 192.168.0.0/22. To allow all CIDRs, set to 0.0.0.0/0. + + + Protocol: The networking protocol that VMs uses to + send outgoing traffic. The TCP and UDP protocols are typically used for data exchange + and end-user communications. The ICMP protocol is typically used to send error messages + or network monitoring data. + + + Start Port, End Port: (TCP, UDP only) A range of + listening ports that are the destination for the outgoing traffic. If you are opening a + single port, use the same number in both fields. + + + ICMP Type, ICMP Code: (ICMP only) The type of + message and error code that are sent. + + + + + Click Add. + + +
diff --git a/docs/en-US/enable-disable-static-nat.xml b/docs/en-US/enable-disable-static-nat.xml index f25327a54b3..0154dca2732 100644 --- a/docs/en-US/enable-disable-static-nat.xml +++ b/docs/en-US/enable-disable-static-nat.xml @@ -5,40 +5,42 @@ ]> -
- Enabling or Disabling Static NAT - If port forwarding rules are already in effect for an IP address, you cannot enable static NAT to that IP. - If a guest VM is part of more than one network, static NAT rules will function only if they are defined on the default network. - - Log in to the &PRODUCT; UI as an administrator or end user. - In the left navigation, choose Network. - Click the name of the network where you want to work with. - Click View IP Addresses. - Click the IP address you want to work with. - - Click the Static NAT button. - - - - ReleaseIPButton.png: button to release an IP - The button toggles between Enable and Disable, depending on whether static NAT is currently enabled for the IP address. - If you are enabling static NAT, a dialog appears where you can choose the destination VM and click Apply - + Enabling or Disabling Static NAT + If port forwarding rules are already in effect for an IP address, you cannot enable static NAT to that IP. + If a guest VM is part of more than one network, static NAT rules will function only if they are defined on the default network. + + Log in to the &PRODUCT; UI as an administrator or end user. + In the left navigation, choose Network. + Click the name of the network where you want to work with. + Click View IP Addresses. + Click the IP address you want to work with. + + Click the Static NAT + + + + + ReleaseIPButton.png: button to release an IP + + button.The button toggles between Enable and Disable, depending on whether static NAT is currently enabled for the IP address. + If you are enabling static NAT, a dialog appears where you can choose the destination VM and + click Apply. +
diff --git a/docs/en-US/enable-security-groups.xml b/docs/en-US/enable-security-groups.xml index 27f69d2cef2..c957310f9d6 100644 --- a/docs/en-US/enable-security-groups.xml +++ b/docs/en-US/enable-security-groups.xml @@ -5,25 +5,28 @@ ]> -
- Enabling Security Groups - In order for security groups to function in a zone, the security groups feature must first be enabled for the zone. The administrator can do this when creating a new zone, by selecting a network offering that includes security groups. The procedure is described in Basic Zone Configuration in the Advanced Installation Guide. + Enabling Security Groups + In order for security groups to function in a zone, the security groups feature must first be + enabled for the zone. The administrator can do this when creating a new zone, by selecting a + network offering that includes security groups. The procedure is described in Basic Zone + Configuration in the Advanced Installation Guide. The administrator can not enable security + groups for an existing zone, only when creating a new zone.
diff --git a/docs/en-US/end-user-ui-overview.xml b/docs/en-US/end-user-ui-overview.xml index dc95ce064b9..6ec1a25fc55 100644 --- a/docs/en-US/end-user-ui-overview.xml +++ b/docs/en-US/end-user-ui-overview.xml @@ -1,28 +1,27 @@ - %BOOK_ENTITIES; ]> -
- End User's UI Overview - The &PRODUCT; UI helps users of cloud infrastructure to view and use their cloud resources, including virtual machines, templates and ISOs, data volumes and snapshots, guest networks, and IP addresses. If the user is a member or administrator of one or more &PRODUCT; projects, the UI can provide a project-oriented view. + End User's UI Overview + The &PRODUCT; UI helps users of cloud infrastructure to view and use their cloud resources, including virtual machines, templates and ISOs, data volumes and snapshots, guest networks, and IP addresses. If the user is a member or administrator of one or more &PRODUCT; projects, the UI can provide a project-oriented view.
diff --git a/docs/en-US/event-log-queries.xml b/docs/en-US/event-log-queries.xml index 32a1612ce6c..a0dcaa607fb 100644 --- a/docs/en-US/event-log-queries.xml +++ b/docs/en-US/event-log-queries.xml @@ -5,23 +5,22 @@ ]> -
Event Log Queries Database logs can be queried from the user interface. The list of events captured by the system includes: @@ -34,4 +33,4 @@ Storage volume creation and deletion User login and logout -
+
diff --git a/docs/en-US/event-types.xml b/docs/en-US/event-types.xml index 2ccd55335df..5ce585763de 100644 --- a/docs/en-US/event-types.xml +++ b/docs/en-US/event-types.xml @@ -5,216 +5,216 @@ ]> + 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. +--> - Event Types - - - - - - - VM.CREATE - TEMPLATE.EXTRACT - SG.REVOKE.INGRESS - - - VM.DESTROY - TEMPLATE.UPLOAD - HOST.RECONNECT - - - VM.START - TEMPLATE.CLEANUP - MAINT.CANCEL - - - VM.STOP - VOLUME.CREATE - MAINT.CANCEL.PS - - - VM.REBOOT - VOLUME.DELETE - MAINT.PREPARE - - - VM.UPGRADE - VOLUME.ATTACH - MAINT.PREPARE.PS - - - VM.RESETPASSWORD - VOLUME.DETACH - VPN.REMOTE.ACCESS.CREATE - - - ROUTER.CREATE - VOLUME.UPLOAD - VPN.USER.ADD - - - ROUTER.DESTROY - SERVICEOFFERING.CREATE - VPN.USER.REMOVE - - - ROUTER.START - SERVICEOFFERING.UPDATE - NETWORK.RESTART - - - ROUTER.STOP - SERVICEOFFERING.DELETE - UPLOAD.CUSTOM.CERTIFICATE - - - ROUTER.REBOOT - DOMAIN.CREATE - UPLOAD.CUSTOM.CERTIFICATE - - - ROUTER.HA - DOMAIN.DELETE - STATICNAT.DISABLE - - - PROXY.CREATE - DOMAIN.UPDATE - SSVM.CREATE - - - PROXY.DESTROY - SNAPSHOT.CREATE - SSVM.DESTROY - - - PROXY.START - SNAPSHOT.DELETE - SSVM.START - - - PROXY.STOP - SNAPSHOTPOLICY.CREATE - SSVM.STOP - - - PROXY.REBOOT - SNAPSHOTPOLICY.UPDATE - SSVM.REBOOT - - - PROXY.HA - SNAPSHOTPOLICY.DELETE - SSVM.H - - - VNC.CONNECT - VNC.DISCONNECT - NET.IPASSIGN - - - NET.IPRELEASE - NET.RULEADD - NET.RULEDELETE - - - NET.RULEMODIFY - NETWORK.CREATE - NETWORK.DELETE - - - LB.ASSIGN.TO.RULE - LB.REMOVE.FROM.RULE - LB.CREATE - - - LB.DELETE - LB.UPDATE - USER.LOGIN - - - USER.LOGOUT - USER.CREATE - USER.DELETE - - - USER.UPDATE - USER.DISABLE - TEMPLATE.CREATE - - - TEMPLATE.DELETE - TEMPLATE.UPDATE - TEMPLATE.COPY - - - TEMPLATE.DOWNLOAD.START - TEMPLATE.DOWNLOAD.SUCCESS - TEMPLATE.DOWNLOAD.FAILED - - - ISO.CREATE - ISO.DELETE - ISO.COPY - - - ISO.ATTACH - ISO.DETACH - ISO.EXTRACT - - - ISO.UPLOAD - SERVICE.OFFERING.CREATE - SERVICE.OFFERING.EDIT - - - SERVICE.OFFERING.DELETE - DISK.OFFERING.CREATE - DISK.OFFERING.EDIT - - - DISK.OFFERING.DELETE - NETWORK.OFFERING.CREATE - NETWORK.OFFERING.EDIT - - - NETWORK.OFFERING.DELETE - POD.CREATE - POD.EDIT - - - POD.DELETE - ZONE.CREATE - ZONE.EDIT - - - ZONE.DELETE - VLAN.IP.RANGE.CREATE - VLAN.IP.RANGE.DELETE - - - CONFIGURATION.VALUE.EDIT - SG.AUTH.INGRESS - - - - - + Event Types + + + + + + + VM.CREATE + TEMPLATE.EXTRACT + SG.REVOKE.INGRESS + + + VM.DESTROY + TEMPLATE.UPLOAD + HOST.RECONNECT + + + VM.START + TEMPLATE.CLEANUP + MAINT.CANCEL + + + VM.STOP + VOLUME.CREATE + MAINT.CANCEL.PS + + + VM.REBOOT + VOLUME.DELETE + MAINT.PREPARE + + + VM.UPGRADE + VOLUME.ATTACH + MAINT.PREPARE.PS + + + VM.RESETPASSWORD + VOLUME.DETACH + VPN.REMOTE.ACCESS.CREATE + + + ROUTER.CREATE + VOLUME.UPLOAD + VPN.USER.ADD + + + ROUTER.DESTROY + SERVICEOFFERING.CREATE + VPN.USER.REMOVE + + + ROUTER.START + SERVICEOFFERING.UPDATE + NETWORK.RESTART + + + ROUTER.STOP + SERVICEOFFERING.DELETE + UPLOAD.CUSTOM.CERTIFICATE + + + ROUTER.REBOOT + DOMAIN.CREATE + UPLOAD.CUSTOM.CERTIFICATE + + + ROUTER.HA + DOMAIN.DELETE + STATICNAT.DISABLE + + + PROXY.CREATE + DOMAIN.UPDATE + SSVM.CREATE + + + PROXY.DESTROY + SNAPSHOT.CREATE + SSVM.DESTROY + + + PROXY.START + SNAPSHOT.DELETE + SSVM.START + + + PROXY.STOP + SNAPSHOTPOLICY.CREATE + SSVM.STOP + + + PROXY.REBOOT + SNAPSHOTPOLICY.UPDATE + SSVM.REBOOT + + + PROXY.HA + SNAPSHOTPOLICY.DELETE + SSVM.H + + + VNC.CONNECT + VNC.DISCONNECT + NET.IPASSIGN + + + NET.IPRELEASE + NET.RULEADD + NET.RULEDELETE + + + NET.RULEMODIFY + NETWORK.CREATE + NETWORK.DELETE + + + LB.ASSIGN.TO.RULE + LB.REMOVE.FROM.RULE + LB.CREATE + + + LB.DELETE + LB.UPDATE + USER.LOGIN + + + USER.LOGOUT + USER.CREATE + USER.DELETE + + + USER.UPDATE + USER.DISABLE + TEMPLATE.CREATE + + + TEMPLATE.DELETE + TEMPLATE.UPDATE + TEMPLATE.COPY + + + TEMPLATE.DOWNLOAD.START + TEMPLATE.DOWNLOAD.SUCCESS + TEMPLATE.DOWNLOAD.FAILED + + + ISO.CREATE + ISO.DELETE + ISO.COPY + + + ISO.ATTACH + ISO.DETACH + ISO.EXTRACT + + + ISO.UPLOAD + SERVICE.OFFERING.CREATE + SERVICE.OFFERING.EDIT + + + SERVICE.OFFERING.DELETE + DISK.OFFERING.CREATE + DISK.OFFERING.EDIT + + + DISK.OFFERING.DELETE + NETWORK.OFFERING.CREATE + NETWORK.OFFERING.EDIT + + + NETWORK.OFFERING.DELETE + POD.CREATE + POD.EDIT + + + POD.DELETE + ZONE.CREATE + ZONE.EDIT + + + ZONE.DELETE + VLAN.IP.RANGE.CREATE + VLAN.IP.RANGE.DELETE + + + CONFIGURATION.VALUE.EDIT + SG.AUTH.INGRESS + + + + + diff --git a/docs/en-US/events-log.xml b/docs/en-US/events-log.xml index 9de679ea130..fa97db45959 100644 --- a/docs/en-US/events-log.xml +++ b/docs/en-US/events-log.xml @@ -5,24 +5,31 @@ ]> -
Event Logs - There are two types of events logged in the &PRODUCT; Event Log. Standard events log the success or failure of an event and can be used to identify jobs or processes that have failed. There are also long running job events. Events for asynchronous jobs log when a job is scheduled, when it starts, and when it completes. Other long running synchronous jobs log when a job starts, and when it completes. Long running synchronous and asynchronous event logs can be used to gain more information on the status of a pending job or can be used to identify a job that is hanging or has not started. The following sections provide more information on these events.. -
+ There are two types of events logged in the &PRODUCT; Event Log. Standard events log + the success or failure of an event and can be used to identify jobs or processes that have + failed. There are also long running job events. Events for asynchronous jobs log when a job + is scheduled, when it starts, and when it completes. Other long running synchronous jobs log + when a job starts, and when it completes. Long running synchronous and asynchronous event + logs can be used to gain more information on the status of a pending job or can be used to + identify a job that is hanging or has not started. The following sections provide more + information on these events.. +
+ diff --git a/docs/en-US/events.xml b/docs/en-US/events.xml index 9b6d75cfbba..242ff4511ff 100644 --- a/docs/en-US/events.xml +++ b/docs/en-US/events.xml @@ -5,21 +5,21 @@ ]>
diff --git a/docs/en-US/external-firewalls-and-load-balancers.xml b/docs/en-US/external-firewalls-and-load-balancers.xml index 6ca49f0ef03..b947daf7361 100644 --- a/docs/en-US/external-firewalls-and-load-balancers.xml +++ b/docs/en-US/external-firewalls-and-load-balancers.xml @@ -27,7 +27,7 @@ -
diff --git a/docs/en-US/feature-overview.xml b/docs/en-US/feature-overview.xml index 501bca88c2f..a05078f8606 100644 --- a/docs/en-US/feature-overview.xml +++ b/docs/en-US/feature-overview.xml @@ -1,57 +1,56 @@ - %BOOK_ENTITIES; ]> -
- What Can &PRODUCT; Do? - - Multiple Hypervisor Support - - + What Can &PRODUCT; Do? + + Multiple Hypervisor Support + + &PRODUCT; works with a variety of hypervisors, and a single cloud deployment can contain multiple hypervisor implementations. The current release of &PRODUCT; supports pre-packaged enterprise solutions like Citrix XenServer and VMware vSphere, as well as KVM or Xen running on Ubuntu or CentOS. - - Massively Scalable Infrastructure Management - - - &PRODUCT; can manage tens of thousands of servers installed in multiple geographically distributed datacenters. The centralized management server scales linearly, eliminating the need for intermediate cluster-level management servers. No single component failure can cause cloud-wide outage. Periodic maintenance of the management server can be performed without affecting the functioning of virtual machines running in the cloud. - - - Automatic Configuration Management - - &PRODUCT; automatically configures each guest virtual machine’s networking and storage settings. - - &PRODUCT; internally manages a pool of virtual appliances to support the cloud itself. These appliances offer services such as firewalling, routing, DHCP, VPN access, console proxy, storage access, and storage replication. The extensive use of virtual appliances simplifies the installation, configuration, and ongoing management of a cloud deployment. - - - Graphical User Interface - - &PRODUCT; offers an administrator's Web interface, used for provisioning and managing the cloud, as well as an end-user's Web interface, used for running VMs and managing VM templates. The UI can be customized to reflect the desired service provider or enterprise look and feel. - - - API and Extensibility - - + + Massively Scalable Infrastructure Management + + + &PRODUCT; can manage tens of thousands of servers installed in multiple geographically distributed datacenters. The centralized management server scales linearly, eliminating the need for intermediate cluster-level management servers. No single component failure can cause cloud-wide outage. Periodic maintenance of the management server can be performed without affecting the functioning of virtual machines running in the cloud. + + + Automatic Configuration Management + + &PRODUCT; automatically configures each guest virtual machine’s networking and storage settings. + + &PRODUCT; internally manages a pool of virtual appliances to support the cloud itself. These appliances offer services such as firewalling, routing, DHCP, VPN access, console proxy, storage access, and storage replication. The extensive use of virtual appliances simplifies the installation, configuration, and ongoing management of a cloud deployment. + + + Graphical User Interface + + &PRODUCT; offers an administrator's Web interface, used for provisioning and managing the cloud, as well as an end-user's Web interface, used for running VMs and managing VM templates. The UI can be customized to reflect the desired service provider or enterprise look and feel. + + + API and Extensibility + + &PRODUCT; provides an API that gives programmatic access to all the management features available in the UI. The API is maintained and documented. This API enables the creation of command line tools and @@ -61,16 +60,16 @@ and Apache CloudStack API Reference respectively. - - + + The &PRODUCT; pluggable allocation architecture allows the creation of new types of allocators for the selection of storage and Hosts. See the Allocator Implementation Guide (http://docs.cloudstack.org/CloudStack_Documentation/Allocator_Implementation_Guide). - - - High Availability - + + + High Availability + &PRODUCT; has a number of features to increase the availability of the system. The Management Server itself may be deployed in a multi-node @@ -78,5 +77,5 @@ to use replication to provide for a manual failover in the event of database loss. For the hosts, &PRODUCT; supports NIC bonding and the use of separate networks for storage as well as iSCSI Multipath. - +
diff --git a/docs/en-US/firewall-rules.xml b/docs/en-US/firewall-rules.xml index 388bf7e2885..837a4c6f9d0 100644 --- a/docs/en-US/firewall-rules.xml +++ b/docs/en-US/firewall-rules.xml @@ -3,54 +3,80 @@ %BOOK_ENTITIES; ]> - -
- Firewall Rules - By default, all incoming traffic to the public IP address is rejected by the firewall. To allow external traffic, you can open firewall ports by specifying firewall rules. You can optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to allow only incoming requests from certain IP addresses. - You cannot use firewall rules to open ports for an elastic IP address. When elastic IP is used, outside access is instead controlled through the use of security groups. See . - Firewall rules can be created using the Firewall tab in the Management Server UI. This tab is not displayed by default when &PRODUCT; is installed. To display the Firewall tab, the &PRODUCT; administrator must set the global configuration parameter firewall.rule.ui.enabled to "true." - To create a firewall rule: - - Log in to the &PRODUCT; UI as an administrator or end user. - In the left navigation, choose Network. - Click the name of the network where you want to work with. - Click View IP Addresses. - Click the IP address you want to work with. + Firewall Rules + By default, all incoming traffic to the public IP address is rejected by the firewall. To + allow external traffic, you can open firewall ports by specifying firewall rules. You can + optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to + allow only incoming requests from certain IP addresses. + You cannot use firewall rules to open ports for an elastic IP address. When elastic IP is + used, outside access is instead controlled through the use of security groups. See . + In an advanced zone, you can also create egress firewall rules by using the virtual router. + For more information, see . + Firewall rules can be created using the Firewall tab in the Management Server UI. This tab + is not displayed by default when &PRODUCT; is installed. To display the Firewall tab, the + &PRODUCT; administrator must set the global configuration parameter firewall.rule.ui.enabled to + "true." + To create a firewall rule: + + + Log in to the &PRODUCT; UI as an administrator or end user. + + + In the left navigation, choose Network. + + + Click the name of the network where you want to work with. + + + Click View IP Addresses. + + + Click the IP address you want to work with. + + + Click the Configuration tab and fill in the following values. + + + Source CIDR. (Optional) To accept only traffic from + IP addresses within a particular address block, enter a CIDR or a comma-separated list + of CIDRs. Example: 192.168.0.0/22. Leave empty to allow all CIDRs. - Click the Configuration tab and fill in the following values. - - Source CIDR. (Optional) To accept only traffic from IP - addresses within a particular address block, enter a CIDR or a - comma-separated list of CIDRs. Example: 192.168.0.0/22. Leave empty to allow - all CIDRs. - Protocol. The communication protocol in use on the opened - port(s). - Start Port and End Port. The port(s) you want to open on the - firewall. If you are opening a single port, use the same number in both - fields - ICMP Type and ICMP Code. Used only if Protocol is set to - ICMP. Provide the type and code required by the ICMP protocol to fill out - the ICMP header. Refer to ICMP documentation for more details if you are not - sure what to enter - - Click Add - + + Protocol. The communication protocol in use on the + opened port(s). + + + Start Port and End Port. The port(s) you want to + open on the firewall. If you are opening a single port, use the same number in both + fields + + + ICMP Type and ICMP Code. Used only if Protocol is + set to ICMP. Provide the type and code required by the ICMP protocol to fill out the + ICMP header. Refer to ICMP documentation for more details if you are not sure what to + enter + + + + + Click Add. + +
diff --git a/docs/en-US/guest-traffic.xml b/docs/en-US/guest-traffic.xml index 8404968b919..16dfa41cf7b 100644 --- a/docs/en-US/guest-traffic.xml +++ b/docs/en-US/guest-traffic.xml @@ -5,27 +5,26 @@ ]> -
- Guest Traffic - A network can carry guest traffic only between VMs within one zone. Virtual machines in different zones cannot communicate with each other using their IP addresses; they must communicate with each other by routing through a public IP address. - The Management Server automatically creates a virtual router for each network. A virtual router is a special virtual machine that runs on the hosts. Each virtual router has three network interfaces. Its eth0 interface serves as the gateway for the guest traffic and has the IP address of 10.1.1.1. Its eth1 interface is used by the system to configure the virtual router. Its eth2 interface is assigned a public IP address for public traffic. - The virtual router provides DHCP and will automatically assign an IP address for each guest VM within the IP range assigned for the network. The user can manually reconfigure guest VMs to assume different IP addresses. - Source NAT is automatically configured in the virtual router to forward outbound traffic for all guest VMs + Guest Traffic + A network can carry guest traffic only between VMs within one zone. Virtual machines in different zones cannot communicate with each other using their IP addresses; they must communicate with each other by routing through a public IP address. + The Management Server automatically creates a virtual router for each network. A virtual router is a special virtual machine that runs on the hosts. Each virtual router has three network interfaces. Its eth0 interface serves as the gateway for the guest traffic and has the IP address of 10.1.1.1. Its eth1 interface is used by the system to configure the virtual router. Its eth2 interface is assigned a public IP address for public traffic. + The virtual router provides DHCP and will automatically assign an IP address for each guest VM within the IP range assigned for the network. The user can manually reconfigure guest VMs to assume different IP addresses. + Source NAT is automatically configured in the virtual router to forward outbound traffic for all guest VMs
diff --git a/docs/en-US/ha-for-hosts.xml b/docs/en-US/ha-for-hosts.xml index e395d22e58a..15b5fa73f0b 100644 --- a/docs/en-US/ha-for-hosts.xml +++ b/docs/en-US/ha-for-hosts.xml @@ -1,29 +1,30 @@ - %BOOK_ENTITIES; ]>
HA for Hosts The user can specify a virtual machine as HA-enabled. By default, all virtual router VMs and Elastic Load Balancing VMs are automatically configured as HA-enabled. When an HA-enabled VM crashes, &PRODUCT; detects the crash and restarts the VM automatically within the same Availability Zone. HA is never performed across different Availability Zones. &PRODUCT; has a conservative policy towards restarting VMs and ensures that there will never be two instances of the same VM running at the same time. The Management Server attempts to start the VM on another Host in the same cluster. HA features work with iSCSI or NFS primary storage. HA with local storage is not supported. -
+ +
diff --git a/docs/en-US/host-add-xenserver-kvm-ovm.xml b/docs/en-US/host-add-xenserver-kvm-ovm.xml index 4bbeefcbed4..1f13e72d4c3 100644 --- a/docs/en-US/host-add-xenserver-kvm-ovm.xml +++ b/docs/en-US/host-add-xenserver-kvm-ovm.xml @@ -83,6 +83,11 @@ Make sure the new host has the same network configuration (guest, private, and public network) as other hosts in the cluster. + + If you are using OpenVswitch bridges edit the file agent.properties on the KVM host + and set the parameter network.bridge.type to + openvswitch before adding the host to &PRODUCT; +
@@ -28,4 +28,5 @@ &PRODUCT; administrators can specify that certain hosts should have a preference for particular types of guest instances. For example, an administrator could state that a host should have a preference to run Windows guests. The default host allocator will attempt to place guests of that OS type on such hosts first. If no such host is available, the allocator will place the instance wherever there is sufficient physical capacity. Both vertical and horizontal allocation is allowed. Vertical allocation consumes all the resources of a given host before allocating any guests on a second host. This reduces power consumption in the cloud. Horizontal allocation places a guest on each host in a round-robin fashion. This may yield better performance to the guests in some cases. &PRODUCT; also allows an element of CPU over-provisioning as configured by the administrator. Over-provisioning allows the administrator to commit more CPU cycles to the allocated guests than are actually available from the hardware. &PRODUCT; also provides a pluggable interface for adding new allocators. These custom allocators can provide any policy the administrator desires. +
diff --git a/docs/en-US/hypervisor-host-install-libvirt.xml b/docs/en-US/hypervisor-host-install-libvirt.xml index 34e66783600..d7dc47f8dbd 100644 --- a/docs/en-US/hypervisor-host-install-libvirt.xml +++ b/docs/en-US/hypervisor-host-install-libvirt.xml @@ -31,7 +31,7 @@ Set the following paramaters: listen_tls = 0 listen_tcp = 1 - tcp_port = 16059 + tcp_port = "16509" auth_tcp = "none" mdns_adv = 0 @@ -40,11 +40,11 @@ On RHEL or CentOS modify /etc/sysconfig/libvirtd: Uncomment the following line: #LIBVIRTD_ARGS="--listen" - On Ubuntu: modify /etc/init/libvirt-bin.conf - Change the following line (at the end of the file): - exec /usr/sbin/libvirtd -d - to (just add -l) - exec /usr/sbin/libvirtd -d -l + On Ubuntu: modify /etc/default/libvirt-bin + Add "-l" to the following line:: + libvirtd_opts="-d" + so it looks like: + libvirtd_opts="-d -l" Restart libvirt diff --git a/docs/en-US/hypervisor-host-install-network-openvswitch.xml b/docs/en-US/hypervisor-host-install-network-openvswitch.xml new file mode 100644 index 00000000000..e9bf47a0d20 --- /dev/null +++ b/docs/en-US/hypervisor-host-install-network-openvswitch.xml @@ -0,0 +1,116 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Configure the network using OpenVswitch + This is a very important section, please make sure you read this thoroughly. + In order to forward traffic to your instances you will need at least two bridges: public and private. + By default these bridges are called cloudbr0 and cloudbr1, but you do have to make sure they are available on each hypervisor. + The most important factor is that you keep the configuration consistent on all your hypervisors. +
+ Preparing + To make sure that the native bridge module will not interfere with openvswitch the bridge module should be added to the blacklist. See the modprobe documentation for your distribution on where to find the blacklist. Make sure the module is not loaded either by rebooting or executing rmmod bridge before executing next steps. + The network configurations below depend on the ifup-ovs and ifdown-ovs scripts which are part of the openvswitch installation. They should be installed in /etc/sysconfig/network-scripts/ +
+
+ Network example + There are many ways to configure your network. In the Basic networking mode you should have two (V)LAN's, one for your private network and one for the public network. + We assume that the hypervisor has one NIC (eth0) with three tagged VLAN's: + + VLAN 100 for management of the hypervisor + VLAN 200 for public network of the instances (cloudbr0) + VLAN 300 for private network of the instances (cloudbr1) + + On VLAN 100 we give the Hypervisor the IP-Address 192.168.42.11/24 with the gateway 192.168.42.1 + The Hypervisor and Management server don't have to be in the same subnet! +
+
+ Configuring the network bridges + It depends on the distribution you are using how to configure these, below you'll find + examples for RHEL/CentOS. + The goal is to have three bridges called 'mgmt0', 'cloudbr0' and 'cloudbr1' after this + section. This should be used as a guideline only. The exact configuration will + depend on your network layout. +
+ Configure OpenVswitch + The network interfaces using OpenVswitch are created using the ovs-vsctl command. This command will configure the interfaces and persist them to the OpenVswitch database. + First we create a main bridge connected to the eth0 interface. Next we create three fake bridges, each connected to a specific vlan tag. + +
+
+ Configure in RHEL or CentOS + The required packages were installed when openvswitch and libvirt were installed, + we can proceed to configuring the network. + First we configure eth0 + vi /etc/sysconfig/network-scripts/ifcfg-eth0 + Make sure it looks similair to: + + We have to configure the base bridge with the trunk. + vi /etc/sysconfig/network-scripts/ifcfg-cloudbr + + We now have to configure the three VLAN bridges: + vi /etc/sysconfig/network-scripts/ifcfg-mgmt0 + + vi /etc/sysconfig/network-scripts/ifcfg-cloudbr0 + + vi /etc/sysconfig/network-scripts/ifcfg-cloudbr1 + + With this configuration you should be able to restart the network, although a reboot is recommended to see if everything works properly. + Make sure you have an alternative way like IPMI or ILO to reach the machine in case you made a configuration error and the network stops functioning! +
+
+
diff --git a/docs/en-US/hypervisor-host-install-network.xml b/docs/en-US/hypervisor-host-install-network.xml index 8f6a10cdd69..3a6dfac48bd 100644 --- a/docs/en-US/hypervisor-host-install-network.xml +++ b/docs/en-US/hypervisor-host-install-network.xml @@ -25,6 +25,7 @@
Configure the network bridges This is a very important section, please make sure you read this thoroughly. + This section details how to configure bridges using the native implementation in Linux. Please refer to the next section if you intend to use OpenVswitch In order to forward traffic to your instances you will need at least two bridges: public and private. By default these bridges are called cloudbr0 and cloudbr1, but you do have to make sure they are available on each hypervisor. The most important factor is that you keep the configuration consistent on all your hypervisors. @@ -146,4 +147,4 @@ iface cloudbr1 inet manual Make sure you have an alternative way like IPMI or ILO to reach the machine in case you made a configuration error and the network stops functioning!
- \ No newline at end of file + diff --git a/docs/en-US/hypervisor-kvm-install-flow.xml b/docs/en-US/hypervisor-kvm-install-flow.xml index 76e03ef7919..6cc73e4fdfa 100644 --- a/docs/en-US/hypervisor-kvm-install-flow.xml +++ b/docs/en-US/hypervisor-kvm-install-flow.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> @@ -31,6 +31,7 @@ + diff --git a/docs/en-US/hypervisor-kvm-requirements.xml b/docs/en-US/hypervisor-kvm-requirements.xml index c42db86a2b8..cdfc808e490 100644 --- a/docs/en-US/hypervisor-kvm-requirements.xml +++ b/docs/en-US/hypervisor-kvm-requirements.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> @@ -35,6 +35,11 @@ libvirt: 0.9.4 or higher Qemu/KVM: 1.0 or higher + The default bridge in &PRODUCT; is the Linux native bridge implementation (bridge module). &PRODUCT; includes an option to work with OpenVswitch, the requirements are listed below + + libvirt: 0.9.11 or higher + openvswitch: 1.7.1 or higher + In addition, the following hardware requirements apply: Within a single cluster, the hosts must be of the same distribution version. diff --git a/docs/en-US/hypervisor-support-for-primarystorage.xml b/docs/en-US/hypervisor-support-for-primarystorage.xml index 055c1826169..7c2596eac29 100644 --- a/docs/en-US/hypervisor-support-for-primarystorage.xml +++ b/docs/en-US/hypervisor-support-for-primarystorage.xml @@ -5,91 +5,88 @@ ]> -
- Hypervisor Support for Primary Storage - The following table shows storage options and parameters for different hypervisors. - - - - - - - - - - - - - VMware vSphere - Citrix XenServer - KVM - - - - - Format for Disks, Templates, and - Snapshots - VMDK - VHD - QCOW2 - - - iSCSI support - VMFS - Clustered LVM - Yes, via Shared Mountpoint - - - Fiber Channel support - VMFS - Yes, via Existing SR - Yes, via Shared Mountpoint - - - NFS support - Y - Y - Y - - - - Local storage support - Y - Y - Y - - - - Storage over-provisioning - NFS and iSCSI - NFS - NFS - - - - - - XenServer uses a clustered LVM system to store VM images on iSCSI and Fiber Channel volumes and does not support over-provisioning in the hypervisor. The storage server itself, however, can support thin-provisioning. As a result the &PRODUCT; can still support storage over-provisioning by running on thin-provisioned storage volumes. - KVM supports "Shared Mountpoint" storage. A shared mountpoint is a file system path local to each server in a given cluster. The path must be the same across all Hosts in the cluster, for example /mnt/primary1. This shared mountpoint is assumed to be a clustered filesystem such as OCFS2. In this case the &PRODUCT; does not attempt to mount or unmount the storage as is done with NFS. The &PRODUCT; requires that the administrator insure that the storage is available + Hypervisor Support for Primary Storage + The following table shows storage options and parameters for different hypervisors. + + + + + + + + + + + VMware vSphere + Citrix XenServer + KVM + + + + + Format for Disks, Templates, and + Snapshots + VMDK + VHD + QCOW2 + + + iSCSI support + VMFS + Clustered LVM + Yes, via Shared Mountpoint + + + Fiber Channel support + VMFS + Yes, via Existing SR + Yes, via Shared Mountpoint + + + NFS support + Y + Y + Y + + + + Local storage support + Y + Y + Y + + + + Storage over-provisioning + NFS and iSCSI + NFS + NFS + + + + + + XenServer uses a clustered LVM system to store VM images on iSCSI and Fiber Channel volumes and does not support over-provisioning in the hypervisor. The storage server itself, however, can support thin-provisioning. As a result the &PRODUCT; can still support storage over-provisioning by running on thin-provisioned storage volumes. + KVM supports "Shared Mountpoint" storage. A shared mountpoint is a file system path local to each server in a given cluster. The path must be the same across all Hosts in the cluster, for example /mnt/primary1. This shared mountpoint is assumed to be a clustered filesystem such as OCFS2. In this case the &PRODUCT; does not attempt to mount or unmount the storage as is done with NFS. The &PRODUCT; requires that the administrator insure that the storage is available - With NFS storage, &PRODUCT; manages the overprovisioning. In this case the global configuration parameter storage.overprovisioning.factor controls the degree of overprovisioning. This is independent of hypervisor type. + With NFS storage, &PRODUCT; manages the overprovisioning. In this case the global configuration parameter storage.overprovisioning.factor controls the degree of overprovisioning. This is independent of hypervisor type. Local storage is an option for primary storage for vSphere, XenServer, and KVM. When the local disk option is enabled, a local disk storage pool is automatically created on each host. To use local storage for the System Virtual Machines (such as the Virtual Router), set system.vm.use.local.storage to true in global configuration. - &PRODUCT; supports multiple primary storage pools in a Cluster. For example, you could provision 2 NFS servers in primary storage. Or you could provision 1 iSCSI LUN initially and then add a second iSCSI LUN when the first approaches capacity. -
+ &PRODUCT; supports multiple primary storage pools in a Cluster. For example, you could provision 2 NFS servers in primary storage. Or you could provision 1 iSCSI LUN initially and then add a second iSCSI LUN when the first approaches capacity. + diff --git a/docs/en-US/images/cluster-overview.png b/docs/en-US/images/cluster-overview.png index 33f1a0477ef..18a86c39afe 100644 Binary files a/docs/en-US/images/cluster-overview.png and b/docs/en-US/images/cluster-overview.png differ diff --git a/docs/en-US/images/egress-firewall-rule.png b/docs/en-US/images/egress-firewall-rule.png new file mode 100644 index 00000000000..fa1d8ecd0bd Binary files /dev/null and b/docs/en-US/images/egress-firewall-rule.png differ diff --git a/docs/en-US/images/resize-volume-icon.png b/docs/en-US/images/resize-volume-icon.png new file mode 100644 index 00000000000..48499021f06 Binary files /dev/null and b/docs/en-US/images/resize-volume-icon.png differ diff --git a/docs/en-US/images/resize-volume.png b/docs/en-US/images/resize-volume.png new file mode 100644 index 00000000000..6195623ab49 Binary files /dev/null and b/docs/en-US/images/resize-volume.png differ diff --git a/docs/en-US/import-ami.xml b/docs/en-US/import-ami.xml index 2f093b178c8..16fe78a1579 100644 --- a/docs/en-US/import-ami.xml +++ b/docs/en-US/import-ami.xml @@ -5,49 +5,51 @@ ]> -
- Importing Amazon Machine Images - The following procedures describe how to import an Amazon Machine Image (AMI) into &PRODUCT; when using the XenServer hypervisor. - Assume you have an AMI file and this file is called CentOS_6.2_x64. Assume further that you are working on a CentOS host. If the AMI is a Fedora image, you need to be working on a Fedora host initially. - You need to have a XenServer host with a file-based storage repository (either a local ext3 SR or an NFS SR) to convert to a VHD once the image file has been customized on the Centos/Fedora host. - When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text. - - Set up loopback on image file:# mkdir -p /mnt/loop/centos62 + Importing Amazon Machine Images + The following procedures describe how to import an Amazon Machine Image (AMI) into &PRODUCT; when using the XenServer hypervisor. + Assume you have an AMI file and this file is called CentOS_6.2_x64. Assume further that you are working on a CentOS host. If the AMI is a Fedora image, you need to be working on a Fedora host initially. + You need to have a XenServer host with a file-based storage repository (either a local ext3 SR or an NFS SR) to convert to a VHD once the image file has been customized on the Centos/Fedora host. + When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text. + + + To import an AMI: + + Set up loopback on image file:# mkdir -p /mnt/loop/centos62 # mount -o loop CentOS_6.2_x64 /mnt/loop/centos54 - Install the kernel-xen package into the image. This downloads the PV kernel and ramdisk to the image.# yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen - Create a grub entry in /boot/grub/grub.conf.# mkdir -p /mnt/loop/centos62/boot/grub + Install the kernel-xen package into the image. This downloads the PV kernel and ramdisk to the image.# yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen + Create a grub entry in /boot/grub/grub.conf.# mkdir -p /mnt/loop/centos62/boot/grub # touch /mnt/loop/centos62/boot/grub/grub.conf -# echo "" > /mnt/loop/centos62/boot/grub/grub.conf +# echo "" > /mnt/loop/centos62/boot/grub/grub.conf - Determine the name of the PV kernel that has been installed into the image. - # cd /mnt/loop/centos62 + Determine the name of the PV kernel that has been installed into the image. + # cd /mnt/loop/centos62 # ls lib/modules/ 2.6.16.33-xenU 2.6.16-xenU 2.6.18-164.15.1.el5xen 2.6.18-164.6.1.el5.centos.plus 2.6.18-xenU-ec2-v1.0 2.6.21.7-2.fc8xen 2.6.31-302-ec2 # ls boot/initrd* boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img # ls boot/vmlinuz* boot/vmlinuz-2.6.18-164.15.1.el5xen boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus boot/vmlinuz-2.6.18-xenU-ec2-v1.0 boot/vmlinuz-2.6.21-2952.fc8xen - - Xen kernels/ramdisk always end with "xen". For the kernel version you choose, there has to be an entry for that version under lib/modules, there has to be an initrd and vmlinuz corresponding to that. Above, the only kernel that satisfies this condition is 2.6.18-164.15.1.el5xen. - Based on your findings, create an entry in the grub.conf file. Below is an example entry.default=0 + + Xen kernels/ramdisk always end with "xen". For the kernel version you choose, there has to be an entry for that version under lib/modules, there has to be an initrd and vmlinuz corresponding to that. Above, the only kernel that satisfies this condition is 2.6.18-164.15.1.el5xen. + Based on your findings, create an entry in the grub.conf file. Below is an example entry.default=0 timeout=5 hiddenmenu title CentOS (2.6.18-164.15.1.el5xen) @@ -55,58 +57,58 @@ title CentOS (2.6.18-164.15.1.el5xen) kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda initrd /boot/initrd-2.6.18-164.15.1.el5xen.img - Edit etc/fstab, changing “sda1†to “xvda†and changing “sdb†to “xvdbâ€. - # cat etc/fstab + Edit etc/fstab, changing “sda1†to “xvda†and changing “sdb†to “xvdbâ€. + # cat etc/fstab /dev/xvda / ext3 defaults 1 1 /dev/xvdb /mnt ext3 defaults 0 0 none /dev/pts devpts gid=5,mode=620 0 0 none /proc proc defaults 0 0 none /sys sysfs defaults 0 0 - Enable login via the console. The default console device in a XenServer system is xvc0. Ensure that etc/inittab and etc/securetty have the following lines respectively: - # grep xvc0 etc/inittab + Enable login via the console. The default console device in a XenServer system is xvc0. Ensure that etc/inittab and etc/securetty have the following lines respectively: + # grep xvc0 etc/inittab co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav # grep xvc0 etc/securetty xvc0 - Ensure the ramdisk supports PV disk and PV network. Customize this for the kernel version you have determined above. - # chroot /mnt/loop/centos54 + Ensure the ramdisk supports PV disk and PV network. Customize this for the kernel version you have determined above. + # chroot /mnt/loop/centos54 # cd /boot/ # mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak # mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --omit-scsi-modules 2.6.18-164.15.1.el5xen - Change the password. - # passwd + Change the password. + # passwd Changing password for user root. New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully. - Exit out of chroot.# exit - Check etc/ssh/sshd_config for lines allowing ssh login using a password. - # egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config + Exit out of chroot.# exit + Check etc/ssh/sshd_config for lines allowing ssh login using a password. + # egrep "PermitRootLogin|PasswordAuthentication" /mnt/loop/centos54/etc/ssh/sshd_config PermitRootLogin yes PasswordAuthentication yes - If you need the template to be enabled to reset passwords from the &PRODUCT; UI or API, + If you need the template to be enabled to reset passwords from the &PRODUCT; UI or API, install the password change script into the image at this point. See - . - Unmount and delete loopback mount.# umount /mnt/loop/centos54 + . + Unmount and delete loopback mount.# umount /mnt/loop/centos54 # losetup -d /dev/loop0 - Copy the image file to your XenServer host's file-based storage repository. In the example below, the Xenserver is "xenhost". This XenServer has an NFS repository whose uuid is a9c5b8c8-536b-a193-a6dc-51af3e5ff799. - # scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/ - Log in to the Xenserver and create a VDI the same size as the image. - [root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799 + Copy the image file to your XenServer host's file-based storage repository. In the example below, the Xenserver is "xenhost". This XenServer has an NFS repository whose uuid is a9c5b8c8-536b-a193-a6dc-51af3e5ff799. + # scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/ + Log in to the Xenserver and create a VDI the same size as the image. + [root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799 [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# ls -lh CentOS_6.2_x64 -rw-r--r-- 1 root root 10G Mar 16 16:49 CentOS_6.2_x64 [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-create virtual-size=10GiB sr-uuid=a9c5b8c8-536b-a193-a6dc-51af3e5ff799 type=user name-label="Centos 6.2 x86_64" cad7317c-258b-4ef7-b207-cdf0283a7923 - Import the image file into the VDI. This may take 10–20 minutes.[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923 - Locate a the VHD file. This is the file with the VDI’s UUID as its name. Compress it and upload it to your web server. - [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2 + Import the image file into the VDI. This may take 10–20 minutes.[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923 + Locate a the VHD file. This is the file with the VDI’s UUID as its name. Compress it and upload it to your web server. + [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2 [root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# scp CentOS_6.2_x64.vhd.bz2 webserver:/var/www/html/templates/ - +
diff --git a/docs/en-US/initialize-and-test.xml b/docs/en-US/initialize-and-test.xml index cf0c04ecea6..2dd6e259176 100644 --- a/docs/en-US/initialize-and-test.xml +++ b/docs/en-US/initialize-and-test.xml @@ -1,53 +1,77 @@ - %BOOK_ENTITIES; ]> -
- Initialize and Test + Initialize and Test After everything is configured, &PRODUCT; will perform its initialization. This can take 30 minutes or more, depending on the speed of your network. When the initialization has completed successfully, the administrator's Dashboard should be displayed in the &PRODUCT; UI. + - Verify that the system is ready. In the left navigation bar, select Templates. Click on the CentOS 5.5 (64bit) no Gui (KVM) template. Check to be sure that the status is "Download Complete." Do not proceed to the next step until this status is displayed. - Go to the Instances tab, and filter by My Instances. - Click Add Instance and follow the steps in the wizard. - - Choose the zone you just added. - In the template selection, choose the template to use in the VM. If this is a fresh installation, likely only the provided CentOS template is available. - Select a service offering. Be sure that the hardware you have allows starting the selected service offering. - In data disk offering, if desired, add another data disk. This is a second volume that will be available to but not mounted in the guest. For example, in Linux on XenServer you will see /dev/xvdb in the guest after rebooting the VM. A reboot is not required if you have a PV-enabled OS kernel in use. - In default network, choose the primary network for the guest. In a trial installation, you would have only one option here. - Optionally give your VM a name and a group. Use any descriptive text you would like. - Click Launch VM. Your VM will be created and started. It might take some time to download the template and complete the VM startup. You can watch the VM’s progress in the Instances screen. - - - - To use the VM, click the View Console button. - - - ConsoleButton.png: button to launch a console - - - + + Verify that the system is ready. In the left navigation bar, select Templates. Click on the CentOS 5.5 (64bit) no Gui (KVM) template. Check to be sure that the status is "Download Complete." Do not proceed to the next step until this status is displayed. + + Go to the Instances tab, and filter by My Instances. + + Click Add Instance and follow the steps in the wizard. + + + + Choose the zone you just added. + + In the template selection, choose the template to use in the VM. If this is a fresh installation, likely only the provided CentOS template is available. + + Select a service offering. Be sure that the hardware you have allows starting the selected service offering. + + In data disk offering, if desired, add another data disk. This is a second volume that will be available to but not mounted in the guest. For example, in Linux on XenServer you will see /dev/xvdb in the guest after rebooting the VM. A reboot is not required if you have a PV-enabled OS kernel in use. + + In default network, choose the primary network for the guest. In a trial installation, you would have only one option here. + Optionally give your VM a name and a group. Use any descriptive text you would like. + + Click Launch VM. Your VM will be created and started. It might take some time to download the template and complete the VM startup. You can watch the VM’s progress in the Instances screen. + + + + + + + + To use the VM, click the View Console button. + + + + + + ConsoleButton.png: button to launch a console + + + + + + For more information about using VMs, including instructions for how to allow incoming network traffic to the VM, start, stop, and delete VMs, and move a VM from one host to another, see Working With Virtual Machines in the Administrator’s Guide. + + + Congratulations! You have successfully completed a &PRODUCT; Installation. + If you decide to grow your deployment, you can add more hosts, primary storage, zones, pods, and clusters.
diff --git a/docs/en-US/installing-publican.xml b/docs/en-US/installing-publican.xml new file mode 100644 index 00000000000..9f180aad375 --- /dev/null +++ b/docs/en-US/installing-publican.xml @@ -0,0 +1,46 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Installing Publican + &PRODUCT; documentation is built using publican. This section describes how to install publican on your own machine so that you can build the documentation guides. + + The &PRODUCT; documentation source code is located under /docs + Publican documentation itself is also very useful. + + On RHEL and RHEL derivatives, install publican with the following command: + yum install publican publican-doc + On Ubuntu, install publican with the following command: + apt-get install publican publican-doc + For other distribution refer to the publican documentation listed above. For latest versions of OSX you may have to install from source and tweak it to your own setup. + Once publican is installed, you need to setup the so-called &PRODUCT; brand defined in the docs/publican-&PRODUCT; directory. + To do so, enter the following commands: + + sudo cp -R publican-cloudstack /usr/share/publican/Common_Content/cloudstack + + If this fails or you later face errors related to the brand files, see the publican documentation. + With publican installed and the &PRODUCT; brand files in place, you should be able to build any documentation guide. + + +
diff --git a/docs/en-US/ip-forwarding-firewalling.xml b/docs/en-US/ip-forwarding-firewalling.xml index 61aa6ad7e71..54e18b7cfbc 100644 --- a/docs/en-US/ip-forwarding-firewalling.xml +++ b/docs/en-US/ip-forwarding-firewalling.xml @@ -3,28 +3,30 @@ %BOOK_ENTITIES; ]> - -
- IP Forwarding and Firewalling - By default, all incoming traffic to the public IP address is rejected. All outgoing traffic from the guests is translated via NAT to the public IP address and is allowed. - To allow incoming traffic, users may set up firewall rules and/or port forwarding rules. For example, you can use a firewall rule to open a range of ports on the public IP address, such as 33 through 44. Then use port forwarding rules to direct traffic from individual ports within that range to specific ports on user VMs. For example, one port forwarding rule could route incoming traffic on the public IP's port 33 to port 100 on one user VM's private IP. - For the steps to implement these rules, see Firewall Rules and Port Forwarding. + IP Forwarding and Firewalling + By default, all incoming traffic to the public IP address is rejected. All outgoing traffic + from the guests is translated via NAT to the public IP address and is allowed. + To allow incoming traffic, users may set up firewall rules and/or port forwarding rules. For + example, you can use a firewall rule to open a range of ports on the public IP address, such as + 33 through 44. Then use port forwarding rules to direct traffic from individual ports within + that range to specific ports on user VMs. For example, one port forwarding rule could route + incoming traffic on the public IP's port 33 to port 100 on one user VM's private IP. + +
diff --git a/docs/en-US/isolated-networks.xml b/docs/en-US/isolated-networks.xml index 13f8aa1d4ca..671591d161c 100644 --- a/docs/en-US/isolated-networks.xml +++ b/docs/en-US/isolated-networks.xml @@ -5,23 +5,22 @@ ]> -
Isolated Networks An isolated network can be accessed only by virtual machines of a single account. Isolated networks have the following properties. @@ -30,4 +29,6 @@ There is one network offering for the entire network The network offering can be upgraded or downgraded but it is for the entire network + +
diff --git a/docs/en-US/linux-installation.xml b/docs/en-US/linux-installation.xml index 60d389c0ef4..b560ee0d5bd 100644 --- a/docs/en-US/linux-installation.xml +++ b/docs/en-US/linux-installation.xml @@ -5,43 +5,49 @@ ]> -
- Linux OS Installation - Use the following steps to begin the Linux OS installation: - - Download the script file cloud-set-guest-password: - - Linux: - Windows: - - - Copy this file to /etc/init.d. - On some Linux distributions, copy the file to /etc/rc.d/init.d. - - Run the following command to make the script executable:chmod +x /etc/init.d/cloud-set-guest-password - - Depending on the Linux distribution, continue with the appropriate step.On Fedora, CentOS/RHEL, and Debian, run:chkconfig --add cloud-set-guest-password - On Ubuntu with VMware tools, link the script file to the /etc/network/if-up and /etc/network/if-down folders, and run the script: - #ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-up/cloud-set-guest-password - #ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-down/cloud-set-guest-password - If you are using Ubuntu 11.04, start by creating a directory called /var/lib/dhcp3 on your Ubuntu machine (works around a known issue with this version of Ubuntu). On all Ubuntu versions: Run “sudo update-rc.d cloud-set-guest-password defaults 98â€. To test, run "mkpasswd" and check that it is generating a new password. If the “mkpasswd†command does not exist, run "sudo apt-get install whois" (or sudo apt-get install mkpasswd, depending on your Ubuntu version) and repeat. - - -
+ Linux OS Installation + Use the following steps to begin the Linux OS installation: + + Download the script file cloud-set-guest-password: + + Linux: + + Windows: + + + + Copy this file to /etc/init.d.On some Linux distributions, copy the file to /etc/rc.d/init.d. + + Run the following command to make the script executable:chmod +x /etc/init.d/cloud-set-guest-password + + Depending on the Linux distribution, continue with the appropriate step.On Fedora, CentOS/RHEL, and Debian, run:chkconfig --add cloud-set-guest-password + On Ubuntu with VMware tools, link the script file to the /etc/network/if-up and + /etc/network/if-down folders, and run the script: + #ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-up/cloud-set-guest-password +#ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-down/cloud-set-guest-password + If you are using Ubuntu 11.04, start by creating a directory called /var/lib/dhcp3 on your Ubuntu machine (works around a known issue with this version of Ubuntu). On all Ubuntu versions: Run “sudo update-rc.d cloud-set-guest-password defaults 98â€. To test, run "mkpasswd" and check that it is generating a new password. If the “mkpasswd†command does not exist, run "sudo apt-get install whois" (or sudo apt-get install mkpasswd, depending on your Ubuntu version) and repeat. + + + + diff --git a/docs/en-US/load-balancer-rules.xml b/docs/en-US/load-balancer-rules.xml index 8dd7d3b47ba..77739001966 100644 --- a/docs/en-US/load-balancer-rules.xml +++ b/docs/en-US/load-balancer-rules.xml @@ -5,25 +5,36 @@ ]> -
- Load Balancer Rules - A &PRODUCT; user or administrator may create load balancing rules that balance traffic received at a public IP to one or more VMs. A user creates a rule, specifies an algorithm, and assigns the rule to a set of VMs. - If you create load balancing rules while using a network service offering that includes an external load balancer device such as NetScaler, and later change the network service offering to one that uses the &PRODUCT; virtual router, you must create a firewall rule on the virtual router for each of your existing load balancing rules so that they continue to function. + Load Balancer Rules + A &PRODUCT; user or administrator may create load balancing rules that balance traffic + received at a public IP to one or more VMs. A user creates a rule, specifies an algorithm, and + assigns the rule to a set of VMs. + + If you create load balancing rules while using a network service offering that includes an + external load balancer device such as NetScaler, and later change the network service offering + to one that uses the &PRODUCT; virtual router, you must create a firewall rule on the virtual + router for each of your existing load balancing rules so that they continue to + function. + + + +
diff --git a/docs/en-US/log-in-root-admin.xml b/docs/en-US/log-in-root-admin.xml index b8535970ee6..0243bd645fe 100644 --- a/docs/en-US/log-in-root-admin.xml +++ b/docs/en-US/log-in-root-admin.xml @@ -5,23 +5,22 @@ ]> -
Logging In as the Root Administrator After the Management Server software is installed and running, you can run the &PRODUCT; user interface. This UI is there to help you provision, view, and manage your cloud infrastructure. @@ -43,4 +42,5 @@ You should set a new root administrator password. If you chose basic setup, you’ll be prompted to create a new password right away. If you chose experienced user, use the steps in . You are logging in as the root administrator. This account manages the &PRODUCT; deployment, including physical infrastructure. The root administrator can modify configuration settings to change basic functionality, create or delete user accounts, and take many actions that should be performed only by an authorized person. Please change the default password to a new, unique password. +
diff --git a/docs/en-US/maintain-hypervisors-on-hosts.xml b/docs/en-US/maintain-hypervisors-on-hosts.xml index 213f078ea2b..43f3f790733 100644 --- a/docs/en-US/maintain-hypervisors-on-hosts.xml +++ b/docs/en-US/maintain-hypervisors-on-hosts.xml @@ -5,26 +5,25 @@ ]> -
Maintaining Hypervisors on Hosts When running hypervisor software on hosts, be sure all the hotfixes provided by the hypervisor vendor are applied. Track the release of hypervisor patches through your hypervisor vendor’s support channel, and apply patches as soon as possible after they are released. &PRODUCT; will not track or notify you of required hypervisor patches. It is essential that your hosts are completely up to date with the provided hypervisor patches. The hypervisor vendor is likely to refuse to support any system that is not up to date with patches. The lack of up-do-date hotfixes can lead to data corruption and lost VMs. - (XenServer) For more information, see Highly Recommended Hotfixes for XenServer in the &PRODUCT; Knowledge Base + (XenServer) For more information, see Highly Recommended Hotfixes for XenServer in the &PRODUCT; Knowledge Base.
diff --git a/docs/en-US/manage-cloud.xml b/docs/en-US/manage-cloud.xml index f5df2c62325..d35667382e5 100644 --- a/docs/en-US/manage-cloud.xml +++ b/docs/en-US/manage-cloud.xml @@ -5,21 +5,21 @@ ]> @@ -27,7 +27,7 @@ - - - + + + diff --git a/docs/en-US/management-server-install-client.xml b/docs/en-US/management-server-install-client.xml index 7e81ec735fc..b5329e3442a 100644 --- a/docs/en-US/management-server-install-client.xml +++ b/docs/en-US/management-server-install-client.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> @@ -11,9 +11,7 @@ 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 @@ -31,16 +29,6 @@ The &PRODUCT; Management server can be installed using either RPM or DEB packages. These packages will depend on everything you need to run the Management server. -
- Downloading vhd-util - This procedure is required only for installations where XenServer is installed on the hypervisor hosts. - Before setting up the Management Server, download vhd-util from vhd-util. - If the Management Server is RHEL or CentOS, copy vhd-util to - /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver. - If the Management Server is Ubuntu, copy vhd-util to - /usr/lib/cloud/common/scripts/vm/hypervisor/xenserver/vhd-util. -
Install on CentOS/RHEL We start by installing the required packages: @@ -50,4 +38,16 @@ Install on Ubuntu apt-get install cloud-client
- \ No newline at end of file + +
+ Downloading vhd-util + This procedure is required only for installations where XenServer is installed on the + hypervisor hosts. + Before setting up the Management Server, download vhd-util from vhd-util. + If the Management Server is RHEL or CentOS, copy vhd-util to + /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver. + If the Management Server is Ubuntu, copy vhd-util to + /usr/lib/cloud/common/scripts/vm/hypervisor/xenserver. +
+ diff --git a/docs/en-US/management-server-install-db-external.xml b/docs/en-US/management-server-install-db-external.xml index 3bba45f3ee1..a28dee56934 100644 --- a/docs/en-US/management-server-install-db-external.xml +++ b/docs/en-US/management-server-install-db-external.xml @@ -127,12 +127,17 @@ bind-address = 0.0.0.0 recommended that you replace this with a more secure value. See . + + (Optional) For management_server_ip, you may explicitly specify cluster management + server node IP. If not specified, the local IP address will be used. +
cloud-setup-databases cloud:<dbpassword>@<ip address mysql server> \ --deploy-as=root:<password> \ -e <encryption_type> \ -m <management_server_key> \ --k <database_key> +-k <database_key> \ +-i <management_server_ip> When this script is finished, you should see a message like “Successfully initialized the database.†diff --git a/docs/en-US/management-server-install-db-local.xml b/docs/en-US/management-server-install-db-local.xml index 3e09c554df0..918cdc0a265 100644 --- a/docs/en-US/management-server-install-db-local.xml +++ b/docs/en-US/management-server-install-db-local.xml @@ -11,9 +11,7 @@ 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 @@ -29,19 +27,23 @@ MySQL. See . - Install MySQL from the package repository from your distribution: + Install MySQL from the package repository of your distribution: On RHEL or CentOS: yum install mysql-server On Ubuntu: apt-get install mysql-server - Edit the MySQL configuration (/etc/my.cnf or /etc/mysql/my.cnf, depending on your OS) - and insert the following lines in the [mysqld] section. You can put these lines below the - datadir line. The max_connections parameter should be set to 350 multiplied by the number of - Management Servers you are deploying. This example assumes one Management Server. + Open the MySQL configuration file. The configuration file is /etc/my.cnf or + /etc/mysql/my.cnf, depending on your OS. + + + Insert the following lines in the [mysqld] section. + You can put these lines below the datadir line. The max_connections parameter should be + set to 350 multiplied by the number of Management Servers you are deploying. This example + assumes one Management Server. - On Ubuntu, you can also create a file /etc/mysql/conf.d/cloudstack.cnf and add these + On Ubuntu, you can also create a file /etc/mysql/conf.d/cloudstack.cnf and add these directives there. Don't forget to add [mysqld] on the first line of the file. innodb_rollback_on_timeout=1 @@ -68,6 +70,36 @@ binlog-format = 'ROW' questions. mysql_secure_installation + + &PRODUCT; can be blocked by security mechanisms, such as SELinux. Disable SELinux to + ensure + that the Agent has all the required permissions. + Configure SELinux (RHEL and CentOS): + + + Check whether SELinux is installed on your machine. If not, you can skip this + section. + In RHEL or CentOS, SELinux is installed and enabled by default. You can verify this + with: + $ rpm -qa | grep selinux + + + Set the SELINUX variable in /etc/selinux/config to + "permissive". This ensures that the permissive setting will be maintained after a system + reboot. + In RHEL or CentOS: + vi /etc/selinux/config + Change the following line + SELINUX=enforcing + to this: + SELINUX=permissive + + + Set SELinux to permissive starting immediately, without requiring a system + reboot. + $ setenforce permissive + + + Set up the database. The following command creates the "cloud" user on the database. @@ -98,12 +130,17 @@ binlog-format = 'ROW' recommended that you replace this with a more secure value. See . + + (Optional) For management_server_ip, you may explicitly specify cluster management + server node IP. If not specified, the local IP address will be used. + cloud-setup-databases cloud:<dbpassword>@localhost \ --deploy-as=root:<password> \ -e <encryption_type> \ -m <management_server_key> \ --k <database_key> +-k <database_key> \ +-i <management_server_ip> When this script is finished, you should see a message like “Successfully initialized the database.†@@ -111,14 +148,11 @@ binlog-format = 'ROW' If you are running the KVM hypervisor on the same machine with the Management Server, edit /etc/sudoers and add the following line: Defaults:cloud !requiretty - - This type of single-machine setup is recommended only for a trial installation. - Now that the database is set up, you can finish configuring the OS for the Management Server. This command will set up iptables, sudoers, and start the Management Server. - # cloud-setup-management + # cloud-setup-management You should see the message “&PRODUCT; Management Server setup is done.†diff --git a/docs/en-US/management-server-install-multi-node.xml b/docs/en-US/management-server-install-multi-node.xml index e61f6230ff0..3f011b83b87 100644 --- a/docs/en-US/management-server-install-multi-node.xml +++ b/docs/en-US/management-server-install-multi-node.xml @@ -53,7 +53,7 @@ linkend="sect-source-buildrpm"/> or as Configure the database client. Note the absence of the --deploy-as argument in this case. (For more details about the arguments to this command, see .) - # cloud-setup-databases cloud:dbpassword@dbhost -e encryption_type -m management_server_key -k database_key + # cloud-setup-databases cloud:dbpassword@dbhost -e encryption_type -m management_server_key -k database_key -i management_server_ip @@ -69,4 +69,4 @@ linkend="sect-source-buildrpm"/> or as Load Balancing. - \ No newline at end of file + diff --git a/docs/en-US/management-server-install-nfs-shares.xml b/docs/en-US/management-server-install-nfs-shares.xml index e917a8e0b6c..a12e09c3eca 100644 --- a/docs/en-US/management-server-install-nfs-shares.xml +++ b/docs/en-US/management-server-install-nfs-shares.xml @@ -26,7 +26,7 @@ Prepare NFS Shares &PRODUCT; needs a place to keep primary and secondary storage (see Cloud Infrastructure Overview). Both of these can be NFS shares. This section tells how to set up the NFS shares before adding the storage to &PRODUCT;. Alternative Storage - NFS is not the only option for primary or secondary storage. For example, you may use a Ceph RDB cluster, GlusterFS, iSCSI, and otthers. + NFS is not the only option for primary or secondary storage. For example, you may use Ceph RBD, GlusterFS, iSCSI, and others. The choice of storage system will depend on the choice of hypervisor and whether you are dealing with primary or secondary storage. The requirements for primary and secondary storage are described in: diff --git a/docs/en-US/management-server-install-systemvm.xml b/docs/en-US/management-server-install-systemvm.xml index df2c3738abf..8dc73deb992 100644 --- a/docs/en-US/management-server-install-systemvm.xml +++ b/docs/en-US/management-server-install-systemvm.xml @@ -54,6 +54,8 @@ # /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2 -h kvm -s <optional-management-server-secret-key> -F + On Ubuntu, use the following path instead: + # /usr/lib/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt If you are using a separate NFS server, perform this step. If you are using the diff --git a/docs/en-US/manual-live-migration.xml b/docs/en-US/manual-live-migration.xml index 52de4c403f3..225f0ba3317 100644 --- a/docs/en-US/manual-live-migration.xml +++ b/docs/en-US/manual-live-migration.xml @@ -5,48 +5,47 @@ ]> -
- Moving VMs Between Hosts (Manual Live Migration) - The &PRODUCT; administrator can move a running VM from one host to another without interrupting service to users or going into maintenance mode. This is called manual live migration, and can be done under the following conditions: - - The root administrator is logged in. Domain admins and users can not perform manual live migration of VMs. - The VM is running. Stopped VMs can not be live migrated. - The destination host must be in the same cluster as the original host. - The VM must not be using local disk storage. - The destination host must have enough available capacity. If not, the VM will remain in the "migrating" state until memory becomes available. + Moving VMs Between Hosts (Manual Live Migration) + The &PRODUCT; administrator can move a running VM from one host to another without interrupting service to users or going into maintenance mode. This is called manual live migration, and can be done under the following conditions: + + The root administrator is logged in. Domain admins and users can not perform manual live migration of VMs. + The VM is running. Stopped VMs can not be live migrated. + The destination host must be in the same cluster as the original host. + The VM must not be using local disk storage. + The destination host must have enough available capacity. If not, the VM will remain in the "migrating" state until memory becomes available. - - To manually live migrate a virtual machine - - Log in to the &PRODUCT; UI as a user or admin. - In the left navigation, click Instances. - Choose the VM that you want to migrate. - Click the Migrate Instance button - - - - Migrateinstance.png: button to migrate an instance - - - From the list of hosts, choose the one to which you want to move the VM. - Click OK. - -
+ + To manually live migrate a virtual machine + + Log in to the &PRODUCT; UI as a user or admin. + In the left navigation, click Instances. + Choose the VM that you want to migrate. + Click the Migrate Instance button. + + + + Migrateinstance.png: button to migrate an instance + + + From the list of hosts, choose the one to which you want to move the VM. + Click OK. + + diff --git a/docs/en-US/migrate-vm-rootvolume-volume-new-storage-pool.xml b/docs/en-US/migrate-vm-rootvolume-volume-new-storage-pool.xml index 67fe2f58920..d615cfe7a5b 100644 --- a/docs/en-US/migrate-vm-rootvolume-volume-new-storage-pool.xml +++ b/docs/en-US/migrate-vm-rootvolume-volume-new-storage-pool.xml @@ -5,33 +5,33 @@ ]> -
- Migrating a VM Root Volume to a New Storage Pool - When migrating the root disk volume, the VM must first be stopped, and users can not access the VM. After migration is complete, the VM can be restarted. - - Log in to the &PRODUCT; UI as a user or admin. - Detach the data disk from the VM. See Detaching and Moving Volumes (but skip the “reattach†step at the end. You will do that after migrating to new storage). - Stop the VM. - Call the &PRODUCT; API command migrateVirtualMachine with the ID of the VM to migrate and the IDs of a destination host and destination storage pool in the same zone. - Watch for the VM status to change to Migrating, then back to Stopped. - Restart the VM. - -
+ Migrating a VM Root Volume to a New Storage Pool + When migrating the root disk volume, the VM must first be stopped, and users can not access the VM. After migration is complete, the VM can be restarted. + + Log in to the &PRODUCT; UI as a user or admin. + Detach the data disk from the VM. See Detaching and Moving Volumes (but skip the “reattach†step at the end. You will do that after migrating to new storage). + Stop the VM. + Use the &PRODUCT; API command, migrateVirtualMachine, with the ID of the VM to migrate and + the IDs of a destination host and destination storage pool in the same zone. + Watch for the VM status to change to Migrating, then back to Stopped. + Restart the VM. + + diff --git a/docs/en-US/minimum-system-requirements.xml b/docs/en-US/minimum-system-requirements.xml index dcab0398dc7..0e497dd33f1 100644 --- a/docs/en-US/minimum-system-requirements.xml +++ b/docs/en-US/minimum-system-requirements.xml @@ -1,62 +1,65 @@ - %BOOK_ENTITIES; ]> -
- Minimum System Requirements -
- Management Server, Database, and Storage System Requirements - The machines that will run the Management Server and MySQL database must meet the following requirements. The same machines can also be used to provide primary and secondary storage, such as via localdisk or NFS. The Management Server may be placed on a virtual machine. - - Operating system: - + Minimum System Requirements +
+ Management Server, Database, and Storage System Requirements + + The machines that will run the Management Server and MySQL database must meet the following requirements. + The same machines can also be used to provide primary and secondary storage, such as via localdisk or NFS. + The Management Server may be placed on a virtual machine. + + + Operating system: + Preferred: CentOS/RHEL 6.3+ or Ubuntu 12.04(.1) - - - 64-bit x86 CPU (more cores results in better performance) - 4 GB of memory - 50 GB of local disk (When running secondary storage on the management server 500GB is recommended) - At least 1 NIC - Statically allocated IP address - Fully qualified domain name as returned by the hostname command - -
-
- Host/Hypervisor System Requirements - The host is where the cloud services run in the form of guest virtual machines. Each host is one machine that meets the following requirements: - + + + 64-bit x86 CPU (more cores results in better performance) + 4 GB of memory + 250 GB of local disk (more results in better capability; 500 GB recommended) + At least 1 NIC + Statically allocated IP address + Fully qualified domain name as returned by the hostname command + +
+
+ Host/Hypervisor System Requirements + The host is where the cloud services run in the form of guest virtual machines. Each host is one machine that meets the following requirements: + Must support HVM (Intel-VT or AMD-V enabled). - 64-bit x86 CPU (more cores results in better performance) - Hardware virtualization support required - 4 GB of memory - 36 GB of local disk - At least 1 NIC + 64-bit x86 CPU (more cores results in better performance) + Hardware virtualization support required + 4 GB of memory + 36 GB of local disk + At least 1 NIC If DHCP is used for hosts, ensure that no conflict occurs between DHCP server used for these hosts and the DHCP router created by &PRODUCT;. - Latest hotfixes applied to hypervisor software - When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running + Latest hotfixes applied to hypervisor software + When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running All hosts within a cluster must be homogenous. The CPUs must be of the same type, count, and feature flags. - - Hosts have additional requirements depending on the hypervisor. See the requirements listed at the top of the Installation section for your chosen hypervisor: + + Hosts have additional requirements depending on the hypervisor. See the requirements listed at the top of the Installation section for your chosen hypervisor: Be sure you fulfill the additional hypervisor requirements and installation steps provided in this Guide. Hypervisor hosts must be properly prepared to work with CloudStack. For example, the requirements for XenServer are listed under Citrix XenServer Installation. diff --git a/docs/en-US/network-offerings.xml b/docs/en-US/network-offerings.xml index c1fd79da890..0a7b8e78e3b 100644 --- a/docs/en-US/network-offerings.xml +++ b/docs/en-US/network-offerings.xml @@ -5,23 +5,22 @@ ]> -
Network Offerings For the most up-to-date list of supported network services, see the &PRODUCT; UI or call listNetworkServices. @@ -43,5 +42,5 @@ If you create load balancing rules while using a network service offering that includes an external load balancer device such as NetScaler, and later change the network service offering to one that uses the &PRODUCT; virtual router, you must create a firewall rule on the virtual router for each of your existing load balancing rules so that they continue to function. When creating a new virtual network, the &PRODUCT; administrator chooses which network offering to enable for that network. Each virtual network is associated with one network offering. A virtual network can be upgraded or downgraded by changing its associated network offering. If you do this, be sure to reprogram the physical network to match. &PRODUCT; also has internal network offerings for use by &PRODUCT; system VMs. These network offerings are not visible to users but can be modified by administrators. - +
diff --git a/docs/en-US/network-rate.xml b/docs/en-US/network-rate.xml new file mode 100644 index 00000000000..56fe25c04a5 --- /dev/null +++ b/docs/en-US/network-rate.xml @@ -0,0 +1,144 @@ + + +%BOOK_ENTITIES; +]> + +
+ Network Throttling + Network throttling is the process of controlling the network access and bandwidth usage + based on certain rules. &PRODUCT; controls this behaviour of the guest networks in the cloud by + using the network rate parameter. This parameter is defined as the default data transfer rate in + Mbps (Megabits Per Second) allowed in a guest network. It defines the upper limits for network + utilization. If the current utilization is below the allowed upper limits, access is granted, + else revoked. + You can throttle the network bandwidth either to control the usage above a certain limit for + some accounts, or to control network congestion in a large cloud environment. The network rate + for your cloud can be configured on the following: + + + Network Offering + + + Service Offering + + + Global parameter + + + If network rate is set to NULL in service offering, the value provided in the + vm.network.throttling.rate global parameter is applied. If the value is set to NULL for network + offering, the value provided in the network.throttling.rate global parameter is + considered. + For the default public, storage, and management networks, network rate is set to 0. This + implies that the public, storage, and management networks will have unlimited bandwidth by + default. For default guest networks, network rate is set to NULL. In this case, network rate is + defaulted to the global parameter value. + The following table gives you an overview of how network rate is applied on different types + of networks in &PRODUCT;. + + + + + + + Networks + Network Rate Is Taken from + + + + + Guest network of Virtual Router + Guest Network Offering + + + Public network of Virtual Router + Guest Network Offering + + + Storage network of Secondary Storage VM + System Network Offering + + + Management network of Secondary Storage VM + System Network Offering + + + Storage network of Console Proxy VM + System Network Offering + + + Management network of Console Proxy VM + System Network Offering + + + Storage network of Virtual Router + System Network Offering + + + Management network of Virtual Router + System Network Offering + + + Public network of Secondary Storage VM + System Network Offering + + + Public network of Console Proxy VM + System Network Offering + + + Default network of a guest VM + Compute Offering + + + Additional networks of a guest VM + Corresponding Network Offerings + + + + + A guest VM must have a default network, and can also have many additional networks. + Depending on various parameters, such as the host and virtual switch used, you can observe a + difference in the network rate in your cloud. For example, on a VMware host the actual network + rate varies based on where they are configured (compute offering, network offering, or both); + the network type (shared or isolated); and traffic direction (ingress or egress). + The network rate set for a network offering used by a particular network in &PRODUCT; is + used for the traffic shaping policy of a port group, for example: port group A, for that + network: a particular subnet or VLAN on the actual network. The virtual routers for that network + connects to the port group A, and by default instances in that network connects to this port + group. However, if an instance is deployed with a compute offering with the network rate set, + and if this rate is used for the traffic shaping policy of another port group for the network, + for example port group B, then instances using this compute offering are connected to the port + group B, instead of connecting to port group A. + The traffic shaping policy on standard port groups in VMware only applies to the egress + traffic, and the net effect depends on the type of network used in &PRODUCT;. In shared + networks, ingress traffic is unlimited for &PRODUCT;, and egress traffic is limited to the rate + that applies to the port group used by the instance if any. If the compute offering has a + network rate configured, this rate applies to the egress traffic, otherwise the network rate set + for the network offering applies. For isolated networks, the network rate set for the network + offering, if any, effectively applies to the ingress traffic. This is mainly because the network + rate set for the network offering applies to the egress traffic from the virtual router to the + instance. The egress traffic is limited by the rate that applies to the port group used by the + instance if any, similar to shared networks. + For example: + Network rate of network offering = 10 Mbps + Network rate of compute offering = 200 Mbps + In shared networks, ingress traffic will not be limited for &PRODUCT;, while egress traffic + will be limited to 200 Mbps. In an isolated network, ingress traffic will be limited to 10 Mbps + and egress to 200 Mbps. +
diff --git a/docs/en-US/network-service-providers.xml b/docs/en-US/network-service-providers.xml index 82eaff18c05..cf86b24667a 100644 --- a/docs/en-US/network-service-providers.xml +++ b/docs/en-US/network-service-providers.xml @@ -5,21 +5,21 @@ ]>
@@ -32,4 +32,101 @@ Supported Network Service Providers &PRODUCT; ships with an internal list of the supported service providers, and you can choose from this list when creating a network offering. + + + + + + + + + + + + Virtual Router + Citrix NetScaler + Juniper SRX + F5 BigIP + Host based (KVM/Xen) + + + + + + Remote Access VPN + Yes + No + No + No + No + + + + DNS/DHCP/User Data + Yes + No + No + No + No + + + + Firewall + Yes + No + Yes + No + No + + + Load Balancing + Yes + Yes + No + Yes + No + + + Elastic IP + No + Yes + No + No + No + + + Elastic LB + No + Yes + No + No + No + + + Source NAT + Yes + No + Yes + No + No + + + Static NAT + Yes + Yes + Yes + No + No + + + Port Forwarding + Yes + No + Yes + No + No + + + +
diff --git a/docs/en-US/networking-in-a-pod.xml b/docs/en-US/networking-in-a-pod.xml index 81f08271874..5a569bf4d1f 100644 --- a/docs/en-US/networking-in-a-pod.xml +++ b/docs/en-US/networking-in-a-pod.xml @@ -5,37 +5,42 @@ ]> -
- Networking in a Pod - Figure 2 illustrates network setup within a single pod. The hosts are connected to a pod-level switch. At a minimum, the hosts should have one physical uplink to each switch. Bonded NICs are supported as well. The pod-level switch is a pair of redundant gigabit switches with 10 G uplinks. - - - - - networking-in-a-pod.png: Network setup in a pod - - Servers are connected as follows: - - Storage devices are connected to only the network that carries management traffic. - Hosts are connected to networks for both management traffic and public traffic. - Hosts are also connected to one or more networks carrying guest traffic. - - We recommend the use of multiple physical Ethernet cards to implement each network interface as well as redundant switch fabric in order to maximize throughput and improve reliability. -
+ Networking in a Pod + The figure below illustrates network setup within a single pod. The hosts are connected to a + pod-level switch. At a minimum, the hosts should have one physical uplink to each switch. + Bonded NICs are supported as well. The pod-level switch is a pair of redundant gigabit + switches with 10 G uplinks. + + + + + + networksinglepod.png: diagram showing logical view of network in a pod + + + Servers are connected as follows: + + Storage devices are connected to only the network that carries management traffic. + Hosts are connected to networks for both management traffic and public traffic. + Hosts are also connected to one or more networks carrying guest traffic. + + We recommend the use of multiple physical Ethernet cards to implement each network interface as well as redundant switch fabric in order to maximize throughput and improve reliability. + +
diff --git a/docs/en-US/networking-in-a-zone.xml b/docs/en-US/networking-in-a-zone.xml index c380c33dd94..e50efbac9ab 100644 --- a/docs/en-US/networking-in-a-zone.xml +++ b/docs/en-US/networking-in-a-zone.xml @@ -5,32 +5,34 @@ ]> -
- Networking in a Zone - Figure 3 illustrates the network setup within a single zone. - - - - - networking-in-a-zone.png: Network setup in a single zone - - A firewall for management traffic operates in the NAT mode. The network typically is assigned IP addresses in the 192.168.0.0/16 Class B private address space. Each pod is assigned IP addresses in the 192.168.*.0/24 Class C private address space. - Each zone has its own set of public IP addresses. Public IP addresses from different zones do not overlap. -
+ Networking in a Zone + The following figure illustrates the network setup within a single zone. + + + + + + networksetupzone.png: Depicts network setup in a single zone + + + A firewall for management traffic operates in the NAT mode. The network typically is assigned IP addresses in the 192.168.0.0/16 Class B private address space. Each pod is assigned IP addresses in the 192.168.*.0/24 Class C private address space. + Each zone has its own set of public IP addresses. Public IP addresses from different zones do not overlap. + +
diff --git a/docs/en-US/networking-overview.xml b/docs/en-US/networking-overview.xml index 798fd7a8bd8..a71fe95a864 100644 --- a/docs/en-US/networking-overview.xml +++ b/docs/en-US/networking-overview.xml @@ -5,31 +5,30 @@ ]> -
- Networking Overview - - &PRODUCT; offers two types of networking scenario: - - - Basic. For AWS-style networking. Provides a single network where guest isolation can be provided through layer-3 means such as security groups (IP address source filtering). - Advanced. For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks. - - For more details, see Network Setup. -
+ Networking Overview + &PRODUCT; offers two types of networking scenario: + + + Basic. For AWS-style networking. Provides a single network where guest isolation can be provided through layer-3 means such as security groups (IP address source filtering). + Advanced. For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks. + + For more details, see Network Setup. +
+ diff --git a/docs/en-US/networks.xml b/docs/en-US/networks.xml index a7b9ea12466..830576902b1 100644 --- a/docs/en-US/networks.xml +++ b/docs/en-US/networks.xml @@ -45,4 +45,5 @@ - \ No newline at end of file + + diff --git a/docs/en-US/nfs-shares-on-management-server.xml b/docs/en-US/nfs-shares-on-management-server.xml index c000ce4818d..881ca8d7600 100644 --- a/docs/en-US/nfs-shares-on-management-server.xml +++ b/docs/en-US/nfs-shares-on-management-server.xml @@ -27,9 +27,9 @@ This section tells how to set up NFS shares for primary and secondary storage on the same node with the Management Server. This is more typical of a trial installation, but is technically possible in a larger deployment. It is assumed that you will have less than 16TB of storage on the host. The exact commands for the following steps may vary depending on your operating system version. - On Ubuntu/Debian systems, you'll need to install the nfs-kernel-server package: + On RHEL/CentOS systems, you'll need to install the nfs-utils package: -$ sudo apt-get install nfs-kernel-server +$ sudo yum install nfs-utils On the Management Server host, create two directories that you will use for primary and secondary storage. For example: diff --git a/docs/en-US/offerings.xml b/docs/en-US/offerings.xml index 10252fd8af4..c880a9c4810 100644 --- a/docs/en-US/offerings.xml +++ b/docs/en-US/offerings.xml @@ -1,25 +1,22 @@ - %BOOK_ENTITIES; ]> - @@ -28,4 +25,6 @@ are discussed in the section on setting up networking for users.
+ + diff --git a/docs/en-US/ongoing-config-of-ext-firewalls-lb.xml b/docs/en-US/ongoing-config-of-ext-firewalls-lb.xml deleted file mode 100644 index 6a02d27fb7b..00000000000 --- a/docs/en-US/ongoing-config-of-ext-firewalls-lb.xml +++ /dev/null @@ -1,34 +0,0 @@ - - -%BOOK_ENTITIES; -]> - - - -
- Ongoing Configuration of External Firewalls and Load Balancers - Additional user actions (e.g. setting a port forward) will cause further programming of the firewall and load balancer. A user may request additional public IP addresses and forward traffic received at these IPs to specific VMs. This is accomplished by enabling static NAT for a public IP address, assigning the IP to a VM, and specifying a set of protocols and port ranges to open. When a static NAT rule is created, &PRODUCT; programs the zone's external firewall with the following objects: - - A static NAT rule that maps the public IP address to the private IP address of a VM. - A security policy that allows traffic within the set of protocols and port ranges that are specified. - A firewall filter counter that measures the number of bytes of incoming traffic to the public IP. - - The number of incoming and outgoing bytes through source NAT, static NAT, and load balancing rules is measured and saved on each external element. This data is collected on a regular basis and stored in the &PRODUCT; database. -
diff --git a/docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml b/docs/en-US/ongoing-config-of-external-firewalls-lb.xml similarity index 97% rename from docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml rename to docs/en-US/ongoing-config-of-external-firewalls-lb.xml index c90c7ada622..f5864da2b2d 100644 --- a/docs/en-US/ongoing-configuration-of-external-firewalls-loadbalancer.xml +++ b/docs/en-US/ongoing-config-of-external-firewalls-lb.xml @@ -18,7 +18,7 @@ specific language governing permissions and limitations under the License. --> -
+
Ongoing Configuration of External Firewalls and Load Balancers Additional user actions (e.g. setting a port forward) will cause further programming of the firewall and load balancer. A user may request additional public IP addresses and forward diff --git a/docs/en-US/persistent-network.xml b/docs/en-US/persistent-network.xml new file mode 100644 index 00000000000..1ccc99c59a6 --- /dev/null +++ b/docs/en-US/persistent-network.xml @@ -0,0 +1,100 @@ + + +%BOOK_ENTITIES; +]> + + +
+ Persistent Networks + The network that you can provision without having to deploy any VMs on it is called a + persistent network. A persistent network can be part of a VPC or a non-VPC environment. + When you create other types of network, a network is only a database entry until the first + VM is created on that network. When the first VM is created, a VLAN ID is assigned and the + network is provisioned. Also, when the last VM is destroyed, the VLAN ID is released and the + network is no longer available. With the addition of persistent network, you will have the + ability to create a network in &PRODUCT; in which physical devices can be deployed without + having to run any VMs. Additionally, you can deploy physical devices on that network. + One of the advantages of having a persistent network is that you can create a VPC with a tier + consisting of only physical devices. For example, you might create a VPC for a three-tier + application, deploy VMs for Web and Application tier, and use physical machines for the + Database tier. Another use case is that if you are providing services by using physical + hardware, you can define the network as persistent and therefore even if all its VMs are + destroyed the services will not be discontinued. +
+ Persistent Network Considerations + + + Persistent network is designed for isolated networks. + + + All default network offerings are non-persistent. + + + A network offering cannot be editable because changing it affects the behavior of the + existing networks that were created using this network offering. + + + When you create a guest network, the network offering that you select defines the + network persistence. This in turn depends on whether persistent network is enabled in the + selected network offering. + + + An existing network can be made persistent by changing its network offering to an + offering that has the Persistent option enabled. While setting this property, even if the + network has no running VMs, the network is provisioned. + + + An existing network can be made non-persistent by changing its network offering to an + offering that has the Persistent option disabled. If the network has no running VMs, + during the next network garbage collection run the network is shut down. + + + When the last VM on a network is destroyed, the network garbage collector checks if + the network offering associated with the network is persistent, and shuts down the network + only if it is non-persistent. + + +
+
+ Creating a Persistent Guest Network + To create a persistent network, perform the following: + + + Create a network offering with the Persistent option enabled. + See . + See the Administration Guide. + + + Select Network from the left navigation pane. + + + Select the guest network that you want to offer this network service to. + + + Click the Edit button. + + + From the Network Offering drop-down, select the persistent network offering you have + just created. + + + Click OK. + + +
+
diff --git a/docs/en-US/plugin-niciranvp-devicemanagement.xml b/docs/en-US/plugin-niciranvp-devicemanagement.xml index 2423ce3925d..57b8eee9d7d 100644 --- a/docs/en-US/plugin-niciranvp-devicemanagement.xml +++ b/docs/en-US/plugin-niciranvp-devicemanagement.xml @@ -22,7 +22,7 @@ -->
Device-management - In CloudStack 4.0.x each Nicira NVP setup is considered a "device" that can be added and removed from a physical network. To complete the configuration of the Nicira NVP plugin a device needs to be added to the physical network using the "addNiciraNVPDevice" API call. The plugin is now enabled on the physical network and any guest networks created on that network will be provisioned using the Nicra NVP Controller. + In &PRODUCT; 4.0.x each Nicira NVP setup is considered a "device" that can be added and removed from a physical network. To complete the configuration of the Nicira NVP plugin a device needs to be added to the physical network using the "addNiciraNVPDevice" API call. The plugin is now enabled on the physical network and any guest networks created on that network will be provisioned using the Nicira NVP Controller. The plugin introduces a set of new API calls to manage the devices, see below or refer to the API reference. addNiciraNvpDevice @@ -44,4 +44,4 @@ listNiciraNVPDevices -
\ No newline at end of file +
diff --git a/docs/en-US/plugin-niciranvp-features.xml b/docs/en-US/plugin-niciranvp-features.xml index b67323d56d2..c346bfb64e3 100644 --- a/docs/en-US/plugin-niciranvp-features.xml +++ b/docs/en-US/plugin-niciranvp-features.xml @@ -22,8 +22,12 @@ -->
Features of the Nicira NVP Plugin - In CloudStack release 4.0.0-incubating this plugin supports the Connectivity service. This service is responsible for creating Layer 2 networks supporting the networks created by Guests. In other words when an tennant creates a new network, instead of the traditional VLAN a logical network will be created by sending the appropriate calls to the Nicira NVP Controller. + In &PRODUCT; release 4.0.0-incubating this plugin supports the Connectivity service. This service is responsible for creating Layer 2 networks supporting the networks created by Guests. In other words when an tenant creates a new network, instead of the traditional VLAN a logical network will be created by sending the appropriate calls to the Nicira NVP Controller. The plugin has been tested with Nicira NVP versions 2.1.0, 2.2.0 and 2.2.1 - In CloudStack 4.0.0-incubating only the XenServer hypervisor is supported for use in combination with Nicira NVP - In CloudStack 4.0.0-incubating the UI components for this plugin are not complete, configuration is done by sending commands to the API + In &PRODUCT; 4.0.0-incubating only the XenServer hypervisor is supported for use in + combination with Nicira NVP. + In &PRODUCT; 4.1.0-incubating both KVM and XenServer hypervisors are + supported. + In &PRODUCT; 4.0.0-incubating the UI components for this plugin are not complete, + configuration is done by sending commands to the API.
diff --git a/docs/en-US/plugin-niciranvp-preparations.xml b/docs/en-US/plugin-niciranvp-preparations.xml index 95a25bdca26..762c941fd13 100644 --- a/docs/en-US/plugin-niciranvp-preparations.xml +++ b/docs/en-US/plugin-niciranvp-preparations.xml @@ -23,14 +23,16 @@
Prerequisites Before enabling the Nicira NVP plugin the NVP Controller needs to be configured. Please review the NVP User Guide on how to do that. - CloudStack needs to have at least one physical network with the isolation method set to "STT". This network should be enabled for the Guest traffic type. - The Guest traffic type should be configured with the traffic label that matches the name of the Integration Bridge on XenServer. See the Nicira NVP User Guide for more details on how to set this up in XenServer. + &PRODUCT; needs to have at least one physical network with the isolation method set to "STT". This network should be enabled for the Guest traffic type. + The Guest traffic type should be configured with the traffic label that matches the name of + the Integration Bridge on the hypervisor. See the Nicira NVP User Guide for more details + on how to set this up in XenServer or KVM. Make sure you have the following information ready: The IP address of the NVP Controller The username to access the API The password to access the API The UUID of the Transport Zone that contains the hypervisors in this Zone - The UUID of the Physical Network that will used for the Guest networks + The UUID of the Physical Network that will be used for the Guest networks -
\ No newline at end of file +
diff --git a/docs/en-US/plugin-niciranvp-ui.xml b/docs/en-US/plugin-niciranvp-ui.xml new file mode 100644 index 00000000000..8b1bbad8395 --- /dev/null +++ b/docs/en-US/plugin-niciranvp-ui.xml @@ -0,0 +1,26 @@ + + +%BOOK_ENTITIES; + +%xinclude; +]> + +
+ Configuring the Nicira NVP plugin from the UI + In CloudStack 4.1.0-incubating the Nicira NVP plugin and its resources can be configured in the infrastructure tab of the UI. Navigate to the physical network with STT isolation and configure the network elements. The NiciraNvp is listed here. +
diff --git a/docs/en-US/plugin-niciranvp-usage.xml b/docs/en-US/plugin-niciranvp-usage.xml index 17413387ea4..76f9a0b5b05 100644 --- a/docs/en-US/plugin-niciranvp-usage.xml +++ b/docs/en-US/plugin-niciranvp-usage.xml @@ -24,6 +24,7 @@ Using the Nicira NVP Plugin + diff --git a/docs/en-US/plugin-niciranvp-uuidreferences.xml b/docs/en-US/plugin-niciranvp-uuidreferences.xml index c912971736b..cb5f1cae834 100644 --- a/docs/en-US/plugin-niciranvp-uuidreferences.xml +++ b/docs/en-US/plugin-niciranvp-uuidreferences.xml @@ -22,9 +22,9 @@ -->
UUID References - The plugin maintains several references in the CloudStack database to items created on the NVP Controller. - Every guest network this is created will have its broadcast type set to Lswitch and if the network is in state "Implemented", the broadcast URI will have the UUID of the Logical Switch that was created for this network on the NVP Controller. + The plugin maintains several references in the &PRODUCT; database to items created on the NVP Controller. + Every guest network that is created will have its broadcast type set to Lswitch and if the network is in state "Implemented", the broadcast URI will have the UUID of the Logical Switch that was created for this network on the NVP Controller. The Nics that are connected to one of the Logical Switches will have their Logical Switch Port UUID listed in the nicira_nvp_nic_map table All devices created on the NVP Controller will have a tag set to domain-account of the owner of the network, this string can be used to search for items in the NVP Controller. -
\ No newline at end of file + diff --git a/docs/en-US/port-forwarding.xml b/docs/en-US/port-forwarding.xml index b2843eb9c29..1bbba45e3b8 100644 --- a/docs/en-US/port-forwarding.xml +++ b/docs/en-US/port-forwarding.xml @@ -5,45 +5,47 @@ ]> -
- Port Forwarding - A port forward service is a set of port forwarding rules that define a policy. A port forward service is then applied to one or more guest VMs. The guest VM then has its inbound network access managed according to the policy defined by the port forwarding service. You can optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to allow only incoming requests from certain IP addresses to be forwarded. - A guest VM can be in any number of port forward services. Port forward services can be defined but have no members. If a guest VM is part of more than one network, port forwarding rules will function only if they are defined on the default network - You cannot use port forwarding to open ports for an elastic IP address. When elastic IP is used, outside access is instead controlled through the use of security groups. See Security Groups. - To set up port forwarding: - - Log in to the &PRODUCT; UI as an administrator or end user. - If you have not already done so, add a public IP address range to a zone in &PRODUCT;. See Adding a Zone and Pod in the Installation Guide. - Add one or more VM instances to &PRODUCT;. - In the left navigation bar, click Network. - Click the name of the guest network where the VMs are running. - - Choose an existing IP address or acquire a new IP address. (See Acquiring a New IP Address on page 73.) Click the name of the IP address in the list. - Click the Configuration tab. - In the Port Forwarding node of the diagram, click View All. - Fill in the following: - - Public Port. The port to which public traffic will be addressed on the IP address you acquired in the previous step. - Private Port. The port on which the instance is listening for forwarded public traffic. - Protocol. The communication protocol in use between the two ports. - - Click Add. - + Port Forwarding + A port forward service is a set of port forwarding rules that define a policy. A port forward service is then applied to one or more guest VMs. The guest VM then has its inbound network access managed according to the policy defined by the port forwarding service. You can optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to allow only incoming requests from certain IP addresses to be forwarded. + A guest VM can be in any number of port forward services. Port forward services can be defined but have no members. If a guest VM is part of more than one network, port forwarding rules will function only if they are defined on the default network + You cannot use port forwarding to open ports for an elastic IP address. When elastic IP is used, outside access is instead controlled through the use of security groups. See Security Groups. + To set up port forwarding: + + Log in to the &PRODUCT; UI as an administrator or end user. + If you have not already done so, add a public IP address range to a zone in &PRODUCT;. See Adding a Zone and Pod in the Installation Guide. + Add one or more VM instances to &PRODUCT;. + In the left navigation bar, click Network. + Click the name of the guest network where the VMs are running. + + Choose an existing IP address or acquire a new IP address. See . Click the name of the IP address in the list. + Click the Configuration tab. + In the Port Forwarding node of the diagram, click View All. + Fill in the following: + + Public Port. The port to which public traffic will be + addressed on the IP address you acquired in the previous step. + Private Port. The port on which the instance is listening for + forwarded public traffic. + Protocol. The communication protocol in use between the two + ports + + Click Add. +
diff --git a/docs/en-US/prepare-system-vm-template.xml b/docs/en-US/prepare-system-vm-template.xml index 22674d47952..b53a509b4a1 100644 --- a/docs/en-US/prepare-system-vm-template.xml +++ b/docs/en-US/prepare-system-vm-template.xml @@ -26,22 +26,28 @@ Secondary storage must be seeded with a template that is used for &PRODUCT; system VMs. Citrix provides you with the necessary binary package of the system VM. - When copying and pasting a command, be sure the command has pasted as a single line before - executing. Some document viewers may introduce unwanted line breaks in copied text. + When copying and pasting a command, ensure that the command has pasted as a single line + before executing. Some document viewers may introduce unwanted line breaks in copied + text. - + + + If you are using a separate NFS server, mount the secondary storage on your Management + Server. Replace the example NFS server name and NFS share paths below with your own. + # mount -t nfs nfsservername:/nfs/share/secondary /mnt/secondary + If your secondary storage mount point is not named /mnt/secondary, substitute your own + mount point name. + On the Management Server, run one or more of the following cloud-install-sys-tmplt commands to retrieve and decompress the system VM template. Run the command for each hypervisor type that you expect end users to run in this Zone. - If your secondary storage mount point is not named /mnt/secondary, substitute your own - mount point name. - If you set the &PRODUCT; database encryption type to "web" when you set up the database, + If you set the &PRODUCT; database encryption type to "web" when you set up the database, you must now add the parameter -s <management-server-secret-key>. See . This process will require approximately 5 GB of free space on the local file system and - up to 30 minutes each time it runs. - + up to 30 minutes each time it runs. + For XenServer: # /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2 -h xenserver -s <optional-management-server-secret-key> -F @@ -57,12 +63,7 @@ - If you are using a separate NFS server, perform this step. - - Do not perform this step if you are using the Management Server as the NFS - server. - - When the script has finished, unmount secondary storage and remove the created + When the script has finished, unmount secondary storage and remove the created directory. # umount /mnt/secondary # rmdir /mnt/secondary diff --git a/docs/en-US/primary-storage-add.xml b/docs/en-US/primary-storage-add.xml index 5581e9e79b1..067cf7114dc 100644 --- a/docs/en-US/primary-storage-add.xml +++ b/docs/en-US/primary-storage-add.xml @@ -5,21 +5,21 @@ ]>
diff --git a/docs/en-US/primary-storage.xml b/docs/en-US/primary-storage.xml index e1736a9d30e..4ab37ef6f17 100644 --- a/docs/en-US/primary-storage.xml +++ b/docs/en-US/primary-storage.xml @@ -5,25 +5,25 @@ ]>
- Primary Storage + Primary Storage This section gives concepts and technical details about &PRODUCT; primary storage. For information about how to install and configure primary storage through the &PRODUCT; UI, see the Installation Guide. diff --git a/docs/en-US/provisioning-steps-overview.xml b/docs/en-US/provisioning-steps-overview.xml index 1da4485ff39..daf2cfc9d9b 100644 --- a/docs/en-US/provisioning-steps-overview.xml +++ b/docs/en-US/provisioning-steps-overview.xml @@ -5,42 +5,40 @@ ]> -
- Overview of Provisioning Steps - After the Management Server is installed and running, you can add the compute resources for it to manage. For an overview of how a &PRODUCT; cloud infrastructure is organized, see . - To provision the cloud infrastructure, or to scale it up at any time, follow these procedures: - - Change the root password. See . - Add a zone. See . - Add more pods (optional). See . - Add more clusters (optional). See . - Add more hosts (optional). See . - Add primary storage. See . - Add secondary storage. See . - Initialize and test the new cloud. See . - - When you have finished these steps, you will have a deployment with the following basic structure: - - - - - provisioning-overview.png: Conceptual overview of a basic deployment - + Overview of Provisioning Steps + After the Management Server is installed and running, you can add the compute resources for it to manage. For an overview of how a &PRODUCT; cloud infrastructure is organized, see . + To provision the cloud infrastructure, or to scale it up at any time, follow these procedures: + + Add a zone. See . + Add more pods (optional). See . + Add more clusters (optional). See . + Add more hosts (optional). See . + Add primary storage. See . + Add secondary storage. See . + Initialize and test the new cloud. See . + + When you have finished these steps, you will have a deployment with the following basic structure: + + + + + provisioning-overview.png: Conceptual overview of a basic deployment +
diff --git a/docs/en-US/provisioning-steps.xml b/docs/en-US/provisioning-steps.xml index 98717435c62..8777b02df13 100644 --- a/docs/en-US/provisioning-steps.xml +++ b/docs/en-US/provisioning-steps.xml @@ -5,23 +5,22 @@ ]> - Steps to Provisioning Your Cloud Infrastructure This section tells how to add zones, pods, clusters, hosts, storage, and networks to your cloud. If you are unfamiliar with these entities, please begin by looking through . diff --git a/docs/en-US/release-ip-address.xml b/docs/en-US/release-ip-address.xml index c60b73ac65b..9fdccd740fc 100644 --- a/docs/en-US/release-ip-address.xml +++ b/docs/en-US/release-ip-address.xml @@ -5,37 +5,39 @@ ]> -
- Releasing an IP Address - - Log in to the &PRODUCT; UI as an administrator or end user. - In the left navigation, choose Network. - Click the name of the network where you want to work with. - Click View IP Addresses. - Click the IP address you want to release. - - Click the Release IP button - - - - ReleaseIPButton.png: button to release an IP - . - + Releasing an IP Address + When the last rule for an IP address is removed, you can release that IP address. The IP address still belongs to the VPC; however, it can be picked up for any guest network again. + + Log in to the &PRODUCT; UI as an administrator or end user. + In the left navigation, choose Network. + Click the name of the network where you want to work with. + Click View IP Addresses. + Click the IP address you want to release. + + Click the Release IP button. + + + + + ReleaseIPButton.png: button to release an IP + + +
diff --git a/docs/en-US/removing-vsphere-hosts.xml b/docs/en-US/removing-vsphere-hosts.xml index 16830b7c17e..3f819f06641 100644 --- a/docs/en-US/removing-vsphere-hosts.xml +++ b/docs/en-US/removing-vsphere-hosts.xml @@ -1,25 +1,25 @@ - %BOOK_ENTITIES; ]>
diff --git a/docs/en-US/reset-ssh-key-dev.xml b/docs/en-US/reset-ssh-key-dev.xml new file mode 100644 index 00000000000..1a904e566ef --- /dev/null +++ b/docs/en-US/reset-ssh-key-dev.xml @@ -0,0 +1,27 @@ + + +%BOOK_ENTITIES; +]> + +
+ Resetting SSH Keys to Access VMs + Use the resetSSHKeyForVirtualMachine API to set or reset the SSH keypair assigned to a + virtual machine. With the addition of this feature, a lost or compromised SSH keypair can be + changed, and the user can access the VM by using the new keypair. Just create or register a new + keypair, then call resetSSHKeyForVirtualMachine. +
diff --git a/docs/en-US/resizing-volumes.xml b/docs/en-US/resizing-volumes.xml index 471411df5fe..42b584bf6c6 100644 --- a/docs/en-US/resizing-volumes.xml +++ b/docs/en-US/resizing-volumes.xml @@ -11,9 +11,7 @@ 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 - + 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 @@ -21,18 +19,80 @@ specific language governing permissions and limitations under the License. --> -
- Resizing Volumes - &PRODUCT; does not provide the ability to resize root disks or data disks; the disk size is fixed based on the template used to create the VM. However, the tool VHD Resizer), while not officially supported by Cloud.com or Citrix, might provide a workaround. To increase disk size with VHD Resizer: - - Get the VHD from the secondary storage. - Import it into VHD Resizer. - Resize the VHD. - Upload the new VHD. - Create a new VM. - Take a snapshot, then create a new template from that snapshot. - For more information, see How to Resize a Provisioning Server 5 Virtual Disk at the Citrix Knowledge Center - + Resizing Volumes + &PRODUCT; provides the ability to resize data disks; &PRODUCT; controls volume size by using + disk offerings. This provides &PRODUCT; administrators with the flexibility to choose how much + space they want to make available to the end users. Volumes within the disk offerings with the + same storage tag can be resized. For example, if you only want to offer 10, 50, and 100 GB + offerings, the allowed resize should stay within those limits. That implies if you define a 10 + GB, a 50 GB and a 100 GB disk offerings, a user can upgrade from 10 GB to 50 GB, or 50 GB to 100 + GB. If you create a custom-sized disk offering, then you have the option to resize the volume by + specifying a new, larger size. + Additionally, using the resizeVolume API, a data volume can be moved from a static disk + offering to a custom disk offering with the size specified. This functionality allows those who + might be billing by certain volume sizes or disk offerings to stick to that model, while + providing the flexibility to migrate to whatever custom size necessary. + This feature is supported on KVM, XenServer, and VMware hosts. However, shrinking volumes is + not supported on VMware hosts. + Before you try to resize a volume, consider the following: + + + The VMs associated with the volume are stopped. + + + The data disks associated with the volume are removed. + + + When a volume is shrunk, the disk associated with it is simply truncated, and doing so + would put its content at risk of data loss. Therefore, resize any partitions or file systems + before you shrink a data disk so that all the data is moved off from that disk. + + + To resize a volume: + + + Log in to the &PRODUCT; UI as a user or admin. + + + In the left navigation bar, click Storage. + + + In Select View, choose Volumes. + + + Select the volume name in the Volumes list, then click the Resize Volume button + + + + + resize-volume-icon.png: button to display the resize volume option. + + + + + In the Resize Volume pop-up, choose desired characteristics for the storage. + + + + + + resize-volume.png: option to resize a volume. + + + + + If you select Custom Disk, specify a custom size. + + + Click Shrink OK to confirm that you are reducing the size of a volume. + This parameter protects against inadvertent shrinking of a disk, which might lead to + the risk of data loss. You must sign off that you know what you are doing. + + + + + Click OK. + +
- diff --git a/docs/en-US/runtime-allocation-virtual-network-resources.xml b/docs/en-US/runtime-allocation-virtual-network-resources.xml index 696ea9b9d6d..479f069680f 100644 --- a/docs/en-US/runtime-allocation-virtual-network-resources.xml +++ b/docs/en-US/runtime-allocation-virtual-network-resources.xml @@ -5,24 +5,27 @@ ]> -
Runtime Allocation of Virtual Network Resources - When you define a new virtual network, all your settings for that network are stored in &PRODUCT;. The actual network resources are activated only when the first virtual machine starts in the network. When all virtual machines have left the virtual network, the network resources are garbage collected so they can be allocated again. This helps to conserve network resources.. + When you define a new virtual network, all your settings for that network are stored in + &PRODUCT;. The actual network resources are activated only when the first virtual + machine starts in the network. When all virtual machines have left the virtual network, the + network resources are garbage collected so they can be allocated again. This helps to + conserve network resources.
diff --git a/docs/en-US/scheduled-maintenance-maintenance-mode-hosts.xml b/docs/en-US/scheduled-maintenance-maintenance-mode-hosts.xml index 6364e8b0c78..6b736e4eb11 100644 --- a/docs/en-US/scheduled-maintenance-maintenance-mode-hosts.xml +++ b/docs/en-US/scheduled-maintenance-maintenance-mode-hosts.xml @@ -1,28 +1,30 @@ - %BOOK_ENTITIES; ]>
Scheduled Maintenance and Maintenance Mode for Hosts You can place a host into maintenance mode. When maintenance mode is activated, the host becomes unavailable to receive new guest VMs, and the guest VMs already running on the host are seamlessly migrated to another host not in maintenance mode. This migration uses live migration technology and does not interrupt the execution of the guest. + +
diff --git a/docs/en-US/secondary-storage-vm.xml b/docs/en-US/secondary-storage-vm.xml index 792644432d2..34015c32a91 100644 --- a/docs/en-US/secondary-storage-vm.xml +++ b/docs/en-US/secondary-storage-vm.xml @@ -5,28 +5,29 @@ ]>
- Secondary Storage VM + Secondary Storage VM In addition to the hosts, &PRODUCT;’s Secondary Storage VM mounts and writes to secondary storage. - Submissions to secondary storage go through the Secondary Storage VM. The Secondary Storage VM can retrieve templates and ISO images from URLs using a variety of protocols. - The secondary storage VM provides a background task that takes care of a variety of secondary storage activities: downloading a new template to a Zone, copying templates between Zones, and snapshot backups. - The administrator can log in to the secondary storage VM if needed. -
+ Submissions to secondary storage go through the Secondary Storage VM. The Secondary Storage VM can retrieve templates and ISO images from URLs using a variety of protocols. + The secondary storage VM provides a background task that takes care of a variety of secondary storage activities: downloading a new template to a Zone, copying templates between Zones, and snapshot backups. + The administrator can log in to the secondary storage VM if needed. + +
diff --git a/docs/en-US/secondary-storage.xml b/docs/en-US/secondary-storage.xml index a254b1e2f6e..4a01c27f72d 100644 --- a/docs/en-US/secondary-storage.xml +++ b/docs/en-US/secondary-storage.xml @@ -1,25 +1,25 @@ - %BOOK_ENTITIES; ]>
diff --git a/docs/en-US/security-groups-advanced-zones.xml b/docs/en-US/security-groups-advanced-zones.xml new file mode 100644 index 00000000000..bfae1883cc9 --- /dev/null +++ b/docs/en-US/security-groups-advanced-zones.xml @@ -0,0 +1,52 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Security Groups in Advanced Zones (KVM Only) + &PRODUCT; provides the ability to use security groups to provide isolation between + guests on a single shared, zone-wide network in an advanced zone where KVM is the + hypervisor. Using security groups in advanced zones rather than multiple VLANs allows a greater range + of options for setting up guest isolation in a cloud. + + Limitations + The following are not supported for this feature: + + + + Two IP ranges with the same VLAN and different gateway or netmask in security + group-enabled shared network. + + + Two IP ranges with the same VLAN and different gateway or netmask in + account-specific shared networks. + + + Multiple VLAN ranges in security group-enabled shared network. + + + Multiple VLAN ranges in account-specific shared networks. + + + Security groups must be enabled in the zone in order for this feature to be used. +
diff --git a/docs/en-US/security-groups.xml b/docs/en-US/security-groups.xml index 3c08965c8d3..6b36650005e 100644 --- a/docs/en-US/security-groups.xml +++ b/docs/en-US/security-groups.xml @@ -1,31 +1,32 @@ - %BOOK_ENTITIES; ]>
Security Groups +
diff --git a/docs/en-US/set-up-invitations.xml b/docs/en-US/set-up-invitations.xml index e6a22dba1af..c1303cf5e92 100644 --- a/docs/en-US/set-up-invitations.xml +++ b/docs/en-US/set-up-invitations.xml @@ -5,69 +5,76 @@ ]> -
Setting Up Invitations &PRODUCT; can be set up either so that project administrators can add people directly to a project, or so that it is necessary to send an invitation which the recipient must accept. The invitation can be sent by email or through the user’s &PRODUCT; account. If you want administrators to use invitations to add members to projects, turn on and set up the invitations feature in &PRODUCT;. - + Log in as administrator to the &PRODUCT; UI. In the left navigation, click Global Settings. - In the search box, type project and click the search button. In the search box, type project and click the search button. searchbutton.png: Searches projects - In the search results, you will see a few other parameters you need to set to control how invitations behave. The table below shows global configuration parameters related to project invitations. Click the edit button to set each parameter + In the search results, you can see a few other parameters you need to set to control how + invitations behave. The table below shows global configuration parameters related to + project invitations. Click the edit button to set each parameter. Configuration Parameters - Description + Description project.invite.required Set to true to turn on the invitations feature. + + project.email.sender The email address to show in the From field of invitation emails. + project.invite.timeout Amount of time to allow for a new member to respond to the invitation. + project.smtp.host Name of the host that acts as an email server to handle invitations. + project.smtp.password (Optional) Password required by the SMTP server. You must also set project.smtp.username and set project.smtp.useAuth to true. + project.smtp.port SMTP server’s listening port. + project.smtp.useAuth @@ -81,7 +88,9 @@ - Restart the Management Server + Restart the Management Server: service cloud-management restart - + +
+ diff --git a/docs/en-US/set-up-network-for-users.xml b/docs/en-US/set-up-network-for-users.xml index 2b409232037..c91565a5456 100644 --- a/docs/en-US/set-up-network-for-users.xml +++ b/docs/en-US/set-up-network-for-users.xml @@ -5,21 +5,21 @@ ]> diff --git a/docs/en-US/set-usage-limit.xml b/docs/en-US/set-usage-limit.xml index 3ef528a690c..5e2d770c7e0 100644 --- a/docs/en-US/set-usage-limit.xml +++ b/docs/en-US/set-usage-limit.xml @@ -5,29 +5,25 @@ ]> -
Setting Usage Limits &PRODUCT; provides several administrator control points for capping resource usage by users. Some of these limits are global configuration parameters. Others are applied at the ROOT domain and may be overridden on a per-account basis. Aggregate limits may be set on a per-domain basis. For example, you may limit a domain and all subdomains to the creation of 100 VMs. This section covers the following topics: - Globally Configured Limits - Default Account Resource Limits - Per Domain Limits -
+
diff --git a/docs/en-US/shared-networks.xml b/docs/en-US/shared-networks.xml index d505fed97b1..d5a7ede9bdb 100644 --- a/docs/en-US/shared-networks.xml +++ b/docs/en-US/shared-networks.xml @@ -5,26 +5,28 @@ ]> -
Shared Networks - A shared network can be accessed by virtual machines that belong to many different accounts. Network Isolation on shared networks is accomplished using techniques such as security groups (supported only in basic zones in &PRODUCT; 3.0.3). + A shared network can be accessed by virtual machines that belong to many different + accounts. Network Isolation on shared networks is accomplished using techniques such as + security groups (supported only in basic zones in &PRODUCT; 3.0.3 and later + versions). Shared Networks are created by the administrator Shared Networks can be designated to a certain domain @@ -32,4 +34,6 @@ Shared Networks are isolated by security groups Public Network is a shared network that is not shown to the end users + +
diff --git a/docs/en-US/site-to-site-vpn.xml b/docs/en-US/site-to-site-vpn.xml index a102ebe1bb4..a5899eac4f1 100644 --- a/docs/en-US/site-to-site-vpn.xml +++ b/docs/en-US/site-to-site-vpn.xml @@ -55,8 +55,11 @@ Create VPN connection from the VPC VPN gateway to the customer VPN gateway. + Appropriate events are generated on the &PRODUCT; UI when status of a Site-to-Site VPN + connection changes from connected to disconnected, or vice versa. Currently no events are generated + when establishing a VPN connection fails or pending. -
\ No newline at end of file +
diff --git a/docs/en-US/snapshot-throttling.xml b/docs/en-US/snapshot-throttling.xml new file mode 100644 index 00000000000..6bda437e503 --- /dev/null +++ b/docs/en-US/snapshot-throttling.xml @@ -0,0 +1,45 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Snapshot Job Throttling + When a snapshot of a virtual machine is requested, the snapshot job runs on the same + host where the VM is running or, in the case of a stopped VM, the host where it ran last. If + many snapshots are requested for VMs on a single host, this can lead to problems with too + many snapshot jobs overwhelming the resources of the host. + To address this situation, the cloud's root administrator can throttle how many snapshot + jobs are executed simultaneously on the hosts in the cloud by using the global configuration + setting concurrent.snapshots.threshold.perhost. By using this setting, the administrator can + better ensure that snapshot jobs do not time out and hypervisor hosts do not experience + performance issues due to hosts being overloaded with too many snapshot requests. + Set concurrent.snapshots.threshold.perhost to a value that represents a best guess about + how many snapshot jobs the hypervisor hosts can execute at one time, given the current + resources of the hosts and the number of VMs running on the hosts. If a given host has more + snapshot requests, the additional requests are placed in a waiting queue. No new snapshot + jobs will start until the number of currently executing snapshot jobs falls below the + configured limit. + The admin can also set job.expire.minutes to place a maximum on how long a snapshot + request will wait in the queue. If this limit is reached, the snapshot request fails and + returns an error message. +
diff --git a/docs/en-US/standard-events.xml b/docs/en-US/standard-events.xml index b4a4c68a6cb..9c10f873044 100644 --- a/docs/en-US/standard-events.xml +++ b/docs/en-US/standard-events.xml @@ -5,23 +5,22 @@ ]> -
Standard Events The events log records three types of standard events. @@ -36,4 +35,6 @@ ERROR. This event is generated when an operation has not been successfully performed -
+ + + diff --git a/docs/en-US/static-nat.xml b/docs/en-US/static-nat.xml index ef9e2fc9167..4225d6eecad 100644 --- a/docs/en-US/static-nat.xml +++ b/docs/en-US/static-nat.xml @@ -5,24 +5,24 @@ ]> -
Static NAT - A static NAT rule maps a public IP address to the private IP address of a VM in order to allow Internet traffic into the VM. The public IP address always remains the same, which is why it is called "static" NAT. This section tells how to enable or disable static NAT for a particular IP address. + A static NAT rule maps a public IP address to the private IP address of a VM in order to allow Internet traffic into the VM. The public IP address always remains the same, which is why it is called “static†NAT. This section tells how to enable or disable static NAT for a particular IP address. +
diff --git a/docs/en-US/sticky-session-policies-for-lb-rules.xml b/docs/en-US/sticky-session-policies-for-lb-rules.xml index a8acfa087d2..09780855f7e 100644 --- a/docs/en-US/sticky-session-policies-for-lb-rules.xml +++ b/docs/en-US/sticky-session-policies-for-lb-rules.xml @@ -21,10 +21,21 @@ specific language governing permissions and limitations under the License. --> -
- Sticky Session Policies for Load Balancer Rules - Sticky sessions are used in Web-based applications to ensure continued availability of information across the multiple requests in a user's session. For example, if a shopper is filling a cart, you need to remember what has been purchased so far. The concept of "stickiness" is also referred to as persistence or maintaining state. - Any load balancer rule defined in &PRODUCT; can have a stickiness policy. The policy consists of a name, stickiness method, and parameters. The parameters are name-value pairs or flags, which are defined by the load balancer vendor. The stickiness method could be load balancer-generated cookie, application-generated cookie, or source-based. In the source-based method, the source IP address is used to identify the user and locate the user’s stored data. In the other methods, cookies are used. The cookie generated by the load balancer or application is included in request and response URLs to create persistence. The cookie name can be specified by the administrator or automatically generated. A variety of options are provided to control the exact behavior of cookies, such as how they are generated and whether they are cached. - For the most up to date list of available stickiness methods, see the &PRODUCT; UI or call listNetworks and check the SupportedStickinessMethods capability. + Sticky Session Policies for Load Balancer Rules + Sticky sessions are used in Web-based applications to ensure continued availability of + information across the multiple requests in a user's session. For example, if a shopper is + filling a cart, you need to remember what has been purchased so far. The concept of "stickiness" + is also referred to as persistence or maintaining state. + Any load balancer rule defined in &PRODUCT; can have a stickiness policy. The policy + consists of a name, stickiness method, and parameters. The parameters are name-value pairs or + flags, which are defined by the load balancer vendor. The stickiness method could be load + balancer-generated cookie, application-generated cookie, or source-based. In the source-based + method, the source IP address is used to identify the user and locate the user’s stored data. In + the other methods, cookies are used. The cookie generated by the load balancer or application is + included in request and response URLs to create persistence. The cookie name can be specified by + the administrator or automatically generated. A variety of options are provided to control the + exact behavior of cookies, such as how they are generated and whether they are cached. + For the most up to date list of available stickiness methods, see the &PRODUCT; UI or call + listNetworks and check the SupportedStickinessMethods capability.
diff --git a/docs/en-US/stop-restart-management-server.xml b/docs/en-US/stop-restart-management-server.xml index 2edc23332c0..5c1bcecbc00 100644 --- a/docs/en-US/stop-restart-management-server.xml +++ b/docs/en-US/stop-restart-management-server.xml @@ -5,27 +5,26 @@ ]> -
Stopping and Restarting the Management Server The root administrator will need to stop and restart the Management Server from time to time. - For example, after changing a global configuration parameter, a restart is required. If you have multiple Management Server nodes, restart all of them to put the new parameter value into effect consistently throughout the cloud. + For example, after changing a global configuration parameter, a restart is required. If you have multiple Management Server nodes, restart all of them to put the new parameter value into effect consistently throughout the cloud.. To stop the Management Server, issue the following command at the operating system prompt on the Management Server node: # service cloud-management stop To start the Management Server: diff --git a/docs/en-US/stopping-and-starting-vms.xml b/docs/en-US/stopping-and-starting-vms.xml index 8b294af0b90..1c8bd808394 100644 --- a/docs/en-US/stopping-and-starting-vms.xml +++ b/docs/en-US/stopping-and-starting-vms.xml @@ -1,5 +1,5 @@ - %BOOK_ENTITIES; ]> @@ -23,6 +23,7 @@ -->
- Stopping and Starting VMs - Any user can access their own virtual machines. The administrator can access all VMs running in the cloud. + Stopping and Starting VMs + Once a VM instance is created, you can stop, restart, or delete it as needed. In the &PRODUCT; UI, click Instances, select the VM, and use the Stop, Start, Reboot, and Destroy links.
+ diff --git a/docs/en-US/storage.xml b/docs/en-US/storage.xml index 86d3f53e766..580fe59e1e1 100644 --- a/docs/en-US/storage.xml +++ b/docs/en-US/storage.xml @@ -5,28 +5,28 @@ ]> - Working With Storage - - - - - + Working With Storage + + + + + diff --git a/docs/en-US/sys-offering-sysvm.xml b/docs/en-US/sys-offering-sysvm.xml new file mode 100644 index 00000000000..cccf3e04796 --- /dev/null +++ b/docs/en-US/sys-offering-sysvm.xml @@ -0,0 +1,75 @@ + + +%BOOK_ENTITIES; +]> + +
+ Changing the Default System Offering for System VMs + You can manually change the system offering for a particular System VM. Additionally, as a + &PRODUCT; administrator, you can also change the default system offering used for System + VMs. + + + Create a new system offering. + For more information, see + Creating a New System Service Offering. + + + Back up the database: + mysqldump -u root -p cloud | bzip2 > cloud_backup.sql.bz2 + + + Open an MySQL prompt: + mysql -u cloud -p cloud + + + Run the following queries on the cloud database. + + + In the disk_offering table, identify the original default offering and the new + offering you want to use by default. + Take a note of the ID of the new offering. + select id,name,unique_name,type from disk_offering; + + + For the original default offering, set the value of unique_name to NULL. + # update disk_offering set unique_name = NULL where id = 10; + Ensure that you use the correct value for the ID. + + + For the new offering that you want to use by default, set the value of unique_name + as follows: + For the default Console Proxy VM (CPVM) offering,set unique_name to + 'Cloud.com-ConsoleProxy'. For the default Secondary Storage VM (SSVM) offering, set + unique_name to 'Cloud.com-SecondaryStorage'. For example: + update disk_offering set unique_name = 'Cloud.com-ConsoleProxy' where id = 16; + + + + + Restart &PRODUCT; Management Server. Restarting is required because the default + offerings are loaded into the memory at startup. + service cloud-management restart + + + Destroy the existing CPVM or SSVM offerings and wait for them to be recreated. The new + CPVM or SSVM are configured with the new offering. + + +
diff --git a/docs/en-US/sys-reliability-and-ha.xml b/docs/en-US/sys-reliability-and-ha.xml index 5c544af0e10..94385ff683d 100644 --- a/docs/en-US/sys-reliability-and-ha.xml +++ b/docs/en-US/sys-reliability-and-ha.xml @@ -1,32 +1,32 @@ - %BOOK_ENTITIES; ]> - System Reliability and High Availability - - - - - - \ No newline at end of file + System Reliability and High Availability + + + + + + diff --git a/docs/en-US/sysprep-for-windows-server-2003R2.xml b/docs/en-US/sysprep-for-windows-server-2003R2.xml index 86e1667a1c5..5f8a3890705 100644 --- a/docs/en-US/sysprep-for-windows-server-2003R2.xml +++ b/docs/en-US/sysprep-for-windows-server-2003R2.xml @@ -5,53 +5,53 @@ ]> -
- Sysprep for Windows Server 2003 R2 - Earlier versions of Windows have a different sysprep tool. Follow these steps for Windows Server 2003 R2. - - Extract the content of \support\tools\deploy.cab on the Windows installation CD into a directory called c:\sysprep on the Windows 2003 R2 VM. - Run c:\sysprep\setupmgr.exe to create the sysprep.inf file. - - Select Create New to create a new Answer File. - Enter “Sysprep setup†for the Type of Setup. - Select the appropriate OS version and edition. - On the License Agreement screen, select “Yes fully automate the installationâ€. - Provide your name and organization. - Leave display settings at default. - Set the appropriate time zone. - Provide your product key. - Select an appropriate license mode for your deployment - Select “Automatically generate computer nameâ€. - Type a default administrator password. If you enable the password reset feature, the users will not actually use this password. This password will be reset by the instance manager after the guest boots up. - Leave Network Components at “Typical Settingsâ€. - Select the “WORKGROUP†option. - Leave Telephony options at default. - Select appropriate Regional Settings. - Select appropriate language settings. - Do not install printers. - Do not specify “Run Once commandsâ€. - You need not specify an identification string. - Save the Answer File as c:\sysprep\sysprep.inf. - - - Run the following command to sysprep the image:c:\sysprep\sysprep.exe -reseal -mini -activated - After this step the machine will automatically shut down - -
+ System Preparation for Windows Server 2003 R2 + Earlier versions of Windows have a different sysprep tool. Follow these steps for Windows Server 2003 R2. + + Extract the content of \support\tools\deploy.cab on the Windows installation CD into a directory called c:\sysprep on the Windows 2003 R2 VM. + Run c:\sysprep\setupmgr.exe to create the sysprep.inf file. + + Select Create New to create a new Answer File. + Enter “Sysprep setup†for the Type of Setup. + Select the appropriate OS version and edition. + On the License Agreement screen, select “Yes fully automate the installationâ€. + Provide your name and organization. + Leave display settings at default. + Set the appropriate time zone. + Provide your product key. + Select an appropriate license mode for your deployment + Select “Automatically generate computer nameâ€. + Type a default administrator password. If you enable the password reset feature, the users will not actually use this password. This password will be reset by the instance manager after the guest boots up. + Leave Network Components at “Typical Settingsâ€. + Select the “WORKGROUP†option. + Leave Telephony options at default. + Select appropriate Regional Settings. + Select appropriate language settings. + Do not install printers. + Do not specify “Run Once commandsâ€. + You need not specify an identification string. + Save the Answer File as c:\sysprep\sysprep.inf. + + + + Run the following command to sysprep the image:c:\sysprep\sysprep.exe -reseal -mini -activated + After this step the machine will automatically shut down + +
diff --git a/docs/en-US/sysprep-windows-server-2008R2.xml b/docs/en-US/sysprep-windows-server-2008R2.xml index af36d15a2c1..49e7477c6b4 100644 --- a/docs/en-US/sysprep-windows-server-2008R2.xml +++ b/docs/en-US/sysprep-windows-server-2008R2.xml @@ -5,34 +5,35 @@ ]> -
- System Preparation for Windows Server 2008 R2 - For Windows 2008 R2, you run Windows System Image Manager to create a custom sysprep response XML file. Windows System Image Manager is installed as part of the Windows Automated Installation Kit (AIK). Windows AIK can be downloaded from the Microsoft Download Center at the following location: - Microsoft Download Center. - Use the following steps to run sysprep for Windows 2008 R2:The steps outlined here are derived from the excellent guide by Charity Shelbourne, originally published at Windows Server 2008 Sysprep Mini-Setup + System Preparation for Windows Server 2008 R2 + For Windows 2008 R2, you run Windows System Image Manager to create a custom sysprep response XML file. Windows System Image Manager is installed as part of the Windows Automated Installation Kit (AIK). Windows AIK can be downloaded from Microsoft Download Center. + Use the following steps to run sysprep for Windows 2008 R2:The steps outlined here are derived from the excellent guide by Charity Shelbourne, originally published at Windows Server 2008 Sysprep Mini-Setup. + + Download and install the Windows AIKWindows AIK should not be installed on the Windows 2008 R2 VM you just created. Windows AIK should not be part of the template you create. It is only used to create the sysprep answer file. Copy the install.wim file in the \sources directory of the Windows 2008 R2 installation DVD to the hard disk. This is a very large file and may take a long time to copy. Windows AIK requires the WIM file to be writable. Start the Windows System Image Manager, which is part of the Windows AIK. - In the Windows Image pane, right click “Select a Windows image or catalog file†to load the install.wim file you just copied. - Select the Windows 2008 R2 EditionYou may be prompted with a warning that the catalog file cannot be opened. Click Yes to create a new catalog file. + In the Windows Image pane, right click the Select a Windows image or catalog file option to + load the install.wim file you just copied. + Select the Windows 2008 R2 Edition.You may be prompted with a warning that the catalog file cannot be opened. Click Yes to create a new catalog file. In the Answer File pane, right click to create a new answer file. Generate the answer file from the Windows System Image Manager using the following steps: @@ -63,5 +64,8 @@ cd c:\Windows\System32\sysprep sysprep.exe /oobe /generalize /shutdown The Windows 2008 R2 VM will automatically shut down after sysprep is complete. + + +
diff --git a/docs/en-US/system-reserved-ip-addresses.xml b/docs/en-US/system-reserved-ip-addresses.xml index 1270378d38c..7ae9fa8df9f 100644 --- a/docs/en-US/system-reserved-ip-addresses.xml +++ b/docs/en-US/system-reserved-ip-addresses.xml @@ -5,23 +5,22 @@ ]> -
System Reserved IP Addresses In each zone, you need to configure a range of reserved IP addresses for the management network. This network carries communication between the &PRODUCT; Management Server and various system VMs, such as Secondary Storage VMs, Console Proxy VMs, and DHCP. diff --git a/docs/en-US/time-zones.xml b/docs/en-US/time-zones.xml index aa8eefb7c59..6b3b64ed85c 100644 --- a/docs/en-US/time-zones.xml +++ b/docs/en-US/time-zones.xml @@ -1,137 +1,137 @@ - %BOOK_ENTITIES; ]> - Time Zones + Time Zones The following time zone identifiers are accepted by &PRODUCT;. There are several places that have a time zone as a required or optional parameter. These include scheduling recurring snapshots, creating a user, and specifying the usage time zone in the Configuration table. - - - - - - - - Etc/GMT+12 - Etc/GMT+11 - Pacific/Samoa - - - Pacific/Honolulu - US/Alaska - America/Los_Angeles - - - Mexico/BajaNorte - US/Arizona - US/Mountain - - - America/Chihuahua - America/Chicago - America/Costa_Rica - - - America/Mexico_City - Canada/Saskatchewan - America/Bogota - - - America/New_York - America/Caracas - America/Asuncion - - - America/Cuiaba - America/Halifax - America/La_Paz - - - America/Santiago - America/St_Johns - America/Araguaina - - - America/Argentina/Buenos_Aires - America/Cayenne - America/Godthab - - - America/Montevideo - Etc/GMT+2 - Atlantic/Azores - - - Atlantic/Cape_Verde - Africa/Casablanca - Etc/UTC - - - Atlantic/Reykjavik - Europe/London - CET - - - Europe/Bucharest - Africa/Johannesburg - Asia/Beirut - - - Africa/Cairo - Asia/Jerusalem - Europe/Minsk - - - Europe/Moscow - Africa/Nairobi - Asia/Karachi - - - Asia/Kolkata - Asia/Bangkok - Asia/Shanghai - - - Asia/Kuala_Lumpur - Australia/Perth - Asia/Taipei - - - Asia/Tokyo - Asia/Seoul - Australia/Adelaide - - - Australia/Darwin - Australia/Brisbane - Australia/Canberra - - - Pacific/Guam - Pacific/Auckland - - - - - + + + + + + + + Etc/GMT+12 + Etc/GMT+11 + Pacific/Samoa + + + Pacific/Honolulu + US/Alaska + America/Los_Angeles + + + Mexico/BajaNorte + US/Arizona + US/Mountain + + + America/Chihuahua + America/Chicago + America/Costa_Rica + + + America/Mexico_City + Canada/Saskatchewan + America/Bogota + + + America/New_York + America/Caracas + America/Asuncion + + + America/Cuiaba + America/Halifax + America/La_Paz + + + America/Santiago + America/St_Johns + America/Araguaina + + + America/Argentina/Buenos_Aires + America/Cayenne + America/Godthab + + + America/Montevideo + Etc/GMT+2 + Atlantic/Azores + + + Atlantic/Cape_Verde + Africa/Casablanca + Etc/UTC + + + Atlantic/Reykjavik + Europe/London + CET + + + Europe/Bucharest + Africa/Johannesburg + Asia/Beirut + + + Africa/Cairo + Asia/Jerusalem + Europe/Minsk + + + Europe/Moscow + Africa/Nairobi + Asia/Karachi + + + Asia/Kolkata + Asia/Bangkok + Asia/Shanghai + + + Asia/Kuala_Lumpur + Australia/Perth + Asia/Taipei + + + Asia/Tokyo + Asia/Seoul + Australia/Adelaide + + + Australia/Darwin + Australia/Brisbane + Australia/Canberra + + + Pacific/Guam + Pacific/Auckland + + + + + diff --git a/docs/en-US/translating-documentation.xml b/docs/en-US/translating-documentation.xml new file mode 100644 index 00000000000..afe27658f1a --- /dev/null +++ b/docs/en-US/translating-documentation.xml @@ -0,0 +1,38 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Translating &PRODUCT; Documentation + + There are two ways to translate the documentation: + + + Directly using the Transifex website and using their user interface. + Using the Transifex client and pushing your translated strings to the website. + + + Once a translation is complete, a site admin will pull the translated strings within the &PRODUCT; repository, build the documenation and publish it. + For instructions on how to use the Transifex website see http://sebgoa.blogspot.ch/2012/11/translating-apache-cloudstack-docs-with.html + For instructions on how to use the Transifex client to translate from the command line see http://sebgoa.blogspot.ch/2012/12/using-transifex-client-to-translate.html +
diff --git a/docs/en-US/troubleshooting.xml b/docs/en-US/troubleshooting.xml index 24ecab5489a..570d02e4315 100644 --- a/docs/en-US/troubleshooting.xml +++ b/docs/en-US/troubleshooting.xml @@ -5,31 +5,31 @@ ]> - Troubleshooting - - + Troubleshooting + + - - - + + + diff --git a/docs/en-US/tuning.xml b/docs/en-US/tuning.xml index 18d83ee40bc..4f9dd01549f 100644 --- a/docs/en-US/tuning.xml +++ b/docs/en-US/tuning.xml @@ -1,25 +1,25 @@ - %BOOK_ENTITIES; ]> @@ -30,4 +30,4 @@ - \ No newline at end of file + diff --git a/docs/en-US/upgrade-virtual-router-with-service-offering.xml b/docs/en-US/upgrade-virtual-router-with-service-offering.xml index 8291c3af46c..dad1d906c5f 100644 --- a/docs/en-US/upgrade-virtual-router-with-service-offering.xml +++ b/docs/en-US/upgrade-virtual-router-with-service-offering.xml @@ -27,7 +27,10 @@ When &PRODUCT; creates a virtual router, it uses default settings which are defined in a default system service offering. See . All the virtual routers in a single guest network use the same system service offering. You can upgrade the capabilities of the virtual router by creating and applying a custom system service offering. Define your custom system service offering. See . In System VM Type, choose Domain Router. - Associate the system service offering with a network offering. See + Associate the system service offering with a network offering. + See "Creating Network Offerings" in the Administrator's Guide. + See . + Apply the network offering to the network where you want the virtual routers to use the new system service offering. If this is a new network, follow the steps in Adding an Additional Guest Network on page 66. To change the service offering for existing virtual routers, follow the steps in .
diff --git a/docs/en-US/upload-template.xml b/docs/en-US/upload-template.xml index 40b64bbe8aa..f270c899a53 100644 --- a/docs/en-US/upload-template.xml +++ b/docs/en-US/upload-template.xml @@ -5,49 +5,63 @@ ]> -
- Uploading Templates + Uploading Templates vSphere Templates and ISOsIf you are uploading a template that was created using vSphere Client, be sure the OVA file does not contain an ISO. If it does, the deployment of VMs from the template will fail. - Templates are uploaded based on a URL. HTTP is the supported access protocol. Templates are frequently large files. You can optionally gzip them to decrease upload times. - To upload a template: - - In the left navigation bar, click Templates. - Click Create Template. - Provide the following: - - Name and Display Text. These will be shown in the UI, so choose something descriptive. - URL. The Management Server will download the file from the specified URL, such as http://my.web.server/filename.vhd.gz. - Zone. Choose the zone where you want the template to be available, or All Zones to make it available throughout &PRODUCT;. - OS Type: This helps &PRODUCT; and the hypervisor perform certain operations and make assumptions that improve the performance of the guest. Select one of the following: - - If the operating system of the stopped VM is listed, choose it. - If the OS type of the stopped VM is not listed, choose Other. + Templates are uploaded based on a URL. HTTP is the supported access protocol. Templates are frequently large files. You can optionally gzip them to decrease upload times. + To upload a template: + + In the left navigation bar, click Templates. + Click Register Template. + Provide the following: + + Name and Description. These will be shown in the UI, so + choose something descriptive. + URL. The Management Server will download the file from the + specified URL, such as http://my.web.server/filename.vhd.gz. + Zone. Choose the zone where you want the template to be + available, or All Zones to make it available throughout + &PRODUCT;. + OS Type: This helps &PRODUCT; and the hypervisor perform + certain operations and make assumptions that improve the performance of the + guest. Select one of the following: + + If the operating system of the stopped VM is listed, choose it. + If the OS type of the stopped VM is not listed, choose Other. You should not choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will in general not work. In those cases you should choose Other. - - - Hypervisor - Format. The format of the template upload file, such as VHD or OVA. - Password Enabled. Choose Yes if your template has the &PRODUCT; password change script installed. See Adding Password Management to Your Templates - Extractable. Choose Yes if the template is available for extraction. If this option is selected, end users can download a full image of a template. - Public. Choose Yes to make this template accessible to all users of this &PRODUCT; installation. The template will appear in the Community Templates list. See - Featured. Choose Yes if you would like this template to be more prominent for users to select. The template will appear in the Featured Templates list. Only an administrator can make a template Featured. - - + + + Hypervisor: The supported hypervisors are listed. Select the desired one. + Format. The format of the template upload file, such as VHD + or OVA. + Password Enabled. Choose Yes if your template has the + &PRODUCT; password change script installed. See Adding Password + Management to Your Templates + Extractable. Choose Yes if the template is available for extraction. If this option is selected, end users can + download a full image of a template. + Public. Choose Yes to make this template accessible to all + users of this &PRODUCT; installation. The template will appear in the + Community Templates list. See . + Featured. Choose Yes if you would like this template to be + more prominent for users to select. The template will appear in the Featured + Templates list. Only an administrator can make a template Featured. + + +
diff --git a/docs/en-US/using-multiple-guest-networks.xml b/docs/en-US/using-multiple-guest-networks.xml index 9076a816640..4e7da1e187f 100644 --- a/docs/en-US/using-multiple-guest-networks.xml +++ b/docs/en-US/using-multiple-guest-networks.xml @@ -5,28 +5,27 @@ ]> -
- Using Multiple Guest Networks - In zones that use advanced networking, additional networks for guest traffic may be added at any time after the initial installation. You can also customize the domain name associated with the network by specifying a DNS suffix for each network. - A VM's networks are defined at VM creation time. A VM cannot add or remove networks after it has been created, although the user can go into the guest and remove the IP address from the NIC on a particular network. - Each VM has just one default network. The virtual router's DHCP reply will set the guest's default gateway as that for the default network. Multiple non-default networks may be added to a guest in addition to the single, required default network. The administrator can control which networks are available as the default network. + Using Multiple Guest Networks + In zones that use advanced networking, additional networks for guest traffic may be added at any time after the initial installation. You can also customize the domain name associated with the network by specifying a DNS suffix for each network. + A VM's networks are defined at VM creation time. A VM cannot add or remove networks after it has been created, although the user can go into the guest and remove the IP address from the NIC on a particular network. + Each VM has just one default network. The virtual router's DHCP reply will set the guest's default gateway as that for the default network. Multiple non-default networks may be added to a guest in addition to the single, required default network. The administrator can control which networks are available as the default network. Additional networks can either be available to all accounts or be assigned to a specific account. Networks that are available to all accounts are zone-wide. Any user with access to the zone can create a VM with access to that network. These zone-wide networks provide little or no isolation between guests.Networks that are assigned to a specific account provide strong isolation. diff --git a/docs/en-US/using-sshkeys.xml b/docs/en-US/using-sshkeys.xml index 1e98eb699ad..cd10d68470a 100644 --- a/docs/en-US/using-sshkeys.xml +++ b/docs/en-US/using-sshkeys.xml @@ -102,4 +102,11 @@ KfEEuzcCUIxtJYTahJ1pvlFkQ8anpuxjSEDp8x/18bq3 ssh -i ~/.ssh/keypair-doc <ip address> The -i parameter tells the ssh client to use a ssh key found at ~/.ssh/keypair-doc.
+
+ Resetting SSH Keys + With the API command resetSSHKeyForVirtualMachine, a user can set or reset the SSH keypair + assigned to a virtual machine. A lost or compromised SSH keypair + can be changed, and the user can access the VM by using the new keypair. Just create or register a + new keypair, then call resetSSHKeyForVirtualMachine. +
diff --git a/docs/en-US/vcenter-maintenance-mode.xml b/docs/en-US/vcenter-maintenance-mode.xml index fb896b2b166..d36dd7cdb44 100644 --- a/docs/en-US/vcenter-maintenance-mode.xml +++ b/docs/en-US/vcenter-maintenance-mode.xml @@ -5,23 +5,22 @@ ]> -
vCenter and Maintenance Mode To enter maintenance mode on a vCenter host, both vCenter and &PRODUCT; must be used in concert. &PRODUCT; and vCenter have separate maintenance modes that work closely together. @@ -36,6 +35,7 @@ This makes the host ready for &PRODUCT; to reactivate it. Then use &PRODUCT;'s administrator UI to cancel the &PRODUCT; maintenance mode When the host comes back online, the VMs that were migrated off of it may be migrated back to it manually and new VMs can be added. - + +
diff --git a/docs/en-US/verifying-source.xml b/docs/en-US/verifying-source.xml index f8bd102379d..b445aa4bd67 100644 --- a/docs/en-US/verifying-source.xml +++ b/docs/en-US/verifying-source.xml @@ -32,7 +32,7 @@ Getting the KEYS To enable you to verify the GPG signature, you will need to download the - KEYS + KEYS file. diff --git a/docs/en-US/virtual-router.xml b/docs/en-US/virtual-router.xml index 775d4740a91..c9b403b1e3e 100644 --- a/docs/en-US/virtual-router.xml +++ b/docs/en-US/virtual-router.xml @@ -5,25 +5,28 @@ ]>
Virtual Router The virtual router is a type of System Virtual Machine. The virtual router is one of the most frequently used service providers in &PRODUCT;. The end user has no direct access to the virtual router. Users can ping the virtual router and take actions that affect it (such as setting up port forwarding), but users do not have SSH access into the virtual router. - There is no mechanism for the administrator to log in to the virtual router. Virtual routers can be restarted by administrators, but this will interrupt public network access and other services for end users. A basic test in debugging networking issues is to attempt to ping the virtual router from a guest VM. Some of the characteristics of the virtual router are determined by its associated system service offering. + There is no mechanism for the administrator to log in to the virtual router. Virtual routers can be restarted by administrators, but this will interrupt public network access and other services for end users. A basic test in debugging networking issues is to attempt to ping the virtual router from a guest VM. Some of the characteristics of the virtual router are determined by its associated system service offering.. + + +
diff --git a/docs/en-US/vm-lifecycle.xml b/docs/en-US/vm-lifecycle.xml index ce09b0d04e9..15d9f7df590 100644 --- a/docs/en-US/vm-lifecycle.xml +++ b/docs/en-US/vm-lifecycle.xml @@ -5,38 +5,39 @@ ]>
- VM Lifecycle - Virtual machines can be in the following states: - - - - + VM Lifecycle + Virtual machines can be in the following states: + + + + basic-deployment.png: Basic two-machine &PRODUCT; deployment - - Once a virtual machine is destroyed, it cannot be recovered. All the resources used by the virtual machine will be reclaimed by the system. This includes the virtual machine’s IP address. - A stop will attempt to gracefully shut down the operating system, which typically involves terminating all the running applications. If the operation system cannot be stopped, it will be forcefully terminated. This has the same effect as pulling the power cord to a physical machine. - A reboot is a stop followed by a start. - &PRODUCT; preserves the state of the virtual machine hard disk until the machine is destroyed. - A running virtual machine may fail because of hardware or network issues. A failed virtual machine is in the down state. - The system places the virtual machine into the down state if it does not receive the heartbeat from the hypervisor for three minutes. - The user can manually restart the virtual machine from the down state. - The system will start the virtual machine from the down state automatically if the virtual machine is marked as HA-enabled. + + Once a virtual machine is destroyed, it cannot be recovered. All the resources used by the virtual machine will be reclaimed by the system. This includes the virtual machine’s IP address. + A stop will attempt to gracefully shut down the operating system, which typically involves terminating all the running applications. If the operation system cannot be stopped, it will be forcefully terminated. This has the same effect as pulling the power cord to a physical machine. + A reboot is a stop followed by a start. + &PRODUCT; preserves the state of the virtual machine hard disk until the machine is destroyed. + A running virtual machine may fail because of hardware or network issues. A failed virtual machine is in the down state. + The system places the virtual machine into the down state if it does not receive the heartbeat from the hypervisor for three minutes. + The user can manually restart the virtual machine from the down state. + The system will start the virtual machine from the down state automatically if the virtual machine is marked as HA-enabled.
+ diff --git a/docs/en-US/vm-storage-migration.xml b/docs/en-US/vm-storage-migration.xml index 4b09ffdb220..7c3824b4817 100644 --- a/docs/en-US/vm-storage-migration.xml +++ b/docs/en-US/vm-storage-migration.xml @@ -5,29 +5,31 @@ ]> -
VM Storage Migration - Supported in XenServer, KVM, and VMware. - This procedure is different from moving disk volumes from one VM to another. See Detaching and Moving Volumes . - You can migrate a virtual machine’s root disk volume or any additional data disk volume from one storage pool to another in the same zone. - You can use the storage migration feature to achieve some commonly desired administration goals, such as balancing the load on storage pools and increasing the reliability of virtual machines by moving them away from any storage pool that is experiencing issues. + Supported in XenServer, KVM, and VMware. + This procedure is different from moving disk volumes from one VM to another. See Detaching and Moving Volumes . + + + You can migrate a virtual machine’s root disk volume or any additional data disk volume from one storage pool to another in the same zone. + You can use the storage migration feature to achieve some commonly desired administration goals, such as balancing the load on storage pools and increasing the reliability of virtual machines by moving them away from any storage pool that is experiencing issues. -
+ + diff --git a/docs/en-US/vmware-install.xml b/docs/en-US/vmware-install.xml index 736b122fd0f..467e1358638 100644 --- a/docs/en-US/vmware-install.xml +++ b/docs/en-US/vmware-install.xml @@ -21,253 +21,313 @@ specific language governing permissions and limitations under the License. --> -
- VMware vSphere Installation and Configuration - If you want to use the VMware vSphere hypervisor to run guest virtual machines, install vSphere on the host(s) in your cloud. - -
+ VMware vSphere Installation and Configuration + If you want to use the VMware vSphere hypervisor to run guest virtual machines, install + vSphere on the host(s) in your cloud. + +
Preparation Checklist for VMware For a smoother installation, gather the following information before you start: - Information listed in - Information listed in + + Information listed in + + + Information listed in +
- vCenter Checklist - You will need the following information about vCenter. - + vCenter Checklist + You will need the following information about vCenter. + - - - - + + + + - vCenter Requirement - Value - Notes + vCenter Requirement + Value + Notes - - + + - vCenter User - - This user must have admin privileges. + vCenter User + + This user must have admin privileges. - vCenter User Password - - Password for the above user. + vCenter User Password + + Password for the above user. - vCenter Datacenter Name - - Name of the datacenter. + vCenter Datacenter Name + + Name of the datacenter. - vCenter Cluster Name - - Name of the cluster. + vCenter Cluster Name + + Name of the cluster. - + - +
- Networking Checklist for VMware - You will need the following information about VLAN. - + Networking Checklist for VMware + You will need the following information about VLAN. + - - - - + + + + - VLAN Information - Value - Notes + VLAN Information + Value + Notes - - + + - ESXi VLAN - - VLAN on which all your ESXi hypervisors reside. + ESXi VLAN + + VLAN on which all your ESXi hypervisors reside. - ESXI VLAN IP Address - - IP Address Range in the ESXi VLAN. One address per Virtual Router is used from this range. + ESXI VLAN IP Address + + IP Address Range in the ESXi VLAN. One address per Virtual Router is used + from this range. - ESXi VLAN IP Gateway - - + ESXi VLAN IP Gateway + + - ESXi VLAN Netmask - - + ESXi VLAN Netmask + + - Management Server VLAN - - VLAN on which the &PRODUCT; Management server is installed. + Management Server VLAN + + VLAN on which the &PRODUCT; Management server is + installed. - Public VLAN - - VLAN for the Public Network. + Public VLAN + + VLAN for the Public Network. - Public VLAN Gateway - - + Public VLAN Gateway + + - Public VLAN Netmask - - + Public VLAN Netmask + + - Public VLAN IP Address Range - - Range of Public IP Addresses available for &PRODUCT; use. These addresses will be used for virtual router on &PRODUCT; to route private traffic to external networks. + Public VLAN IP Address Range + + Range of Public IP Addresses available for &PRODUCT; use. These addresses + will be used for virtual router on &PRODUCT; to route private traffic to external + networks. - VLAN Range for Customer use - - A contiguous range of non-routable VLANs. One VLAN will be assigned for each customer. + VLAN Range for Customer use + + A contiguous range of non-routable VLANs. One VLAN will be assigned for + each customer. - + - +
-
-
+
+
vSphere Installation Steps - If you haven't already, you'll need to download and purchase vSphere from the VMware Website (https://www.vmware.com/tryvmware/index.php?p=vmware-vsphere&lp=1) and install it by following the VMware vSphere Installation Guide. - - Following installation, perform the following configuration, which are described in the next few sections: + + If you haven't already, you'll need to download and purchase vSphere from the VMware + Website (https://www.vmware.com/tryvmware/index.php?p=vmware-vsphere&lp=1) and + install it by following the VMware vSphere Installation Guide. + + + Following installation, perform the following configuration, which are described in + the next few sections: - - - + + + - + Required Optional - + - + ESXi host setup NIC bonding - - - Configure host physical networking, virtual switch, vCenter Management Network, and extended port range + + + Configure host physical networking, virtual switch, vCenter Management + Network, and extended port range Multipath storage - - + + Prepare storage for iSCSI - - - - Configure clusters in vCenter and add hosts to them, or add hosts without clusters to vCenter - - + + + + Configure clusters in vCenter and add hosts to them, or add hosts + without clusters to vCenter + + - + - + -
-
+
+
ESXi Host setup - All ESXi hosts should enable CPU hardware virtualization support in BIOS. Please note hardware virtualization support is not enabled by default on most servers. -
-
+ All ESXi hosts should enable CPU hardware virtualization support in BIOS. Please note + hardware virtualization support is not enabled by default on most servers. +
+
Physical Host Networking - You should have a plan for cabling the vSphere hosts. Proper network configuration is required before adding a vSphere host to &PRODUCT;. To configure an ESXi host, you can use vClient to add it as standalone host to vCenter first. Once you see the host appearing in the vCenter inventory tree, click the host node in the inventory tree, and navigate to the Configuration tab. + You should have a plan for cabling the vSphere hosts. Proper network configuration is + required before adding a vSphere host to &PRODUCT;. To configure an ESXi host, you can use + vClient to add it as standalone host to vCenter first. Once you see the host appearing in the + vCenter inventory tree, click the host node in the inventory tree, and navigate to the + Configuration tab. - + - - + + vsphereclient.png: vSphere client - + - In the host configuration tab, click the "Hardware/Networking" link to bring up the networking configuration page as above. -
- Configure Virtual Switch - A default virtual switch vSwitch0 is created. &PRODUCT; requires all ESXi hosts in the cloud to use the same set of virtual switch names. If you change the default virtual switch name, you will need to configure one or more &PRODUCT; configuration variables as well. -
+ In the host configuration tab, click the "Hardware/Networking" link to bring up + the networking configuration page as above. +
+ Configure Virtual Switch + A default virtual switch vSwitch0 is created. &PRODUCT; requires all ESXi hosts in the + cloud to use the same set of virtual switch names. If you change the default virtual switch + name, you will need to configure one or more &PRODUCT; configuration variables as + well. +
Separating Traffic - &PRODUCT; allows you to use vCenter to configure three separate networks per ESXi host. These networks are identified by the name of the vSwitch they are connected to. The allowed networks for configuration are public (for traffic to/from the public internet), guest (for guest-guest traffic), and private (for management and usually storage traffic). You can use the default virtual switch for all three, or create one or two other vSwitches for those traffic types. - If you want to separate traffic in this way you should first create and configure vSwitches in vCenter according to the vCenter instructions. Take note of the vSwitch names you have used for each traffic type. You will configure &PRODUCT; to use these vSwitches. -
-
+ &PRODUCT; allows you to use vCenter to configure three separate networks per ESXi + host. These networks are identified by the name of the vSwitch they are connected to. The + allowed networks for configuration are public (for traffic to/from the public internet), + guest (for guest-guest traffic), and private (for management and usually storage traffic). + You can use the default virtual switch for all three, or create one or two other vSwitches + for those traffic types. + If you want to separate traffic in this way you should first create and configure + vSwitches in vCenter according to the vCenter instructions. Take note of the vSwitch names + you have used for each traffic type. You will configure &PRODUCT; to use these + vSwitches. +
+
Increasing Ports - By default a virtual switch on ESXi hosts is created with 56 ports. We recommend setting it to 4088, the maximum number of ports allowed. To do that, click the "Properties..." link for virtual switch (note this is not the Properties link for Networking). + By default a virtual switch on ESXi hosts is created with 56 ports. We recommend + setting it to 4088, the maximum number of ports allowed. To do that, click the + "Properties..." link for virtual switch (note this is not the Properties link + for Networking). - + - - + + vsphereclient.png: vSphere client - + - In vSwitch properties dialog, select the vSwitch and click Edit. You should see the following dialog: + In vSwitch properties dialog, select the vSwitch and click Edit. You should see the + following dialog: - + - - + + vsphereclient.png: vSphere client - + - In this dialog, you can change the number of switch ports. After you've done that, ESXi hosts are required to reboot in order for the setting to take effect. -
+ In this dialog, you can change the number of switch ports. After you've done + that, ESXi hosts are required to reboot in order for the setting to take effect. +
- Configure vCenter Management Network - In the vSwitch properties dialog box, you may see a vCenter management network. This same network will also be used as the &PRODUCT; management network. &PRODUCT; requires the vCenter management network to be configured properly. Select the management network item in the dialog, then click Edit. - + Configure vCenter Management Network + In the vSwitch properties dialog box, you may see a vCenter management network. This + same network will also be used as the &PRODUCT; management network. &PRODUCT; requires the + vCenter management network to be configured properly. Select the management network item in + the dialog, then click Edit. + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - - Make sure the following values are set: - - VLAN ID set to the desired ID - vMotion enabled. - Management traffic enabled. - - If the ESXi hosts have multiple VMKernel ports, and ESXi is not using the default value "Management Network" as the management network name, you must follow these guidelines to configure the management network port group so that &PRODUCT; can find it: - - Use one label for the management network port across all ESXi hosts. - In the &PRODUCT; UI, go to Configuration - Global Settings and set vmware.management.portgroup to the management network label from the ESXi hosts. - + + Make sure the following values are set: + + + VLAN ID set to the desired ID + + + vMotion enabled. + + + Management traffic enabled. + + + If the ESXi hosts have multiple VMKernel ports, and ESXi is not using the default value + "Management Network" as the management network name, you must follow these + guidelines to configure the management network port group so that &PRODUCT; can find + it: + + + Use one label for the management network port across all ESXi hosts. + + + In the &PRODUCT; UI, go to Configuration - Global Settings and set + vmware.management.portgroup to the management network label from the ESXi hosts. + +
- Extend Port Range for &PRODUCT; Console Proxy - (Applies only to VMware vSphere version 4.x) - You need to extend the range of firewall ports that the console proxy works with on the hosts. This is to enable the console proxy to work with VMware-based VMs. The default additional port range is 59000-60000. To extend the port range, log in to the VMware ESX service console on each host and run the following commands: - + Extend Port Range for &PRODUCT; Console Proxy + (Applies only to VMware vSphere version 4.x) + You need to extend the range of firewall ports that the console proxy works with on the + hosts. This is to enable the console proxy to work with VMware-based VMs. The default + additional port range is 59000-60000. To extend the port range, log in to the VMware ESX + service console on each host and run the following commands: + esxcfg-firewall -o 59000-60000,tcp,in,vncextras esxcfg-firewall -o 59000-60000,tcp,out,vncextras
- Configure NIC Bonding for vSphere - NIC bonding on vSphere hosts may be done according to the vSphere installation guide. + Configure NIC Bonding for vSphere + NIC bonding on vSphere hosts may be done according to the vSphere installation + guide.
-
- -
+
Storage Preparation for vSphere (iSCSI only) - Use of iSCSI requires preparatory work in vCenter. You must add an iSCSI target and create an iSCSI datastore. + Use of iSCSI requires preparatory work in vCenter. You must add an iSCSI target and create + an iSCSI datastore. If you are using NFS, skip this section.
- Enable iSCSI initiator for ESXi hosts - + Enable iSCSI initiator for ESXi hosts + - In vCenter, go to hosts and Clusters/Configuration, and click Storage Adapters link. You will see: - + In vCenter, go to hosts and Clusters/Configuration, and click Storage Adapters link. + You will see: + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - + - Select iSCSI software adapter and click Properties. - + Select iSCSI software adapter and click Properties. + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - + - Click the Configure... button. - + Click the Configure... button. + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - + - Check Enabled to enable the initiator. - Click OK to save. - + + Check Enabled to enable the initiator. + + + Click OK to save. + +
- Add iSCSI target - Under the properties dialog, add the iSCSI target info: - + Add iSCSI target + Under the properties dialog, add the iSCSI target info: + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - - Repeat these steps for all ESXi hosts in the cluster. + + Repeat these steps for all ESXi hosts in the cluster.
- Create an iSCSI datastore - You should now create a VMFS datastore. Follow these steps to do so: - - Select Home/Inventory/Datastores. - Right click on the datacenter node. - Choose Add Datastore... command. - Follow the wizard to create a iSCSI datastore. - - This procedure should be done on one host in the cluster. It is not necessary to do this on all hosts. - + Create an iSCSI datastore + You should now create a VMFS datastore. Follow these steps to do so: + + + Select Home/Inventory/Datastores. + + + Right click on the datacenter node. + + + Choose Add Datastore... command. + + + Follow the wizard to create a iSCSI datastore. + + + This procedure should be done on one host in the cluster. It is not necessary to do this + on all hosts. + - + - vsphereclient.png: vSphere client + vsphereclient.png: vSphere client - +
- Multipathing for vSphere (Optional) - Storage multipathing on vSphere nodes may be done according to the vSphere installation guide. + Multipathing for vSphere (Optional) + Storage multipathing on vSphere nodes may be done according to the vSphere installation + guide.
-
-
+
+
Add Hosts or Configure Clusters (vSphere) - Use vCenter to create a vCenter cluster and add your desired hosts to the cluster. You will later add the entire cluster to &PRODUCT;. (see ). -
+ Use vCenter to create a vCenter cluster and add your desired hosts to the cluster. You + will later add the entire cluster to &PRODUCT;. (see ). +
+
+ Applying Hotfixes to a VMware vSphere Host + + + Disconnect the VMware vSphere cluster from &PRODUCT;. It should remain disconnected + long enough to apply the hotfix on the host. + + + Log in to the &PRODUCT; UI as root. + See . + + + Navigate to the VMware cluster, click Actions, and select Unmanage. + + + Watch the cluster status until it shows Unmanaged. + + + + + Perform the following on each of the ESXi hosts in the cluster: + + + Move each of the ESXi hosts in the cluster to maintenance mode. + + + Ensure that all the VMs are migrated to other hosts in that cluster. + + + If there is only one host in that cluster, shutdown all the VMs and move the host + into maintenance mode. + + + Apply the patch on the ESXi host. + + + Restart the host if prompted. + + + Cancel the maintenance mode on the host. + + + + + Reconnect the cluster to &PRODUCT;: + + + Log in to the &PRODUCT; UI as root. + + + Navigate to the VMware cluster, click Actions, and select Manage. + + + Watch the status to see that all the hosts come up. It might take several minutes + for the hosts to come up. + Alternatively, verify the host state is properly synchronized and updated in the + &PRODUCT; database. + + + + +
diff --git a/docs/en-US/vmx-settings-dev.xml b/docs/en-US/vmx-settings-dev.xml new file mode 100644 index 00000000000..a0fdf7f7825 --- /dev/null +++ b/docs/en-US/vmx-settings-dev.xml @@ -0,0 +1,40 @@ + + +%BOOK_ENTITIES; +]> + +
+ Additional VMX Settings + A VMX (.vmx) file is the primary configuration file for a virtual machine. When a new VM is + created, information on the operating system, disk sizes, and networking is stored in this file. + The VM actively writes to its .vmx file for all the configuration changes. The VMX file is + typically located in the directory where the VM is created. In Windows Vista / Windows 7 / + Windows Server 2008, the default location is C:\Users\<your_user_name>\My + Documents\Virtual Machines\<virtual_machine_name>.vmx. In Linux, vmware-cmd -l lists the + full path to all the registered VMX files. Any manual additions to the .vmx file from ESX/ESXi + are overwritten by the entries stored in the vCenter Server database. Therefore, before you edit + a .vmx file, first remove the VM from the vCenter server's inventory and register the VM again + after editing. + The CloudStack API that supports passing some of the VMX settings is registerTemplate. The + supported parameters are rootDiskController, nicAdapter, and keyboard. In addition to these + existing VMX parameters, you can now use the keyboard.typematicMinDelay parameter in the + registerTemplate API call. This parameter controls the amount of delay for the repeated key + strokes on remote consoles. For more information on keyboard.typematicMinDelay, see keyboard.typematicMinDelay. +
diff --git a/docs/en-US/vpc.xml b/docs/en-US/vpc.xml index cfa5fe1dd02..0665d372b4e 100644 --- a/docs/en-US/vpc.xml +++ b/docs/en-US/vpc.xml @@ -180,4 +180,4 @@ Remote access VPN is not supported in VPC networks. -
\ No newline at end of file +
diff --git a/docs/en-US/vpn.xml b/docs/en-US/vpn.xml index 724e4800f94..ccb3e861310 100644 --- a/docs/en-US/vpn.xml +++ b/docs/en-US/vpn.xml @@ -5,33 +5,41 @@ ]> -
- VPN - &PRODUCT; account owners can create virtual private networks (VPN) to access their virtual machines. If the guest network is instantiated from a network offering that offers the Remote Access VPN service, the virtual router (based on the System VM) is used to provide the service. &PRODUCT; provides a L2TP-over-IPsec-based remote access VPN service to guest virtual networks. Since each network gets its own virtual router, VPNs are not shared across the networks. VPN clients native to Windows, Mac OS X and iOS can be used to connect to the guest networks. The account owner can create and manage users for their VPN. &PRODUCT; does not use its account database for this purpose but uses a separate table. The VPN user database is shared across all the VPNs created by the account owner. All VPN users get access to all VPNs created by the account owner. - Make sure that not all traffic goes through the VPN. That is, the route installed by the VPN should be only for the guest network and not for all traffic. - - Road Warrior / Remote Access. Users want to be able to connect securely from a home or office to a private network in the cloud. Typically, the IP address of the connecting client is dynamic and cannot be preconfigured on the VPN server. - Site to Site. In this scenario, two private subnets are connected over the public Internet with a secure VPN tunnel. The cloud user’s subnet (for example, an office network) is connected through a gateway to the network in the cloud. The address of the user’s gateway must be preconfigured on the VPN server in the cloud. Note that although L2TP-over-IPsec can be used to set up Site-to-Site VPNs, this is not the primary intent of this feature. - - - - - + VPN + &PRODUCT; account owners can create virtual private networks (VPN) to access their virtual machines. If the guest network is instantiated from a network offering that offers the Remote Access VPN service, the virtual router (based on the System VM) is used to provide the service. &PRODUCT; provides a L2TP-over-IPsec-based remote access VPN service to guest virtual networks. Since each network gets its own virtual router, VPNs are not shared across the networks. VPN clients native to Windows, Mac OS X and iOS can be used to connect to the guest networks. The account owner can create and manage users for their VPN. &PRODUCT; does not use its account database for this purpose but uses a separate table. The VPN user database is shared across all the VPNs created by the account owner. All VPN users get access to all VPNs created by the account owner. + Make sure that not all traffic goes through the VPN. That is, the route installed by the VPN should be only for the guest network and not for all traffic. + + + Road Warrior / Remote Access. Users want to be able to + connect securely from a home or office to a private network in the cloud. Typically, + the IP address of the connecting client is dynamic and cannot be preconfigured on + the VPN server. + Site to Site. In this scenario, two private subnets are + connected over the public Internet with a secure VPN tunnel. The cloud user’s subnet + (for example, an office network) is connected through a gateway to the network in + the cloud. The address of the user’s gateway must be preconfigured on the VPN server + in the cloud. Note that although L2TP-over-IPsec can be used to set up Site-to-Site + VPNs, this is not the primary intent of this feature. For more information, see + + + + +
diff --git a/docs/en-US/whats-new.xml b/docs/en-US/whats-new.xml index 77b3ec3df22..29ae1f68903 100644 --- a/docs/en-US/whats-new.xml +++ b/docs/en-US/whats-new.xml @@ -3,40 +3,45 @@ %BOOK_ENTITIES; ]> - - - What's New in the API? - The following describes any new major features of each &PRODUCT; version as it applies to API usage. -
- What's New in the API for 4.0 - - -
-
- What's New in the API for 3.0 - - - - - - -
+ What's New in the API? + The following describes any new major features of each &PRODUCT; version as it applies to + API usage. +
+ What's New in the API for 4.1 + + + + +
+
+ What's New in the API for 4.0 + + +
+
+ What's New in the API for 3.0 + + + + + + +
diff --git a/docs/en-US/windows-installation.xml b/docs/en-US/windows-installation.xml index 541f8ddd4e5..bcecc8071f6 100644 --- a/docs/en-US/windows-installation.xml +++ b/docs/en-US/windows-installation.xml @@ -5,25 +5,24 @@ ]> -
- Windows OS Installation + Windows OS Installation Download the installer, CloudInstanceManager.msi, from Download page and run the installer in the newly created Windows VM. diff --git a/docs/en-US/work-with-usage.xml b/docs/en-US/work-with-usage.xml index 939ba6378a4..00a7fb5df81 100644 --- a/docs/en-US/work-with-usage.xml +++ b/docs/en-US/work-with-usage.xml @@ -5,32 +5,32 @@ ]> - Working with Usage - The Usage Server is an optional, separately-installed part of &PRODUCT; that provides aggregated usage records which you can use to create billing integration for &PRODUCT;. The Usage Server works by taking data from the events log and creating summary usage records that you can access using the listUsageRecords API call. - The usage records show the amount of resources, such as VM run time or template storage - space, consumed by guest instances. - The Usage Server runs at least once per day. It can be configured to run multiple times per day. - - - - - - \ No newline at end of file + Working with Usage + The Usage Server is an optional, separately-installed part of &PRODUCT; that provides aggregated usage records which you can use to create billing integration for &PRODUCT;. The Usage Server works by taking data from the events log and creating summary usage records that you can access using the listUsageRecords API call. + The usage records show the amount of resources, such as VM run time or template storage + space, consumed by guest instances. + The Usage Server runs at least once per day. It can be configured to run multiple times per day. + + + + + + diff --git a/docs/en-US/working-with-documentation.xml b/docs/en-US/working-with-documentation.xml new file mode 100644 index 00000000000..67748427299 --- /dev/null +++ b/docs/en-US/working-with-documentation.xml @@ -0,0 +1,32 @@ + + +%BOOK_ENTITIES; +]> + + + + + Preparing and Building &PRODUCT; Documentation + This chapter describes how to install publican, how to write new documentation and build a guide as well as how to build a translated version of the documentation using transifex + + + + + diff --git a/docs/en-US/working-with-hosts.xml b/docs/en-US/working-with-hosts.xml index 4dcb8521ae2..83cd8b2bdc6 100644 --- a/docs/en-US/working-with-hosts.xml +++ b/docs/en-US/working-with-hosts.xml @@ -1,39 +1,39 @@ - %BOOK_ENTITIES; ]> - Working With Hosts -
- Adding Hosts + Working With Hosts +
+ Adding Hosts Additional hosts can be added at any time to provide more capacity for guest VMs. For requirements and instructions, see . -
- - - - - - - - - \ No newline at end of file +
+ + + + + + + + +
diff --git a/docs/en-US/working-with-iso.xml b/docs/en-US/working-with-iso.xml index efe5fb50e5e..03e18ee3535 100644 --- a/docs/en-US/working-with-iso.xml +++ b/docs/en-US/working-with-iso.xml @@ -5,29 +5,28 @@ ]> -
- Working with ISOs - &PRODUCT; supports ISOs and their attachment to guest VMs. An ISO is a read-only file that has an ISO/CD-ROM style file system. Users can upload their own ISOs and mount them on their guest VMs. - ISOs are uploaded based on a URL. HTTP is the supported protocol. Once the ISO is available via HTTP specify an upload URL such as http://my.web.server/filename.iso. - ISOs may be public or private, like templates.ISOs are not hypervisor-specific. That is, a guest on vSphere can mount the exact same image that a guest on KVM can mount. - ISO images may be stored in the system and made available with a privacy level similar to templates. ISO images are classified as either bootable or not bootable. A bootable ISO image is one that contains an OS image. &PRODUCT; allows a user to boot a guest VM off of an ISO image. Users can also attach ISO images to guest VMs. For example, this enables installing PV drivers into Windows. ISO images are not hypervisor-specific. + Working with ISOs + &PRODUCT; supports ISOs and their attachment to guest VMs. An ISO is a read-only file that has an ISO/CD-ROM style file system. Users can upload their own ISOs and mount them on their guest VMs. + ISOs are uploaded based on a URL. HTTP is the supported protocol. Once the ISO is available via HTTP specify an upload URL such as http://my.web.server/filename.iso. + ISOs may be public or private, like templates.ISOs are not hypervisor-specific. That is, a guest on vSphere can mount the exact same image that a guest on KVM can mount. + ISO images may be stored in the system and made available with a privacy level similar to templates. ISO images are classified as either bootable or not bootable. A bootable ISO image is one that contains an OS image. &PRODUCT; allows a user to boot a guest VM off of an ISO image. Users can also attach ISO images to guest VMs. For example, this enables installing PV drivers into Windows. ISO images are not hypervisor-specific. - +
diff --git a/docs/en-US/working-with-snapshots.xml b/docs/en-US/working-with-snapshots.xml index d6b145875d4..a381707e8f0 100644 --- a/docs/en-US/working-with-snapshots.xml +++ b/docs/en-US/working-with-snapshots.xml @@ -5,28 +5,28 @@ ]> -
- Working with Snapshots + Working with Snapshots (Supported for the following hypervisors: XenServer, VMware vSphere, and KVM) &PRODUCT; supports snapshots of disk volumes. Snapshots are a point-in-time capture of virtual machine disks. Memory and CPU states are not captured. Snapshots may be taken for volumes, including both root and data disks. The administrator places a limit on the number of stored snapshots per user. Users can create new volumes from the snapshot for recovery of particular files and they can create templates from snapshots to boot from a restored disk. - Users can create snapshots manually or by setting up automatic recurring snapshot policies. Users can also create disk volumes from snapshots, which may be attached to a VM like any other disk volume. Snapshots of both root disks and data disks are supported. However, &PRODUCT; does not currently support booting a VM from a recovered root disk. A disk recovered from snapshot of a root disk is treated as a regular data disk; the data on recovered disk can be accessed by attaching the disk to a VM. - A completed snapshot is copied from primary storage to secondary storage, where it is stored until deleted or purged by newer snapshot. + Users can create snapshots manually or by setting up automatic recurring snapshot policies. Users can also create disk volumes from snapshots, which may be attached to a VM like any other disk volume. Snapshots of both root disks and data disks are supported. However, &PRODUCT; does not currently support booting a VM from a recovered root disk. A disk recovered from snapshot of a root disk is treated as a regular data disk; the data on recovered disk can be accessed by attaching the disk to a VM. + A completed snapshot is copied from primary storage to secondary storage, where it is stored until deleted or purged by newer snapshot. +
diff --git a/docs/en-US/working-with-system-vm.xml b/docs/en-US/working-with-system-vm.xml index ed2bdcded41..70f7dd1aa4e 100644 --- a/docs/en-US/working-with-system-vm.xml +++ b/docs/en-US/working-with-system-vm.xml @@ -1,33 +1,39 @@ - %BOOK_ENTITIES; ]> - - Working with System Virtual Machines - &PRODUCT; uses several types of system virtual machines to perform tasks in the cloud. In general &PRODUCT; manages these system VMs and creates, starts, and stops them as needed based on scale and immediate needs. However, the administrator should be aware of them and their roles to assist in debugging issues. - - - - - - \ No newline at end of file + &PRODUCT; uses several types of system virtual machines to perform tasks in the cloud. In + general &PRODUCT; manages these system VMs and creates, starts, and stops them as needed based + on scale and immediate needs. However, the administrator should be aware of them and their roles + to assist in debugging issues. + + You can configure the system.vm.random.password parameter to create a random system VM + password to ensure higher security. If you reset the value for system.vm.random.password to + true and restart the Management Server, a random password is generated and stored encrypted in + the database. You can view the decrypted password under the system.vm.password global + parameter on the &PRODUCT; UI or by calling the listConfigurations API. + + + + + + + diff --git a/docs/en-US/working-with-templates.xml b/docs/en-US/working-with-templates.xml index a01c1814a21..9f4e7509d30 100644 --- a/docs/en-US/working-with-templates.xml +++ b/docs/en-US/working-with-templates.xml @@ -5,28 +5,28 @@ ]> - Working with Templates - A template is a reusable configuration for virtual machines. When users launch VMs, they can choose from a list of templates in &PRODUCT;. - Specifically, a template is a virtual disk image that includes one of a variety of operating systems, optional additional software such as office applications, and settings such as access control to determine who can use the template. Each template is associated with a particular type of hypervisor, which is specified when the template is added to &PRODUCT;. - &PRODUCT; ships with a default template. In order to present more choices to users, &PRODUCT; administrators and users can create templates and add them to &PRODUCT;. + Working with Templates + A template is a reusable configuration for virtual machines. When users launch VMs, they can choose from a list of templates in &PRODUCT;. + Specifically, a template is a virtual disk image that includes one of a variety of operating systems, optional additional software such as office applications, and settings such as access control to determine who can use the template. Each template is associated with a particular type of hypervisor, which is specified when the template is added to &PRODUCT;. + &PRODUCT; ships with a default template. In order to present more choices to users, &PRODUCT; administrators and users can create templates and add them to &PRODUCT;. diff --git a/docs/en-US/working-with-volumes.xml b/docs/en-US/working-with-volumes.xml index 117912015d2..ab567d2d0ca 100644 --- a/docs/en-US/working-with-volumes.xml +++ b/docs/en-US/working-with-volumes.xml @@ -5,21 +5,21 @@ ]>
@@ -46,3 +46,4 @@ type may not be used on a guest of another hypervisor type.
+ diff --git a/docs/en-US/writing-new-documentation.xml b/docs/en-US/writing-new-documentation.xml new file mode 100644 index 00000000000..340900e3c60 --- /dev/null +++ b/docs/en-US/writing-new-documentation.xml @@ -0,0 +1,100 @@ + + +%BOOK_ENTITIES; +]> + + + +
+ Writing &PRODUCT; Documentation + &PRODUCT; documentation is written in DocBook xml format. Each guide defined with a publican configuration file refers to a DocBook book. + These books are defined in xml files in docs/en-US, for instance if we look at the Developers guide, its configuration file contains: + + xml_lang: en-US + type: Book + docname: Developers_Guide + brand: cloudstack + chunk_first: 1 + chunk_section_depth: 1 + + The docname key gives you the basename of the DocBook file located in the en-US directory that contains the description of the book. + Looking closely at Developers_Guide.xml we see that it contains book tags and several references to other xml files. These are the chapters of the book, currently they are: + + + + + + + + + + + + + + ]]> + + All these xml files are written in DocBook format. + + DocBook format is well documented, refer to the documentation for any questions about DocBook tags + + When writing documentation, you therefore need to located the book,chapter and section of the content you want to write/correct. + Or create a new book,chapter,section. + You will then learn much more about DocBook tagging. In order to write this chapter about documentation, I added the working-with-documentation.xmlfile describing a chapter in the Developer book and I created several sections within that chapter like so: + + + Preparing and Building &PRODUCT; Documentation + This chapter describes how to install publican, how to write new documentation and build a guide as well as how to build a translated version of the documentation using transifex + + + + + + ]]> + + + Note the id witin the chapter tag, it represents the basename of the xml file describing the chapter. + For translation purposes it is important that this basename be less than 50 characters long. + + This chapter also refers to xml files which contains each section. While you could embed the sections directly in the chapter file and as a matter of fact also write the chapters within a single book file. Breaking things up in smaller files at the granularity of the section, allows us to re-use any section to build different books. + For completeness here is an example of a section: + + + Building &PRODUCT; Documentation + To build a specific guide, go to the source tree of the documentation in /docs and identify the guide you want to build. + Currenlty there are four guides plus the release notes, all defined in publican configuration files: + + publican-adminguide.cfg + publican-devguide.cfg + publican-installation.cfg + publican-plugin-niciranvp.cfg + publican-release-notes.cfg + + To build the Developer guide for example, do the following: + publican build --config=publican-devguide.cfg --formats=pdf --langs=en-US + A pdf file will be created in tmp/en-US/pdf, you may choose to build the guide in a different format like html. In that case just replace the format value. +
+ ]]> + + Happy Publicaning and DocBooking. +
diff --git a/docs/en-US/xenserver-maintenance-mode.xml b/docs/en-US/xenserver-maintenance-mode.xml index 4dfa43ebe05..b947278a9bb 100644 --- a/docs/en-US/xenserver-maintenance-mode.xml +++ b/docs/en-US/xenserver-maintenance-mode.xml @@ -5,23 +5,22 @@ ]> -
XenServer and Maintenance Mode For XenServer, you can take a server offline temporarily by using the Maintenance Mode feature in XenCenter. When you place a server into Maintenance Mode, all running VMs are automatically migrated from it to another host in the same pool. If the server is the pool master, a new master will also be selected for the pool. While a server is Maintenance Mode, you cannot create or start any VMs on it. @@ -31,10 +30,10 @@ Right-click, then click Enter Maintenance Mode on the shortcut menu. - On the Server menu, click Enter Maintenance Mode + On the Server menu, click Enter Maintenance Mode. - Click Enter Maintenance Mode + Click Enter Maintenance Mode. The server's status in the Resources pane shows when all running VMs have been successfully migrated off the server. To take a server out of Maintenance Mode: @@ -43,9 +42,10 @@ Right-click, then click Exit Maintenance Mode on the shortcut menu. - On the Server menu, click Exit Maintenance Mode + On the Server menu, click Exit Maintenance Mode. - Click Exit Maintenance Mode + Click Exit Maintenance Mode. +
diff --git a/docs/pot/Admin_Guide.pot b/docs/pot/Admin_Guide.pot new file mode 100644 index 00000000000..d3acd9b8e29 --- /dev/null +++ b/docs/pot/Admin_Guide.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Administrator's Guide" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Administration Guide for &PRODUCT;." +msgstr "" + diff --git a/docs/pot/Author_Group.pot b/docs/pot/Author_Group.pot new file mode 100644 index 00000000000..7e9c48f48bd --- /dev/null +++ b/docs/pot/Author_Group.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: firstname +#, no-c-format +msgid "Apache" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "CloudStack" +msgstr "" + diff --git a/docs/pot/Book_Info.pot b/docs/pot/Book_Info.pot new file mode 100644 index 00000000000..a2f07956e9c --- /dev/null +++ b/docs/pot/Book_Info.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Guide" +msgstr "" + +#. Tag: subtitle +#, no-c-format +msgid "Revised August 9, 2012 10:48 pm Pacific" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Complete technical documentation of &PRODUCT;." +msgstr "" + diff --git a/docs/pot/Book_Info_Release_Notes_4-0.pot b/docs/pot/Book_Info_Release_Notes_4-0.pot new file mode 100644 index 00000000000..ea3ff8bf1ca --- /dev/null +++ b/docs/pot/Book_Info_Release_Notes_4-0.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Version 4.0.0-incubating Release Notes" +msgstr "" + +#. Tag: subtitle +#, no-c-format +msgid "Revised October 17, 2012 19:49 UTC" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Release notes for the Apache CloudStack 4.0.0-incubating release." +msgstr "" + diff --git a/docs/pot/CloudStack_Nicira_NVP_Guide.pot b/docs/pot/CloudStack_Nicira_NVP_Guide.pot new file mode 100644 index 00000000000..5320c4b66a8 --- /dev/null +++ b/docs/pot/CloudStack_Nicira_NVP_Guide.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Plugin Guide for the Nicira NVP Plugin" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Plugin Guide for the Nicira NVP Plugin." +msgstr "" + diff --git a/docs/pot/Common_Content/Legal_Notice.pot b/docs/pot/Common_Content/Legal_Notice.pot new file mode 100644 index 00000000000..f059a2bc57f --- /dev/null +++ b/docs/pot/Common_Content/Legal_Notice.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: para +#, no-c-format +msgid "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" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://www.apache.org/licenses/LICENSE-2.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "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." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apache CloudStack is an effort undergoing incubation at The Apache Software Foundation (ASF)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "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." +msgstr "" + diff --git a/docs/pot/Developers_Guide.pot b/docs/pot/Developers_Guide.pot new file mode 100644 index 00000000000..c5706c2e7e6 --- /dev/null +++ b/docs/pot/Developers_Guide.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Developer's Guide" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This guide shows how to develop &PRODUCT;, use the API for operation and integration, access the usage data and use &PRODUCT; specific tools to ease development, testing and integration." +msgstr "" + diff --git a/docs/pot/Installation_Guide.pot b/docs/pot/Installation_Guide.pot new file mode 100644 index 00000000000..ee6bb9da0e2 --- /dev/null +++ b/docs/pot/Installation_Guide.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Installation Guide" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Installation Guide for &PRODUCT;." +msgstr "" + diff --git a/docs/pot/LDAPserver-for-user-authentication.pot b/docs/pot/LDAPserver-for-user-authentication.pot new file mode 100644 index 00000000000..fbac556906c --- /dev/null +++ b/docs/pot/LDAPserver-for-user-authentication.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using an LDAP Server for User Authentication" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can use an external LDAP server such as Microsoft Active Directory or ApacheDS to authenticate &PRODUCT; end-users. Just map &PRODUCT; accounts to the corresponding LDAP accounts using a query filter. The query filter is written using the query syntax of the particular LDAP server, and can include special wildcard characters provided by &PRODUCT; for matching common values such as the user’s email address and name. &PRODUCT; will search the external LDAP directory tree starting at a specified base directory and return the distinguished name (DN) and password of the matching user. This information along with the given password is used to authenticate the user.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up LDAP authentication in &PRODUCT;, call the &PRODUCT; API command ldapConfig and provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hostname or IP address and listening port of the LDAP server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Base directory and query filter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Search user DN credentials, which give &PRODUCT; permission to search on the LDAP server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSL keystore and password, if SSL is used" +msgstr "" + diff --git a/docs/pot/Preface.pot b/docs/pot/Preface.pot new file mode 100644 index 00000000000..0684f6ca3e2 --- /dev/null +++ b/docs/pot/Preface.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:55\n" +"PO-Revision-Date: 2013-02-02T20:11:55\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Preface" +msgstr "" + diff --git a/docs/pot/Release_Notes.pot b/docs/pot/Release_Notes.pot new file mode 100644 index 00000000000..e95dc9e5985 --- /dev/null +++ b/docs/pot/Release_Notes.pot @@ -0,0 +1,4478 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Submitting Feedback and Getting Help" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Apache CloudStack project has mailing lists for users and developers. These are the official channels of communication for the project and are the best way to get answers about using and contributing to CloudStack. It's a good idea to subscribe to the cloudstack-users mailing list if you've deployed or are deploying CloudStack into production, and even for test deployments." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The CloudStack developer's mailing list (cloudstack-dev) is for discussions about CloudStack development, and is the best list for discussing possible bugs in CloudStack. Anyone contributing to CloudStack should be on this mailing list." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can also report bugs in CloudStack using the Apache Defect Tracking System." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To posts to the lists, you'll need to be subscribed. See the CloudStack Web site for instructions." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Upgrade Instructions" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Upgrade from 3.0.2 to 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Perform the following to upgrade from version 3.0.2 to version 4.0.0-incubating. Note that some of the steps here are only required if you're using a specific hypervisor. The steps that are hypervisor-specific are called out with a note." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that you query your IP address usage records and process them or make a backup. During the upgrade you will lose the old IP address usage records." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Starting in 3.0.2, the usage record format for IP addresses is the same as the rest of the usage types. Instead of a single record with the assignment and release dates, separate records are generated per aggregation period with start and end dates. After upgrading, any existing IP address usage records in the old format will no longer be available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following upgrade instructions apply only if you're using VMware hosts. If you're not using VMware hosts, skip this step and move on to step 3: stopping all usage servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In each zone that includes VMware hosts, you need to add a new system VM template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While running the existing 3.0.2 system, log in to the UI as root administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select view, click Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Register template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Register template dialog box is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Register template dialog box, specify the following values (do not change these):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Field" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Value" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "systemvm-vmware-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the zone where this hypervisor is used" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OVA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Debian GNU/Linux 5.0 (32-bit)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extractable" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "no" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password Enabled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Featured" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the screen to be sure that the template downloads successfully and enters the READY state. Do not proceed until this is successful." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop all Usage Servers if running. Run this on all Usage Server hosts." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-usage stop" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the Management Servers. Run this on all Management Server hosts." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management stop" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the MySQL master, take a backup of the MySQL databases. We recommend performing this step even in test upgrades. If there is an issue, this will assist with debugging." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the following commands, it is assumed that you have set the root password on the database, which is a CloudStack recommended best practice. Substitute your own MySQL root password." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mysqldump -u root -pmysql_password cloud > cloud-backup.dmp\n" +"# mysqldump -u root -pmysql_password cloud_usage > cloud-usage-backup.dmp" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Either build RPM/DEB packages as detailed in the Installation Guide, or use one of the community provided yum/apt repositories to gain access to the &PRODUCT; binaries." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you have configured an appropriate yum or apt repository, you may execute the one of the following commands as appropriate for your environment in order to upgrade &PRODUCT;:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# yum update cloud-*" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# apt-get update\n" +"# apt-get upgrade cloud-*" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You will, of course, have to agree to the changes suggested by Yum or APT." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the upgrade output includes a message similar to the following, then some custom content was found in your old components.xml, and you need to merge the two files:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "warning: /etc/cloud/management/components.xml created as /etc/cloud/management/components.xml.rpmnew " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Instructions follow in the next step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have made changes to your copy of /etc/cloud/management/components.xml the changes will be preserved in the upgrade. However, you need to do the following steps to place these changes in a new version of the file which is compatible with version 4.0.0-incubating." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make a backup copy of /etc/cloud/management/components.xml. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mv /etc/cloud/management/components.xml /etc/cloud/management/components.xml-backup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy /etc/cloud/management/components.xml.rpmnew to create a new /etc/cloud/management/components.xml:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cp -ap /etc/cloud/management/components.xml.rpmnew /etc/cloud/management/components.xml" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Merge your changes from the backup file into the new components.xml." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/cloud/management/components.xml" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have more than one management server node, repeat the upgrade steps on each node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the first Management Server. Do not start any other Management Server nodes yet." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait until the databases are upgraded. Ensure that the database upgrade is complete. After confirmation, start the other Management Servers one at a time by running the same command on each node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Failing to restart the Management Server indicates a problem in the upgrade. Having the Management Server restarted without any issues indicates that the upgrade is successfully completed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start all Usage Servers (if they were running on your previous version). Perform this on each Usage Server host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# service cloud-usage start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional steps are required for each KVM host. These steps will not affect running guests in the cloud. These steps are required only for clouds using KVM as hosts and only on the KVM hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure a yum or apt respository containing the &PRODUCT; packages as outlined in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the running agent." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# service cloud-agent stop" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Update the agent software with one of the following command sets as appropriate for your environment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# yum update cloud-*" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# apt-get update" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# apt-get upgrade cloud-*" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the agent." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-agent start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit /etc/cloud/agent/agent.properties to change the resource parameter from \"com.cloud.agent.resource.computing.LibvirtComputingResource\" to \"com.cloud.hypervisor.kvm.resource.LibvirtComputingResource\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the cloud agent and cloud management services." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the Management Server is up and running, log in to the CloudStack UI and restart the virtual router for proper functioning of all the features." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the CloudStack UI as administrator, and check the status of the hosts. All hosts should come to Up state (except those that you know to be offline). You may need to wait 20 or 30 minutes, depending on the number of hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Troubleshooting: If login fails, clear your browser cache and reload the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not proceed to the next step until the hosts show in Up state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are upgrading from 3.0.2, perform the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the admin port is set to 8096 by using the \"integration.api.port\" global parameter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This port is used by the cloud-sysvmadm script at the end of the upgrade procedure. For information about how to set this parameter, see \"Setting Global Configuration Parameters\" in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you don't want the admin port to remain open, you can set it to null after the upgrade is done and restart the management server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the cloud-sysvmadm script to stop, then start, all Secondary Storage VMs, Console Proxy VMs, and virtual routers. Run the script once on each management server. Substitute your own IP address of the MySQL instance, the MySQL user to connect as, and the password to use for that user. In addition to those parameters, provide the -c and -r arguments. For example:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# nohup cloud-sysvmadm -d 192.168.1.5 -u cloud -p password -c -r > sysvm.log 2>&1 &" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# tail -f sysvm.log" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This might take up to an hour or more to run, depending on the number of accounts in the system." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If needed, upgrade all Citrix XenServer hypervisor hosts in your cloud to a version supported by CloudStack 4.0.0-incubating. The supported versions are XenServer 5.6 SP2 and 6.0.2. Instructions for upgrade can be found in the CloudStack 4.0.0-incubating Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now apply the XenServer hotfix XS602E003 (and any other needed hotfixes) to XenServer v6.0.2 hypervisor hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disconnect the XenServer cluster from CloudStack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar of the CloudStack UI, select Infrastructure. Under Clusters, click View All. Select the XenServer cluster and click Actions - Unmanage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This may fail if there are hosts not in one of the states Up, Down, Disconnected, or Alert. You may need to fix that before unmanaging this cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait until the status of the cluster has reached Unmanaged. Use the CloudStack UI to check on the status. When the cluster is in the unmanaged state, there is no connection to the hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To clean up the VLAN, log in to one XenServer host and run:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/cloud-clean-vlan.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now prepare the upgrade by running the following on one XenServer host:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/cloud-prepare-upgrade.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you see a message like \"can't eject CD\", log in to the VM and unmount the CD, then run this script again." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upload the hotfix to the XenServer hosts. Always start with the Xen pool master, then the slaves. Using your favorite file copy utility (e.g. WinSCP), copy the hotfixes to the host. Place them in a temporary folder such as /tmp." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Xen pool master, upload the hotfix with this command:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "xe patch-upload file-name=XS602E003.xsupdate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make a note of the output from this command, which is a UUID for the hotfix file. You'll need it in another step later." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) If you are applying other hotfixes as well, you can repeat the commands in this section with the appropriate hotfix number. For example, XS602E004.xsupdate." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Manually live migrate all VMs on this host to another host. First, get a list of the VMs on this host:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# xe vm-list" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then use this command to migrate each VM. Replace the example host name and VM name with your own:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# xe vm-migrate live=true host=host-name vm=VM-name" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Troubleshooting" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you see a message like \"You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected,\" run:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/make_migratable.sh b6cf79c8-02ee-050b-922f-49583d9f1a14." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apply the hotfix. First, get the UUID of this host:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe host-list" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then use the following command to apply the hotfix. Replace the example host UUID with the current host ID, and replace the hotfix UUID with the output from the patch-upload command you ran on this machine earlier. You can also get the hotfix UUID by running xe patch-list." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "xe patch-apply host-uuid=host-uuid uuid=hotfix-uuid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the following files from the CloudStack Management Server to the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy from here..." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "...to here" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/sm/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Only for hotfixes XS602E005 and XS602E007) You need to apply a new Cloud Support Pack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download the CSP software onto the XenServer host from one of the following links:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For hotfix XS602E005: http://coltrane.eng.hq.xensource.com/release/XenServer-6.x/XS-6.0.2/hotfixes/XS602E005/56710/xe-phase-2/xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For hotfix XS602E007: http://coltrane.eng.hq.xensource.com/release/XenServer-6.x/XS-6.0.2/hotfixes/XS602E007/57824/xe-phase-2/xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extract the file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# tar xf xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe-install-supplemental-pack xenserver-cloud-supp.iso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the XenServer host is part of a zone that uses basic networking, disable Open vSwitch (OVS):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe-switch-network-backend bridge" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reboot this XenServer host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the message \"mv: cannot stat `/etc/cron.daily/logrotate': No such file or directory\" appears, you can safely ignore it." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "for pbd in `xe pbd-list currently-attached=false| grep ^uuid | awk '{print $NF}'`; do xe pbd-plug uuid=$pbd ; " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On each slave host in the Xen pool, repeat these steps, starting from \"manually live migrate VMs.\"" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Troubleshooting Tip" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If passwords which you know to be valid appear not to work after upgrade, or other UI issues are seen, try clearing your browser cache and reloading the UI page." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Upgrade from 2.2.14 to 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that you query your IPaddress usage records and process them; for example, issue invoices for any usage that you have not yet billed users for." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Starting in 3.0.2, the usage record format for IP addresses is the same as the rest of the usage types. Instead of a single record with the assignment and release dates, separate records are generated per aggregation period with start and end dates. After upgrading to 4.0.0-incubating, any existing IP address usage records in the old format will no longer be available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using version 2.2.0 - 2.2.13, first upgrade to 2.2.14 by using the instructions in the 2.2.14 Release Notes." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "KVM Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If KVM hypervisor is used in your cloud, be sure you completed the step to insert a valid username and password into the host_details table on each KVM node as described in the 2.2.14 Release Notes. This step is critical, as the database will be encrypted after the upgrade to 4.0.0-incubating." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While running the 2.2.14 system, log in to the UI as root administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Using the UI, add a new System VM template for each hypervisor type that is used in your cloud. In each zone, add a system VM template for each hypervisor used in that zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Register template dialog box, specify the following values depending on the hypervisor type (do not change these):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: systemvm-xenserver-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: systemvm-xenserver-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL: http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone: Choose the zone where this hypervisor is used" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor: XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format: VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type: Debian GNU/Linux 5.0 (32-bit)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extractable: no" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password Enabled: no" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public: no" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Featured: no" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: systemvm-kvm-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: systemvm-kvm-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL: http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor: KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format: QCOW2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: systemvm-vmware-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: systemvm-vmware-3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL: http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor: VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format: OVA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the screen to be sure that the template downloads successfully and enters the READY state. Do not proceed until this is successful" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "WARNING: If you use more than one type of hypervisor in your cloud, be sure you have repeated these steps to download the system VM template for each hypervisor type. Otherwise, the upgrade will fail." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mysqldump -u root -pmysql_password cloud > cloud-backup.dmp\n" +"# mysqldump -u root -pmysql_password cloud_usage > cloud-usage-backup.dmp\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have made changes to your existing copy of the file components.xml in your previous-version CloudStack installation, the changes will be preserved in the upgrade. However, you need to do the following steps to place these changes in a new version of the file which is compatible with version 4.0.0-incubating." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How will you know whether you need to do this? If the upgrade output in the previous step included a message like the following, then some custom content was found in your old components.xml, and you need to merge the two files:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make a backup copy of your /etc/cloud/management/components.xml file. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mv /etc/cloud/management/components.xml /etc/cloud/management/components.xml-backup" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cp -ap /etc/cloud/management/components.xml.rpmnew /etc/cloud/management/components.xml" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Merge your changes from the backup file into the new components.xml file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/cloud/management/components.xml\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have made changes to your existing copy of the /etc/cloud/management/db.properties file in your previous-version CloudStack installation, the changes will be preserved in the upgrade. However, you need to do the following steps to place these changes in a new version of the file which is compatible with version 4.0.0-incubating." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make a backup copy of your file /etc/cloud/management/db.properties. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mv /etc/cloud/management/db.properties /etc/cloud/management/db.properties-backup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy /etc/cloud/management/db.properties.rpmnew to create a new /etc/cloud/management/db.properties:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cp -ap /etc/cloud/management/db.properties.rpmnew etc/cloud/management/db.properties" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Merge your changes from the backup file into the new db.properties file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/cloud/management/db.properties" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the management server node, run the following command. It is recommended that you use the command-line flags to provide your own encryption keys. See Password and Key Encryption in the Installation Guide." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cloud-setup-encryption -e encryption_type -m management_server_key -k database_key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When used without arguments, as in the following example, the default encryption type and keys will be used:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For encryption_type, use file or web to indicate the technique used to pass in the database encryption password. Default: file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For management_server_key, substitute the default key that is used to encrypt confidential parameters in the properties file. Default: password. It is highly recommended that you replace this with a more secure value" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For database_key, substitute the default key that is used to encrypt confidential parameters in the CloudStack database. Default: password. It is highly recommended that you replace this with a more secure value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat steps 10 - 14 on every management server node. If you provided your own encryption key in step 14, use the same key on all other management servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait until the databases are upgraded. Ensure that the database upgrade is complete. You should see a message like \"Complete! Done.\" After confirmation, start the other Management Servers one at a time by running the same command on each node." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-usage start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(KVM only) Additional steps are required for each KVM host. These steps will not affect running guests in the cloud. These steps are required only for clouds using KVM as hosts and only on the KVM hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure your CloudStack package repositories as outlined in the Installation Guide" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-agent stop" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Update the agent software with one of the following command sets as appropriate." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" # apt-get update\n" +"# apt-get upgrade cloud-*\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the contents of the agent.properties file to the new agent.properties file by using the following command" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sed -i 's/com.cloud.agent.resource.computing.LibvirtComputingResource/com.cloud.hypervisor.kvm.resource.LibvirtComputingResource/g' /etc/cloud/agent/agent.properties" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the CloudStack UI as admin, and check the status of the hosts. All hosts should come to Up state (except those that you know to be offline). You may need to wait 20 or 30 minutes, depending on the number of hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not proceed to the next step until the hosts show in the Up state. If the hosts do not come to the Up state, contact support." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following script to stop, then start, all Secondary Storage VMs, Console Proxy VMs, and virtual routers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the command once on one management server. Substitute your own IP address of the MySQL instance, the MySQL user to connect as, and the password to use for that user. In addition to those parameters, provide the \"-c\" and \"-r\" arguments. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# nohup cloud-sysvmadm -d 192.168.1.5 -u cloud -p password -c -r > sysvm.log 2>&1 &\n" +"# tail -f sysvm.log" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the script terminates, check the log to verify correct execution:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# tail -f sysvm.log" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The content should be like the following:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"Stopping and starting 1 secondary storage vm(s)...\n" +"Done stopping and starting secondary storage vm(s)\n" +"Stopping and starting 1 console proxy vm(s)...\n" +"Done stopping and starting console proxy vm(s).\n" +"Stopping and starting 4 running routing vm(s)...\n" +"Done restarting router(s).\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you would like additional confirmation that the new system VM templates were correctly applied when these system VMs were rebooted, SSH into the System VM and check the version." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use one of the following techniques, depending on the hypervisor." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "XenServer or KVM:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSH in by using the link local IP address of the system VM. For example, in the command below, substitute your own path to the private key used to log in to the system VM and your own link local IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following commands on the XenServer or KVM host on which the system VM is present:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ssh -i private-key-path link-local-ip -p 3922\n" +"# cat /etc/cloudstack-release" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The output should be like the following:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "Cloudstack Release 4.0.0-incubating Mon Oct 9 15:10:04 PST 2012" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "ESXi" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSH in using the private IP address of the system VM. For example, in the command below, substitute your own path to the private key used to log in to the system VM and your own private IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following commands on the Management Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ssh -i private-key-path private-ip -p 3922\n" +"# cat /etc/cloudstack-release\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apply the XenServer hotfix XS602E003 (and any other needed hotfixes) to XenServer v6.0.2 hypervisor hosts." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/opt/xensource/bin/cloud-clean-vlan.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the upgrade by running the following on one XenServer host:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/opt/xensource/bin/cloud-prepare-upgrade.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you see a message like \"can't eject CD\", log in to the VM and umount the CD, then run this script again." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upload the hotfix to the XenServer hosts. Always start with the Xen pool master, then the slaves. Using your favorite file copy utility (e.g. WinSCP), copy the hotfixes to the host. Place them in a temporary folder such as /root or /tmp." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "xe patch-upload file-name=XS602E003.xsupdate" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe vm-list" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe vm-migrate live=true host=host-name vm=VM-name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# xe host-list" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "xe patch-apply host-uuid=host-uuid uuid=hotfix-uuid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/sm/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# tar xf xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# xe-install-supplemental-pack xenserver-cloud-supp.iso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# xe-switch-network-backend bridge" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "for pbd in `xe pbd-list currently-attached=false| grep ^uuid | awk '{print $NF}'`; do xe pbd-plug uuid=$pbd ; " +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Version 4.0.0-incubating" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "What’s New in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apache CloudStack 4.0.0-incubating includes the following new features:" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Inter-VLAN Routing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Inter-VLAN Routing is the capability to route network traffic between VLANs. This feature enables you to set up Virtual Private Clouds (VPC) that can hold multi-tier applications. These tiers are deployed on different VLANs that can communicate with each other. You can provision VLANs to the tiers your create, and VMs can be deployed on different tiers, such as Web, Application, or Database. The VLANs are connected to a virtual router, which facilitates communication between the VMs. In effect, you can segment VMs by means of VLANs into different networks that can host multi-tier applications. Such segmentation by means of VLANs logically separate application VMs for higher security and lower broadcasts, while remaining physically connected to the same device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This feature is supported on XenServer and VMware hypervisors." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A Site-to-Site VPN connection helps you establish a secure connection from an enterprise datacenter to the cloud infrastructure. This allows users to access the guest VMs by establishing a VPN connection to the virtual router of the account from a device in the datacenter of the enterprise. Having this facility eliminates the need to establish VPN connections to individual VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The supported endpoints on the remote datacenters are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cisco ISR with IOS 12.4 or later" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Juniper J-Series routers with JunOS 9.5 or later" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Local Storage Support for Data Volumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can now create data volumes on local storage. The data volume is placed on the same XenServer host as the VM instance that is attached to the data volume. These local data volumes can be attached to virtual machines, detached, re-attached, and deleted just as with the other types of data volume. In earlier releases of CloudStack, only the root disk could be placed in local storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Local storage is ideal for scenarios where persistence of data volumes and HA is not required. Some of the benefits include reduced disk I/O latency and cost reduction from using inexpensive local disks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order for local volumes to be used, the feature must be enabled for the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can create a data disk offering for local storage. When a user creates a new VM, they can select this disk offering in order to cause the data disk volume to be placed in local storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can not migrate a VM that has a volume in local storage to a different host, nor migrate the volume itself away to a different host. If you want to put a host into maintenance mode, you must first stop any VMs with local data volumes on that host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Local storage support for volumes is available for XenServer, KVM, and VMware hypervisors." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A tag is a key-value pair that stores metadata about a resource in the cloud. Tags are useful for categorizing resources. For example, you can tag a user VM with a value that indicates the user's city of residence. In this case, the key would be \"city\" and the value might be \"Toronto\" or \"Tokyo.\" You can then request CloudStack to find all resources that have a given tag; for example, VMs for users in a given city." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can tag a user virtual machine, volume, snapshot, guest network, template, ISO, firewall rule, port forwarding rule, public IP address, security group, load balancer rule, project, VPC, network ACL, or static route. You can not tag a remote access VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can work with tags through the UI or through the new API commands createTags, deleteTags, and listTags. You can define multiple tags for each resource. There is no limit on the number of tags you can define. Each tag can be up to 255 characters long. Users can define tags on the resources they own, and administrators can define tags on any resources in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new optional input parameter, \"tags,\" has been added to many of the list* API commands. The following example shows how to use this new parameter to find all the volumes having tag region=canada OR tag city=Toronto:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=listVolumes\n" +"&listAll=true\n" +"&tags[0].key=region\n" +"&tags[0].value=canada\n" +"&tags[1].key=city\n" +"&tags[1].value=Toronto" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following API commands have the new \"tags\" input parameter:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVirtualMachines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVolumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSnapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTemplates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listIsos" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listFirewallRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPortForwardingRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPublicIpAddresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSecurityGroups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLoadBalancerRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listStaticRoutes" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "AWS API Changes for Tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Some changes have been made to the Amazon Web Services API compatibility support in order to accommodate the new tagging feature." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New APIs:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ec2-create-tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add tags to one or more resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ec2-delete-tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remove tags from one or more resources." +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Show currently defined tags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Changed APIs:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Changed API" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-images" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Output now shows tags defined for each image." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ec2-describe-instances" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following filters can now be passed in to limit the output result set: tag-key, tag-value and tag:key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ec2-describe-snapshots" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-volumes" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Secure Console Access on XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With the addition of Secure Console feature, users can now securely access the VM consoles on the XenServer hypervisor. You can either SSH or use the View Console option in the Management Server to securely connect to the VMs on the XenServer host. The Management Server uses the xapi API to stream the VM consoles. However, there is no change in the way you can access the console of a VM. This feature is supported on XenServer 5.6 and 6.0 versions." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Stopped VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This release supports creating VMs without starting them on the backend. You can determine whether the VM needs to be started as part of the VM deployment. A VM can be deployed in two ways: create and start a VM (the default method); create a VM and leave it in the stopped state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new request parameter, startVM, is introduced in the deployVm API to support the stopped VM feature. The possible values are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "true - The VM starts as a part of the VM deployment" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "false - The VM is left in stopped state at the end of the VM deployment" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Uploading an Existing Volume to a Virtual Machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Existing data can now be made accessible to a virtual machine. This is called uploading a volume to the VM. For example, this is useful to upload data from a local file system and attach it to a VM. Root administrators, domain administrators, and end users can all upload existing volumes to VMs. The upload is performed by using HTTP. The uploaded volume is placed in the zone's secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This functionality is supported for the following hypervisors:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor : Disk Image Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer : VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware : OVA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM : QCOW2" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Dedicated High-Availability Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "One or more hosts can now be designated for use only by high-availability (HA) enabled VMs that are restarted due to a host failure. Setting up a pool of such dedicated HA hosts as the recovery destination for all HA-enabled VMs make it easier to determine which VMs are restarted as part of the high-availability function. You can designate a host as a dedicated-HA restart node only if the Dedicated HA Hosts feature is enabled by setting the appropriate global configuration parameter." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Support for Amazon Web Services API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This release supports Amazon Web Services APIs, including Elastic Compute Cloud (EC2) API. Fidelity with the EC2 API and the installation experience for this functionality are both enhanced. In prior releases, users were required to install a separate component called CloudBridge, in addition to installing the Management Server. For new installations of CloudStack 4.0.0-incubating, this software is installed automatically along with CloudStack and runs in a more closely integrated fashion. The feature is disabled by default, but can be easily enabled by setting the appropriate global configuration parameter and performing a few setup steps." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "The Nicira NVP Plugin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Nicira NVP plug-in allows CloudStack to use the Nicira solution for virtualized network as a provider for CloudStack networks and services. In CloudStack 4.0.0-incubating this plug-in supports the Connectivity service. This service is responsible for creating Layer 2 networks supporting the networks created by guests. When a tenant creates a new network, instead of a traditional VLAN, a logical network will be created by sending the appropriate calls to the Nicira NVP Controller. The plug-in has been tested with Nicira NVP versions 2.1.0, 2.2.0 and 2.2.1." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Support for CAStor Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 4.0.0-incubating supports using a CAStor cluster as the back-end storage system for a CloudStack S3 front-end. The CAStor back-end storage for CloudStack extends the existing storage classes and allows the storage configuration attribute to point to a CAStor cluster. This feature makes use of the CloudStack server's local disk to spool files before writing them to CAStor when handling the PUT operations. However, a file must be successfully written into the CAStor cluster prior to the return of a success code to the S3 client to ensure that the transaction outcome is correctly reported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The S3 multipart file upload is not supported in this release. You are prompted with proper error message if a multipart upload is attempted." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Clustered Logical Volume Manager Support for KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This release adds Clustered Logical Volume Manager (CLVM) storage support for KVM hosts. With this support, you can use CLVM as primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The CLVM support for KVM allows root and data disks (primary storage) to reside on Linux logical volumes. The administrators are required to configure CLVM on the KVM hosts independent of CloudStack. When the volume groups are available, an administrator can simply add primary storage of type CLVM, providing the volume group name. Then CloudStack creates and manages logical volumes as needed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CLVM also supports Snapshots. CloudStack creates an LVM snapshot, copy the applicable logical volume to the secondary storage in the qcow2 format, and then delete the LVM snapshot." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Rados Block Device Support for KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can now use Rados Block Device (RBD) to run instances on Apache CloudStack 4.0.0-incubating. This can be done by adding a RBD pool as primary storage. Before using RBD, ensure that Qemu is compiled with RBD enabled, and the libvirt version is at least 0.10 with RBD enabled on the KVM host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a disk offering for RBD so that you can ensure that StoragePoolAllocator chooses the RBD pool to deploy instances." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Issues Fixed in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many bugs include a defect number that reflects the bug number that was held in the bug tracker run by Citrix (bugs.cloudstack.org). The Apache CloudStack project now uses Jira to manage its bugs, so some of the bugs that are referenced here may not be available to view. However, we are still including them for completeness." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Defect" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere 5.0 now has GA support. Formerly only Beta support was provided." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16135" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Creating volumes after upgrading from snapshot taken in 2.2.14 no longer deletes the snapshot physically from the secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16122" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a site-to-site VPN setup, alerts are generated when the VPC virtual router is rebooted with multiple vpn connections." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16022" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If host connection fails due to a database error, host now disconnects and the Managerment Server id is removed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16011" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name of network offering is no longer truncated due to too-narrow field width in Add Guest Network dialog box." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15978" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the virtual router and its host go down, the high availability mechanism now works for the virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15921" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The 2.2.x security group script now accounts for the VMs created in the version 2.1 timeframe." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15919" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A level parameter is added to the listVolumes command; therefore queries return the response more quickly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15904" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upgrade from version 2.2.14 to CloudStack-3.0.5-0.2944-rhel5 works as expected. The upgrade script, /usr/share/cloud/setup/db/schema-2214to30-cleanup.sql, works as expected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15879" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The database upgrade from version 3.0.4 to 3.0.5 works as expected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15807" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network label for OVM now available in UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15779" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the thumbnail is requested, the console session will not be terminated." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15778" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fetching a VM thumbnail now gets a thumbnail of appropriate visual dimensions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15734" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM Snapshots no longer shows incorrect disk usage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15733" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The domainId parameter for the listNetworks command now lists the resources belonging to the domain specified." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15676" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stopping the router no longer fails with the null pointer exception." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15648" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If creating a volume from a snapshot fails, the error is reported on the UI but the volume is stuck in the creating state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15646" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createFirewallRule API no longer causes null pointer exception." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15628" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a KVM host, the high availability mechanism no longer takes a long time to migrate VMs to another KVM host if there are multiple storage pools." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15627" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Metadata instance-id and vm-id for existing VMs stays the same after upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15621" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Solved difficulty with allocating disk volumes when running multiple VM deployment in parallel." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15603" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack now stop the VMs when destroyVM command is called." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15586" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Vlan for an account no longer fails if multiple physical networks are present." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15582" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The dns-name filter is now supported for ec2-describe-instances in the Amazon Web Services API compatibility commands. The filter maps to the name of a user VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15503" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An IP address which has static NAT rules can now be released. Subsequently, restarting this network after it was shutdown can succeed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15464" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Can now delete static route whose state is set to Revoke." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15443" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Creating a firewall rule no longer fails with an internal server error." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15398" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Corrected technique for programming DNS on the user VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15356" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Internal DNS 2 entry now correctly shown in UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15335" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The CloudBridge S3 Engine now connects to the database by using the deciphered password in the db.properties file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15318" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UI now correctly prevents the user from stopping a VM that is in the Starting state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15307" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fixed Japanese localization of instance statuses in the Instances menu." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15278" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The deployment planner no longer takes long time to locate a suitable host to deploy VMs when large number of clusters are present." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15274" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Creating a VLAN range using Zone ID without network ID now succeeds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15243" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now check to be sure source NAT and VPN have same provider." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15232" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that networks using external load balancer/firewall in 2.2.14 or earlier can properly upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15200" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "No exception when trying to attach the same volume while attaching the first volume is in progress." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15173" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional cluster can no longer be added with same VSM IP address as another cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15167" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "AWS API calls now honor the admin account's ability to view or act on the resources owned by the regular users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15163" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The minimum limit is not honored when there is not enough capacity to deploy all the VMs and the ec2-run-instances command with the -n >n1 -n2> option is used to deploy multiple VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15157" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Can now add/enable service providers for multiple physical networks through the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15145" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "AWS API call ec2-register has better error handling for negative cases." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15122" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Filters now supported for AWS API call ec2-describe-availability-zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15120" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Actions column in UI of Volume page now shows action links." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15099" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Buttons no longer overlap text on Account Deletion confirmation page in UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15095" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensures you can not create a VM with a CPU frequency greater than the host CPU frequency." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15094" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU cap now set properly in VMware." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15077" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NullPointerException is no longer observed while executing the command to list the public IP in a basic zone created with the default shared NetScaler EIP and ELB network offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15044" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UI now provides option to view the list of instances which are part of the guest network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15026" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UI in Deploy VM dialog now lists only templates or ISOs depending on which is selected in previous dialog." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14989" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In KVM, the Create Instance wizard now shows only templates from the current (KVM) zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14986, CS-14985" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Listing filters works as expected in the ec2-describe-volumes and ec2-describe-snapshots commands." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14964" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Automatically starting the Console Proxy no longer fails due to its missing volume on the primary storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14907" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User is now correctly prevented from trying to download an uploaded volume which has not yet been moved to primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14879" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a user VM is stopped or terminated, the static NAT associated with this VM is now disabled. This public IP address is no longer owned by this account and can be associated to any other user VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14854" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Only the admin user can change the template permission to Public, so this option is removed from the UI for domain Admins and regular Users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14817" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While checking if network has any external provider, CloudStack will consider all providers in the network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14796" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When deploying a VM with ec2-run-instances, userdata is now encoded." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14770" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The API returns the keypair information when a VM is deployed with sshkey. This affects the API commands related to virtual machines (deployVirtualMachine, listVirtualMachines, ... *VirtualMachine), as well as the corresponding AWS APIs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14724" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UI no longer displays the dropdown list of isolation method choices if sdn.ovs.controller is false." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14345" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Logout API returns XML header." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host IPs now associated with appropriate IPs according to traffic type." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14253" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Can now delete and re-create port forwarding rule on same firewall." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14452" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Data disk volumes are now automatically copied from one cluster to another." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13539" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Windows VM can get IP after reboot." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13537" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When user tries to delete a domain that contains sub-domains, an error message is now sent to convey the reason for the delete failure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13153" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System VMs support HTTP proxy." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12642" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Added Close button to Select Project list view popup in UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12510" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deleting and reinserting host_details no longer causes deadlocks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12407" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "F5 and Netscaler - when dedicated is selected, capacity field is disabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12111" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Email validation for edit user form." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-10928" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network read/write values now always positive numbers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15376, CS-15373" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The AWS APIs (EC2 and S3) now listen on the 7080 port and send request to CloudStack on the 8080 port just as any other clients of CloudStack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13944" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The CloudStack 2.2.x to 3.0.x database upgrade for multiple physical networks is now supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15300" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The admin accounts of a domain now honour the limits imposed on that domain just like the regular accounts do. A domain admin now is not allowed to create an unlimited number of instances, volumes, snapshots, and so on." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15396" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The CloudStack database now contain the UUD information after the 2.2.14 to 3.0.4 upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15450" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upgrade from 2.2.14 to 3.0.4 no longer fails on a VMware host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15449" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Running cloudstack-aws-api-register no longer fails with the \"User registration failed with error: [Errno 113] No route to host\" error." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15455" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The iptable rules are configured to open the awsapi port (7080) as part of the installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15429" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While creating an instance with data volume, disk offering also is considered while checking the account limit on volume resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15414" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the 2.2.14 to 3.0.4 upgrade, the value of the global parameter xen.guest.network.device is now decrypted before setting the traffic label." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15382" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "During 2.2.14 to 3.0.4 upgrade, the hosts no longer go to the Alert state if destroyed networks existed with non-existent tags prior to upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15323" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack supports the following Citrix XenServer hotfixes: XS602E003, XS602E004, and XS602E005." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15430" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create snapshot now fails if creating a snapshot exceeds the snapshot resource limit for a domain admin or a user account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14256" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual Router no longer remains in starting state for subdomain or user on a KVM 3.0.1 prerlease host on RHEL 6.2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-7495" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Implemented a variety of Xen management host improvements." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-8105" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS v4 for primary storage now works as expected on KVM hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-9989" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The error messages returned during VM deployment failure will have much more details than before." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12584" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can no longer add security groups not supported by the hypervisor in use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12705" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When creating a Network offering by using SRX as the service provider for SourceNAT servcies, an option is given in the CloudStack UI now to set the source_nat type to \"per Zone\"/\"per account\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12782" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Assigning a VM from Basic to Advanced zone no longer ignores the network ID. A warning message is displayed for VM movements across zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12591" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Broadcast Address on the Second Public IP NIC is now corrected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13272" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a user is deleted, all the associated properties, such as IPs and virtual routers, are now deleted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13377" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Creating template from a root disk of a stopped instance now provides an option to make it a \"Featured template\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13500" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reaching the first guest VM by using its public IP from the second guest VM no longer fails." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13853" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default gateway can no longer be 0.0.0.0 in the Secondary Storage VM (SSVM)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13863" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The queryAsyncJobResult command in XML format now returns the correct UUIDs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13867" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Corrected CSP xenserver-cloud-supp.tgz for XenServer 5.6 and 6.0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13904" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Labels and values for the service offerings CPU and memory are now consistent." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13998" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The SSVM kernel panic issue is fixed on XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14090" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The issue is fixed where running the VMware snapshots randomly fails with the ArrayIndexOutOfBoundsException error." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14021" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The java.lang.OutOfMemoryError is fixed on the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14025" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Python Eggs are provided to easily package the test client for each branch of CloudStack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14068" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Resetting the VM password through the CloudStack UI no longer causes any error." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14156" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The pod which has the administrator's virtual router is no longer selected while creating the virtual routers for guests." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14182" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The users can now delete their ISOs as normal users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14185" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The listOSTypes API now filters out the types of operating system by using the keywords." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14204" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The cloud-setup-bonding.sh command no longer generates the \"command not found\" error." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14214" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Specify VLAN option cannot be enabled now for an isolated Network offering with SourceNAT enabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14234" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Sending project invite email to an account now requires SMTP configured in CloudStack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14237" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The garbage collector of the primary storage no longer fails when the first host in the cluster is not up." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14241" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Custom Volume Disk Offering is now matching the Global configuration value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14270" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The listNetworks API no longer assumes that the broadcast type is always VLAN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14319" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The internal name of the VM is no longer present in the error message that is displayed to a domain administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14321" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The listVolumes API call now returns a valid value for the isExtractable parameter for the ISO-derived disk and data disk volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14323" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Invalid API calls will now give valid response in json/xml format." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14339" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Custom Disk Size will now allow values larger than 100GB." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14357" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The ConsoleProxyLoadReportCommand is no longer fired continuously." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14421" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fixed the issue of virtual router deployments. The DHCP entries can now be assigned to the router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14555" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unzipped downloaded template MD5SUM will no longer override the zipped template MD5SUM in the database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14598" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The complete screen of the running VM is now displayed in the console proxy." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14600" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Windows or Linux based consoles are no longer lost upon rebooting VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14784" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multiple subnets with the same VLAN now work as expected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13303, 14874, 13897, 13944, 14088, 14190" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A variety of upgrade issues have been fixed in release 3.0.3." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15080" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Setting a private network on a VLAN for VMWare environment is now supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15168" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The console proxy now works as expected and no exception is shown in the log after upgrading from version 2.2.14 to 3.0.2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15172" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Version 3.0.2 now accepts the valid public key." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Known Issues in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Issue ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CLOUDSTACK-301" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Nexus 1000v DVS integration is not functional" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This source code release includes some partial functionality to support the Cisco Nexus 1000v Distributed Virtual Switch within a VMware hypervisor environment. The functionality is not complete at this time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CLOUDSTACK-368" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OVM - cannot create guest VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This source code release has regressed from the CloudStack 2.2.x code and is unable to support Oracle VM (OVM)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CLOUDSTACK-279" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deleting a project fails when executed by the regular user. This works as expected for root/domain admin. To workaround, perform either of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the account cleanup thread which will eventually complete the project deletion." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Execute the call as the root/domain admin on behalf of the regular user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16067" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The command=listTags&key=city command does not work as expected. The command does not return tags for the resources of the account with the tag, city" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16063" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The current values of volumes and snapshots are incorrect when using KVM as a host. To fix this, the database upgrade codes, volumes.size and snapshots.size, should be changed to show the virtual sizes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16058" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Null pointer Exception while deleting the host after moving the host to maintenance state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16045" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Only the root administrator can handle the API keys. The domain administrators are not allowed to create, delete, or retrieve API keys for the users in their domain." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16019" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CIDR list in the Add VPN Customer Gateway dialog does not prompt the user that they can provide a comma separated CIDRs if multiple CIDRs have to be supplied." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16015" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deleting a network is not supported when its network providers are disabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-16012" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unable to delete a zone in the UI because the necessary cleanup cannot be completed. When the hosts are removed, the expunge process fails to delete the volumes as no hosts are present to send the commands to. Therefore, the storage pool removal fails, and zone can't be cleaned and deleted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name of network offering might be truncated due to too-narrow field width in Add Guest Network dialog box." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15789" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Invalid global setting prevents management server to restart. For example, if you configure the \"project.invite.timeout\" parameter to \"300\" and attempt to restart management server, it fails without throwing a warning or setting the value to the default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15749" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restarting VPC is resulting in intermittent connection loss to the port forwarding and StaticNAT rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15690" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IpAssoc command failed as a part of starting the virtual router, but the final start result is reported as succes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15672, CS-15635" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The FQDN of the VM is not configured if it is deployed as a part of default shared network and isolated guest network (DefaultIsolatedNetworkOfferingWithSourceNatService)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15634" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The FQDN of a VM that is deployed as a part of both a shared network and default isolated guest network has the suffix of the shared network instead of the default isolated guest network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15576" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stopping a VM on XenServer creates a backlog of API commands. For example, the Attach volume calls become delayed while waiting for the stopVirtualMachine command to be executed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15569" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Misleading error message in the exception when creating a StaticNAT rule fails in a VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15566" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "External device such as Netscaler is not supported in VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15557" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Intermittent traffic loss in the VPN connection if Juniper is the remote router and the life time is 300 seconds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15361" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Egress rules are not working in NetScaler loadbalancer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15105" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The cloud-sysvmadm script does not work if the integration.api.port parameter is set to any port other than 8096." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15092" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Connecting to the guest VMs through SSH is extremely slow, and it results in connection timeout." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15037" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hairpin NAT is not supported when NetScaler is used for EIP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15009" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The port_profile table will not be populated with port profile information. In this release, CloudStack directly connects to the VSM for all the port profile operations; therefore, no port profile information is cached." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14939" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Adding a VMware cluster is not supported when the Management Network is migrated to the Distributed Virtual Switch environment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14780" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You are allowed to ping the elastic IP address of the VM even though no ingress rule is set that allows the ICMP protocol." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14756" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Installing KVM on RHEL 6.2 will result in unreliable network performance. Workaround: blacklist vhost-net. Edit /etc/modprobe.d/blacklist-kvm.conf and include vhost-net." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14346" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The UpdateVirtualMachine API call does not check whether the VM is stopped. Therefore, stop the VM manually before issuing this call." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14303 (was 14537)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP addresses for a shared network are still being consumed even if no services are defined for that network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14296 (was 14530)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OVM: Network traffic labels are not supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14291 (was 14523)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The EIP/ELB network offering for basic zones does not support multiple NetScalers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14275 (was 14506)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "F5: Unable to properly remove a F5 device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14201 (was 14430)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMWare: Template sizes are being reported different depending on whether the primary storage is using ISCSI or NFS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13758 (was 13963)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere: template download from templates created off of the root volume does not work properly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13733 (was 13935)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere: detaching an ISO from a restored VM instance fails." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13682 (was 13883)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multiple NetScalers are not supported in Basic Networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13599 (was 13359)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Programming F5/NetScaler rules can be better optimized." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13337 (was 13518)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Security Groups are not supported in Advanced Networking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-13173 (was 13336)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere: cross cluster volume migration does not work properly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12714 (was 12840)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Capacity view is not available for pods or clusters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-12624 (was 12741)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere: maintenance mode will not live migrate system VM to another host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15476" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The 2.2.14 to 4.0.0-incubating upgrade fails if multiple untagged physical networks exist before the upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15407" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the 2.2.14 to 4.0.0-incubating upgrade, VLAN allocation on multiple physical networks does not happen as expected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To workaround this issue, follow the instructions given below:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Revert to your 2.2.14 setup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop all the VMs with the isolated virtual networks in your cloud setup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run following query to find if any networks still have the NICs allocated:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check if any virtual guest networks have the NICs allocated:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#SELECT DISTINCT op.id from `cloud`.`op_networks` op JOIN `cloud`.`networks` n on op.id=n.id WHERE nics_count != 0 AND guest_type = 'Virtual'; " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If this returns any network IDs, then ensure the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VMs are stopped." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "No new VM is started." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shutdown the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remove the NICs count for the virtual network IDs returned in step (a), and set the NIC count to 0:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "UPDATE `cloud`.`op_networks` SET nics_count = 0 WHERE id = enter id of virtual network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server, and wait for all the networks to shut down." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Networks shutdown is determined by the network.gc.interval and network.gc.wait parameters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that all the networks are shut down and all the guest VNETs are free." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the upgrade script." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This allocates all your guest VNET ranges to the first physical network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By using the updatePhysicalNetwork API, reconfigure the VNET ranges for each physical network as desired." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start all the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-14680" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack and LDAP user validation cannot happen simultaneously because the user password is hashed and stored in the database, and LDAP requires the passwords in plain text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To work with the LDAP user, the MD5 hash should be disabled in the login process by commenting the following variable in sharedFunctions.js file available at /usr/share/cloud/management/webapps/client/scripts, and restart the cloud-management service." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "var md5HashedLogin = false;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "However, if md5HashedLogin is set to false, the end user can login with the LDAP credentials but not with the CloudStack user credentials." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CS-15130" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Data disk volumes are not automatically copied from one cluster to another." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "API Changes from 3.0.2 to 4.0.0-incubating" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "New API Commands in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createCounter (Adds metric counter)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteCounter (Deletes a counter)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listCounters (List the counters)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createCondition (Creates a condition)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteCondition (Removes a condition)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listConditions (List Conditions for the specific user)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createTags. Add tags to one or more resources. Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=createTags\n" +"&resourceIds=1,10,12\n" +"&resourceType=userVm\n" +"&tags[0].key=region\n" +"&tags[0].value=canada\n" +"&tags[1].key=city\n" +"&tags[1].value=Toronto" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteTags. Remove tags from one or more resources. Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=deleteTags\n" +"&resourceIds=1,12\n" +"&resourceType=Snapshot\n" +"&tags[0].key=city" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTags (Show currently defined resource tags)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVPC (Creates a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCs (Lists VPCs)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVPC (Deletes a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVPC (Updates a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restartVPC (Restarts a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVPCOffering (Creates VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVPCOffering (Updates VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVPCOffering (Deletes VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCOfferings (Lists VPC offerings)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createPrivateGateway (Creates a private gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPrivateGateways (List private gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deletePrivateGateway (Deletes a Private gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createNetworkACL (Creates a ACL rule the given network (the network has to belong to VPC))" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNetworkACL (Deletes a Network ACL)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkACLs (Lists all network ACLs)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createStaticRoute (Creates a static route)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteStaticRoute (Deletes a static route)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listStaticRoutes (Lists all static routes)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnCustomerGateway (Creates site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnGateway (Creates site to site vpn local gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnConnection (Create site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnCustomerGateway (Delete site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnGateway (Delete site to site vpn gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnConnection (Delete site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVpnCustomerGateway (Update site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "resetVpnConnection (Reset site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnCustomerGateways (Lists site to site vpn customer gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnGateways (Lists site 2 site vpn gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnConnections (Lists site to site vpn connection gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "markDefaultZoneForAccount (Marks a default zone for the current account)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "uploadVolume (Uploads a data disk)" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Changed API Commands in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "API Commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "copyTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "prepareTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "registerTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "activateProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "suspendProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjectAccounts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "migrateVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "attachVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "detachVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "uploadVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createSecurityGroup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "registerIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "copyIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createIpForwardingRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listIpForwardingRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createLoadBalancerRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateLoadBalancerRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createSnapshot" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have a single new response parameter, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many other commands also have the new tags(*) parameter in addition to other changes; those commands are listed separately." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rebootVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "attachIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "detachIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLoadBalancerRuleInstances" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "resetPasswordForVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "changeServiceForVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "recoverVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "migrateVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deployVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "assignVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restoreVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "stopVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "destroyVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have two new response parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: keypair, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have the following new parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: tags (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listF5LoadBalancerNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetscalerLoadBalancerNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSrxFirewallNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have three new response parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: canusefordeploy, vpcid, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createZone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateZone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: localstorageenabled (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: localstorageenabled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listZones" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rebootRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "changeServiceForRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "destroyRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "stopRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcid, nic(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "disableAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listAccounts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "markDefaultZoneForAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enableAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcavailable, vpclimit, vpctotal" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listRouters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: forvpc (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkOfferings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: forvpc (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: forvpc" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: details (optional), tags (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addTrafficMonitor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: excludezones (optional), includezones (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: tags (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcid, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: canusefordeploy (optional), forvpc (optional), tags (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restartNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enableStaticNat" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: networkid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createDiskOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: storagetype (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: storagetype" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listDiskOfferings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateDiskOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createFirewallRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Changed request parameters: ipaddressid (old version - optional, new version - required)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: isoid (optional), tags (optional), templateid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateStorageNetworkIpRange" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: id, endip, gateway, netmask, networkid, podid, startip, vlan, zoneid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "reconnectHost" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new response parameter is added: hahost." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addCluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following request parameters are added:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vsmipaddress (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vsmpassword (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vsmusername (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following parameter is made mandatory: podid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new response parameter is added: status" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "prepareHostForMaintenance" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addSecondaryStorage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new response parameter is added: defaultzoneid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "cancelHostMaintenance" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new response parameter is added: hahost" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addSwift" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSwifts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listExternalLoadBalancers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listCapabilities" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new response parameter is added: customdiskofferingmaxsize" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new request parameter is added: startvm (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteStoragePool" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new request parameter is added: forced (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addHost" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateHost" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listHosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new request parameter is added: hahost (optional)" +msgstr "" + diff --git a/docs/pot/Revision_History.pot b/docs/pot/Revision_History.pot new file mode 100644 index 00000000000..3f213ced877 --- /dev/null +++ b/docs/pot/Revision_History.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Revision History" +msgstr "" + +#. Tag: firstname +#, no-c-format +msgid "Jessica" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "Tomechak" +msgstr "" + +#. Tag: member +#, no-c-format +msgid "Initial creation of book by publican" +msgstr "" + diff --git a/docs/pot/Revision_History_Install_Guide.pot b/docs/pot/Revision_History_Install_Guide.pot new file mode 100644 index 00000000000..632f931b123 --- /dev/null +++ b/docs/pot/Revision_History_Install_Guide.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Revision History" +msgstr "" + +#. Tag: firstname +#, no-c-format +msgid "Jessica" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "Tomechak" +msgstr "" + +#. Tag: firstname +#, no-c-format +msgid "Radhika" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "PC" +msgstr "" + +#. Tag: firstname +#, no-c-format +msgid "Wido" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "den Hollander" +msgstr "" + +#. Tag: member +#, no-c-format +msgid "Initial publication" +msgstr "" + diff --git a/docs/pot/SSL-keystore-path-and-password.pot b/docs/pot/SSL-keystore-path-and-password.pot new file mode 100644 index 00000000000..54955c82243 --- /dev/null +++ b/docs/pot/SSL-keystore-path-and-password.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "SSL Keystore Path and Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the LDAP server requires SSL, you need to enable it in the ldapConfig command by setting the parameters ssl, truststore, and truststorepass. Before enabling SSL for ldapConfig, you need to get the certificate which the LDAP server is using and add it to a trusted keystore. You will need to know the path to the keystore and the password." +msgstr "" + diff --git a/docs/pot/VPN-user-usage-record-format.pot b/docs/pot/VPN-user-usage-record-format.pot new file mode 100644 index 00000000000..fd5669107a3 --- /dev/null +++ b/docs/pot/VPN-user-usage-record-format.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VPN User Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage – String representation of the usage, including the units of usage (e.g. 'Hrs' for hours)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – VPN user ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/about-clusters.pot b/docs/pot/about-clusters.pot new file mode 100644 index 00000000000..8247f2d16c4 --- /dev/null +++ b/docs/pot/about-clusters.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Clusters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A cluster provides a way to group hosts. To be precise, a cluster is a XenServer server pool, a set of KVM servers, , or a VMware cluster preconfigured in vCenter. The hosts in a cluster all have identical hardware, run the same hypervisor, are on the same subnet, and access the same shared primary storage. Virtual machine instances (VMs) can be live-migrated from one host to another within the same cluster, without interrupting service to the user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A cluster is the third-largest organizational unit within a &PRODUCT; deployment. Clusters are contained within pods, and pods are contained within zones. Size of the cluster is limited by the underlying hypervisor, although the &PRODUCT; recommends less in most cases; see Best Practices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A cluster consists of one or more hosts and one or more primary storage servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; allows multiple clusters in a cloud deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Even when local storage is used exclusively, clusters are still required organizationally, even if there is just one host per cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When VMware is used, every VMware cluster is managed by a vCenter server. Administrator must register the vCenter server with &PRODUCT;. There may be multiple vCenter servers per zone. Each vCenter server may manage multiple VMware clusters." +msgstr "" + diff --git a/docs/pot/about-hosts.pot b/docs/pot/about-hosts.pot new file mode 100644 index 00000000000..9a5e67c03cc --- /dev/null +++ b/docs/pot/about-hosts.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A host is a single computer. Hosts provide the computing resources that run the guest virtual machines. Each host has hypervisor software installed on it to manage the guest VMs. For example, a Linux KVM-enabled server, a Citrix XenServer server, and an ESXi server are hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host is the smallest organizational unit within a &PRODUCT; deployment. Hosts are contained within clusters, clusters are contained within pods, and pods are contained within zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts in a &PRODUCT; deployment:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the CPU, memory, storage, and networking resources needed to host the virtual machines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Interconnect using a high bandwidth TCP/IP network and connect to the Internet" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "May reside in multiple data centers across different geographic locations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "May have different capacities (different CPU speeds, different amounts of RAM, etc.), although the hosts within a cluster must all be homogeneous" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional hosts can be added at any time to provide more capacity for guest VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; automatically detects the amount of CPU and memory resources provided by the Hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts are not visible to the end user. An end user cannot determine which host their guest has been assigned to." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For a host to function in &PRODUCT;, you must do the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install hypervisor software on the host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Assign an IP address to the host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure the host is connected to the &PRODUCT; Management Server" +msgstr "" + diff --git a/docs/pot/about-password-encryption.pot b/docs/pot/about-password-encryption.pot new file mode 100644 index 00000000000..2219780d907 --- /dev/null +++ b/docs/pot/about-password-encryption.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Password and Key Encryption" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; stores several sensitive passwords and secret keys that are used to provide security. These values are always automatically encrypted:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Database secret key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Database password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSH keys" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Compute node root password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User API secret key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VNC password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses the Java Simplified Encryption (JASYPT) library. The data values are encrypted and decrypted using a database secret key, which is stored in one of &PRODUCT;’s internal properties files along with the database password. The other encrypted values listed above, such as SSH keys, are in the &PRODUCT; internal database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Of course, the database secret key itself can not be stored in the open – it must be encrypted. How then does &PRODUCT; read it? A second secret key must be provided from an external source during Management Server startup. This key can be provided in one of two ways: loaded from a file or provided by the &PRODUCT; administrator. The &PRODUCT; database has a new configuration setting that lets it know which of these methods will be used. If the encryption type is set to \"file,\" the key must be in a file in a known location. If the encryption type is set to \"web,\" the administrator runs the utility com.cloud.utils.crypt.EncryptionSecretKeySender, which relays the key to the Management Server over a known port." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The encryption type, database secret key, and Management Server secret key are set during &PRODUCT; installation. They are all parameters to the &PRODUCT; database setup script (cloud-setup-databases). The default values are file, password, and password. It is, of course, highly recommended that you change these to more secure keys." +msgstr "" + diff --git a/docs/pot/about-physical-networks.pot b/docs/pot/about-physical-networks.pot new file mode 100644 index 00000000000..734803c236c --- /dev/null +++ b/docs/pot/about-physical-networks.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Physical Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Part of adding a zone is setting up the physical network. One or (in an advanced zone) more physical networks can be associated with each zone. The network corresponds to a NIC on the hypervisor host. Each physical network can carry one or more types of network traffic. The choices of traffic type for each network vary depending on whether you are creating a zone with basic networking or advanced networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A physical network is the actual network hardware and wiring in a zone. A zone can have multiple physical networks. An administrator can:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add/Remove/Update physical networks in a zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure VLANs on the physical network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure a name so the network can be recognized by hypervisors" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the service providers (firewalls, load balancers, etc.) available on a physical network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the IP addresses trunked to a physical network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify what type of traffic is carried on the physical network, as well as other properties like network speed" +msgstr "" + diff --git a/docs/pot/about-pods.pot b/docs/pot/about-pods.pot new file mode 100644 index 00000000000..f80760c0654 --- /dev/null +++ b/docs/pot/about-pods.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Pods" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A pod often represents a single rack. Hosts in the same pod are in the same subnet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A pod is the second-largest organizational unit within a &PRODUCT; deployment. Pods are contained within zones. Each zone can contain one or more pods." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pods are not visible to the end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A pod consists of one or more clusters of hosts and one or more primary storage servers." +msgstr "" + diff --git a/docs/pot/about-primary-storage.pot b/docs/pot/about-primary-storage.pot new file mode 100644 index 00000000000..c2ba526788d --- /dev/null +++ b/docs/pot/about-primary-storage.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Primary storage is associated with a cluster, and it stores the disk volumes for all the VMs running on hosts in that cluster. You can add multiple primary storage servers to a cluster. At least one is required. It is typically located close to the hosts for increased performance." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; is designed to work with all standards-compliant iSCSI and NFS servers that are supported by the underlying hypervisor, including, for example:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Dell EqualLogicâ„¢ for iSCSI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Appliances filers for NFS and iSCSI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Scale Computing for NFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you intend to use only local disk for your installation, you can skip to Add Secondary Storage." +msgstr "" + diff --git a/docs/pot/about-secondary-storage.pot b/docs/pot/about-secondary-storage.pot new file mode 100644 index 00000000000..4543890df21 --- /dev/null +++ b/docs/pot/about-secondary-storage.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage is associated with a zone, and it stores the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Templates — OS images that can be used to boot VMs and can include additional configuration information, such as installed applications" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO images — disc images containing data or bootable media for operating systems" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk volume snapshots — saved copies of VM data which can be used for data recovery or to create new templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The items in zone-based NFS secondary storage are available to all hosts in the zone. &PRODUCT; manages the allocation of guest virtual disks to particular primary storage devices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To make items in secondary storage available to all hosts throughout the cloud, you can add OpenStack Object Storage (Swift, swift.openstack.org) in addition to the zone-based NFS secondary storage. When using Swift, you configure Swift storage for the entire &PRODUCT;, then set up NFS secondary storage for each zone as usual. The NFS storage in each zone acts as a staging area through which all templates and other secondary storage data pass before being forwarded to Swift. The Swift storage acts as a cloud-wide resource, making templates and other data available to any zone in the cloud. There is no hierarchy in the Swift storage, just one Swift container per storage object. Any secondary storage in the whole cloud can pull a container from Swift at need. It is not necessary to copy templates and snapshots from one zone to another, as would be required when using zone NFS alone. Everything is available everywhere." +msgstr "" + diff --git a/docs/pot/about-security-groups.pot b/docs/pot/about-security-groups.pot new file mode 100644 index 00000000000..2acdbb4b484 --- /dev/null +++ b/docs/pot/about-security-groups.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Security Groups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Security groups provide a way to isolate traffic to VMs. A security group is a group of VMs that filter their incoming and outgoing traffic according to a set of rules, called ingress and egress rules. These rules filter network traffic according to the IP address that is attempting to communicate with the VM. Security groups are particularly useful in zones that use basic networking, because there is a single guest network for all guest VMs. In &PRODUCT; 3.0.3 - 3.0.5, security groups are supported only in zones that use basic networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a zone that uses advanced networking, you can instead define multiple guest networks to isolate traffic to VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each &PRODUCT; account comes with a default security group that denies all inbound traffic and allows all outbound traffic. The default security group can be modified so that all new VMs inherit some other desired set of rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Any &PRODUCT; user can set up any number of additional security groups. When a new VM is launched, it is assigned to the default security group unless another user-defined security group is specified. A VM can be a member of any number of security groups. Once a VM is assigned to a security group, it remains in that group for its entire lifetime; you can not move a running VM from one security group to another." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can modify a security group by deleting or adding any number of ingress and egress rules. When you do, the new rules apply to all VMs in the group, whether running or stopped." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If no ingress rules are specified, then no traffic will be allowed in, except for responses to any traffic that has been allowed out through an egress rule." +msgstr "" + diff --git a/docs/pot/about-virtual-networks.pot b/docs/pot/about-virtual-networks.pot new file mode 100644 index 00000000000..7d396bf51e6 --- /dev/null +++ b/docs/pot/about-virtual-networks.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Virtual Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A virtual network is a logical construct that enables multi-tenancy on a single physical network. In &PRODUCT; a virtual network can be shared or isolated." +msgstr "" + diff --git a/docs/pot/about-working-with-vms.pot b/docs/pot/about-working-with-vms.pot new file mode 100644 index 00000000000..1b566121ba8 --- /dev/null +++ b/docs/pot/about-working-with-vms.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Working with Virtual Machines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides administrators with complete control over the lifecycle of all guest VMs executing in the cloud. &PRODUCT; provides several guest management operations for end users and administrators. VMs may be stopped, started, rebooted, and destroyed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest VMs have a name and group. VM names and groups are opaque to &PRODUCT; and are available for end users to organize their VMs. Each VM can have three names for use in different contexts. Only two of these names can be controlled by the user:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Instance name – a unique, immutable ID that is generated by &PRODUCT; and can not be modified by the user. This name conforms to the requirements in IETF RFC 1123." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Display name – the name displayed in the &PRODUCT; web UI. Can be set by the user. Defaults to instance name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name – host name that the DHCP server assigns to the VM. Can be set by the user. Defaults to instance name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest VMs can be configured to be Highly Available (HA). An HA-enabled VM is monitored by the system. If the system detects that the VM is down, it will attempt to restart the VM, possibly on a different host. For more information, see HA-Enabled Virtual Machines on" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each new VM is allocated one public IP address. When the VM is started, &PRODUCT; automatically creates a static NAT between this public IP address and the private IP address of the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If elastic IP is in use (with the NetScaler load balancer), the IP address initially allocated to the new VM is not marked as elastic. The user must replace the automatically configured IP with a specifically acquired elastic IP, and set up the static NAT mapping between this new IP and the guest VM’s private IP. The VM’s original IP address is then released and returned to the pool of available public IPs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; cannot distinguish a guest VM that was shut down by the user (such as with the “shutdown†command in Linux) from a VM that shut down unexpectedly. If an HA-enabled VM is shut down from inside the VM, &PRODUCT; will restart it. To shut down an HA-enabled VM, you must go through the &PRODUCT; UI or API." +msgstr "" + diff --git a/docs/pot/about-zones.pot b/docs/pot/about-zones.pot new file mode 100644 index 00000000000..c9111a7e484 --- /dev/null +++ b/docs/pot/about-zones.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Zones" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A zone is the largest organizational unit within a &PRODUCT; deployment. A zone typically corresponds to a single datacenter, although it is permissible to have multiple zones in a datacenter. The benefit of organizing infrastructure into zones is to provide physical isolation and redundancy. For example, each zone can have its own power supply and network uplink, and the zones can be widely separated geographically (though this is not required)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A zone consists of:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "One or more pods. Each pod contains one or more clusters of hosts and one or more primary storage servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage, which is shared by all the pods in the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zones are visible to the end user. When a user starts a guest VM, the user must select a zone for their guest. Users might also be required to copy their private templates to additional zones to enable creation of guest VMs using their templates in those zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zones can be public or private. Public zones are visible to all users. This means that any user may create a guest in that zone. Private zones are reserved for a specific domain. Only users in that domain or its subdomains may create guests in that zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts in the same zone are directly accessible to each other without having to go through a firewall. Hosts in different zones can access each other through statically configured VPN tunnels." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For each zone, the administrator must decide the following." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How many pods to place in a zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How many clusters to place in each pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How many hosts to place in each cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How many primary storage servers to place in each cluster and total capacity for the storage servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How much secondary storage to deploy in a zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you add a new zone, you will be prompted to configure the zone’s physical network and add the first pod, cluster, host, primary storage, and secondary storage." +msgstr "" + diff --git a/docs/pot/accept-membership-invite.pot b/docs/pot/accept-membership-invite.pot new file mode 100644 index 00000000000..977962aa115 --- /dev/null +++ b/docs/pot/accept-membership-invite.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Accepting a Membership Invitation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have received an invitation to join a &PRODUCT; project, and you want to accept the invitation, follow these steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Invitations." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you see the invitation listed onscreen, click the Accept button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Invitations listed on screen were sent to you using your &PRODUCT; account name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you received an email invitation, click the Enter Token button, and provide the project ID and unique ID code (token) from the email." +msgstr "" + diff --git a/docs/pot/accessing-vms.pot b/docs/pot/accessing-vms.pot new file mode 100644 index 00000000000..2ca92867a87 --- /dev/null +++ b/docs/pot/accessing-vms.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Accessing VMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Any user can access their own virtual machines. The administrator can access all VMs running in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To access a VM through the &PRODUCT; UI:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Instances, then click the name of a running VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the View Console button ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To access a VM directly over the network:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VM must have some port open to incoming traffic. For example, in a basic zone, a new VM might be assigned to a security group which allows incoming traffic. This depends on what security group you picked when creating the VM. In other cases, you can open a port by setting up a port forwarding policy. See IP Forwarding and Firewalling." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If a port is open but you can not access the VM using ssh, it’s possible that ssh is not already enabled on the VM. This will depend on whether ssh is enabled in the template you picked when creating the VM. Access the VM through the &PRODUCT; UI and enable ssh on the machine using the commands for the VM’s operating system." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the network has an external firewall device, you will need to create a firewall rule to allow access. See IP Forwarding and Firewalling." +msgstr "" + diff --git a/docs/pot/accounts-users-domains.pot b/docs/pot/accounts-users-domains.pot new file mode 100644 index 00000000000..542934b8c62 --- /dev/null +++ b/docs/pot/accounts-users-domains.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Accounts, Users, and Domains" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Accounts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An account typically represents a customer of the service provider or a department in a large organization. Multiple users can exist in an account." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Domains" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Accounts are grouped by domains. Domains usually contain multiple accounts that have some logical relationship to each other and a set of delegated administrators with some authority over the domain and its subdomains. For example, a service provider with several resellers could create a domain for each reseller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For each account created, the Cloud installation creates three different types of user accounts: root administrator, domain administrator, and user." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Users are like aliases in the account. Users in the same account are not isolated from each other, but they are isolated from users in other accounts. Most installations need not surface the notion of users; they just have one user per account. The same user cannot belong to multiple accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username is unique in a domain across accounts in that domain. The same username can exist in other domains, including sub-domains. Domain name can repeat only if the full pathname from root is unique. For example, you can create root/d1, as well as root/foo/d1, and root/sales/d1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Administrators are accounts with special privileges in the system. There may be multiple administrators in the system. Administrators can create or delete other administrators, and change the password for any user in the system." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Domain Administrators" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Domain administrators can perform administrative operations for users who belong to that domain. Domain administrators do not have visibility into physical servers or other domains." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Root Administrator" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Root administrators have complete access to the system, including managing templates, service offerings, customer care administrators, and domains" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The resources belong to the account, not individual users in that account. For example, billing, resource limits, and so on are maintained by the account, not the users. A user can operate on any resource in the account provided the user has privileges for that operation. The privileges are determined by the role." +msgstr "" + diff --git a/docs/pot/accounts.pot b/docs/pot/accounts.pot new file mode 100644 index 00000000000..1c37079b7e8 --- /dev/null +++ b/docs/pot/accounts.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Accounts" +msgstr "" + diff --git a/docs/pot/acquire-new-ip-address.pot b/docs/pot/acquire-new-ip-address.pot new file mode 100644 index 00000000000..16b58478319 --- /dev/null +++ b/docs/pot/acquire-new-ip-address.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Acquiring a New IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network where you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Acquire New IP, and click Yes in the confirmation dialog." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You are prompted for confirmation because, typically, IP addresses are a limited resource. Within a few moments, the new IP address should appear with the state Allocated. You can now use the IP address in port forwarding or static NAT rules." +msgstr "" + diff --git a/docs/pot/acquire-new-ip-for-vpc.pot b/docs/pot/acquire-new-ip-for-vpc.pot new file mode 100644 index 00000000000..b11b61eb072 --- /dev/null +++ b/docs/pot/acquire-new-ip-for-vpc.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Acquiring a New IP Address for a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you acquire an IP address, all IP addresses are allocated to VPC, not to the guest networks within the VPC. The IPs are associated to the guest network only when the first port-forwarding, load balancing, or Static NAT rule is created for the IP or the network. IP can't be associated to more than one network at a time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP Addresses page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Acquire New IP, and click Yes in the confirmation dialog." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You are prompted for confirmation because, typically, IP addresses are a limited resource. Within a few moments, the new IP address should appear with the state Allocated. You can now use the IP address in port forwarding, load balancing, and static NAT rules." +msgstr "" + diff --git a/docs/pot/add-additional-guest-network.pot b/docs/pot/add-additional-guest-network.pot new file mode 100644 index 00000000000..a673cbc9e07 --- /dev/null +++ b/docs/pot/add-additional-guest-network.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding an Additional Guest Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add guest network. Provide the following information:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: The name of the network. This will be user-visible." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Display Text: The description of the network. This will be user-visible." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone. The name of the zone this network applies to. Each zone is a broadcast domain, and therefore each zone has a different IP range for the guest network. The administrator must configure the IP range for each zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network offering: If the administrator has configured multiple network offerings, select the one you want to use for this network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Gateway: The gateway that the guests should use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Netmask: The netmask in use on the subnet the guests will use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create." +msgstr "" + diff --git a/docs/pot/add-clusters-kvm-xenserver.pot b/docs/pot/add-clusters-kvm-xenserver.pot new file mode 100644 index 00000000000..97fb78c96ab --- /dev/null +++ b/docs/pot/add-clusters-kvm-xenserver.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add Cluster: KVM or XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These steps assume you have already installed the hypervisor on the hosts and logged in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Clusters node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the hypervisor type for this cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the pod in which you want to create the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enter a name for the cluster. This can be text of your choosing and is not used by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/add-clusters-ovm.pot b/docs/pot/add-clusters-ovm.pot new file mode 100644 index 00000000000..25ad8ce2c01 --- /dev/null +++ b/docs/pot/add-clusters-ovm.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add Cluster: OVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add a Cluster of hosts that run Oracle VM (OVM):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add a companion non-OVM cluster to the Pod. This cluster provides an environment where the &PRODUCT; System VMs can run. You should have already installed a non-OVM hypervisor on at least one Host to prepare for this step. Depending on which hypervisor you used:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For VMWare, follow the steps in Add Cluster: vSphere. When finished, return here and continue with the next step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM or XenServer, follow the steps in . When finished, return here and continue with the next step" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab. In the Pods node, click View All. Select the same pod you used in step 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View Clusters, then click Add Cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Add Cluster dialog is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Hypervisor, choose OVM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Cluster, enter a name for the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/add-clusters-vsphere.pot b/docs/pot/add-clusters-vsphere.pot new file mode 100644 index 00000000000..2c4ebe4e3aa --- /dev/null +++ b/docs/pot/add-clusters-vsphere.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add Cluster: vSphere" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host management for vSphere is done through a combination of vCenter and the &PRODUCT; admin UI. &PRODUCT; requires that all hosts be in a &PRODUCT; cluster, but the cluster may consist of a single host. As an administrator you must decide if you would like to use clusters of one host or of multiple hosts. Clusters of multiple hosts allow for features like live migration. Clusters also require shared storage such as NFS or iSCSI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere servers, we recommend creating the cluster of hosts in vCenter and then adding the entire cluster to &PRODUCT;. Follow these requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not put more than 8 hosts in a vSphere cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the hypervisor hosts do not have any VMs already running before you add them to &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add a vSphere cluster to &PRODUCT;:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create the cluster of hosts in vCenter. Follow the vCenter instructions to do this. You will create a cluster that looks something like this in vCenter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab, and click View All on Pods. Choose the pod to which you want to add the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View Clusters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Hypervisor, choose VMware." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information in the dialog. The fields below make reference to values from vCenter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster Name. Enter the name of the cluster you created in vCenter. For example, \"cloud.cluster.2.2.1\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Host. Enter the hostname or IP address of the vCenter server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Username. Enter the username that &PRODUCT; should use to connect to vCenter. This user must have all administrative privileges." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Password. Enter the password for the user named above" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Datacenter. Enter the vCenter datacenter that the cluster is in. For example, \"cloud.dc.VM\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There might be a slight delay while the cluster is provisioned. It will automatically display in the UI" +msgstr "" + diff --git a/docs/pot/add-gateway-vpc.pot b/docs/pot/add-gateway-vpc.pot new file mode 100644 index 00000000000..a73b92ad54d --- /dev/null +++ b/docs/pot/add-gateway-vpc.pot @@ -0,0 +1,145 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Private Gateway to a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A private gateway can be added by the root admin only. The VPC private network has 1:1 relationship with the NIC of the physical network. No gateways with duplicated VLAN and IP are allowed in the same data center." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to configure load balancing rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Private Gateways." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Gateways page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add new gateway:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Physical Network: The physical network you have created in the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address: The IP address associated with the VPC gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway: The gateway through which the traffic is routed to and from the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask: The netmask associated with the VPC gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN: The VLAN associated with the VPC gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new gateway appears in the list. You can repeat these steps to add more gateway for this VPC." +msgstr "" + diff --git a/docs/pot/add-ingress-egress-rules.pot b/docs/pot/add-ingress-egress-rules.pot new file mode 100644 index 00000000000..c0d3e4eef12 --- /dev/null +++ b/docs/pot/add-ingress-egress-rules.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Ingress and Egress Rules to a Security Group" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select view, choose Security Groups, then click the security group you want ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add an ingress rule, click the Ingress Rules tab and fill out the following fields to specify what network traffic is allowed into VM instances in this security group. If no ingress rules are specified, then no traffic will be allowed in, except for responses to any traffic that has been allowed out through an egress rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add by CIDR/Account. Indicate whether the source of the traffic will be defined by IP address (CIDR) or an existing security group in a &PRODUCT; account (Account). Choose Account if you want to allow incoming traffic from all VMs in another security group" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. The networking protocol that sources will use to send traffic to the security group. TCP and UDP are typically used for data exchange and end-user communications. ICMP is typically used to send error messages or network monitoring data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start Port, End Port. (TCP, UDP only) A range of listening ports that are the destination for the incoming traffic. If you are opening a single port, use the same number in both fields." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ICMP Type, ICMP Code. (ICMP only) The type of message and error code that will be accepted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CIDR. (Add by CIDR only) To accept only traffic from IP addresses within a particular address block, enter a CIDR or a comma-separated list of CIDRs. The CIDR is the base IP address of the incoming traffic. For example, 192.168.0.0/22. To allow all CIDRs, set to 0.0.0.0/0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Account, Security Group. (Add by Account only) To accept only traffic from another security group, enter the &PRODUCT; account and name of a security group that has already been defined in that account. To allow traffic between VMs within the security group you are editing now, enter the same name you used in step 7." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following example allows inbound HTTP access from anywhere:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add an egress rule, click the Egress Rules tab and fill out the following fields to specify what type of traffic is allowed to be sent out of VM instances in this security group. If no egress rules are specified, then all traffic will be allowed out. Once egress rules are specified, the following types of traffic are allowed out: traffic specified in egress rules; queries to DNS and DHCP servers; and responses to any traffic that has been allowed in through an ingress rule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add by CIDR/Account. Indicate whether the destination of the traffic will be defined by IP address (CIDR) or an existing security group in a &PRODUCT; account (Account). Choose Account if you want to allow outgoing traffic to all VMs in another security group." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. The networking protocol that VMs will use to send outgoing traffic. TCP and UDP are typically used for data exchange and end-user communications. ICMP is typically used to send error messages or network monitoring data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start Port, End Port. (TCP, UDP only) A range of listening ports that are the destination for the outgoing traffic. If you are opening a single port, use the same number in both fields." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ICMP Type, ICMP Code. (ICMP only) The type of message and error code that will be sent" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CIDR. (Add by CIDR only) To send traffic only to IP addresses within a particular address block, enter a CIDR or a comma-separated list of CIDRs. The CIDR is the base IP address of the destination. For example, 192.168.0.0/22. To allow all CIDRs, set to 0.0.0.0/0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Account, Security Group. (Add by Account only) To allow traffic to be sent to another security group, enter the &PRODUCT; account and name of a security group that has already been defined in that account. To allow traffic between VMs within the security group you are editing now, enter its name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/add-iso.pot b/docs/pot/add-iso.pot new file mode 100644 index 00000000000..eb1e630c7e0 --- /dev/null +++ b/docs/pot/add-iso.pot @@ -0,0 +1,215 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding an ISO" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To make additional operating system or other software available for use with guest VMs, you can add an ISO. The ISO is typically thought of as an operating system image, but you can also add ISOs for other types of software, such as desktop applications that you want to be installed as part of a template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose ISOs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add ISO." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Add ISO screen, provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: Short name for the ISO image. For example, CentOS 6.2 64-bit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: Display test for the ISO image. For example, CentOS 6.2 64-bit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL: The URL that hosts the ISO image. The Management Server must be able to access this location via HTTP. If needed you can place the ISO image directly on the Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone: Choose the zone where you want the ISO to be available, or All Zones to make it available throughout &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Bootable: Whether or not a guest could boot off this ISO image. For example, a CentOS ISO is bootable, a Microsoft Office ISO is not bootable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type: This helps &PRODUCT; and the hypervisor perform certain operations and make assumptions that improve the performance of the guest. Select one of the following." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the operating system of your desired ISO image is listed, choose it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the OS Type of the ISO is not listed or if the ISO is not bootable, choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(XenServer only) If you want to boot from this ISO in PV mode, choose Other PV (32-bit) or Other PV (64-bit)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(KVM only) If you choose an OS that is PV-enabled, the VMs created from this ISO will have a SCSI (virtio) root disk. If the OS is not PV-enabled, the VMs will have an IDE root disk. The PV-enabled types are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fedora 13" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fedora 12" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fedora 11" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fedora 10" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fedora 9" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Other PV" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Debian GNU/Linux" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CentOS 5.3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CentOS 5.4" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CentOS 5.5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Red Hat Enterprise Linux 5.3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Red Hat Enterprise Linux 5.4" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Red Hat Enterprise Linux 5.5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Red Hat Enterprise Linux 6" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It is not recommended to choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will usually not work. In these cases, choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extractable: Choose Yes if the ISO should be available for extraction." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public: Choose Yes if this ISO should be available to other users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Featured: Choose Yes if you would like this ISO to be more prominent for users to select. The ISO will appear in the Featured ISOs list. Only an administrator can make an ISO Featured." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server will download the ISO. Depending on the size of the ISO, this may take a long time. The ISO status column will display Ready once it has been successfully downloaded into secondary storage. Clicking Refresh updates the download percentage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Important: Wait for the ISO to finish downloading. If you move on to the next task and try to use the ISO right away, it will appear to fail. The entire ISO must be available before &PRODUCT; can work with it." +msgstr "" + diff --git a/docs/pot/add-load-balancer-rule.pot b/docs/pot/add-load-balancer-rule.pot new file mode 100644 index 00000000000..b2f82e0dd6c --- /dev/null +++ b/docs/pot/add-load-balancer-rule.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Load Balancer Rule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network where you want to load balance the traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address for which you want to create the rule, then click the Configuration tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Load Balancing node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a Basic zone, you can also create a load balancing rule without acquiring or selecting an IP address. &PRODUCT; internally assign an IP when you create the load balancing rule, which is listed in the IP Addresses page when the rule is created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To do that, select the name of the network, then click Add Load Balancer tab. Continue with ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fill in the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: A name for the load balancer rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Port: The port receiving incoming traffic to be balanced." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Port: The port that the VMs will use to receive the traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Algorithm: Choose the load balancing algorithm you want &PRODUCT; to use. &PRODUCT; supports a variety of well-known algorithms. If you are not familiar with these choices, you will find plenty of information about them on the Internet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stickiness: (Optional) Click Configure and choose the algorithm for the stickiness policy. See Sticky Session Policies for Load Balancer Rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add VMs, then select two or more VMs that will divide the load of incoming traffic, and click Apply." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new load balancer rule appears in the list. You can repeat these steps to add more load balancer rules for this IP address." +msgstr "" + diff --git a/docs/pot/add-loadbalancer-rule-vpc.pot b/docs/pot/add-loadbalancer-rule-vpc.pot new file mode 100644 index 00000000000..15b5d76a5c2 --- /dev/null +++ b/docs/pot/add-loadbalancer-rule-vpc.pot @@ -0,0 +1,180 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Load Balancing Rules on a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A &PRODUCT; user or administrator may create load balancing rules that balance traffic received at a public IP to one or more VMs that belong to a network tier that provides load balancing service in a VPC. A user creates a rule, specifies an algorithm, and assigns the rule to a set of VMs within a VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to configure load balancing rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP Addresses page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address for which you want to create the rule, then click the Configuration tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Load Balancing node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the tier to which you want to apply the rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a VPC, the load balancing service is supported only on a single tier." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: A name for the load balancer rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Port: The port that receives the incoming traffic to be balanced." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Port: The port that the VMs will use to receive the traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Algorithm. Choose the load balancing algorithm you want &PRODUCT; to use. &PRODUCT; supports the following well-known algorithms:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Round-robin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Least connections" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stickiness. (Optional) Click Configure and choose the algorithm for the stickiness policy. See Sticky Session Policies for Load Balancer Rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add VMs: Click Add VMs, then select two or more VMs that will divide the load of incoming traffic, and click Apply." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new load balancing rule appears in the list. You can repeat these steps to add more load balancing rules for this IP address." +msgstr "" + diff --git a/docs/pot/add-members-to-projects.pot b/docs/pot/add-members-to-projects.pot new file mode 100644 index 00000000000..f3a581792de --- /dev/null +++ b/docs/pot/add-members-to-projects.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Members to a Project" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New members can be added to a project by the project’s administrator, the domain administrator of the domain where the project resides or any parent domain, or the &PRODUCT; root administrator. There are two ways to add members in &PRODUCT;, but only one way is enabled at a time:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If invitations have been enabled, you can send invitations to new members." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If invitations are not enabled, you can add members directly through the UI." +msgstr "" + diff --git a/docs/pot/add-more-clusters.pot b/docs/pot/add-more-clusters.pot new file mode 100644 index 00000000000..d2d1d8ddafe --- /dev/null +++ b/docs/pot/add-more-clusters.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add More Clusters (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to tell &PRODUCT; about the hosts that it will manage. Hosts exist inside clusters, so before you begin adding hosts to the cloud, you must add at least one cluster." +msgstr "" + diff --git a/docs/pot/add-password-management-to-templates.pot b/docs/pot/add-password-management-to-templates.pot new file mode 100644 index 00000000000..0a0df6f65f6 --- /dev/null +++ b/docs/pot/add-password-management-to-templates.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Password Management to Your Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides an optional password reset feature that allows users to set a temporary admin or root password as well as reset the existing admin or root password from the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable the Reset Password feature, you will need to download an additional script to patch your template. When you later upload the template into &PRODUCT;, you can specify whether reset admin/root password feature should be enabled for this template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The password management feature works always resets the account password on instance boot. The script does an HTTP call to the virtual router to retrieve the account password that should be set. As long as the virtual router is accessible the guest will have access to the account password that should be used. When the user requests a password reset the management server generates and sends a new password to the virtual router for the account. Thus an instance reboot is necessary to effect any password changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the script is unable to contact the virtual router during instance boot it will not set the password but boot will continue normally." +msgstr "" + diff --git a/docs/pot/add-portforward-rule-vpc.pot b/docs/pot/add-portforward-rule-vpc.pot new file mode 100644 index 00000000000..1700043e3b6 --- /dev/null +++ b/docs/pot/add-portforward-rule-vpc.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Port Forwarding Rule on a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose an existing IP address or acquire a new IP address. Click the name of the IP address in the list." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP Addresses page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address for which you want to create the rule, then click the Configuration tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Port Forwarding node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the tier to which you want to apply the rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Port: The port to which public traffic will be addressed on the IP address you acquired in the previous step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Port: The port on which the instance is listening for forwarded public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol: The communication protocol in use between the two ports." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UDP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add VM: Click Add VM. Select the name of the instance to which this rule applies, and click Apply." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can test the rule by opening an ssh session to the instance." +msgstr "" + diff --git a/docs/pot/add-primary-storage.pot b/docs/pot/add-primary-storage.pot new file mode 100644 index 00000000000..bac6723efee --- /dev/null +++ b/docs/pot/add-primary-storage.pot @@ -0,0 +1,145 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that nothing stored on the server. Adding the server to CloudStack will destroy any existing data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you create a new zone, the first primary storage is added as part of that procedure. You can add primary storage servers at any time, such as when adding a new cluster or adding more servers to an existing cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Primary Storage node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Primary Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information in the dialog. The information required varies depending on your choice in Protocol." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pod. The pod for the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster. The cluster for the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the storage device" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. For XenServer, choose either NFS, iSCSI, or PreSetup. For KVM, choose NFS or SharedMountPoint. For vSphere choose either VMFS (iSCSI or FiberChannel) or NFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server (for NFS, iSCSI, or PreSetup). The IP address or DNS name of the storage device" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server (for VMFS). The IP address or DNS name of the vCenter server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for NFS). In NFS this is the exported path from the server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for VMFS). In vSphere this is a combination of the datacenter name and the datastore name. The format is \"/\" datacenter name \"/\" datastore name. For example, \"/cloud.dc.VM/cluster1datastore\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for SharedMountPoint). With KVM this is the path on each host that is where this primary storage is mounted. For example, \"/mnt/primary\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SR Name-Label (for PreSetup). Enter the name-label of the SR that has been set up outside &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Target IQN (for iSCSI). In iSCSI this is the IQN of the target. For example, iqn.1986-03.com.sun:02:01ec9bb549-1271378984" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Lun # (for iSCSI). In iSCSI this is the LUN number. For example, 3." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags (optional). The comma-separated list of tags for this storage device. It should be an equivalent set or superset of the tags on your disk offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The tag sets on primary storage across clusters in a Zone must be identical. For example, if cluster A provides primary storage that has tags T1 and T2, all other clusters in the Zone must also provide primary storage that has tags T1 and T2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/add-projects-members-from-ui.pot b/docs/pot/add-projects-members-from-ui.pot new file mode 100644 index 00000000000..26515261a2b --- /dev/null +++ b/docs/pot/add-projects-members-from-ui.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Project Members From the UI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The steps below tell how to add a new member to a project if the invitations feature is not enabled in the cloud. If the invitations feature is enabled cloud,as described in , use the procedure in ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the project you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Accounts tab. The current members of the project are listed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type the account name of the new member you want to add, and click Add Account. You can add only people who have an account in this cloud and within the same domain as the project." +msgstr "" + diff --git a/docs/pot/add-secondary-storage.pot b/docs/pot/add-secondary-storage.pot new file mode 100644 index 00000000000..d75c1dc56cc --- /dev/null +++ b/docs/pot/add-secondary-storage.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure there is nothing stored on the server. Adding the server to CloudStack will destroy any existing data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you create a new zone, the first secondary storage is added as part of that procedure. You can add secondary storage servers at any time to add more servers to an existing zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are going to use Swift for cloud-wide secondary storage, you must add the Swift storage to &PRODUCT; before you add the local zone secondary storage servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To prepare for local zone secondary storage, you should have created and mounted an NFS share during Management Server installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you prepared the system VM template during Management Server installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4. Now that the secondary storage server for per-zone storage is prepared, add it to &PRODUCT;. Secondary storage is added as part of the procedure for adding a new zone." +msgstr "" + diff --git a/docs/pot/add-security-group.pot b/docs/pot/add-security-group.pot new file mode 100644 index 00000000000..38a117412a9 --- /dev/null +++ b/docs/pot/add-security-group.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Security Group" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A user or administrator can define a new security group." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select view, choose Security Groups." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Security Group." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide a name and description." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new security group appears in the Security Groups Details tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To make the security group useful, continue to Adding Ingress and Egress Rules to a Security Group." +msgstr "" + diff --git a/docs/pot/add-tier.pot b/docs/pot/add-tier.pot new file mode 100644 index 00000000000..f51b6eae721 --- /dev/null +++ b/docs/pot/add-tier.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding Tiers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tiers are distinct locations within a VPC that act as isolated networks, which do not have access to other tiers by default. Tiers are set up on different VLANs that can communicate with each other by using a virtual router. Tiers provide inexpensive, low latency network connectivity to other tiers within the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPC that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The end users can see their own VPCs, while root and domain admin can see any VPC they are authorized to see." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC for which you want to set up tiers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Add new tier dialog is displayed, as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have already created tiers, the VPC diagram is displayed. Click Create Tier to add a new tier." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the fields are mandatory." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: A unique name for the tier you create." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Offering: The following default network offerings are listed: DefaultIsolatedNetworkOfferingForVpcNetworksNoLB, DefaultIsolatedNetworkOfferingForVpcNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a VPC, only one tier can be created by using LB-enabled network offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway: The gateway for the tier you create. Ensure that the gateway is within the Super CIDR range that you specified while creating the VPC, and is not overlapped with the CIDR of any existing tier within the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask: The netmask for the tier you create." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, if the VPC CIDR is 10.0.0.0/16 and the network tier CIDR is 10.0.1.0/24, the gateway of the tier is 10.0.1.1, and the netmask of the tier is 255.255.255.0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Continue with configuring access control list for the tier." +msgstr "" + diff --git a/docs/pot/add-vm-to-tier.pot b/docs/pot/add-vm-to-tier.pot new file mode 100644 index 00000000000..0b997934bb8 --- /dev/null +++ b/docs/pot/add-vm-to-tier.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Deploying VMs to the Tier" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Add VM button of the tier for which you want to add a VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Add Instance page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Follow the on-screen instruction to add an instance. For information on adding an instance, see Adding Instances section in the Installation Guide." +msgstr "" + diff --git a/docs/pot/add-vpc.pot b/docs/pot/add-vpc.pot new file mode 100644 index 00000000000..626b41369bb --- /dev/null +++ b/docs/pot/add-vpc.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Virtual Private Cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When creating the VPC, you simply provide the zone and a set of IP addresses for the VPC network address space. You specify this set of addresses in the form of a Classless Inter-Domain Routing (CIDR) block." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add VPC. The Add VPC page is displayed as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: A short name for the VPC that you are creating." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: A brief description of the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone: Choose the zone where you want the VPC to be available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Super CIDR for Guest Networks: Defines the CIDR range for all the tiers (guest networks) within a VPC. When you create a tier, ensure that its CIDR is within the Super CIDR value you enter. The CIDR must be RFC1918 compliant." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS domain for Guest Networks: If you want to assign a special domain name, specify the DNS suffix. This parameter is applied to all the tiers within the VPC. That implies, all the tiers you create in the VPC belong to the same DNS domain. If the parameter is not specified, a DNS domain name is generated automatically." +msgstr "" + diff --git a/docs/pot/added-API-commands-4-0.pot b/docs/pot/added-API-commands-4-0.pot new file mode 100644 index 00000000000..1a477c316a2 --- /dev/null +++ b/docs/pot/added-API-commands-4-0.pot @@ -0,0 +1,259 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Added API Commands in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createCounter (Adds metric counter)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteCounter (Deletes a counter)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listCounters (List the counters)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createCondition (Creates a condition)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteCondition (Removes a condition)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listConditions (List Conditions for the specific user)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createTags. Add tags to one or more resources. Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=createTags\n" +"&resourceIds=1,10,12\n" +"&resourceType=userVm\n" +"&tags[0].key=region\n" +"&tags[0].value=canada\n" +"&tags[1].key=city\n" +"&tags[1].value=Toronto " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteTags. Remove tags from one or more resources. Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=deleteTags\n" +"&resourceIds=1,12\n" +"&resourceType=Snapshot\n" +"&tags[0].key=city " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTags (Show currently defined resource tags)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVPC (Creates a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCs (Lists VPCs)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVPC (Deletes a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVPC (Updates a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restartVPC (Restarts a VPC)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVPCOffering (Creates VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVPCOffering (Updates VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVPCOffering (Deletes VPC offering)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCOfferings (Lists VPC offerings)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createPrivateGateway (Creates a private gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPrivateGateways (List private gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deletePrivateGateway (Deletes a Private gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createNetworkACL (Creates a ACL rule the given network (the network has to belong to VPC))" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNetworkACL (Deletes a Network ACL)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkACLs (Lists all network ACLs)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createStaticRoute (Creates a static route)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteStaticRoute (Deletes a static route)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listStaticRoutes (Lists all static routes)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnCustomerGateway (Creates site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnGateway (Creates site to site vpn local gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVpnConnection (Create site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnCustomerGateway (Delete site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnGateway (Delete site to site vpn gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteVpnConnection (Delete site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVpnCustomerGateway (Update site to site vpn customer gateway)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "resetVpnConnection (Reset site to site vpn connection)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnCustomerGateways (Lists site to site vpn customer gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnGateways (Lists site 2 site vpn gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVpnConnections (Lists site to site vpn connection gateways)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enableCiscoNexusVSM (Enables Nexus 1000v dvSwitch in &PRODUCT;.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "disableCiscoNexusVSM (Disables Nexus 1000v dvSwitch in &PRODUCT;.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteCiscoNexusVSM (Deletes Nexus 1000v dvSwitch in &PRODUCT;.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listCiscoNexusVSMs (Lists the control VLAN ID, packet VLAN ID, and data VLAN ID, as well as the IP address of the Nexus 1000v dvSwitch.)" +msgstr "" + diff --git a/docs/pot/added-API-commands.pot b/docs/pot/added-API-commands.pot new file mode 100644 index 00000000000..fd6cb1e4a47 --- /dev/null +++ b/docs/pot/added-API-commands.pot @@ -0,0 +1,375 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:56\n" +"PO-Revision-Date: 2013-02-02T20:11:56\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Added API commands in 3.0" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Added in 3.0.2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "changeServiceForSystemVm" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Changes the service offering for a system VM (console proxy or secondary storage). The system VM must be in a \"Stopped\" state for this command to take effect." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Added in 3.0.1" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Added in 3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "assignVirtualMachine (Move a user VM to another user under same domain.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restoreVirtualMachine (Restore a VM to original template or specific snapshot)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createLBStickinessPolicy (Creates a Load Balancer stickiness policy )" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteLBStickinessPolicy (Deletes a LB stickiness policy.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLBStickinessPolicies (Lists LBStickiness policies.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ldapConfig (Configure the LDAP context for this site.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addSwift (Adds Swift.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSwifts (List Swift.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "migrateVolume (Migrate volume)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateStoragePool (Updates a storage pool.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "authorizeSecurityGroupEgress (Authorizes a particular egress rule for this security group)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "revokeSecurityGroupEgress (Deletes a particular egress rule from this security group)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createNetworkOffering (Creates a network offering.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNetworkOffering (Deletes a network offering.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createProject (Creates a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteProject (Deletes a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateProject (Updates a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "activateProject (Activates a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "suspendProject (Suspends a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjects (Lists projects and provides detailed information for listed projects)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addAccountToProject (Adds acoount to a project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteAccountFromProject (Deletes account from the project)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjectAccounts (Lists project's accounts)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjectInvitations (Lists an account's invitations to join projects)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateProjectInvitation (Accepts or declines project invitation)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteProjectInvitation (Deletes a project invitation)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateHypervisorCapabilities (Updates a hypervisor capabilities.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listHypervisorCapabilities (Lists all hypervisor capabilities.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createPhysicalNetwork (Creates a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deletePhysicalNetwork (Deletes a Physical Network.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPhysicalNetworks (Lists physical networks)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updatePhysicalNetwork (Updates a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSupportedNetworkServices (Lists all network services provided by &PRODUCT; or for the given Provider.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addNetworkServiceProvider (Adds a network serviceProvider to a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNetworkServiceProvider (Deletes a Network Service Provider.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkServiceProviders (Lists network serviceproviders for a given physical network.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateNetworkServiceProvider (Updates a network serviceProvider of a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addTrafficType (Adds traffic type to a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteTrafficType (Deletes traffic type of a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTrafficTypes (Lists traffic types of a given physical network.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateTrafficType (Updates traffic type of a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTrafficTypeImplementors (Lists implementors of implementor of a network traffic type or implementors of all network traffic types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createStorageNetworkIpRange (Creates a Storage network IP range.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteStorageNetworkIpRange (Deletes a storage network IP Range.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listStorageNetworkIpRange (List a storage network IP range.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateStorageNetworkIpRange (Update a Storage network IP range, only allowed when no IPs in this range have been allocated.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listUsageTypes (List Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addF5LoadBalancer (Adds a F5 BigIP load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "configureF5LoadBalancer (configures a F5 load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteF5LoadBalancer ( delete a F5 load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listF5LoadBalancers (lists F5 load balancer devices)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listF5LoadBalancerNetworks (lists network that are using a F5 load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addSrxFirewall (Adds a SRX firewall device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteSrxFirewall ( delete a SRX firewall device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSrxFirewalls (lists SRX firewall devices in a physical network)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSrxFirewallNetworks (lists network that are using SRX firewall device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addNetscalerLoadBalancer (Adds a netscaler load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNetscalerLoadBalancer ( delete a netscaler load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "configureNetscalerLoadBalancer (configures a netscaler load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetscalerLoadBalancers (lists netscaler load balancer devices)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetscalerLoadBalancerNetworks (lists network that are using a netscaler load balancer device)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVirtualRouterElement (Create a virtual router element.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "configureVirtualRouterElement (Configures a virtual router element.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVirtualRouterElements (Lists all available virtual router elements.)" +msgstr "" + diff --git a/docs/pot/added-error-codes.pot b/docs/pot/added-error-codes.pot new file mode 100644 index 00000000000..5062c9ebbac --- /dev/null +++ b/docs/pot/added-error-codes.pot @@ -0,0 +1,330 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Added &PRODUCT; Error Codes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can now find the &PRODUCT;-specific error code in the exception response for each type of exception. The following list of error codes is added to the new class named CSExceptionErrorCode. These codes are applicable in &PRODUCT; 3.0.3 and later versions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4250 : \"com.cloud.utils.exception.CloudRuntimeException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4255 : \"com.cloud.utils.exception.ExceptionUtil\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4260 : \"com.cloud.utils.exception.ExecutionException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4265 : \"com.cloud.utils.exception.HypervisorVersionChangedException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4270 : \"com.cloud.utils.exception.RuntimeCloudException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4275 : \"com.cloud.exception.CloudException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4280 : \"com.cloud.exception.AccountLimitException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4285 : \"com.cloud.exception.AgentUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4290 : \"com.cloud.exception.CloudAuthenticationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4295 : \"com.cloud.exception.CloudExecutionException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4300 : \"com.cloud.exception.ConcurrentOperationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4305 : \"com.cloud.exception.ConflictingNetworkSettingsException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4310 : \"com.cloud.exception.DiscoveredWithErrorException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4315 : \"com.cloud.exception.HAStateException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4320 : \"com.cloud.exception.InsufficientAddressCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4325 : \"com.cloud.exception.InsufficientCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4330 : \"com.cloud.exception.InsufficientNetworkCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4335 : \"com.cloud.exception.InsufficientServerCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4340 : \"com.cloud.exception.InsufficientStorageCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4345 : \"com.cloud.exception.InternalErrorException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4350 : \"com.cloud.exception.InvalidParameterValueException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4355 : \"com.cloud.exception.ManagementServerException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4360 : \"com.cloud.exception.NetworkRuleConflictException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4365 : \"com.cloud.exception.PermissionDeniedException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4370 : \"com.cloud.exception.ResourceAllocationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4375 : \"com.cloud.exception.ResourceInUseException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4380 : \"com.cloud.exception.ResourceUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4385 : \"com.cloud.exception.StorageUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4390 : \"com.cloud.exception.UnsupportedServiceException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4395 : \"com.cloud.exception.VirtualMachineMigrationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4400 : \"com.cloud.exception.AccountLimitException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4405 : \"com.cloud.exception.AgentUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4410 : \"com.cloud.exception.CloudAuthenticationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4415 : \"com.cloud.exception.CloudException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4420 : \"com.cloud.exception.CloudExecutionException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4425 : \"com.cloud.exception.ConcurrentOperationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4430 : \"com.cloud.exception.ConflictingNetworkSettingsException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4435 : \"com.cloud.exception.ConnectionException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4440 : \"com.cloud.exception.DiscoveredWithErrorException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4445 : \"com.cloud.exception.DiscoveryException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4450 : \"com.cloud.exception.HAStateException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4455 : \"com.cloud.exception.InsufficientAddressCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4460 : \"com.cloud.exception.InsufficientCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4465 : \"com.cloud.exception.InsufficientNetworkCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4470 : \"com.cloud.exception.InsufficientServerCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4475 : \"com.cloud.exception.InsufficientStorageCapacityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4480 : \"com.cloud.exception.InsufficientVirtualNetworkCapcityException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4485 : \"com.cloud.exception.InternalErrorException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4490 : \"com.cloud.exception.InvalidParameterValueException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4495 : \"com.cloud.exception.ManagementServerException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4500 : \"com.cloud.exception.NetworkRuleConflictException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4505 : \"com.cloud.exception.PermissionDeniedException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4510 : \"com.cloud.exception.ResourceAllocationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4515 : \"com.cloud.exception.ResourceInUseException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4520 : \"com.cloud.exception.ResourceUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4525 : \"com.cloud.exception.StorageUnavailableException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4530 : \"com.cloud.exception.UnsupportedServiceException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4535 : \"com.cloud.exception.VirtualMachineMigrationException\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "9999 : \"org.apache.cloudstack.api.ServerApiException\"" +msgstr "" + diff --git a/docs/pot/adding-IP-addresses-for-the-public-network.pot b/docs/pot/adding-IP-addresses-for-the-public-network.pot new file mode 100644 index 00000000000..ef9a609f5c1 --- /dev/null +++ b/docs/pot/adding-IP-addresses-for-the-public-network.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding IP Addresses for the Public Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These instructions assume you have already logged in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the desired zone ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Network tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Public node of the diagram, click Configure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP Ranges tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway. The gateway in use for these IP addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask. The netmask associated with this IP range" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN. The VLAN that will be used for public traffic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start IP/End IP. A range of IP addresses that are assumed to be accessible from the Internet and will be allocated for access to guest networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/additional-installation-options.pot b/docs/pot/additional-installation-options.pot new file mode 100644 index 00000000000..1e00eaed152 --- /dev/null +++ b/docs/pot/additional-installation-options.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Additional Installation Options" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The next few sections describe &PRODUCT; features above and beyond the basic deployment options." +msgstr "" + diff --git a/docs/pot/admin-alerts.pot b/docs/pot/admin-alerts.pot new file mode 100644 index 00000000000..7935a2b3655 --- /dev/null +++ b/docs/pot/admin-alerts.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Administrator Alerts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The system provides alerts and events to help with the management of the cloud. Alerts are notices to an administrator, generally delivered by e-mail, notifying the administrator that an error has occurred in the cloud. Alert behavior is configurable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Events track all of the user and administrator actions in the cloud. For example, every guest VM start creates an associated event. Events are stored in the Management Server’s database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Emails will be sent to administrators under the following circumstances:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server cluster runs low on CPU, memory, or storage resources" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server loses heartbeat from a Host for more than 3 minutes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Host cluster runs low on CPU, memory, or storage resources" +msgstr "" + diff --git a/docs/pot/admin-guide.pot b/docs/pot/admin-guide.pot new file mode 100644 index 00000000000..b571c79a78c --- /dev/null +++ b/docs/pot/admin-guide.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Administrator Guide" +msgstr "" + diff --git a/docs/pot/adv-zone-topology-req.pot b/docs/pot/adv-zone-topology-req.pot new file mode 100644 index 00000000000..2b0fd2d948c --- /dev/null +++ b/docs/pot/adv-zone-topology-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With Advanced Networking, separate subnets must be used for private and public networks." +msgstr "" + diff --git a/docs/pot/advanced-zone-configuration.pot b/docs/pot/advanced-zone-configuration.pot new file mode 100644 index 00000000000..2c0543140b4 --- /dev/null +++ b/docs/pot/advanced-zone-configuration.pot @@ -0,0 +1,345 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you select Advanced in the Add Zone wizard and click Next, you will be asked to enter the following details. Then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. A name for the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS 1 and 2. These are DNS servers for use by guest VMs in the zone. These DNS servers will be accessed via the public network you will add later. The public IP addresses for the zone must have a route to the DNS server named here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Internal DNS 1 and Internal DNS 2. These are DNS servers for use by system VMs in the zone(these are VMs used by &PRODUCT; itself, such as virtual routers, console proxies,and Secondary Storage VMs.) These DNS servers will be accessed via the management traffic network interface of the System VMs. The private IP address you provide for the pods must have a route to the internal DNS server named here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Domain. (Optional) If you want to assign a special domain name to the guest VM network, specify the DNS suffix." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest CIDR. This is the CIDR that describes the IP addresses in use in the guest virtual networks in this zone. For example, 10.1.1.0/24. As a matter of good practice you should set different CIDRs for different zones. This will make it easier to set up VPNs between networks in different zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. (Introduced in version 3.0.1) Choose the hypervisor for the first cluster in the zone. You can add clusters with different hypervisors later, after you finish adding the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. A public zone is available to all users. A zone that is not public will be assigned to a particular domain. Only users in that domain will be allowed to create guest VMs in this zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose which traffic types will be carried by the physical network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The traffic types are management, public, guest, and storage traffic. For more information about the types, roll over the icons to display their tool tips, or see . This screen starts out with one network already configured. If you have multiple physical networks, you need to add more. Drag and drop traffic types onto a greyed-out network and it will become active. You can move the traffic icons from one network to another; for example, if the default traffic types shown for Network 1 do not match your actual setup, you can move them down. You can also change the network names if desired." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Introduced in version 3.0.1) Assign a network traffic label to each traffic type on each physical network. These labels must match the labels you have already defined on the hypervisor host. To assign each label, click the Edit button under the traffic type icon within each physical network. A popup dialog appears where you can type the label, then click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These traffic labels will be defined only for the hypervisor selected for the first cluster. For all other hypervisors, the labels can be configured after the zone is created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the IP range for public Internet traffic. Enter the following details, then click Add. If desired, you can repeat this step to add more public Internet IP ranges. When done, click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway. The gateway in use for these IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask. The netmask associated with this IP range." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN. The VLAN that will be used for public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start IP/End IP. A range of IP addresses that are assumed to be accessible from the Internet and will be allocated for access to guest networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new zone, &PRODUCT; adds the first pod for you. You can always add more pods later. For an overview of what a pod is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first pod, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pod Name. A name for the pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reserved system gateway. The gateway for the hosts in that pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reserved system netmask. The network prefix that defines the pod's subnet. Use CIDR notation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start/End Reserved System IP. The IP range in the management network that &PRODUCT; uses to manage various system VMs, such as Secondary Storage VMs, Console Proxy VMs, and DHCP. For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify a range of VLAN IDs to carry guest traffic for each physical network (see VLAN Allocation Example ), then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new pod, &PRODUCT; adds the first cluster for you. You can always add more clusters later. For an overview of what a cluster is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first cluster, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. (Version 3.0.0 only; in 3.0.1, this field is read only) Choose the type of hypervisor software that all hosts in this cluster will run. If you choose VMware, additional fields appear so you can give information about a vSphere cluster. For vSphere servers, we recommend creating the cluster of hosts in vCenter and then adding the entire cluster to &PRODUCT;. See Add Cluster: vSphere ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster name. Enter a name for the cluster. This can be text of your choosing and is not used by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new cluster, &PRODUCT; adds the first host for you. You can always add more hosts later. For an overview of what a host is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you can configure the host, you need to install the hypervisor software on the host. You will need to know which version of the hypervisor software version is supported by &PRODUCT; and what additional configuration is required to ensure the host will work with &PRODUCT;. To find these installation details, see:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix XenServer Installation for &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware vSphere Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first host, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Name. The DNS name or IP address of the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username. Usually root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password. This is the password for the user named above (from your XenServer or KVM install)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Tags. (Optional) Any labels that you use to categorize hosts for ease of maintenance. For example, you can set to the cloud's HA tag (set in the ha.tag global configuration parameter) if you want this host to be used only for VMs with the \"high availability\" feature enabled. For more information, see HA-Enabled Virtual Machines as well as HA for Hosts, both in the Administration Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new cluster, &PRODUCT; adds the first primary storage server for you. You can always add more servers later. For an overview of what primary storage is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first primary storage server, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. For XenServer, choose either NFS, iSCSI, or PreSetup. For KVM, choose NFS, SharedMountPoint, CLVM, and RBD. For vSphere choose either VMFS (iSCSI or FiberChannel) or NFS. The remaining fields in the screen vary depending on what you choose here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server. The IP address or DNS name of the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path. The exported path from the server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags (optional). The comma-separated list of tags for this storage device. It should be an equivalent set or superset of the tags on your disk offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The tag sets on primary storage across clusters in a Zone must be identical. For example, if cluster A provides primary storage that has tags T1 and T2, all other clusters in the Zone must also provide primary storage that has tags T1 and T2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "iSCSI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Target IQN. The IQN of the target. For example, iqn.1986-03.com.sun:02:01ec9bb549-1271378984." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Lun. The LUN number. For example, 3." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "preSetup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SR Name-Label. Enter the name-label of the SR that has been set up outside &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SharedMountPoint" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path. The path on each host that is where this primary storage is mounted. For example, \"/mnt/primary\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server. The IP address or DNS name of the vCenter server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path. A combination of the datacenter name and the datastore name. The format is \"/\" datacenter name \"/\" datastore name. For example, \"/cloud.dc.VM/cluster1datastore\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new zone, &PRODUCT; adds the first secondary storage server for you. For an overview of what secondary storage is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you can fill out this screen, you need to prepare the secondary storage by setting up NFS shares and installing the latest &PRODUCT; System VM template. See Adding Secondary Storage :" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS Server. The IP address of the server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Launch." +msgstr "" + diff --git a/docs/pot/advanced-zone-guest-ip-addresses.pot b/docs/pot/advanced-zone-guest-ip-addresses.pot new file mode 100644 index 00000000000..c0ed786071b --- /dev/null +++ b/docs/pot/advanced-zone-guest-ip-addresses.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Guest IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When advanced networking is used, the administrator can create additional networks for use by the guests. These networks can span the zone and be available to all accounts, or they can be scoped to a single account, in which case only the named account may create guests that attach to these networks. The networks are defined by a VLAN ID, IP range, and gateway. The administrator may provision thousands of these networks if desired." +msgstr "" + diff --git a/docs/pot/advanced-zone-network-traffic-types.pot b/docs/pot/advanced-zone-network-traffic-types.pot new file mode 100644 index 00000000000..3b24de1289e --- /dev/null +++ b/docs/pot/advanced-zone-network-traffic-types.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Network Traffic Types" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When advanced networking is used, there can be multiple physical networks in the zone. Each physical network can carry one or more traffic types, and you need to let &PRODUCT; know which type of network traffic you want each network to carry. The traffic types in an advanced zone are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest. When end users run VMs, they generate guest traffic. The guest VMs communicate with each other over a network that can be referred to as the guest network. This network can be isolated or shared. In an isolated guest network, the administrator needs to reserve VLAN ranges to provide isolation for each &PRODUCT; account’s network (potentially a large number of VLANs). In a shared guest network, all guest VMs share a single network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management. When &PRODUCT;’s internal resources communicate with each other, they generate management traffic. This includes communication between hosts, system VMs (VMs used by &PRODUCT; to perform various tasks in the cloud), and any other component that communicates directly with the &PRODUCT; Management Server. You must configure the IP range for the system VMs to use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Public traffic is generated when VMs in the cloud access the Internet. Publicly accessible IPs must be allocated for this purpose. End users can use the &PRODUCT; UI to acquire these IPs to implement NAT between their guest network and the public network, as described in “Acquiring a New IP Address†in the Administration Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage. Traffic such as VM templates and snapshots, which is sent between the secondary storage VM and secondary storage servers. &PRODUCT; uses a separate Network Interface Controller (NIC) named storage NIC for storage network traffic. Use of a storage NIC that always operates on a high bandwidth network allows fast template and snapshot copying. You must configure the IP range to use for the storage network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These traffic types can each be on a separate physical network, or they can be combined with certain restrictions. When you use the Add Zone wizard in the UI to create a new zone, you are guided into making only valid choices." +msgstr "" + diff --git a/docs/pot/advanced-zone-physical-network-configuration.pot b/docs/pot/advanced-zone-physical-network-configuration.pot new file mode 100644 index 00000000000..ba06ced75ce --- /dev/null +++ b/docs/pot/advanced-zone-physical-network-configuration.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Physical Network Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Within a zone that uses advanced networking, you need to tell the Management Server how the physical network is set up to carry different kinds of traffic in isolation." +msgstr "" + diff --git a/docs/pot/advanced-zone-public-ip-addresses.pot b/docs/pot/advanced-zone-public-ip-addresses.pot new file mode 100644 index 00000000000..54d3ef2933e --- /dev/null +++ b/docs/pot/advanced-zone-public-ip-addresses.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Advanced Zone Public IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When advanced networking is used, the administrator can create additional networks for use by the guests. These networks can span the zone and be available to all accounts, or they can be scoped to a single account, in which case only the named account may create guests that attach to these networks. The networks are defined by a VLAN ID, IP range, and gateway. The administrator may provision thousands of these networks if desired." +msgstr "" + diff --git a/docs/pot/alerts.pot b/docs/pot/alerts.pot new file mode 100644 index 00000000000..ea65bdc3ed6 --- /dev/null +++ b/docs/pot/alerts.pot @@ -0,0 +1,165 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Alerts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following is the list of alert type numbers. The current alerts can be found by calling listAlerts." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "MEMORY = 0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "CPU = 1" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "STORAGE =2" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "STORAGE_ALLOCATED = 3" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "PUBLIC_IP = 4" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "PRIVATE_IP = 5" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "HOST = 6" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "USERVM = 7" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DOMAIN_ROUTER = 8" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "CONSOLE_PROXY = 9" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ROUTING = 10// lost connection to default route (to the gateway)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "STORAGE_MISC = 11 // lost connection to default route (to the gateway)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "USAGE_SERVER = 12 // lost connection to default route (to the gateway)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "MANAGMENT_NODE = 13 // lost connection to default route (to the gateway)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DOMAIN_ROUTER_MIGRATE = 14" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "CONSOLE_PROXY_MIGRATE = 15" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "USERVM_MIGRATE = 16" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "VLAN = 17" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "SSVM = 18" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "USAGE_SERVER_RESULT = 19" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "STORAGE_DELETE = 20;" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "UPDATE_RESOURCE_COUNT = 21; //Generated when we fail to update the resource count" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "USAGE_SANITY_RESULT = 22;" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DIRECT_ATTACHED_PUBLIC_IP = 23;" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "LOCAL_STORAGE = 24;" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "RESOURCE_LIMIT_EXCEEDED = 25; //Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only" +msgstr "" + diff --git a/docs/pot/allocators.pot b/docs/pot/allocators.pot new file mode 100644 index 00000000000..9394ee6806c --- /dev/null +++ b/docs/pot/allocators.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Allocators" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; enables administrators to write custom allocators that will choose the Host to place a new guest and the storage host from which to allocate guest virtual disk images." +msgstr "" + diff --git a/docs/pot/api-calls.pot b/docs/pot/api-calls.pot new file mode 100644 index 00000000000..b8e2c8fb6db --- /dev/null +++ b/docs/pot/api-calls.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Calling the &PRODUCT; API" +msgstr "" + diff --git a/docs/pot/api-overview.pot b/docs/pot/api-overview.pot new file mode 100644 index 00000000000..51a559d7ffb --- /dev/null +++ b/docs/pot/api-overview.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; API is a low level API that has been used to implement the &PRODUCT; web UIs. It is also a good basis for implementing other popular APIs such as EC2/S3 and emerging DMTF standards." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many &PRODUCT; API calls are asynchronous. These will return a Job ID immediately when called. This Job ID can be used to query the status of the job later. Also, status calls on impacted resources will provide some indication of their state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The API has a REST-like query basis and returns results in XML or JSON." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See the Developer’s Guide and the API Reference." +msgstr "" + diff --git a/docs/pot/api-reference.pot b/docs/pot/api-reference.pot new file mode 100644 index 00000000000..0a6a99ec4db --- /dev/null +++ b/docs/pot/api-reference.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "API Reference Documentation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can find all the API reference documentation at the below site:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://incubator.apache.org/cloudstack/docs/api/" +msgstr "" + diff --git a/docs/pot/asynchronous-commands-example.pot b/docs/pot/asynchronous-commands-example.pot new file mode 100644 index 00000000000..92f8d322c09 --- /dev/null +++ b/docs/pot/asynchronous-commands-example.pot @@ -0,0 +1,166 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Example" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following shows an example of using an asynchronous command. Assume the API command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=deployVirtualMachine&zoneId=1&serviceOfferingId=1&diskOfferingId=1&templateId=1\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack will immediately return a job ID and any other additional data." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <deployvirtualmachineresponse> \n" +" <jobid>1</jobid>\n" +" <id>100</id>\n" +" </deployvirtualmachineresponse>\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Using the job ID, you can periodically poll for the results by using the queryAsyncJobResult command." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=queryAsyncJobResult&jobId=1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Three possible results could come from this query." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Job is still pending:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <queryasyncjobresult> \n" +" <jobid>1</jobid>\n" +" <jobstatus>0</jobstatus>\n" +" <jobprocstatus>1</jobprocstatus>\n" +" </queryasyncjobresult>\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Job has succeeded:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <queryasyncjobresultresponse cloud-stack-version=\"3.0.1.6\">\n" +" <jobid>1</jobid>\n" +" <jobstatus>1</jobstatus>\n" +" <jobprocstatus>0</jobprocstatus>\n" +" <jobresultcode>0</jobresultcode>\n" +" <jobresulttype>object</jobresulttype>\n" +" <jobresult>\n" +" <virtualmachine>\n" +" <id>450</id>\n" +" <name>i-2-450-VM</name>\n" +" <displayname>i-2-450-VM</displayname>\n" +" <account>admin</account>\n" +" <domainid>1</domainid>\n" +" <domain>ROOT</domain>\n" +" <created>2011-03-10T18:20:25-0800</created>\n" +" <state>Running</state>\n" +" <haenable>false</haenable>\n" +" <zoneid>1</zoneid>\n" +" <zonename>San Jose 1</zonename>\n" +" <hostid>2</hostid>\n" +" <hostname>905-13.sjc.lab.vmops.com</hostname>\n" +" <templateid>1</templateid>\n" +" <templatename>CentOS 5.3 64bit LAMP</templatename>\n" +" <templatedisplaytext>CentOS 5.3 64bit LAMP</templatedisplaytext>\n" +" <passwordenabled>false</passwordenabled>\n" +" <serviceofferingid>1</serviceofferingid>\n" +" <serviceofferingname>Small Instance</serviceofferingname>\n" +" <cpunumber>1</cpunumber>\n" +" <cpuspeed>500</cpuspeed>\n" +" <memory>512</memory>\n" +" <guestosid>12</guestosid>\n" +" <rootdeviceid>0</rootdeviceid>\n" +" <rootdevicetype>NetworkFilesystem</rootdevicetype>\n" +" <nic>\n" +" <id>561</id>\n" +" <networkid>205</networkid>\n" +" <netmask>255.255.255.0</netmask>\n" +" <gateway>10.1.1.1</gateway>\n" +" <ipaddress>10.1.1.225</ipaddress>\n" +" <isolationuri>vlan://295</isolationuri>\n" +" <broadcasturi>vlan://295</broadcasturi>\n" +" <traffictype>Guest</traffictype>\n" +" <type>Virtual</type>\n" +" <isdefault>true</isdefault>\n" +" </nic>\n" +" <hypervisor>XenServer</hypervisor>\n" +" </virtualmachine>\n" +" </jobresult>\n" +" </queryasyncjobresultresponse>\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Job has failed:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <queryasyncjobresult>\n" +" <jobid>1</jobid> \n" +" <jobstatus>2</jobstatus> \n" +" <jobprocstatus>0</jobprocstatus>\n" +" <jobresultcode>551</jobresultcode>\n" +" <jobresulttype>text</jobresulttype>\n" +" <jobresult>Unable to deploy virtual machine id = 100 due to not enough capacity</jobresult> \n" +" </queryasyncjobresult>\n" +" " +msgstr "" + diff --git a/docs/pot/asynchronous-commands.pot b/docs/pot/asynchronous-commands.pot new file mode 100644 index 00000000000..44e2aacc8b5 --- /dev/null +++ b/docs/pot/asynchronous-commands.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Asynchronous Commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asynchronous commands were introduced in &PRODUCT; 2.x. Commands are designated as asynchronous when they can potentially take a long period of time to complete such as creating a snapshot or disk volume. They differ from synchronous commands by the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "They are identified in the API Reference by an (A)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "They will immediately return a job ID to refer to the job that will be responsible in processing the command." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If executed as a \"create\" resource command, it will return the resource ID as well as the job ID." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can periodically check the status of the job by making a simple API call to the command, queryAsyncJobResult and passing in the job ID." +msgstr "" + diff --git a/docs/pot/attach-iso-to-vm.pot b/docs/pot/attach-iso-to-vm.pot new file mode 100644 index 00000000000..791bd167243 --- /dev/null +++ b/docs/pot/attach-iso-to-vm.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Attaching an ISO to a VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the virtual machine you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Attach ISO button iso.png: Depicts adding an iso image " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Attach ISO dialog box, select the desired ISO." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK" +msgstr "" + diff --git a/docs/pot/attaching-volume.pot b/docs/pot/attaching-volume.pot new file mode 100644 index 00000000000..37336587d1f --- /dev/null +++ b/docs/pot/attaching-volume.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Attaching a Volume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can attach a volume to a guest VM to provide extra disk storage. Attach a volume when you first create a new volume, when you are moving an existing volume from one VM to another, or after you have migrated a volume from one storage pool to another." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4. Click the volume name in the Volumes list, then click the Attach Disk button AttachDiskButton.png: button to attach a volume " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Instance popup, choose the VM to which you want to attach the volume. You will only see instances to which you are allowed to attach volumes; for example, a user will see only instances created by that user, but the administrator will have more choices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the volume has been attached, you should be able to see it by clicking Instances, the instance name, and View Volumes." +msgstr "" + diff --git a/docs/pot/automatic-snapshot-creation-retention.pot b/docs/pot/automatic-snapshot-creation-retention.pot new file mode 100644 index 00000000000..a0443c4ad37 --- /dev/null +++ b/docs/pot/automatic-snapshot-creation-retention.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Automatic Snapshot Creation and Retention" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Supported for the following hypervisors: XenServer, VMware vSphere, and KVM)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Users can set up a recurring snapshot policy to automatically create multiple snapshots of a disk at regular intervals. Snapshots can be created on an hourly, daily, weekly, or monthly interval. One snapshot policy can be set up per disk volume. For example, a user can set up a daily snapshot at 02:30." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With each snapshot schedule, users can also specify the number of scheduled snapshots to be retained. Older snapshots that exceed the retention limit are automatically deleted. This user-defined limit must be equal to or lower than the global limit set by the &PRODUCT; administrator. See . The limit applies only to those snapshots that are taken as part of an automatic recurring snapshot policy. Additional manual snapshots can be created and retained." +msgstr "" + diff --git a/docs/pot/autoscale.pot b/docs/pot/autoscale.pot new file mode 100644 index 00000000000..34c60c45482 --- /dev/null +++ b/docs/pot/autoscale.pot @@ -0,0 +1,270 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring AutoScale" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "AutoScaling allows you to scale your back-end services or application VMs up or down seamlessly and automatically according to the conditions you define. With AutoScaling enabled, you can ensure that the number of VMs you are using seamlessly scale up when demand increases, and automatically decreases when demand subsides. Thus it helps you save compute costs by terminating underused VMs automatically and launching new VMs when you need them, without the need for manual intervention." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NetScaler AutoScaling is designed to seamlessly launch or terminate VMs based on user-defined conditions. Conditions for triggering a scaleup or scaledown action can vary from a simple use case like monitoring the CPU usage of a server to a complex use case of monitoring a combination of server's responsiveness and its CPU usage. For example, you can configure AutoScaling to launch an additional VM whenever CPU usage exceeds 80 percent for 15 minutes, or to remove a VM whenever CPU usage is less than 20 percent for 30 minutes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses the NetScaler load balancer to monitor all aspects of a system's health and work in unison with &PRODUCT; to initiate scale-up or scale-down actions. The supported NetScaler version is 10.0." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Prerequisites" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you configure an AutoScale rule, consider the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the necessary template is prepared before configuring AutoScale. When a VM is deployed by using a template and when it comes up, the application should be up and running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the application is not running, the NetScaler device considers the VM as ineffective and continues provisioning the VMs unconditionally until the resource limit is exhausted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deploy the templates you prepared. Ensure that the applications come up on the first boot and is ready to take the traffic. Observe the time requires to deploy the template. Consider this time when you specify the quiet time while configuring AutoScale." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The AutoScale feature supports the SNMP counters that can be used to define conditions for taking scale up or scale down actions. To monitor the SNMP-based counter, ensure that the SNMP agent is installed in the template used for creating the AutoScale VMs, and the SNMP operations work with the configured SNMP community and port by using standard SNMP managers. For example, see to configure SNMP on a RHEL machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the endpointe.url parameter present in the Global Settings is set to the Management Server API URL. For example, http://10.102.102.22:8080/client/api. In a multi-node Management Server deployment, use the virtual IP address configured in the load balancer for the management server’s cluster. Additionally, ensure that the NetScaler device has access to this IP address to provide AutoScale support." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you update the endpointe.url, disable the AutoScale functionality of the load balancer rules in the system, then enable them back to reflect the changes. For more information see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the API Key and Secret Key are regenerated for an AutoScale user, ensure that the AutoScale functionality of the load balancers that the user participates in are disabled and then enabled to reflect the configuration changes in the NetScaler." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In an advanced Zone, ensure that at least one VM should be present before configuring a load balancer rule with AutoScale. Having one VM in the network ensures that the network is in implemented state for configuring AutoScale." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Template: A template consists of a base OS image and application. A template is used to provision the new instance of an application on a scaleup action. When a VM is deployed from a template, the VM can start taking the traffic from the load balancer without any admin intervention. For example, if the VM is deployed for a Web service, it should have the Web server running, the database connected, and so on." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Compute offering: A predefined set of virtual hardware attributes, including CPU speed, number of CPUs, and RAM size, that the user can select when creating a new virtual machine instance. Choose one of the compute offerings to be used while provisioning a VM instance as part of scaleup action." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Min Instance: The minimum number of active VM instances that is assigned to a load balancing rule. The active VM instances are the application instances that are up and serving the traffic, and are being load balanced. This parameter ensures that a load balancing rule has at least the configured number of active VM instances are available to serve the traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If an application, such as SAP, running on a VM instance is down for some reason, the VM is then not counted as part of Min Instance parameter, and the AutoScale feature initiates a scaleup action if the number of active VM instances is below the configured value. Similarly, when an application instance comes up from its earlier down state, this application instance is counted as part of the active instance count and the AutoScale process initiates a scaledown action when the active instance count breaches the Max instance value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Max Instance: Maximum number of active VM instances that should be assigned to a load balancing rule. This parameter defines the upper limit of active VM instances that can be assigned to a load balancing rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specifying a large value for the maximum instance parameter might result in provisioning large number of VM instances, which in turn leads to a single load balancing rule exhausting the VM instances limit specified at the account or domain level." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If an application, such as SAP, running on a VM instance is down for some reason, the VM is not counted as part of Max Instance parameter. So there may be scenarios where the number of VMs provisioned for a scaleup action might be more than the configured Max Instance value. Once the application instances in the VMs are up from an earlier down state, the AutoScale feature starts aligning to the configured Max Instance value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify the following scale-up and scale-down policies:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Duration: The duration, in seconds, for which the conditions you specify must be true to trigger a scaleup action. The conditions defined should hold true for the entire duration you specify for an AutoScale action to be invoked." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Counter: The performance counters expose the state of the monitored instances. By default, &PRODUCT; offers four performance counters: Three SNMP counters and one NetScaler counter. The SNMP counters are Linux User CPU, Linux System CPU, and Linux CPU Idle. The NetScaler counter is ResponseTime. The root administrator can add additional counters into &PRODUCT; by using the &PRODUCT; API." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Operator: The following five relational operators are supported in AutoScale feature: Greater than, Less than, Less than or equal to, Greater than or equal to, and Equal to." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Threshold: Threshold value to be used for the counter. Once the counter defined above breaches the threshold value, the AutoScale feature initiates a scaleup or scaledown action." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add: Click Add to add the condition." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additionally, if you want to configure the advanced settings, click Show advanced settings, and specify the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Polling interval: Frequency in which the conditions, combination of counter, operator and threshold, are to be evaluated before taking a scale up or down action. The default polling interval is 30 seconds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Quiet Time: This is the cool down period after an AutoScale action is initiated. The time includes the time taken to complete provisioning a VM instance from its template and the time taken by an application to be ready to serve traffic. This quiet time allows the fleet to come up to a stable state before any action can take place. The default is 300 seconds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Destroy VM Grace Period: The duration in seconds, after a scaledown action is initiated, to wait before the VM is destroyed as part of scaledown action. This is to ensure graceful close of any pending sessions or transactions being served by the VM marked for destroy. The default is 120 seconds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Security Groups: Security groups provide a way to isolate traffic to the VM instances. A security group is a group of VMs that filter their incoming and outgoing traffic according to a set of rules, called ingress and egress rules. These rules filter network traffic according to the IP address that is attempting to communicate with the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk Offerings: A predefined set of disk size for primary data storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNMP Community: The SNMP community string to be used by the NetScaler device to query the configured counter value from the provisioned VM instances. Default is public." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNMP Port: The port number on which the SNMP agent that run on the provisioned VMs is listening. Default port is 161." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User: This is the user that the NetScaler device use to invoke scaleup and scaledown API calls to the cloud. If no option is specified, the user who configures AutoScaling is applied. Specify another user name to override." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apply: Click Apply to create the AutoScale configuration." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Disabling and Enabling an AutoScale Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to perform any maintenance operation on the AutoScale VM instances, disable the AutoScale configuration. When the AutoScale configuration is disabled, no scaleup or scaledown action is performed. You can use this downtime for the maintenance activities. To disable the AutoScale configuration, click the Disable AutoScale EnableDisable.png: button to enable or disable AutoScale. button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The button toggles between enable and disable, depending on whether AutoScale is currently enabled or not. After the maintenance operations are done, you can enable the AutoScale configuration back. To enable, open the AutoScale configuration page again, then click the Enable AutoScale EnableDisable.png: button to enable or disable AutoScale. button." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Updating an AutoScale Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can update the various parameters and add or delete the conditions in a scaleup or scaledown rule. Before you update an AutoScale configuration, ensure that you disable the AutoScale load balancer rule by clicking the Disable AutoScale button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you modify the required AutoScale parameters, click Apply. To apply the new AutoScale policies, open the AutoScale configuration page again, then click the Enable AutoScale button." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Runtime Considerations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An administrator should not assign a VM to a load balancing rule which is configured for AutoScale." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before a VM provisioning is completed if NetScaler is shutdown or restarted, the provisioned VM cannot be a part of the load balancing rule though the intent was to assign it to a load balancing rule. To workaround, rename the AutoScale provisioned VMs based on the rule name or ID so at any point of time the VMs can be reconciled to its load balancing rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Making API calls outside the context of AutoScale, such as destroyVM, on an autoscaled VM leaves the load balancing configuration in an inconsistent state. Though VM is destroyed from the load balancer rule, NetScaler continues to show the VM as a service assigned to a rule." +msgstr "" + diff --git a/docs/pot/aws-api-examples.pot b/docs/pot/aws-api-examples.pot new file mode 100644 index 00000000000..be0b0369de6 --- /dev/null +++ b/docs/pot/aws-api-examples.pot @@ -0,0 +1,166 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Examples" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are many tools available to interface with a AWS compatible API. In this section we provide a few examples that users of &PRODUCT; can build upon." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Boto Examples" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Boto is one of them. It is a Python package available at https://github.com/boto/boto. In this section we provide two examples of Python scripts that use Boto and have been tested with the &PRODUCT; AWS API Interface." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First is an EC2 example. Replace the Access and Secret Keys with your own and update the endpoint." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "An EC2 Boto example" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#!/usr/bin/env python\n" +"\n" +"import sys\n" +"import os\n" +"import boto\n" +"import boto.ec2\n" +"\n" +"region = boto.ec2.regioninfo.RegionInfo(name=\"ROOT\",endpoint=\"localhost\")\n" +"apikey='GwNnpUPrO6KgIdZu01z_ZhhZnKjtSdRwuYd4DvpzvFpyxGMvrzno2q05MB0ViBoFYtdqKd'\n" +"secretkey='t4eXLEYWw7chBhDlaKf38adCMSHx_wlds6JfSx3z9fSpSOm0AbP9Moj0oGIzy2LSC8iw'\n" +"\n" +"def main():\n" +" '''Establish connection to EC2 cloud'''\n" +" conn =boto.connect_ec2(aws_access_key_id=apikey,\n" +" aws_secret_access_key=secretkey,\n" +" is_secure=False,\n" +" region=region,\n" +" port=7080,\n" +" path=\"/awsapi\",\n" +" api_version=\"2010-11-15\")\n" +"\n" +" '''Get list of images that I own'''\n" +" images = conn.get_all_images()\n" +" print images\n" +" myimage = images[0]\n" +" '''Pick an instance type'''\n" +" vm_type='m1.small'\n" +" reservation = myimage.run(instance_type=vm_type,security_groups=['default'])\n" +"\n" +"if __name__ == '__main__':\n" +" main()\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Second is an S3 example. Replace the Access and Secret keys with your own, as well as the endpoint of the service. Be sure to also update the file paths to something that exists on your machine." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "An S3 Boto Example" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#!/usr/bin/env python\n" +"\n" +"import sys\n" +"import os\n" +"from boto.s3.key import Key\n" +"from boto.s3.connection import S3Connection\n" +"from boto.s3.connection import OrdinaryCallingFormat\n" +"\n" +"apikey='ChOw-pwdcCFy6fpeyv6kUaR0NnhzmG3tE7HLN2z3OB_s-ogF5HjZtN4rnzKnq2UjtnHeg_yLA5gOw'\n" +"secretkey='IMY8R7CJQiSGFk4cHwfXXN3DUFXz07cCiU80eM3MCmfLs7kusgyOfm0g9qzXRXhoAPCH-IRxXc3w'\n" +"\n" +"cf=OrdinaryCallingFormat()\n" +"\n" +"def main(): \n" +" '''Establish connection to S3 service'''\n" +" conn =S3Connection(aws_access_key_id=apikey,aws_secret_access_key=secretkey, \\\n" +" is_secure=False, \\\n" +" host='localhost', \\\n" +" port=7080, \\\n" +" calling_format=cf, \\\n" +" path=\"/awsapi/rest/AmazonS3\")\n" +"\n" +" try:\n" +" bucket=conn.create_bucket('cloudstack')\n" +" k = Key(bucket)\n" +" k.key = 'test'\n" +" try:\n" +" k.set_contents_from_filename('/Users/runseb/Desktop/s3cs.py')\n" +" except:\n" +" print 'could not write file'\n" +" pass\n" +" except:\n" +" bucket = conn.get_bucket('cloudstack')\n" +" k = Key(bucket)\n" +" k.key = 'test'\n" +" try:\n" +" k.get_contents_to_filename('/Users/runseb/Desktop/foobar')\n" +" except:\n" +" print 'Could not get file'\n" +" pass\n" +"\n" +" try:\n" +" bucket1=conn.create_bucket('teststring')\n" +" k=Key(bucket1)\n" +" k.key('foobar')\n" +" k.set_contents_from_string('This is my silly test')\n" +" except:\n" +" bucket1=conn.get_bucket('teststring')\n" +" k = Key(bucket1)\n" +" k.key='foobar'\n" +" k.get_contents_as_string()\n" +" \n" +"if __name__ == '__main__':\n" +" main()\n" +"\n" +" " +msgstr "" + +#. Tag: title +#, no-c-format +msgid "JClouds Examples" +msgstr "" + diff --git a/docs/pot/aws-ec2-configuration.pot b/docs/pot/aws-ec2-configuration.pot new file mode 100644 index 00000000000..e49f076edaf --- /dev/null +++ b/docs/pot/aws-ec2-configuration.pot @@ -0,0 +1,153 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling the EC2 and S3 Compatible Interface" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The software that provides AWS API compatibility is installed along with &PRODUCT;. You must enable the services and perform some setup steps prior to using it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the global configuration parameters for each service to true. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a set of &PRODUCT; service offerings with names that match the Amazon service offerings. You can do this through the &PRODUCT; UI as described in the Administration Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure you have included the Amazon default service offering, m1.small. As well as any EC2 instance types that you will use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you did not already do so when you set the configuration parameter in step 1, restart the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following sections provides details to perform these steps" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Enabling the Services" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable the EC2 and S3 compatible services you need to set the configuration variables enable.ec2.api and enable.s3.api to true. You do not have to enable both at the same time. Enable the ones you need. This can be done via the &PRODUCT; GUI by going in Global Settings or via the API." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The snapshot below shows you how to use the GUI to enable these services" +msgstr "" + +#. Tag: para +#, no-c-format +msgid " Use the GUI to set the configuration variable to true " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Using the &PRODUCT; API, the easiest is to use the so-called integration port on which you can make unauthenticated calls. In Global Settings set the port to 8096 and subsequently call the updateConfiguration method. The following urls shows you how:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" http://localhost:8096/client/api?command=updateConfiguration&name=enable.ec2.api&value=true\n" +" http://localhost:8096/client/api?command=updateConfiguration&name=enable.ec2.api&value=true\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once you have enabled the services, restart the server." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating EC2 Compatible Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You will also need to define compute service offerings with names compatible with the Amazon EC2 instance types API names (e.g m1.small,m1.large). This can be done via the &PRODUCT; GUI. Go under Service Offerings select Compute offering and either create a new compute offering or modify an existing one, ensuring that the name matches an EC2 instance type API name. The snapshot below shows you how:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid " Use the GUI to set the name of a compute service offering to an EC2 instance type API name. " +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Modifying the AWS API Port" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) The AWS API listens for requests on port 7080. If you prefer AWS API to listen on another port, you can change it as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the files /etc/cloud/management/server.xml, /etc/cloud/management/server-nonssl.xml, and /etc/cloud/management/server-ssl.xml." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In each file, find the tag <Service name=\"Catalina7080\">. Under this tag, locate <Connector executor=\"tomcatThreadPool-internal\" port= ....<." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the port to whatever port you want to use, then save the files." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you re-install &PRODUCT;, you will have to re-enable the services and if need be update the port." +msgstr "" + diff --git a/docs/pot/aws-ec2-introduction.pot b/docs/pot/aws-ec2-introduction.pot new file mode 100644 index 00000000000..f6c87340dea --- /dev/null +++ b/docs/pot/aws-ec2-introduction.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Amazon Web Services Compatible Interface" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; can translate Amazon Web Services (AWS) API calls to native &PRODUCT; API calls so that users can continue using existing AWS-compatible tools. This translation service runs as a separate web application in the same tomcat server as the management server of &PRODUCT;, listening on a different port. The Amazon Web Services (AWS) compatible interface provides the EC2 SOAP and Query APIs as well as the S3 REST API." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This service was previously enabled by separate software called CloudBridge. It is now fully integrated with the &PRODUCT; management server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The compatible interface for the EC2 Query API and the S3 API are Work In Progress. The S3 compatible API offers a way to store data on the management server file system, it is not an implementation of the S3 backend." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Limitations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported only in zones that use basic networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Available in fresh installations of &PRODUCT;. Not available through upgrade of previous versions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Features such as Elastic IP (EIP) and Elastic Load Balacing (ELB) are only available in an infrastructure with a Citrix NetScaler device. Users accessing a Zone with a NetScaler device will need to use a NetScaler-enabled network offering (DefaultSharedNetscalerEIP and ELBNetworkOffering)." +msgstr "" + diff --git a/docs/pot/aws-ec2-requirements.pot b/docs/pot/aws-ec2-requirements.pot new file mode 100644 index 00000000000..27644e77be1 --- /dev/null +++ b/docs/pot/aws-ec2-requirements.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Supported API Version" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The EC2 interface complies with Amazon's WDSL version dated November 15, 2010, available at http://ec2.amazonaws.com/doc/2010-11-15/." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The interface is compatible with the EC2 command-line tools EC2 tools v. 1.3.6230, which can be downloaded at http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-62308.zip." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Work is underway to support a more recent version of the EC2 API" +msgstr "" + diff --git a/docs/pot/aws-ec2-supported-commands.pot b/docs/pot/aws-ec2-supported-commands.pot new file mode 100644 index 00000000000..9ffd9f4b6fb --- /dev/null +++ b/docs/pot/aws-ec2-supported-commands.pot @@ -0,0 +1,665 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Supported AWS API Calls" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following Amazon EC2 commands are supported by &PRODUCT; when the AWS API compatible interface is enabled. For a few commands, there are differences between the &PRODUCT; and Amazon EC2 versions, and these differences are noted. The underlying SOAP call for each command is also given, for those who have built tools using those calls." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Elastic IP API mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "EC2 command" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "SOAP call" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "&PRODUCT; API call" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-allocate-address" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "AllocateAddress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "associateIpAddress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-associate-address" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "AssociateAddress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "enableStaticNat" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-addresses" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeAddresses" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listPublicIpAddresses" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-diassociate-address" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DisassociateAddress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "disableStaticNat" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-release-address" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ReleaseAddress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "disassociateIpAddress" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Availability Zone API mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-availability-zones" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeAvailabilityZones" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listZones" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Images API mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-create-image" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "CreateImage" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "createTemplate" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-deregister" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeregisterImage" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeleteTemplate" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-images" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeImages" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listTemplates" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-register" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "RegisterImage" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "registerTemplate" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Image Attributes API mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-image-attribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeImageAttribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listTemplatePermissions" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-modify-image-attribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ModifyImageAttribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "updateTemplatePermissions" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-reset-image-attribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ResetImageAttribute" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Instances API mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listVirtualMachines" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-run-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "RunInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "deployVirtualMachine" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-reboot-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "RebootInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "rebootVirtualMachine" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-start-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "StartInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "startVirtualMachine" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-stop-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "StopInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "stopVirtualMachine" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-terminate-instances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "TerminateInstances" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "destroyVirtualMachine" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Instance Attributes Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-instance-attribute" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeInstanceAttribute" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Keys Pairs Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-add-keypair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "CreateKeyPair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "createSSHKeyPair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-delete-keypair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeleteKeyPair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "deleteSSHKeyPair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-keypairs" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeKeyPairs" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listSSHKeyPairs" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-import-keypair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ImportKeyPair" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "registerSSHKeyPair" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Passwords API Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-get-password" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "GetPasswordData" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "getVMPassword" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Security Groups API Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-authorize" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "AuthorizeSecurityGroupIngress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "authorizeSecurityGroupIngress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-add-group" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "CreateSecurityGroup" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "createSecurityGroup" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-delete-group" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeleteSecurityGroup" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "deleteSecurityGroup" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-group" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeSecurityGroups" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listSecurityGroups" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-revoke" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "RevokeSecurityGroupIngress" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "revokeSecurityGroupIngress" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Snapshots API Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-create-snapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "CreateSnapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "createSnapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-delete-snapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeleteSnapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "deleteSnapshot" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-snapshots" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeSnapshots" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listSnapshots" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Volumes API Mapping" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-attach-volume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "AttachVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "attachVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-create-volume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "CreateVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "createVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-delete-volume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DeleteVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "deleteVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-describe-volume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DescribeVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "listVolumes" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "ec2-detach-volume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "DetachVolume" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "detachVolume" +msgstr "" + diff --git a/docs/pot/aws-ec2-timeouts.pot b/docs/pot/aws-ec2-timeouts.pot new file mode 100644 index 00000000000..190ad8d82bc --- /dev/null +++ b/docs/pot/aws-ec2-timeouts.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Timeouts to Ensure AWS API Command Completion" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Amazon EC2 command-line tools have a default connection timeout. When used with &PRODUCT;, a longer timeout might be needed for some commands. If you find that commands are not completing due to timeouts, you can specify a custom timeouts. You can add the following optional command-line parameters to any &PRODUCT;-supported EC2 command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "--connection-timeout TIMEOUT" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Specifies a connection timeout (in seconds). Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "--connection-timeout 30" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "--request-timeout TIMEOUT" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Specifies a request timeout (in seconds). Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "--request-timeout 45" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ec2-run-instances 2 –z us-test1 –n 1-3 --connection-timeout 120 --request-timeout 120" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The timeouts optional arguments are not specific to &PRODUCT;." +msgstr "" + diff --git a/docs/pot/aws-ec2-user-setup.pot b/docs/pot/aws-ec2-user-setup.pot new file mode 100644 index 00000000000..c1412920889 --- /dev/null +++ b/docs/pot/aws-ec2-user-setup.pot @@ -0,0 +1,141 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "AWS API User Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In general, users need not be aware that they are using a translation service provided by &PRODUCT;. They only need to send AWS API calls to &PRODUCT;'s endpoint, and it will translate the calls to the native &PRODUCT; API. Users of the Amazon EC2 compatible interface will be able to keep their existing EC2 tools and scripts and use them with their &PRODUCT; deployment, by specifying the endpoint of the management server and using the proper user credentials. In order to do this, each user must perform the following configuration steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate user credentials." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Register with the service." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For convenience, set up environment variables for the EC2 SOAP command-line tools." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "AWS API User Registration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each user must perform a one-time registration. The user follows these steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Obtain the following by looking in the &PRODUCT; UI, using the API, or asking the cloud administrator:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; server's publicly available DNS name or IP address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user account's Access key and Secret key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate a private key and a self-signed X.509 certificate. The user substitutes their own desired storage location for /path/to/… below." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /path/to/private_key.pem -out /path/to/cert.pem" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Register the user X.509 certificate and Access/Secret keys with the AWS compatible service. If you have the source code of &PRODUCT; go to the awsapi-setup/setup directory and use the Python script cloudstack-aws-api-register. If you do not have the source then download the script using the following command." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "wget -O cloudstack-aws-api-register \"https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=blob_plain;f=awsapi-setup/setup/cloudstack-aws-api-register;hb=HEAD\"\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then execute it, using the parameter values that were obtained in step 1. An example is shown below." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ cloudstack-aws-api-register --apikey=User’s &PRODUCT; API key --secretkey=User’s &PRODUCT; Secret key --cert=/path/to/cert.pem --url=http://&PRODUCT;.server:7080/awsapi" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A user with an existing AWS certificate could choose to use the same certificate with &PRODUCT;, but note that the certificate would be uploaded to the &PRODUCT; management server database." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "AWS API Command-Line Tools Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To use the EC2 command-line tools, the user must perform these steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure you have the right version of EC2 Tools. The supported version is available at http://s3.amazonaws.com/ec2-downloads/ec2-api-tools-1.3-62308.zip." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up the EC2 environment variables. This can be done every time you use the service or you can set them up in the proper shell profile. Replace the endpoint (i.e EC2_URL) with the proper address of your &PRODUCT; management server and port. In a bash shell do the following." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" $ export EC2_CERT=/path/to/cert.pem\n" +" $ export EC2_PRIVATE_KEY=/path/to/private_key.pem\n" +" $ export EC2_URL=http://localhost:7080/awsapi\n" +" $ export EC2_HOME=/path/to/EC2_tools_directory\n" +" " +msgstr "" + diff --git a/docs/pot/aws-interface-compatibility.pot b/docs/pot/aws-interface-compatibility.pot new file mode 100644 index 00000000000..8ed02a8270c --- /dev/null +++ b/docs/pot/aws-interface-compatibility.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Amazon Web Services Compatible Interface" +msgstr "" + diff --git a/docs/pot/basic-adv-networking.pot b/docs/pot/basic-adv-networking.pot new file mode 100644 index 00000000000..2e67f2c2d7b --- /dev/null +++ b/docs/pot/basic-adv-networking.pot @@ -0,0 +1,195 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Basic and Advanced Networking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides two styles of networking:." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Basic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For AWS-style networking. Provides a single network where guest isolation can be provided through layer-3 means such as security groups (IP address source filtering)." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Advanced" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks, but requires more configuration steps than basic networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each zone has either basic or advanced networking. Once the choice of networking model for a zone has been made and configured in &PRODUCT;, it can not be changed. A zone is either basic or advanced for its entire lifetime." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table compares the networking features in the two networking models." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Networking Feature" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Basic Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Advanced Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Single network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multiple networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Firewall type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Physical" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Physical and Virtual" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Load balancer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Isolation type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Layer 3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Layer 2 and Layer 3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "No" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Port forwarding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "1:1 NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Userdata" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network usage monitoring" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "sFlow / netFlow at physical router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor and Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS and DHCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The two types of networking may be in use in the same cloud. However, a given zone must use either Basic Networking or Advanced Networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Different types of network traffic can be segmented on the same physical network. Guest traffic can also be segmented by account. To isolate traffic, you can use separate VLANs. If you are using separate VLANs on a single physical network, make sure the VLAN tags are in separate numerical ranges." +msgstr "" + diff --git a/docs/pot/basic-zone-configuration.pot b/docs/pot/basic-zone-configuration.pot new file mode 100644 index 00000000000..ee76cf456f9 --- /dev/null +++ b/docs/pot/basic-zone-configuration.pot @@ -0,0 +1,360 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Basic Zone Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you select Basic in the Add Zone wizard and click Next, you will be asked to enter the following details. Then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. A name for the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS 1 and 2. These are DNS servers for use by guest VMs in the zone. These DNS servers will be accessed via the public network you will add later. The public IP addresses for the zone must have a route to the DNS server named here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Internal DNS 1 and Internal DNS 2. These are DNS servers for use by system VMs in the zone (these are VMs used by &PRODUCT; itself, such as virtual routers, console proxies, and Secondary Storage VMs.) These DNS servers will be accessed via the management traffic network interface of the System VMs. The private IP address you provide for the pods must have a route to the internal DNS server named here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. (Introduced in version 3.0.1) Choose the hypervisor for the first cluster in the zone. You can add clusters with different hypervisors later, after you finish adding the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Offering. Your choice here determines what network services will be available on the network for guest VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DefaultSharedNetworkOfferingWithSGService" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to enable security groups for guest traffic isolation, choose this. (See Using Security Groups to Control Traffic to VMs.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DefaultSharedNetworkOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you do not need security groups, choose this." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DefaultSharedNetscalerEIPandELBNetworkOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have installed a Citrix NetScaler appliance as part of your zone network, and you will be using its Elastic IP and Elastic Load Balancing features, choose this. With the EIP and ELB features, a basic zone with security groups enabled can offer 1:1 static NAT and load balancing." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Domain. (Optional) If you want to assign a special domain name to the guest VM network, specify the DNS suffix." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. A public zone is available to all users. A zone that is not public will be assigned to a particular domain. Only users in that domain will be allowed to create guest VMs in this zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose which traffic types will be carried by the physical network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The traffic types are management, public, guest, and storage traffic. For more information about the types, roll over the icons to display their tool tips, or see Basic Zone Network Traffic Types. This screen starts out with some traffic types already assigned. To add more, drag and drop traffic types onto the network. You can also change the network name if desired." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Introduced in version 3.0.1) Assign a network traffic label to each traffic type on the physical network. These labels must match the labels you have already defined on the hypervisor host. To assign each label, click the Edit button under the traffic type icon. A popup dialog appears where you can type the label, then click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These traffic labels will be defined only for the hypervisor selected for the first cluster. For all other hypervisors, the labels can be configured after the zone is created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(NetScaler only) If you chose the network offering for NetScaler, you have an additional screen to fill out. Provide the requested details to set up the NetScaler, then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP address. The NSIP (NetScaler IP) address of the NetScaler device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username/Password. The authentication credentials to access the device. &PRODUCT; uses these credentials to access the device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type. NetScaler device type that is being added. It could be NetScaler VPX, NetScaler MPX, or NetScaler SDX. For a comparison of the types, see About Using a NetScaler Load Balancer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public interface. Interface of NetScaler that is configured to be part of the public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private interface. Interface of NetScaler that is configured to be part of the private network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of retries. Number of times to attempt a command on the device before considering the operation failed. Default is 2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Capacity. Number of guest networks/accounts that will share this NetScaler device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Dedicated. When marked as dedicated, this device will be dedicated to a single account. When Dedicated is checked, the value in the Capacity field has no significance – implicitly, its value is 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(NetScaler only) Configure the IP range for public traffic. The IPs in this range will be used for the static NAT capability which you enabled by selecting the network offering for NetScaler with EIP and ELB. Enter the following details, then click Add. If desired, you can repeat this step to add more IP ranges. When done, click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway. The gateway in use for these IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask. The netmask associated with this IP range." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN. The VLAN that will be used for public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start IP/End IP. A range of IP addresses that are assumed to be accessible from the Internet and will be allocated for access to guest VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new zone, &PRODUCT; adds the first pod for you. You can always add more pods later. For an overview of what a pod is, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first pod, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pod Name. A name for the pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reserved system gateway. The gateway for the hosts in that pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reserved system netmask. The network prefix that defines the pod's subnet. Use CIDR notation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start/End Reserved System IP. The IP range in the management network that &PRODUCT; uses to manage various system VMs, such as Secondary Storage VMs, Console Proxy VMs, and DHCP. For more information, see System Reserved IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the network for guest traffic. Provide the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest gateway. The gateway that the guests should use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest netmask. The netmask in use on the subnet the guests will use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest start IP/End IP. Enter the first and last IP addresses that define a range that &PRODUCT; can assign to guests." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We strongly recommend the use of multiple NICs. If multiple NICs are used, they may be in a different subnet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If one NIC is used, these IPs should be in the same CIDR as the pod CIDR." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new pod, &PRODUCT; adds the first cluster for you. You can always add more clusters later. For an overview of what a cluster is, see About Clusters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first cluster, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. (Version 3.0.0 only; in 3.0.1, this field is read only) Choose the type of hypervisor software that all hosts in this cluster will run. If you choose VMware, additional fields appear so you can give information about a vSphere cluster. For vSphere servers, we recommend creating the cluster of hosts in vCenter and then adding the entire cluster to &PRODUCT;. See Add Cluster: vSphere." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster name. Enter a name for the cluster. This can be text of your choosing and is not used by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new cluster, &PRODUCT; adds the first host for you. You can always add more hosts later. For an overview of what a host is, see About Hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you add a hypervisor host to &PRODUCT;, the host must not have any VMs already running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you can configure the host, you need to install the hypervisor software on the host. You will need to know which version of the hypervisor software version is supported by &PRODUCT; and what additional configuration is required to ensure the host will work with &PRODUCT;. To find these installation details, see:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix XenServer Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware vSphere Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM vSphere Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first host, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Name. The DNS name or IP address of the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username. The username is root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password. This is the password for the user named above (from your XenServer or KVM install)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Tags. (Optional) Any labels that you use to categorize hosts for ease of maintenance. For example, you can set this to the cloud's HA tag (set in the ha.tag global configuration parameter) if you want this host to be used only for VMs with the \"high availability\" feature enabled. For more information, see HA-Enabled Virtual Machines as well as HA for Hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new cluster, &PRODUCT; adds the first primary storage server for you. You can always add more servers later. For an overview of what primary storage is, see About Primary Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the first primary storage server, enter the following, then click Next:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. For XenServer, choose either NFS, iSCSI, or PreSetup. For KVM, choose NFS, SharedMountPoint,CLVM, or RBD. For vSphere choose either VMFS (iSCSI or FiberChannel) or NFS. The remaining fields in the screen vary depending on what you choose here." +msgstr "" + diff --git a/docs/pot/basic-zone-guest-ip-addresses.pot b/docs/pot/basic-zone-guest-ip-addresses.pot new file mode 100644 index 00000000000..c656eb525a5 --- /dev/null +++ b/docs/pot/basic-zone-guest-ip-addresses.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Basic Zone Guest IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When basic networking is used, &PRODUCT; will assign IP addresses in the CIDR of the pod to the guests in that pod. The administrator must add a Direct IP range on the pod for this purpose. These IPs are in the same VLAN as the hosts." +msgstr "" + diff --git a/docs/pot/basic-zone-network-traffic-types.pot b/docs/pot/basic-zone-network-traffic-types.pot new file mode 100644 index 00000000000..dab50e915e5 --- /dev/null +++ b/docs/pot/basic-zone-network-traffic-types.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Basic Zone Network Traffic Types" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When basic networking is used, there can be only one physical network in the zone. That physical network carries the following traffic types:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest. When end users run VMs, they generate guest traffic. The guest VMs communicate with each other over a network that can be referred to as the guest network. Each pod in a basic zone is a broadcast domain, and therefore each pod has a different IP range for the guest network. The administrator must configure the IP range for each pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management. When &PRODUCT;’s internal resources communicate with each other, they generate management traffic. This includes communication between hosts, system VMs (VMs used by &PRODUCT; to perform various tasks in the cloud), and any other component that communicates directly with the &PRODUCT; Management Server. You must configure the IP range for the system VMs to use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We strongly recommend the use of separate NICs for management traffic and guest traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Public traffic is generated when VMs in the cloud access the Internet. Publicly accessible IPs must be allocated for this purpose. End users can use the &PRODUCT; UI to acquire these IPs to implement NAT between their guest network and the public network, as described in Acquiring a New IP Address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage. Traffic such as VM templates and snapshots, which is sent between the secondary storage VM and secondary storage servers. &PRODUCT; uses a separate Network Interface Controller (NIC) named storage NIC for storage network traffic. Use of a storage NIC that always operates on a high bandwidth network allows fast template and snapshot copying. You must configure the IP range to use for the storage network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a basic network, configuring the physical network is fairly straightforward. In most cases, you only need to configure one guest network to carry traffic that is generated by guest VMs. If you use a NetScaler load balancer and enable its elastic IP and elastic load balancing (EIP and ELB) features, you must also configure a network to carry public traffic. &PRODUCT; takes care of presenting the necessary network configuration steps to you in the UI when you add a new zone." +msgstr "" + diff --git a/docs/pot/basic-zone-physical-network-configuration.pot b/docs/pot/basic-zone-physical-network-configuration.pot new file mode 100644 index 00000000000..a9d81520fa3 --- /dev/null +++ b/docs/pot/basic-zone-physical-network-configuration.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Basic Zone Physical Network Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a basic network, configuring the physical network is fairly straightforward. You only need to configure one guest network to carry traffic that is generated by guest VMs. When you first add a zone to &PRODUCT;, you set up the guest network through the Add Zone screens." +msgstr "" + diff --git a/docs/pot/best-practices-for-vms.pot b/docs/pot/best-practices-for-vms.pot new file mode 100644 index 00000000000..9e8ca118723 --- /dev/null +++ b/docs/pot/best-practices-for-vms.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Best Practices for Virtual Machines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator should monitor the total number of VM instances in each cluster, and disable allocation to the cluster if the total is approaching the maximum that the hypervisor can handle. Be sure to leave a safety margin to allow for the possibility of one or more hosts failing, which would increase the VM load on the other hosts as the VMs are automatically redeployed. Consult the documentation for your chosen hypervisor to find the maximum permitted number of VMs per host, then use &PRODUCT; global configuration settings to set this as the default limit. Monitor the VM activity in each cluster at all times. Keep the total number of VMs below a safe level that allows for the occasional host failure. For example, if there are N hosts in the cluster, and you want to allow for one host in the cluster to be down at any given time, the total number of VM instances you can permit in the cluster is at most (N-1) * (per-host-limit). Once a cluster reaches this number of VMs, use the &PRODUCT; UI to disable allocation of more VMs to the cluster." +msgstr "" + diff --git a/docs/pot/best-practices-primary-storage.pot b/docs/pot/best-practices-primary-storage.pot new file mode 100644 index 00000000000..6dd7ab2af01 --- /dev/null +++ b/docs/pot/best-practices-primary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Best Practices for Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The speed of primary storage will impact guest performance. If possible, choose smaller, higher RPM drives for primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that nothing is stored on the server. Adding the server to &PRODUCT; will destroy any existing data" +msgstr "" + diff --git a/docs/pot/best-practices-secondary-storage.pot b/docs/pot/best-practices-secondary-storage.pot new file mode 100644 index 00000000000..43326cf0292 --- /dev/null +++ b/docs/pot/best-practices-secondary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Best Practices for Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each Zone can have one or more secondary storage servers. Multiple secondary storage servers provide increased scalability to the system." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage has a high read:write ratio and is expected to consist of larger drives with lower IOPS than primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that nothing is stored on the server. Adding the server to &PRODUCT; will destroy any existing data." +msgstr "" + diff --git a/docs/pot/best-practices-templates.pot b/docs/pot/best-practices-templates.pot new file mode 100644 index 00000000000..4b822784dc1 --- /dev/null +++ b/docs/pot/best-practices-templates.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Best Practices for Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you plan to use large templates (100 GB or larger), be sure you have a 10-gigabit network to support the large templates. A slower network can lead to timeouts and other errors when large templates are used." +msgstr "" + diff --git a/docs/pot/best-practices-virtual-router.pot b/docs/pot/best-practices-virtual-router.pot new file mode 100644 index 00000000000..d1cd63a5982 --- /dev/null +++ b/docs/pot/best-practices-virtual-router.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Best Practices for Virtual Routers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "WARNING: Restarting a virtual router from a hypervisor console deletes all the iptables rules. To work around this issue, stop the virtual router and start it from the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "WARNING: Do not use the destroyRouter API when only one router is available in the network, because restartNetwork API with the cleanup=false parameter can't recreate it later. If you want to destroy and recreate the single router available in the network, use the restartNetwork API with the cleanup=true parameter." +msgstr "" + diff --git a/docs/pot/build-deb.pot b/docs/pot/build-deb.pot new file mode 100644 index 00000000000..ca2bb9f54c0 --- /dev/null +++ b/docs/pot/build-deb.pot @@ -0,0 +1,175 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building DEB packages" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the bootstrap dependencies, you'll also need to install several other dependencies. Note that we recommend using Maven 3, which is not currently available in 12.04.1 LTS. So, you'll also need to add a PPA repository that includes Maven 3. After running the command add-apt-repository, you will be prompted to continue and a GPG key will be added." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"$ sudo apt-get update\n" +"$ sudo apt-get install python-software-properties\n" +"$ sudo add-apt-repository ppa:natecarlson/maven3\n" +"$ sudo apt-get update\n" +"$ sudo apt-get install ant debhelper openjdk-6-jdk tomcat6 libws-commons-util-java genisoimage python-mysqldb libcommons-codec-java libcommons-httpclient-java liblog4j1.2-java maven3\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While we have defined, and you have presumably already installed the bootstrap prerequisites, there are a number of build time prerequisites that need to be resolved. &PRODUCT; uses maven for dependency resolution. You can resolve the buildtime depdencies for CloudStack by running:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "$ mvn3 -P deps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that we have resolved the dependencies we can move on to building &PRODUCT; and packaging them into DEBs by issuing the following command." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"$ dpkg-buildpackge -uc -us\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This command will build 16 Debian packages. You should have all of the following:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"cloud-agent_4.0.0-incubating_amd64.deb\n" +"cloud-agent-deps_4.0.0-incubating_amd64.deb\n" +"cloud-agent-libs_4.0.0-incubating_amd64.deb\n" +"cloud-awsapi_4.0.0-incubating_amd64.deb\n" +"cloud-cli_4.0.0-incubating_amd64.deb\n" +"cloud-client_4.0.0-incubating_amd64.deb\n" +"cloud-client-ui_4.0.0-incubating_amd64.deb\n" +"cloud-core_4.0.0-incubating_amd64.deb\n" +"cloud-deps_4.0.0-incubating_amd64.deb\n" +"cloud-python_4.0.0-incubating_amd64.deb\n" +"cloud-scripts_4.0.0-incubating_amd64.deb\n" +"cloud-server_4.0.0-incubating_amd64.deb\n" +"cloud-setup_4.0.0-incubating_amd64.deb\n" +"cloud-system-iso_4.0.0-incubating_amd64.deb\n" +"cloud-usage_4.0.0-incubating_amd64.deb\n" +"cloud-utils_4.0.0-incubating_amd64.deb\n" +"" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Setting up an APT repo" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you've created the packages, you'll want to copy them to a system where you can serve the packages over HTTP. You'll create a directory for the packages and then use dpkg-scanpackages to create Packages.gz, which holds information about the archive structure. Finally, you'll add the repository to your system(s) so you can install the packages using APT." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The first step is to make sure that you have the dpkg-dev package installed. This should have been installed when you pulled in the debhelper application previously, but if you're generating Packages.gz on a different system, be sure that it's installed there as well." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "$ sudo apt-get install dpkg-dev" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The next step is to copy the DEBs to the directory where they can be served over HTTP. We'll use /var/www/cloudstack/repo in the examples, but change the directory to whatever works for you." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"sudo mkdir -p /var/www/cloudstack/repo/binary\n" +"sudo cp *.deb /var/www/cloudstack/repo/binary\n" +"sudo cd /var/www/cloudstack/repo/binary\n" +"sudo dpkg-scanpackages . /dev/null | tee Packages | gzip -9 > Packages.gz\n" +"" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Note: Override Files" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can safely ignore the warning about a missing override file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now you should have all of the DEB packages and Packages.gz in the binary directory and available over HTTP. (You may want to use wget or curl to test this before moving on to the next step.)" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring your machines to use the APT repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that we have created the repository, you need to configure your machine to make use of the APT repository. You can do this by adding a repository file under /etc/apt/sources.list.d. Use your preferred editor to create /etc/apt/sources.list.d/cloudstack.list with this line:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "deb http://server.url/cloudstack/repo binary ./" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that you have the repository info in place, you'll want to run another update so that APT knows where to find the &PRODUCT; packages." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "$ sudo apt-get update" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can now move on to the instructions under Install on Ubuntu." +msgstr "" + diff --git a/docs/pot/build-rpm.pot b/docs/pot/build-rpm.pot new file mode 100644 index 00000000000..a514062a672 --- /dev/null +++ b/docs/pot/build-rpm.pot @@ -0,0 +1,111 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building RPMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While we have defined, and you have presumably already installed the bootstrap prerequisites, there are a number of build time prerequisites that need to be resolved. &PRODUCT; uses maven for dependency resolution. You can resolve the buildtime depdencies for CloudStack by running the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ mvn -P deps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that we have resolved the dependencies we can move on to building &PRODUCT; and packaging them into RPMs by issuing the following command." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ./waf rpm" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once this completes, you should find assembled RPMs in artifacts/rpmbuild/RPMS/x86_64" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating a yum repo" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While RPMs is an ideal packaging format - it's most easily consumed from yum repositories over a network. We'll move into the directory with the newly created RPMs by issuing the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ cd artifacts/rpmbuild/RPMS/x86_64" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Next we'll issue a command to create the repository metadata by issuing the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ createrepo ./" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The files and directories within our current working directory can now be uploaded to a web server and serve as a yum repository" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring your systems to use your new yum repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that your yum repository is populated with RPMs and metadata we need to configure our machines that need to install CloudStack. We will create a file at /etc/yum.repos.d/cloudstack.repo with the following content:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"[apache-cloudstack]\n" +"name=Apache CloudStack\n" +"baseurl=http://webserver.tld/path/to/repo\n" +"enabled=1\n" +"gpgcheck=0\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Completing this step will allow you to easily install CloudStack on a number of machines across the network." +msgstr "" + diff --git a/docs/pot/building-devcloud.pot b/docs/pot/building-devcloud.pot new file mode 100644 index 00000000000..ef4d81475d8 --- /dev/null +++ b/docs/pot/building-devcloud.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building DevCloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The DevCloud appliance can be downloaded from the wiki at . It can also be built from scratch. Code is being developed to provide this alternative build. It is based on veewee, Vagrant and Puppet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The goal is to automate the DevCloud build and make this automation capability available to all within the source release of &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This is under heavy development. The code is located in the source tree under tools/devcloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A preliminary wiki page describes the build at https://cwiki.pache.org/CLOUDSTACK/building-devcloud.html" +msgstr "" + diff --git a/docs/pot/building-marvin.pot b/docs/pot/building-marvin.pot new file mode 100644 index 00000000000..500d792704d --- /dev/null +++ b/docs/pot/building-marvin.pot @@ -0,0 +1,91 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building and Installing Marvin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Marvin is built with Maven and is dependent on APIdoc. To build it do the following in the root tree of &PRODUCT;:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mvn -P developer -l :cloud-apidoc" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mvn -P developer -l :cloud-marvin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If successfull the build will have created the cloudstackAPI Python package under tools/marvin/marvin/cloudstackAPI as well as a gziped Marvin package under tools/marvin dist. To install the Python Marvin module do the following in tools/marvin:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sudo python ./setup.py install" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The dependencies will be downloaded the Python module installed and you should be able to use Marvin in Python. Check that you can import the module before starting to use it." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ python\n" +"Python 2.7.3 (default, Nov 17 2012, 19:54:34) \n" +"[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n" +">>> import marvin\n" +">>> from marvin.cloudstackAPI import *\n" +">>> " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You could also install it using pip or easy_install using the local distribution package in tools/marvin/dist :" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "pip install tools/marvin/dist/Marvin-0.1.0.tar.gz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Or:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "easy_install tools/marvin/dist/Marvin-0.1.0.tar.gz" +msgstr "" + diff --git a/docs/pot/building-prerequisites.pot b/docs/pot/building-prerequisites.pot new file mode 100644 index 00000000000..8758528a926 --- /dev/null +++ b/docs/pot/building-prerequisites.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Build Procedure Prerequisites" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In this section we will assume that you are using the Ubuntu Linux distribution with the Advanced Packaging Tool (APT). If you are using a different distribution or OS and a different packaging tool, adapt the following instructions to your environment. To build &PRODUCT; you will need:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "git, http://git-scm.com" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sudo apt-get install git-core" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "maven, http://maven.apache.org" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sudo apt-get install maven" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure that you installed maven 3" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ mvn --version\n" +"Apache Maven 3.0.4\n" +"Maven home: /usr/share/maven\n" +"Java version: 1.6.0_24, vendor: Sun Microsystems Inc.\n" +"Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre\n" +"Default locale: en_US, platform encoding: UTF-8\n" +"OS name: \"linux\", version: \"3.2.0-33-generic\", arch: \"amd64\", family: \"unix\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "java" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "set the JAVA_HOME environment variable" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ export JAVA_HOME=/usr/lib/jvm/java-6-openjdk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition, to deploy and run &PRODUCT; in a development environment you will need:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Mysql" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sudo apt-get install mysql-server-5.5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the mysqld service and create a cloud user with cloud as a password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tomcat 6" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "sudo apt-get install tomcat6" +msgstr "" + diff --git a/docs/pot/building-with-maven-deploy.pot b/docs/pot/building-with-maven-deploy.pot new file mode 100644 index 00000000000..5efce88366d --- /dev/null +++ b/docs/pot/building-with-maven-deploy.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Deployment and Testing Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deploying the &PRODUCT; code that you compiled is a two step process:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have not configured the database or modified its properties do:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mvn -P developer -pl developer -Ddeploydb" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then you need to run the &PRODUCT; management server. To attach a debugger to it, do:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "export MAVEN_OPTS=\"-Xmx1024 -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n\"" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mvn -pl :cloud-client-ui jetty:run" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When dealing with the database, remember that you may wipe it entirely and lose any data center configuration that you may have set previously." +msgstr "" + diff --git a/docs/pot/building-with-maven-steps.pot b/docs/pot/building-with-maven-steps.pot new file mode 100644 index 00000000000..3e8bdb955f7 --- /dev/null +++ b/docs/pot/building-with-maven-steps.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses git for source version control, first make sure you have the source code by pulling it:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "git clone https://git-wip-us.apache.org/repos/asf/incubator-cloudstack.git" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Several Project Object Models (POM) are defined to deal with the various build targets of &PRODUCT;. Certain features require some packages that are not compatible with the Apache license and therefore need to be downloaded on your own. Check the wiki for additional information https://cwiki.apache.org/CLOUDSTACK/building-with-maven.html. In order to build all the open source targets of &PRODUCT; do:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mvn clean install" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The resulting jar files will be in the target directory of the subdirectory of the compiled module." +msgstr "" + diff --git a/docs/pot/building-with-maven.pot b/docs/pot/building-with-maven.pot new file mode 100644 index 00000000000..aaa0a27b0a5 --- /dev/null +++ b/docs/pot/building-with-maven.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Maven to Build &PRODUCT;" +msgstr "" + diff --git a/docs/pot/castor-with-cs.pot b/docs/pot/castor-with-cs.pot new file mode 100644 index 00000000000..1637a6b3482 --- /dev/null +++ b/docs/pot/castor-with-cs.pot @@ -0,0 +1,123 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using the CAStor Back-end Storage with &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section describes how to use a CAStor cluster as the back-end storage system for a &PRODUCT; S3 front-end. The CAStor back-end storage for &PRODUCT; extends the existing storage classes and allows the storage configuration attribute to point to a CAStor cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This feature makes use of the &PRODUCT; server's local disk to spool files before writing them to CAStor when handling the PUT operations. However, a file must be successfully written into the CAStor cluster prior to the return of a success code to the S3 client to ensure that the transaction outcome is correctly reported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The S3 multipart file upload is not supported in this release. You are prompted with proper error message if a multipart upload is attempted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure CAStor:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install &PRODUCT; 4.0.0-incubating by following the instructions given in the INSTALL.txt file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can use the S3 storage system in &PRODUCT; without setting up and installing the compute components." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enable the S3 API by setting \"enable.s3.api = true\" in the Global parameter section in the UI and register a user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see S3 API in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the cloud-bridge.properties file and modify the \"storage.root\" parameter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set \"storage.root\" to the key word \"castor\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify a CAStor tenant domain to which content is written. If the domain is not specified, the CAStor default domain, specified by the \"cluster\" parameter in CAStor's node.cfg file, will be used." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify a list of node IP addresses, or set \"zeroconf\" and the cluster name. When using a static IP list with a large cluster, it is not necessary to include every node, only a few is required to initialize the client software." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "storage.root=castor domain=cloudstack 10.1.1.51 10.1.1.52 10.1.1.53" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In this example, the configuration file directs &PRODUCT; to write the S3 files to CAStor instead of to a file system, where the CAStor domain name is cloudstack, and the CAStor node IP addresses are those listed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) The last value is a port number on which to communicate with the CAStor cluster. If not specified, the default is 80." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#Static IP list with optional port\n" +"storage.root=castor domain=cloudstack 10.1.1.51 10.1.1.52 10.1.1.53 80\n" +"#Zeroconf locator for cluster named \"castor.example.com\"\n" +"storage.root=castor domain=cloudstack zeroconf=castor.example.com" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create the tenant domain within the CAStor storage cluster. If you omit this step before attempting to store content, you will get HTTP 412 errors in the awsapi.log." +msgstr "" + diff --git a/docs/pot/change-console-proxy-ssl-certificate-domain.pot b/docs/pot/change-console-proxy-ssl-certificate-domain.pot new file mode 100644 index 00000000000..cd1d121d03f --- /dev/null +++ b/docs/pot/change-console-proxy-ssl-certificate-domain.pot @@ -0,0 +1,120 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Console Proxy SSL Certificate and Domain" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the administrator prefers, it is possible for the URL of the customer's console session to show a domain other than realhostip.com. The administrator can customize the displayed domain by selecting a different domain and uploading a new SSL certificate and private key. The domain must run a DNS service that is capable of resolving queries for addresses of the form aaa-bbb-ccc-ddd.your.domain to an IPv4 IP address in the form aaa.bbb.ccc.ddd, for example, 202.8.44.1. To change the console proxy domain, SSL certificate, and private key:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up dynamic name resolution or populate all possible DNS names in your public IP range into your existing DNS server with the format aaa-bbb-ccc-ddd.company.com -> aaa.bbb.ccc.ddd." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate the private key and certificate signing request (CSR). When you are using openssl to generate private/public key pairs and CSRs, for the private key that you are going to paste into the &PRODUCT; UI, be sure to convert it into PKCS#8 format." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate a new 2048-bit private key" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "openssl genrsa -des3 -out yourprivate.key 2048" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate a new certificate CSR" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "openssl req -new -key yourprivate.key -out yourcertificate.csr" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Head to the website of your favorite trusted Certificate Authority, purchase an SSL certificate, and submit the CSR. You should receive a valid certificate in return" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Convert your private key format into PKCS#8 encrypted format." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "openssl pkcs8 -topk8 -in yourprivate.key -out yourprivate.pkcs8.encryped.key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Convert your PKCS#8 encrypted private key into the PKCS#8 format that is compliant with &PRODUCT;" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "openssl pkcs8 -in yourprivate.pkcs8.encrypted.key -out yourprivate.pkcs8.key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Update SSL Certificate screen of the &PRODUCT; UI, paste the following" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Certificate from step 1(c)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private key from step 1(e)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The desired new domain name; for example, company.com" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This stops all currently running console proxy VMs, then restarts them with the new certificate and key. Users might notice a brief interruption in console availability" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server will generate URLs of the form \"aaa-bbb-ccc-ddd.company.com\" after this change is made. New console requests will be served with the new DNS domain name, certificate, and key" +msgstr "" + diff --git a/docs/pot/change-database-config.pot b/docs/pot/change-database-config.pot new file mode 100644 index 00000000000..f4f6eb056da --- /dev/null +++ b/docs/pot/change-database-config.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Database Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Management Server stores database configuration information (e.g., hostname, port, credentials) in the file /etc/cloud/management/db.properties. To effect a change, edit this file on each Management Server, then restart the Management Server." +msgstr "" + diff --git a/docs/pot/change-database-password.pot b/docs/pot/change-database-password.pot new file mode 100644 index 00000000000..19445d56675 --- /dev/null +++ b/docs/pot/change-database-password.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Database Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You may need to change the password for the MySQL account used by CloudStack. If so, you'll need to change the password in MySQL, and then add the encrypted password to /etc/cloud/management/db.properties." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before changing the password, you'll need to stop CloudStack's management server and the usage engine if you've deployed that component." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"# service cloud-management stop\n" +"# service cloud-usage stop\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Next, you'll update the password for the CloudStack user on the MySQL server." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"# mysql -u root -p\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At the MySQL shell, you'll change the password and flush privileges:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"update mysql.user set password=PASSWORD(\"newpassword123\") where User='cloud';\n" +"flush privileges;\n" +"quit;\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The next step is to encrypt the password and copy the encrypted password to CloudStack's database configuration (/etc/cloud/management/db.properties)." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +"# java -classpath /usr/share/java/cloud-jasypt-1.8.jar \\\n" +"org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI encrypt.sh \\ \n" +"input=\"newpassword123\" password=\"`cat /etc/cloud/management/key`\" \\\n" +"verbose=false \n" +"\n" +"" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "File encryption type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note that this is for the file encryption type. If you're using the web encryption type then you'll use password=\"management_server_secret_key\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now, you'll update /etc/cloud/management/db.properties with the new ciphertext. Open /etc/cloud/management/db.properties in a text editor, and update these parameters:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"db.cloud.password=ENC(encrypted_password_from_above) \n" +"db.usage.password=ENC(encrypted_password_from_above) \n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After copying the new password over, you can now start CloudStack (and the usage engine, if necessary)." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "\n" +" # service cloud-management start\n" +" # service cloud-usage start\n" +" " +msgstr "" + diff --git a/docs/pot/change-host-password.pot b/docs/pot/change-host-password.pot new file mode 100644 index 00000000000..8623e8579b1 --- /dev/null +++ b/docs/pot/change-host-password.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing Host Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The password for a XenServer Node, KVM Node, or vSphere Node may be changed in the database. Note that all Nodes in a Cluster must have the same password." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To change a Node's password:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Identify all hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the password on all hosts in the cluster. Now the password for the host and the password known to &PRODUCT; will not match. Operations on the cluster will fail until the two passwords match." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Get the list of host IDs for the host in the cluster where you are changing the password. You will need to access the database to determine these host IDs. For each hostname \"h\" (or vSphere cluster) that you are changing the password for, execute:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysql> select id from cloud.host where name like '%h%';" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This should return a single ID. Record the set of such IDs for these hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Update the passwords for the host in the database. In this example, we change the passwords for hosts with IDs 5, 10, and 12 to \"password\"." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysql> update cloud.host set password='password' where id=5 or id=10 or id=12;" +msgstr "" + diff --git a/docs/pot/change-network-offering-on-guest-network.pot b/docs/pot/change-network-offering-on-guest-network.pot new file mode 100644 index 00000000000..1c2778bd8b2 --- /dev/null +++ b/docs/pot/change-network-offering-on-guest-network.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Network Offering on a Guest Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A user or administrator can change the network offering that is associated with an existing guest network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are changing from a network offering that uses the &PRODUCT; virtual router to one that uses external devices as network service providers, you must first stop all the VMs on the network. See Stopping and Starting VMs. Then return here and continue to the next step" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network you want to modify AttachDiskButton.png: button to attach a volume ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Network Offering, choose the new network offering, then click Apply." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A prompt appears asking whether you want to keep the existing CIDR. This is to let you know that if you change the network offering, the CIDR will be affected. Choose No to proceed with the change." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait for the update to complete. Don’t try to restart VMs until after the network change is complete." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you stopped any VMs in step 2, restart them." +msgstr "" + diff --git a/docs/pot/change-to-behavior-of-list-commands.pot b/docs/pot/change-to-behavior-of-list-commands.pot new file mode 100644 index 00000000000..4ecb6440471 --- /dev/null +++ b/docs/pot/change-to-behavior-of-list-commands.pot @@ -0,0 +1,170 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Change to Behavior of List Commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There was a major change in how our List* API commands work in CloudStack 3.0 compared to 2.2.x. The rules below apply only for managed resources – those that belong to an account, domain, or project. They are irrelevant for the List* commands displaying unmanaged (system) resources, such as hosts, clusters, and external network resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When no parameters are passed in to the call, the caller sees only resources owned by the caller (even when the caller is the administrator). Previously, the administrator saw everyone else's resources by default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When accountName and domainId are passed in:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The caller sees the resources dedicated to the account specified." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the call is executed by a regular user, the user is authorized to specify only the user's own account and domainId." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the caller is a domain administrator, CloudStack performs an authorization check to see whether the caller is permitted to view resources for the given account and domainId." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When projectId is passed in, only resources belonging to that project are listed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When domainId is passed in, the call returns only resources belonging to the domain specified. To see the resources of subdomains, use the parameter isRecursive=true. Again, the regular user can see only resources owned by that user, the root administrator can list anything, and a domain administrator is authorized to see only resources of the administrator's own domain and subdomains." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To see all resources the caller is authorized to see, except for Project resources, use the parameter listAll=true." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To see all Project resources the caller is authorized to see, use the parameter projectId=-1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is one API command that doesn't fall under the rules above completely: the listTemplates command. This command has its own flags defining the list rules:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTemplates Flag" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "featured" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Returns templates that have been marked as featured and public." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "self" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Returns templates that have been registered or created by the calling user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "selfexecutable" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Same as self, but only returns templates that are ready to be deployed with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "sharedexecutable" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ready templates that have been granted to the calling user by another user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "executable" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Templates that are owned by the calling user, or public templates, that can be used to deploy a new VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "community" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Returns templates that have been marked as public but not featured." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "all" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Returns all templates (only usable by admins)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; UI on a general view will display all resources that the logged-in user is authorized to see, except for project resources. To see the project resources, select the project view." +msgstr "" + diff --git a/docs/pot/changed-apicommands-4-0.pot b/docs/pot/changed-apicommands-4-0.pot new file mode 100644 index 00000000000..7f0024f7824 --- /dev/null +++ b/docs/pot/changed-apicommands-4-0.pot @@ -0,0 +1,575 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changed API Commands in 4.0.0-incubating" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "API Commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "copyTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "prepareTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "registerTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateTemplate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "activateProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "suspendProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateProject" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjectAccounts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "migrateVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "attachVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "detachVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "uploadVolume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createSecurityGroup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "registerIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "copyIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createIpForwardingRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listIpForwardingRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createLoadBalancerRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateLoadBalancerRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createSnapshot" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have a single new response parameter, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many other commands also have the new tags(*) parameter in addition to other changes; those commands are listed separately." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rebootVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "attachIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "detachIso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLoadBalancerRuleInstances" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "resetPasswordForVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "changeServiceForVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "recoverVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "migrateVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deployVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "assignVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restoreVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "stopVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "destroyVirtualMachine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have two new response parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: keypair, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSecurityGroups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listFirewallRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPortForwardingRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSnapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listIsos" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTemplates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLoadBalancerRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have the following new parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: tags (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listF5LoadBalancerNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetscalerLoadBalancerNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSrxFirewallNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The commands in this list have three new response parameters, and no other changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: canusefordeploy, vpcid, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createZone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateZone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: localstorageenabled (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: localstorageenabled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listZones" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rebootRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "changeServiceForRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "destroyRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "stopRouter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcid, nic(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "disableAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listAccounts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "markDefaultZoneForAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enableAccount" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcavailable, vpclimit, vpctotal" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listRouters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: forvpc (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkOfferings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: forvpc (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: forvpc" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVolumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: details (optional), tags (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addTrafficMonitor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: excludezones (optional), includezones (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPublicIpAddresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: tags (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: vpcid, tags(*)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: canusefordeploy (optional), forvpc (optional), tags (optional), vpcid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "restartNetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enableStaticNat" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: networkid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createDiskOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameter: storagetype (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameter: storagetype" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listDiskOfferings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateDiskOffering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createFirewallRule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Changed request parameters: ipaddressid (old version - optional, new version - required)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVirtualMachines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New request parameters: isoid (optional), tags (optional), templateid (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateStorageNetworkIpRange" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "New response parameters: id, endip, gateway, netmask, networkid, podid, startip, vlan, zoneid" +msgstr "" + diff --git a/docs/pot/changing-root-password.pot b/docs/pot/changing-root-password.pot new file mode 100644 index 00000000000..996cbc2fe08 --- /dev/null +++ b/docs/pot/changing-root-password.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Root Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "During installation and ongoing cloud administration, you will need to log in to the UI as the root administrator. The root administrator account manages the &PRODUCT; deployment, including physical infrastructure. The root administrator can modify configuration settings to change basic functionality, create or delete user accounts, and take many actions that should be performed only by an authorized person. When first installing &PRODUCT;, be sure to change the default password to a new, unique value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Open your favorite Web browser and go to this URL. Substitute the IP address of your own Management Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://<management-server-ip-address>:8080/client" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the UI using the current root user ID and password. The default is admin, password." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the admin account name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View Users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the admin user name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Change Password button. change-password.png: button to change a user's password " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type the new password, and click OK." +msgstr "" + diff --git a/docs/pot/changing-secondary-storage-ip.pot b/docs/pot/changing-secondary-storage-ip.pot new file mode 100644 index 00000000000..c02be1a977d --- /dev/null +++ b/docs/pot/changing-secondary-storage-ip.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Making API Requests" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can change the secondary storage IP address after it has been provisioned. After changing the IP address on the host, log in to your management server and execute the following commands. Replace HOSTID below with your own value, and change the URL to use the appropriate IP address and path for your server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" # mysql -p\n" +" mysql> use cloud;\n" +" mysql> select id from host where type = 'SecondaryStorage';\n" +" mysql> update host_details set value = 'nfs://192.168.160.20/export/mike-ss1'\n" +" where host_id = HOSTID and name = 'orig.url';\n" +" mysql> update host set name = 'nfs://192.168.160.20/export/mike-ss1' where type\n" +" = 'SecondaryStorage' and id = #;\n" +" mysql> update host set url = 'nfs://192.168.160.20/export/mike-ss1' where type\n" +" = 'SecondaryStorage' and id = #;\n" +" mysql> update host set guid = 'nfs://192.168.160.20/export/mike-ss1' where type\n" +" = 'SecondaryStorage' and id = #;\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then log in to the cloud console UI and stop and start (not reboot) the Secondary Storage VM for that Zone." +msgstr "" + diff --git a/docs/pot/changing-secondary-storage-servers.pot b/docs/pot/changing-secondary-storage-servers.pot new file mode 100644 index 00000000000..2a17400909a --- /dev/null +++ b/docs/pot/changing-secondary-storage-servers.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing Secondary Storage Servers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can change the secondary storage NFS mount. Perform the following steps to do so:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop all running Management Servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait 30 minutes. This allows any writes to secondary storage to complete." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy all files from the old secondary storage mount to the new." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the procedure above to change the IP address for secondary storage if required." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the Management Server." +msgstr "" + diff --git a/docs/pot/changing-service-offering-for-vm.pot b/docs/pot/changing-service-offering-for-vm.pot new file mode 100644 index 00000000000..cc0232f39cb --- /dev/null +++ b/docs/pot/changing-service-offering-for-vm.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Service Offering for a VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To upgrade or downgrade the level of compute resources available to a virtual machine, you can change the VM's compute offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the VM that you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Stop button to stop the VM StopButton.png: button to stop a VM " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Change Service button ChangeServiceButton.png: button to change the service of a VM . The Change service dialog box is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the offering you want." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/changing-vm-name-os-group.pot b/docs/pot/changing-vm-name-os-group.pot new file mode 100644 index 00000000000..cbf2c279e52 --- /dev/null +++ b/docs/pot/changing-vm-name-os-group.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the VM Name, OS, or Group" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After a VM is created, you can modify the display name, operating system, and the group it belongs to." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To access a VM through the &PRODUCT; UI:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the VM that you want to modify." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Stop button to stop the VM StopButton.png: button to stop a VM " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Edit StopButton.png: button to edit the properties of a VM ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make the desired changes to the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Display name: Enter a new display name if you want to change the name of the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type: Select the desired operating system." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Group: Enter the group name for the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Apply." +msgstr "" + diff --git a/docs/pot/choosing-a-deployment-architecture.pot b/docs/pot/choosing-a-deployment-architecture.pot new file mode 100644 index 00000000000..a42b765b542 --- /dev/null +++ b/docs/pot/choosing-a-deployment-architecture.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Choosing a Deployment Architecture" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The architecture used in a deployment will vary depending on the size and purpose of the deployment. This section contains examples of deployment architecture, including a small-scale deployment useful for test and trial deployments and a fully-redundant large-scale setup for production deployments." +msgstr "" + diff --git a/docs/pot/cisco3750-hardware.pot b/docs/pot/cisco3750-hardware.pot new file mode 100644 index 00000000000..f819da49919 --- /dev/null +++ b/docs/pot/cisco3750-hardware.pot @@ -0,0 +1,76 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Cisco 3750" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following steps show how a Cisco 3750 is configured for zone-level layer-3 switching. These steps assume VLAN 201 is used to route untagged private IPs for pod 1, and pod 1’s layer-2 switch is connected to GigabitEthernet1/0/1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Setting VTP mode to transparent allows us to utilize VLAN IDs above 1000. Since we only use VLANs up to 999, vtp transparent mode is not strictly required." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vtp mode transparent\n" +"vlan 200-999\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure GigabitEthernet1/0/1." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "interface GigabitEthernet1/0/1\n" +"switchport trunk encapsulation dot1q\n" +"switchport mode trunk\n" +"switchport trunk native vlan 201\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The statements configure GigabitEthernet1/0/1 as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 201 is the native untagged VLAN for port GigabitEthernet1/0/1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cisco passes all VLANs by default. As a result, all VLANs (300-999) are passed to all the pod-level layer-2 switches." +msgstr "" + diff --git a/docs/pot/cisco3750-layer2.pot b/docs/pot/cisco3750-layer2.pot new file mode 100644 index 00000000000..ad13cc66ea8 --- /dev/null +++ b/docs/pot/cisco3750-layer2.pot @@ -0,0 +1,66 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Cisco 3750" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following steps show how a Cisco 3750 is configured for pod-level layer-2 switching." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Setting VTP mode to transparent allows us to utilize VLAN IDs above 1000. Since we only use VLANs up to 999, vtp transparent mode is not strictly required." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vtp mode transparent\n" +"vlan 300-999\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure all ports to dot1q and set 201 as the native VLAN." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "interface range GigabitEthernet 1/0/1-24\n" +"switchport trunk encapsulation dot1q\n" +"switchport mode trunk\n" +"switchport trunk native vlan 201\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default, Cisco passes all VLANs. Cisco switches complain of the native VLAN IDs are different when 2 ports are connected together. That’s why you must specify VLAN 201 as the native VLAN on the layer-2 switch." +msgstr "" + diff --git a/docs/pot/citrix-xenserver-installation.pot b/docs/pot/citrix-xenserver-installation.pot new file mode 100644 index 00000000000..1a54c152f73 --- /dev/null +++ b/docs/pot/citrix-xenserver-installation.pot @@ -0,0 +1,1195 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Citrix XenServer Installation for &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to use the Citrix XenServer hypervisor to run guest virtual machines, install XenServer 6.0 or XenServer 6.0.2 on the host(s) in your cloud. For an initial installation, follow the steps below. If you have previously installed XenServer and want to upgrade to another version, see ." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "System Requirements for XenServer Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host must be certified as compatible with one of the following. See the Citrix Hardware Compatibility Guide: http://hcl.xensource.com" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 5.6 SP2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 6.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 6.0.2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You must re-install Citrix XenServer if you are going to re-use a host from a previous install." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Must support HVM (Intel-VT or AMD-V enabled)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure all the hotfixes provided by the hypervisor vendor are applied. Track the release of hypervisor patches through your hypervisor vendor’s support channel, and apply patches as soon as possible after they are released. &PRODUCT; will not track or notify you of required hypervisor patches. It is essential that your hosts are completely up to date with the provided hypervisor patches. The hypervisor vendor is likely to refuse to support any system that is not up to date with patches." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts within a cluster must be homogenous. The CPUs must be of the same type, count, and feature flags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Must support HVM (Intel-VT or AMD-V enabled in BIOS)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "64-bit x86 CPU (more cores results in better performance)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hardware virtualization support required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4 GB of memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "36 GB of local disk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At least 1 NIC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Statically allocated IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The lack of up-do-date hotfixes can lead to data corruption and lost VMs." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "XenServer Installation Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From https://www.citrix.com/English/ss/downloads/, download the appropriate version of XenServer for your &PRODUCT; version (see ). Install it using the Citrix XenServer Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After installation, perform the following configuration steps, which are described in the next few sections:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Optional" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up SR if not using NFS, iSCSI, or local disk; see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure XenServer dom0 Memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the XenServer dom0 settings to allocate more memory to dom0. This can enable XenServer to handle larger numbers of virtual machines. We recommend 2940 MB of RAM for XenServer dom0. For instructions on how to do this, see http://support.citrix.com/article/CTX126531. The article refers to XenServer 5.6, but the same information applies to XenServer 6.0." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Username and Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All XenServers in a cluster must have the same username and password as configured in &PRODUCT;." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Time Synchronization" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host must be set to use NTP. All hosts in a pod must have the same time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install NTP." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# yum install ntp" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the NTP configuration file to point to your NTP server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/ntp.conf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add one or more server lines in this file with the names of the NTP servers you want to use. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "server 0.xenserver.pool.ntp.org\n" +"server 1.xenserver.pool.ntp.org\n" +"server 2.xenserver.pool.ntp.org\n" +"server 3.xenserver.pool.ntp.org\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the NTP client." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service ntpd restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure NTP will start again upon reboot." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# chkconfig ntpd on" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Licensing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix XenServer Free version provides 30 days usage without a license. Following the 30 day trial, XenServer requires a free activation and license. You can choose to install a license now or skip this step. If you skip this step, you will need to install a license when you activate and license the XenServer." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Getting and Deploying a License" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you choose to install a license now you will need to use the XenCenter to activate and get a license." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In XenCenter, click Tools > License manager." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select your XenServer and select Activate Free XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Request a license." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can install the license with XenCenter or using the xe command line tool." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Install &PRODUCT; XenServer Support Package (CSP)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable security groups, elastic load balancing, and elastic IP on XenServer, download and install the &PRODUCT; XenServer Support Package (CSP). After installing XenServer, perform the following additional steps on each XenServer host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download the CSP software onto the XenServer host from one of the following links:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer 6.0.2:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://download.cloud.com/releases/3.0.1/XS-6.0.2/xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer 5.6 SP2:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://download.cloud.com/releases/2.2.0/xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer 6.0:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://download.cloud.com/releases/3.0/xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extract the file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# tar xf xenserver-cloud-supp.tgz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe-install-supplemental-pack xenserver-cloud-supp.iso" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the XenServer host is part of a zone that uses basic networking, disable Open vSwitch (OVS):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe-switch-network-backend bridge" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the host machine when prompted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The XenServer host is now ready to be added to &PRODUCT;." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Primary Storage Setup for XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; natively supports NFS, iSCSI and local storage. If you are using one of these storage types, there is no need to create the XenServer Storage Repository (\"SR\")." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If, however, you would like to use storage connected via some other technology, such as FiberChannel, you must set up the SR yourself. To do so, perform the following steps. If you have your hosts in a XenServer pool, perform the steps on the master node. If you are working with a single XenServer which is not part of a cluster, perform the steps on that XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Connect FiberChannel cable to all hosts in the cluster and to the FiberChannel storage host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Rescan the SCSI bus. Either use the following command or use XenCenter to perform an HBA rescan." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# scsi-rescan" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat step 2 on every host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check to be sure you see the new SCSI disk." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ls /dev/disk/by-id/scsi-360a98000503365344e6f6177615a516b -l" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The output should look like this, although the specific file name will be different (scsi-<scsiID>):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "lrwxrwxrwx 1 root root 9 Mar 16 13:47\n" +"/dev/disk/by-id/scsi-360a98000503365344e6f6177615a516b -> ../../sdc\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat step 4 on every host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the storage server, run this command to get a unique ID for the new SR." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# uuidgen" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The output should look like this, although the specific ID will be different:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "e6849e96-86c3-4f2c-8fcc-350cc711be3d" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create the FiberChannel SR. In name-label, use the unique ID you just generated." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# xe sr-create type=lvmohba shared=true\n" +"device-config:SCSIid=360a98000503365344e6f6177615a516b\n" +"name-label=\"e6849e96-86c3-4f2c-8fcc-350cc711be3d\"\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This command returns a unique ID for the SR, like the following example (your ID will be different):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "7a143820-e893-6c6a-236e-472da6ee66bf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a human-readable description for the SR, use the following command. In uuid, use the SR ID returned by the previous command. In name-description, set whatever friendly text you prefer." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe sr-param-set uuid=7a143820-e893-6c6a-236e-472da6ee66bf name-description=\"Fiber Channel storage repository\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make note of the values you will need when you add this storage to &PRODUCT; later (see ). In the Add Primary Storage dialog, in Protocol, you will choose PreSetup. In SR Name-Label, you will enter the name-label you set earlier (in this example, e6849e96-86c3-4f2c-8fcc-350cc711be3d)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) If you want to enable multipath I/O on a FiberChannel SAN, refer to the documentation provided by the SAN vendor." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "iSCSI Multipath Setup for XenServer (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When setting up the storage repository on a Citrix XenServer, you can enable multipath I/O, which uses redundant physical components to provide greater reliability in the connection between the server and the SAN. To enable multipathing, use a SAN solution that is supported for Citrix servers and follow the procedures in Citrix documentation. The following links provide a starting point:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://support.citrix.com/article/CTX118791" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://support.citrix.com/article/CTX125403" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can also ask your SAN vendor for advice about setting up your Citrix repository for multipathing." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make note of the values you will need when you add this storage to the &PRODUCT; later (see ). In the Add Primary Storage dialog, in Protocol, you will choose PreSetup. In SR Name-Label, you will enter the same name used to create the SR." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you encounter difficulty, address the support team for the SAN provided by your vendor. If they are not able to solve your issue, see Contacting Support." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Physical Networking Setup for XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once XenServer has been installed, you may need to do some additional network configuration. At this point in the installation, you should have a plan for what NICs the host will have and what traffic each NIC will carry. The NICs should be cabled as necessary to implement your plan." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you plan on using NIC bonding, the NICs on all hosts in the cluster must be cabled exactly the same. For example, if eth0 is in the private bond on one host in a cluster, then eth0 must be in the private bond on all hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP address assigned for the management network interface must be static. It can be set on the host itself or obtained via static DHCP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; configures network traffic of various types to use different NICs or bonds on the XenServer host. You can control this process and provide input to the Management Server through the use of XenServer network name labels. The name labels are placed on physical interfaces or bonds and configured in &PRODUCT;. In some simple cases the name labels are not required." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring Public Network with a Dedicated NIC for XenServer (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports the use of a second NIC (or bonded pair of NICs, described in ) for the public network. If bonding is not used, the public network can be on any NIC and can be on different NICs on the hosts in a cluster. For example, the public network can be on eth0 on node A and eth1 on node B. However, the XenServer name-label for the public network must be identical across all hosts. The following examples set the network label to \"cloud-public\". After the management server is installed and running you must configure it with the name of the chosen network label (e.g. \"cloud-public\"); this is discussed in ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using two NICs bonded together to create a public network, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using a single dedicated NIC to provide public network access, follow this procedure on each new host that is added to &PRODUCT; before adding the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run xe network-list and find the public network. This is usually attached to the NIC that is public. Once you find the network make note of its UUID. Call this <UUID-Public>." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe network-param-set name-label=cloud-public uuid=<UUID-Public>" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring Multiple Guest Networks for XenServer (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports the use of multiple guest networks with the XenServer hypervisor. Each network is assigned a name-label in XenServer. For example, you might have two networks with the labels \"cloud-guest\" and \"cloud-guest2\". After the management server is installed and running, you must add the networks and use these labels so that &PRODUCT; is aware of the networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Follow this procedure on each new host before adding the host to &PRODUCT;:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run xe network-list and find one of the guest networks. Once you find the network make note of its UUID. Call this <UUID-Guest>." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command, substituting your own name-label and uuid values." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe network-param-set name-label=<cloud-guestN> uuid=<UUID-Guest>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps for each additional guest network, using a different name-label and uuid each time." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Separate Storage Network for XenServer (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can optionally set up a separate storage network. This should be done first on the host, before implementing the bonding steps below. This can be done using one or two available NICs. With two NICs bonding may be done as above. It is the administrator's responsibility to set up a separate storage network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Give the storage network a different name-label than what will be given for other networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the separate storage network to work correctly, it must be the only interface that can ping the primary storage device's IP address. For example, if eth0 is the management network NIC, ping -I eth0 <primary storage device IP> must fail. In all deployments, secondary storage devices must be pingable from the management network NIC or bond. If a secondary storage device has been placed on the storage network, it must also be pingable via the storage network NIC or bond on the hosts as well." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can set up two separate storage networks as well. For example, if you intend to implement iSCSI multipath, dedicate two non-bonded NICs to multipath. Each of the two networks needs a unique name-label." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If no bonding is done, the administrator must set up and name-label the separate storage network on all hosts (masters and slaves)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Here is an example to set up eth5 to access a storage network on 172.16.0.0/24." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# xe pif-list host-name-label='hostname' device=eth5\n" +"uuid(RO): ab0d3dd4-5744-8fae-9693-a022c7a3471d\n" +"device ( RO): eth5\n" +"#xe pif-reconfigure-ip DNS=172.16.3.3 gateway=172.16.0.1 IP=172.16.0.55 mode=static netmask=255.255.255.0 uuid=ab0d3dd4-5744-8fae-9693-a022c7a3471d" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "NIC Bonding for XenServer (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer supports Source Level Balancing (SLB) NIC bonding. Two NICs can be bonded together to carry public, private, and guest traffic, or some combination of these. Separate storage networks are also possible. Here are some example supported configurations:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2 NICs on private, 2 NICs on public, 2 NICs on storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2 NICs on private, 1 NIC on public, storage uses management network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2 NICs on private, 2 NICs on public, storage uses management network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "1 NIC for private, public, and storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All NIC bonding is optional." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer expects all nodes in a cluster will have the same network cabling and same bonds implemented. In an installation the master will be the first host that was added to the cluster and the slave hosts will be all subsequent hosts added to the cluster. The bonds present on the master set the expectation for hosts added to the cluster later. The procedure to set up bonds on the master and slaves are different, and are described below. There are several important implications of this:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You must set bonds on the first host added to a cluster. Then you must use xe commands as below to establish the same bonds in the second and subsequent hosts added to a cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Slave hosts in a cluster must be cabled exactly the same as the master. For example, if eth0 is in the private bond on the master, it must be in the management network for added slave hosts." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Management Network Bonding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator must bond the management network NICs prior to adding the host to &PRODUCT;." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating a Private Bond on the First Host in the Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the following steps to create a bond in XenServer. These steps should be run on only the first host in a cluster. This example creates the cloud-private network with two physical NICs (eth0 and eth1) bonded into it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Find the physical NICs that you want to bond together." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe pif-list host-name-label='hostname' device=eth0\n" +"# xe pif-list host-name-label='hostname' device=eth1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These command shows the eth0 and eth1 NICs and their UUIDs. Substitute the ethX devices of your choice. Call the UUID's returned by the above command slave1-UUID and slave2-UUID." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a new network for the bond. For example, a new network with name \"cloud-private\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This label is important. &PRODUCT; looks for a network by a name you configure. You must use the same name-label for all hosts in the cloud for the management network." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe network-create name-label=cloud-private\n" +"# xe bond-create network-uuid=[uuid of cloud-private created above]\n" +"pif-uuids=[slave1-uuid],[slave2-uuid]" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now you have a bonded pair that can be recognized by &PRODUCT; as the management network." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Public Network Bonding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Bonding can be implemented on a separate, public network. The administrator is responsible for creating a bond for the public network if that network will be bonded and will be separate from the management network." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating a Public Bond on the First Host in the Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These steps should be run on only the first host in a cluster. This example creates the cloud-public network with two physical NICs (eth2 and eth3) bonded into it." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#xe pif-list host-name-label='hostname' device=eth2\n" +"# xe pif-list host-name-label='hostname' device=eth3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These command shows the eth2 and eth3 NICs and their UUIDs. Substitute the ethX devices of your choice. Call the UUID's returned by the above command slave1-UUID and slave2-UUID." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a new network for the bond. For example, a new network with name \"cloud-public\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This label is important. &PRODUCT; looks for a network by a name you configure. You must use the same name-label for all hosts in the cloud for the public network." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe network-create name-label=cloud-public\n" +"# xe bond-create network-uuid=[uuid of cloud-public created above]\n" +"pif-uuids=[slave1-uuid],[slave2-uuid]" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now you have a bonded pair that can be recognized by &PRODUCT; as the public network." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Adding More Hosts to the Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With the bonds (if any) established on the master, you should add additional, slave hosts. Run the following command for all additional hosts to be added to the cluster. This will cause the host to join the master in a single XenServer pool." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe pool-join master-address=[master IP] master-username=root\n" +"master-password=[your password]" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Complete the Bonding Setup Across the Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With all hosts added to the pool, run the cloud-setup-bond script. This script will complete the configuration and set up of the bonds across all hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the script from the Management Server in /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/cloud-setup-bonding.sh to the master host and ensure it is executable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ./cloud-setup-bonding.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now the bonds are set up and configured properly across the cluster." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Upgrading XenServer Versions" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section tells how to upgrade XenServer software on &PRODUCT; hosts. The actual upgrade is described in XenServer documentation, but there are some additional steps you must perform before and after the upgrade." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure the hardware is certified compatible with the new version of XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To upgrade XenServer:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upgrade the database. On the Management Server node:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Back up the database:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mysqldump --user=root --databases cloud > cloud.backup.sql\n" +"# mysqldump --user=root --databases cloud_usage > cloud_usage.backup.sql" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You might need to change the OS type settings for VMs running on the upgraded hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you upgraded from XenServer 5.6 GA to XenServer 5.6 SP2, change any VMs that have the OS type CentOS 5.5 (32-bit), Oracle Enterprise Linux 5.5 (32-bit), or Red Hat Enterprise Linux 5.5 (32-bit) to Other Linux (32-bit). Change any VMs that have the 64-bit versions of these same OS types to Other Linux (64-bit)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you upgraded from XenServer 5.6 SP2 to XenServer 6.0.2, change any VMs that have the OS type CentOS 5.6 (32-bit), CentOS 5.7 (32-bit), Oracle Enterprise Linux 5.6 (32-bit), Oracle Enterprise Linux 5.7 (32-bit), Red Hat Enterprise Linux 5.6 (32-bit) , or Red Hat Enterprise Linux 5.7 (32-bit) to Other Linux (32-bit). Change any VMs that have the 64-bit versions of these same OS types to Other Linux (64-bit)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you upgraded from XenServer 5.6 to XenServer 6.0.2, do all of the above." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server and Usage Server. You only need to do this once for all clusters." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management start\n" +"# service cloud-usage start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disconnect the XenServer cluster from &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Navigate to the XenServer cluster, and click Actions – Unmanage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the cluster status until it shows Unmanaged." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to one of the hosts in the cluster, and run this command to clean up the VLAN:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# . /opt/xensource/bin/cloud-clean-vlan.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Still logged in to the host, run the upgrade preparation script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /opt/xensource/bin/cloud-prepare-upgrade.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Troubleshooting: If you see the error \"can't eject CD,\" log in to the VM and umount the CD, then run the script again." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upgrade the XenServer software on all hosts in the cluster. Upgrade the master first." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Live migrate all VMs on this host to other hosts. See the instructions for live migration in the Administrator's Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Troubleshooting: You might see the following error when you migrate a VM:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "[root@xenserver-qa-2-49-4 ~]# xe vm-migrate live=true host=xenserver-qa-2-49-5 vm=i-2-8-VM\n" +"You attempted an operation on a VM which requires PV drivers to be installed but the drivers were not detected.\n" +"vm: b6cf79c8-02ee-050b-922f-49583d9f1a14 (i-2-8-VM)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To solve this issue, run the following:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /opt/xensource/bin/make_migratable.sh b6cf79c8-02ee-050b-922f-49583d9f1a14" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reboot the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upgrade to the newer version of XenServer. Use the steps in XenServer documentation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the upgrade is complete, copy the following files from the management server to this host, in the directory locations shown below:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy this Management Server file..." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "...to this location on the XenServer host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/xenserver60/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/sm/NFSSR.py" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/make_migratable.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/cloud-clean-vlan.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "/opt/xensource/bin/cloud-clean-vlan.sh" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /opt/xensource/bin/setupxenserver.sh" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Troubleshooting: If you see the following error message, you can safely ignore it." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mv: cannot stat `/etc/cron.daily/logrotate': No such file or directory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Plug in the storage repositories (physical block devices) to the XenServer host:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# for pbd in `xe pbd-list currently-attached=false| grep ^uuid | awk '{print $NF}'`; do xe pbd-plug uuid=$pbd ; done" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note: If you add a host to this XenServer pool, you need to migrate all VMs on this host to other hosts, and eject this host from XenServer pool." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps to upgrade every host in the cluster to the same version of XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command on one host in the XenServer cluster to clean up the host tags:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# for host in $(xe host-list | grep ^uuid | awk '{print $NF}') ; do xe host-param-clear uuid=$host param-name=tags; done;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reconnect the XenServer cluster to &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Navigate to the XenServer cluster, and click Actions – Manage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the status to see that all the hosts come up." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After all hosts are up, run the following on one host in the cluster:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /opt/xensource/bin/cloud-clean-vlan.sh" +msgstr "" + diff --git a/docs/pot/cloud-infrastructure-concepts.pot b/docs/pot/cloud-infrastructure-concepts.pot new file mode 100644 index 00000000000..8fdb0f850de --- /dev/null +++ b/docs/pot/cloud-infrastructure-concepts.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Cloud Infrastructure Concepts" +msgstr "" + diff --git a/docs/pot/cloud-infrastructure-overview.pot b/docs/pot/cloud-infrastructure-overview.pot new file mode 100644 index 00000000000..61f33864915 --- /dev/null +++ b/docs/pot/cloud-infrastructure-overview.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Cloud Infrastructure Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server manages one or more zones (typically, datacenters) containing host computers where guest virtual machines will run. The cloud infrastructure is organized as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone: Typically, a zone is equivalent to a single datacenter. A zone consists of one or more pods and secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pod: A pod is usually one rack of hardware that includes a layer-2 switch and one or more clusters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster: A cluster consists of one or more hosts and primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host: A single compute node within a cluster. The hosts are where the actual cloud services run in the form of guest virtual machines." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Primary storage is associated with a cluster, and it stores the disk volumes for all the VMs running on hosts in that cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage is associated with a zone, and it stores templates, ISO images, and disk volume snapshots." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "More Information" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see documentation on cloud infrastructure concepts." +msgstr "" + diff --git a/docs/pot/cloudstack-api.pot b/docs/pot/cloudstack-api.pot new file mode 100644 index 00000000000..762ea4a4e0b --- /dev/null +++ b/docs/pot/cloudstack-api.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; API is a low level API that has been used to implement the &PRODUCT; web UIs. It is also a good basis for implementing other popular APIs such as EC2/S3 and emerging DMTF standards." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Many &PRODUCT; API calls are asynchronous. These will return a Job ID immediately when called. This Job ID can be used to query the status of the job later. Also, status calls on impacted resources will provide some indication of their state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The API has a REST-like query basis and returns results in XML or JSON." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See the Developer’s Guide and the API Reference." +msgstr "" + diff --git a/docs/pot/cloudstack.pot b/docs/pot/cloudstack.pot new file mode 100644 index 00000000000..2ebfd4eaa4b --- /dev/null +++ b/docs/pot/cloudstack.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "&PRODUCT; Complete Documentation" +msgstr "" + +#. Tag: productname +#, no-c-format +msgid "Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Complete documentation for &PRODUCT;." +msgstr "" + diff --git a/docs/pot/cluster-add.pot b/docs/pot/cluster-add.pot new file mode 100644 index 00000000000..f7601417591 --- /dev/null +++ b/docs/pot/cluster-add.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Cluster" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to tell &PRODUCT; about the hosts that it will manage. Hosts exist inside clusters, so before you begin adding hosts to the cloud, you must add at least one cluster." +msgstr "" + diff --git a/docs/pot/compatibility-matrix.pot b/docs/pot/compatibility-matrix.pot new file mode 100644 index 00000000000..0b03bdddde0 --- /dev/null +++ b/docs/pot/compatibility-matrix.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Compatibility Matrix" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 2.1.x" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 2.2.x" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 3.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 3.0.1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 3.0.2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack 3.0.3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 5.6" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "No" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 5.6 FP1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 5.6 SP2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 6.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 6.0.2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer 6.1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM (RHEL 6.0 or 6.1)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware (vSphere and vCenter, both version 4.1)" +msgstr "" + diff --git a/docs/pot/compute-disk-service-offerings.pot b/docs/pot/compute-disk-service-offerings.pot new file mode 100644 index 00000000000..93a78d389d2 --- /dev/null +++ b/docs/pot/compute-disk-service-offerings.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Compute and Disk Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A service offering is a set of virtual hardware features such as CPU core count and speed, memory, and disk size. The &PRODUCT; administrator can set up various offerings, and then end users choose from the available offerings when they create a new VM. A service offering includes the following elements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU, memory, and network resource guarantees" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How resources are metered" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How the resource usage is charged" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How often the charges are generated" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, one service offering might allow users to create a virtual machine instance that is equivalent to a 1 GHz Intel® Coreâ„¢ 2 CPU, with 1 GB memory at $0.20/hour, with network traffic metered at $0.10/GB. Based on the user’s selected offering, &PRODUCT; emits usage records that can be integrated with billing systems. &PRODUCT; separates service offerings into compute offerings and disk offerings. The computing service offering specifies:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest CPU" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest RAM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Networking type (virtual or direct)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags on the root disk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The disk offering specifies:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk size (optional). An offering without a disk size will allow users to pick their own" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags on the data disk" +msgstr "" + diff --git a/docs/pot/concepts.pot b/docs/pot/concepts.pot new file mode 100644 index 00000000000..ed6f2ab0c78 --- /dev/null +++ b/docs/pot/concepts.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Concepts" +msgstr "" + diff --git a/docs/pot/configure-acl.pot b/docs/pot/configure-acl.pot new file mode 100644 index 00000000000..64e5c96acf0 --- /dev/null +++ b/docs/pot/configure-acl.pot @@ -0,0 +1,165 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring Access Control List" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Define Network Access Control List (ACL) on the VPC virtual router to control incoming (ingress) and outgoing (egress) traffic between the VPC tiers, and the tiers and Internet. By default, all incoming and outgoing traffic to the guest networks is blocked. To open the ports, you must create a new network ACL. The network ACLs can be created for the tiers only if the NetworkACL service is supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Network ACLs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Network ACLs page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Network ACLs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add an ACL rule, fill in the following fields to specify what kind of network traffic is allowed in this tier." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CIDR: The CIDR acts as the Source CIDR for the Ingress rules, and Destination CIDR for the Egress rules. To accept traffic only from or to the IP addresses within a particular address block, enter a CIDR or a comma-separated list of CIDRs. The CIDR is the base IP address of the incoming traffic. For example, 192.168.0.0/22. To allow all CIDRs, set to 0.0.0.0/0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol: The networking protocol that sources use to send traffic to the tier. The TCP and UDP protocols are typically used for data exchange and end-user communications. The ICMP protocol is typically used to send error messages or network monitoring data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start Port, End Port (TCP, UDP only): A range of listening ports that are the destination for the incoming traffic. If you are opening a single port, use the same number in both fields." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Tier: Select the tier for which you want to add this ACL rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ICMP Type, ICMP Code (ICMP only): The type of message and error code that will be sent." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Traffic Type: Select the traffic type you want to apply." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Egress: To add an egress rule, select Egress from the Traffic type drop-down box and click Add. This specifies what type of traffic is allowed to be sent out of VM instances in this tier. If no egress rules are specified, all traffic from the tier is allowed out at the VPC virtual router. Once egress rules are specified, only the traffic specified in egress rules and the responses to any traffic that has been allowed in through an ingress rule are allowed out. No egress rule is required for the VMs in a tier to communicate with each other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ingress: To add an ingress rule, select Ingress from the Traffic type drop-down box and click Add. This specifies what network traffic is allowed into the VM instances in this tier. If no ingress rules are specified, then no traffic will be allowed in, except for responses to any traffic that has been allowed out through an egress rule." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default, all incoming and outgoing traffic to the guest networks is blocked. To open the ports, create a new network ACL." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add. The ACL rule is added." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To view the list of ACL rules you have added, click the desired tier from the Network ACLs page, then select the Network ACL tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can edit the tags assigned to the ACL rules and delete the ACL rules you have created. Click the appropriate button in the Actions column." +msgstr "" + diff --git a/docs/pot/configure-guest-traffic-in-advanced-zone.pot b/docs/pot/configure-guest-traffic-in-advanced-zone.pot new file mode 100644 index 00000000000..eedfdcb1a92 --- /dev/null +++ b/docs/pot/configure-guest-traffic-in-advanced-zone.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure Guest Traffic in an Advanced Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These steps assume you have already logged in to the &PRODUCT; UI. To configure the base guest network:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. On Zones, click View More, then click the zone to which you want to add a network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Network tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add guest network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Add guest network window is displayed:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the network. This will be user-visible" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Display Text: The description of the network. This will be user-visible" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone: The zone in which you are configuring the guest network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network offering: If the administrator has configured multiple network offerings, select the one you want to use for this network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Gateway: The gateway that the guests should use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Netmask: The netmask in use on the subnet the guests will use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/configure-package-repository.pot b/docs/pot/configure-package-repository.pot new file mode 100644 index 00000000000..e91535826a5 --- /dev/null +++ b/docs/pot/configure-package-repository.pot @@ -0,0 +1,131 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure package repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; is only distributed from source from the official mirrors. However, members of the CloudStack community may build convenience binaries so that users can install Apache CloudStack without needing to build from source." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you didn't follow the steps to build your own packages from source in the sections for or you may find pre-built DEB and RPM packages for your convience linked from the downloads page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These repositories contain both the Management Server and KVM Hypervisor packages." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "DEB package repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can add a DEB package repository to your apt sources with the following commands. Please note that only packages for Ubuntu 12.04 LTS (precise) are being built at this time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use your preferred editor and open (or create) /etc/apt/sources.list.d/cloudstack.list. Add the community provided repository to the file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "deb http://cloudstack.apt-get.eu/ubuntu precise 4.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We now have to add the public key to the trusted keys." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ wget -O - http://cloudstack.apt-get.eu/release.asc|apt-key add -" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now update your local apt cache." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ apt-get update" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Your DEB package repository should now be configured and ready for use." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "RPM package repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is a RPM package repository for &PRODUCT; so you can easily install on RHEL based platforms." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you're using an RPM-based system, you'll want to add the Yum repository so that you can install &PRODUCT; with Yum." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yum repository information is found under /etc/yum.repos.d. You'll see several .repo files in this directory, each one denoting a specific repository." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add the &PRODUCT; repository, create /etc/yum.repos.d/cloudstack.repo and insert the following information." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"[cloudstack]\n" +"name=cloudstack\n" +"baseurl=http://cloudstack.apt-get.eu/rhel/4.0/\n" +"enabled=1\n" +"gpgcheck=0\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now you should be able to install CloudStack using Yum." +msgstr "" + diff --git a/docs/pot/configure-public-traffic-in-an-advanced-zone.pot b/docs/pot/configure-public-traffic-in-an-advanced-zone.pot new file mode 100644 index 00000000000..e69b5f4be9e --- /dev/null +++ b/docs/pot/configure-public-traffic-in-an-advanced-zone.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure Public Traffic in an Advanced Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a zone that uses advanced networking, you need to configure at least one range of IP addresses for Internet traffic." +msgstr "" + diff --git a/docs/pot/configure-snmp-rhel.pot b/docs/pot/configure-snmp-rhel.pot new file mode 100644 index 00000000000..d614a53aad7 --- /dev/null +++ b/docs/pot/configure-snmp-rhel.pot @@ -0,0 +1,143 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:57\n" +"PO-Revision-Date: 2013-02-02T20:11:57\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring SNMP Community String on a RHEL Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The SNMP Community string is similar to a user id or password that provides access to a network device, such as router. This string is sent along with all SNMP requests. If the community string is correct, the device responds with the requested information. If the community string is incorrect, the device discards the request and does not respond." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The NetScaler device uses SNMP to communicate with the VMs. You must install SNMP and configure SNMP Community string for a secure communication between the NetScaler device and the RHEL machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that you installed SNMP on RedHat. If not, run the following command:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "yum install net-snmp-utils" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the /etc/snmp/snmpd.conf file to allow the SNMP polling from the NetScaler device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Map the community name into a security name (local and mynetwork, depending on where the request is coming from):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use a strong password instead of public when you edit the following table." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "# sec.name source community\n" +"com2sec local localhost public\n" +"com2sec mynetwork 0.0.0.0 public" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Setting to 0.0.0.0 allows all IPs to poll the NetScaler server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Map the security names into group names:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "# group.name sec.model sec.name\n" +"group MyRWGroup v1 local\n" +"group MyRWGroup v2c local\n" +"group MyROGroup v1 mynetwork\n" +"group MyROGroup v2c mynetwork" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a view to allow the groups to have the permission to:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "incl/excl subtree mask view all included .1 " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Grant access with different write permissions to the two groups to the view you created." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "# context sec.model sec.level prefix read write notif\n" +" access MyROGroup \"\" any noauth exact all none none\n" +" access MyRWGroup \"\" any noauth exact all all all " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unblock SNMP in iptables." +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "iptables -A INPUT -p udp --dport 161 -j ACCEPT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the SNMP service:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "service snmpd start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the SNMP service is started automatically during the system startup:" +msgstr "" + +#. Tag: screen +#, no-c-format +msgid "chkconfig snmpd on" +msgstr "" + diff --git a/docs/pot/configure-usage-server.pot b/docs/pot/configure-usage-server.pot new file mode 100644 index 00000000000..deadcad6a3a --- /dev/null +++ b/docs/pot/configure-usage-server.pot @@ -0,0 +1,230 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring the Usage Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the usage server:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure the Usage Server has been installed. This requires extra steps beyond just installing the &PRODUCT; software. See Installing the Usage Server (Optional) in the Advanced Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Search, type usage. Find the configuration parameter that controls the behavior you want to set. See the table below for a description of the available parameters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Actions, click the Edit icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type the desired value and click the Save icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server (as usual with any global configuration change) and also the Usage Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart\n" +"# service cloud-usage restart \n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table shows the global configuration settings that control the behavior of the Usage Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Parameter Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enable.usage.server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Whether the Usage Server is active." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.aggregation.timezone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Time zone of usage records. Set this if the usage records and daily job execution are in different time zones. For example, with the following settings, the usage job will run at PST 00:15 and generate usage records for the 24 hours from 00:00:00 GMT to 23:59:59 GMT:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "usage.stats.job.exec.time = 00:15 \n" +"usage.execution.timezone = PST\n" +"usage.aggregation.timezone = GMT\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Valid values for the time zone are specified in " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default: GMT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.execution.timezone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The time zone of usage.stats.job.exec.time. Valid values for the time zone are specified in " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default: The time zone of the management server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.sanity.check.interval" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The number of days between sanity checks. Set this in order to periodically search for records with erroneous data before issuing customer invoices. For example, this checks for VM usage records created after the VM was destroyed, and similar checks for templates, volumes, and so on. It also checks for usage times longer than the aggregation range. If any issue is found, the alert ALERT_TYPE_USAGE_SANITY_RESULT = 21 is sent." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.stats.job.aggregation.range" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The time period in minutes between Usage Server processing jobs. For example, if you set it to 1440, the Usage Server will run once per day. If you set it to 600, it will run every ten hours. In general, when a Usage Server job runs, it processes all events generated since usage was last run." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is special handling for the case of 1440 (once per day). In this case the Usage Server does not necessarily process all records since Usage was last run. &PRODUCT; assumes that you require processing once per day for the previous, complete day’s records. For example, if the current day is October 7, then it is assumed you would like to process records for October 6, from midnight to midnight. &PRODUCT; assumes this \"midnight to midnight\" is relative to the usage.execution.timezone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default: 1440" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.stats.job.exec.time" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The time when the Usage Server processing will start. It is specified in 24-hour format (HH:MM) in the time zone of the server, which should be GMT. For example, to start the Usage job at 10:30 GMT, enter \"10:30\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If usage.stats.job.aggregation.range is also set, and its value is not 1440, then its value will be added to usage.stats.job.exec.time to get the time to run the Usage Server job again. This is repeated until 24 hours have elapsed, and the next day's processing begins again at usage.stats.job.exec.time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default: 00:15." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, suppose that your server is in GMT, your user population is predominantly in the East Coast of the United States, and you would like to process usage records every night at 2 AM local (EST) time. Choose these settings:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "enable.usage.server = true" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.execution.timezone = America/New_York" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.stats.job.exec.time = 07:00. This will run the Usage job at 2:00 AM EST. Note that this will shift by an hour as the East Coast of the U.S. enters and exits Daylight Savings Time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage.stats.job.aggregation.range = 1440" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With this configuration, the Usage job will run every night at 2 AM EST and will process records for the previous day’s midnight-midnight as defined by the EST (America/New_York) time zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Because the special value 1440 has been used for usage.stats.job.aggregation.range, the Usage Server will ignore the data between midnight and 2 AM. That data will be included in the next day's run" +msgstr "" + diff --git a/docs/pot/configure-virtual-router.pot b/docs/pot/configure-virtual-router.pot new file mode 100644 index 00000000000..616d8e0669c --- /dev/null +++ b/docs/pot/configure-virtual-router.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring the Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can set the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP range" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported network services" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default domain name for the network serviced by the virtual router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway IP address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How often &PRODUCT; fetches network usage statistics from &PRODUCT; virtual routers. If you want to collect traffic metering data from the virtual router, set the global configuration parameter router.stats.interval. If you are not using the virtual router to gather network usage statistics, set it to 0." +msgstr "" + diff --git a/docs/pot/configure-vpc.pot b/docs/pot/configure-vpc.pot new file mode 100644 index 00000000000..13d1bd7242e --- /dev/null +++ b/docs/pot/configure-vpc.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring a Virtual Private Cloud" +msgstr "" + diff --git a/docs/pot/configure-vpn.pot b/docs/pot/configure-vpn.pot new file mode 100644 index 00000000000..9d4e798860f --- /dev/null +++ b/docs/pot/configure-vpn.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up VPN for the cloud:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the following global configuration parameters." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "remote.access.vpn.client.ip.range – The range of IP addressess to be allocated to remote access VPN clients. The first IP in the range is used by the VPN server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "remote.access.vpn.psk.length – Length of the IPSec key." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "remote.access.vpn.user.limit – Maximum number of VPN users per account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable VPN for a particular network:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as a user or administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click one of the displayed IP address names." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Enable VPN button AttachDiskButton.png: button to attach a volume ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IPsec key is displayed in a popup window." +msgstr "" + diff --git a/docs/pot/configure-xenserver-dom0-memory.pot b/docs/pot/configure-xenserver-dom0-memory.pot new file mode 100644 index 00000000000..33e6b06166a --- /dev/null +++ b/docs/pot/configure-xenserver-dom0-memory.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure XenServer dom0 Memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the XenServer dom0 settings to allocate more memory to dom0. This can enable XenServer to handle larger numbers of virtual machines. We recommend 2940 MB of RAM for XenServer dom0. For instructions on how to do this, see Citrix Knowledgebase Article.The article refers to XenServer 5.6, but the same information applies to XenServer 6" +msgstr "" + diff --git a/docs/pot/configuring-projects.pot b/docs/pot/configuring-projects.pot new file mode 100644 index 00000000000..46b2193e05d --- /dev/null +++ b/docs/pot/configuring-projects.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring Projects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before &PRODUCT; users start using projects, the &PRODUCT; administrator must set up various systems to support them, including membership invitations, limits on project resources, and controls on who can create projects." +msgstr "" + diff --git a/docs/pot/console-proxy.pot b/docs/pot/console-proxy.pot new file mode 100644 index 00000000000..6117a8680db --- /dev/null +++ b/docs/pot/console-proxy.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Console Proxy" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Console Proxy is a type of System Virtual Machine that has a role in presenting a console view via the web UI. It connects the user’s browser to the VNC port made available via the hypervisor for the console of the guest. Both the administrator and end user web UIs offer a console connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Clicking on a console icon brings up a new window. The AJAX code downloaded into that window refers to the public IP address of a console proxy VM. There is exactly one public IP address allocated per console proxy VM. The AJAX application connects to this IP. The console proxy then proxies the connection to the VNC port for the requested VM on the Host hosting the guest. ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The hypervisors will have many ports assigned to VNC usage so that multiple VNC sessions can occur simultaneously." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is never any traffic to the guest virtual IP, and there is no need to enable VNC within the guest." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The console proxy VM will periodically report its active session count to the Management Server. The default reporting interval is five seconds. This can be changed through standard Management Server configuration with the parameter consoleproxy.loadscan.interval." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Assignment of guest VM to console proxy is determined by first determining if the guest VM has a previous session associated with a console proxy. If it does, the Management Server will assign the guest VM to the target Console Proxy VM regardless of the load on the proxy VM. Failing that, the first available running Console Proxy VM that has the capacity to handle new sessions is used." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Console proxies can be restarted by administrators but this will interrupt existing console sessions for users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The console viewing functionality uses a dynamic DNS service under the domain name realhostip.com to assist in providing SSL security to console sessions. The console proxy is assigned a public IP address. In order to avoid browser warnings for mismatched SSL certificates, the URL for the new console window is set to the form of https://aaa-bbb-ccc-ddd.realhostip.com. Customers will see this URL during console session creation. &PRODUCT; includes the realhostip.com SSL certificate in the console proxy VM. Of course, &PRODUCT; cannot know about DNS A records for our customers' public IPs prior to shipping the software. &PRODUCT; therefore runs a dynamic DNS server that is authoritative for the realhostip.com domain. It maps the aaa-bbb-ccc-ddd part of the DNS name to the IP address aaa.bbb.ccc.ddd on lookups. This allows the browser to correctly connect to the console proxy's public IP, where it then expects and receives a SSL certificate for realhostip.com, and SSL is set up without browser warnings." +msgstr "" + diff --git a/docs/pot/convert-hyperv-vm-to-template.pot b/docs/pot/convert-hyperv-vm-to-template.pot new file mode 100644 index 00000000000..c4f6f380160 --- /dev/null +++ b/docs/pot/convert-hyperv-vm-to-template.pot @@ -0,0 +1,170 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Converting a Hyper-V VM to a Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To convert a Hyper-V VM to a XenServer-compatible &PRODUCT; template, you will need a standalone XenServer host with an attached NFS VHD SR. Use whatever XenServer version you are using with &PRODUCT;, but use XenCenter 5.6 FP1 or SP2 (it is backwards compatible to 5.6). Additionally, it may help to have an attached NFS ISO SR." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For Linux VMs, you may need to do some preparation in Hyper-V before trying to get the VM to work in XenServer. Clone the VM and work on the clone if you still want to use the VM in Hyper-V. Uninstall Hyper-V Integration Components and check for any references to device names in /etc/fstab:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the linux_ic/drivers/dist directory, run make uninstall (where \"linux_ic\" is the path to the copied Hyper-V Integration Components files)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restore the original initrd from backup in /boot/ (the backup is named *.backup0)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remove the \"hdX=noprobe\" entries from /boot/grub/menu.lst." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check /etc/fstab for any partitions mounted by device name. Change those entries (if any) to mount by LABEL or UUID (get that information with the \"blkid\" command).." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The next step is make sure the VM is not running in Hyper-V, then get the VHD into XenServer. There are two options for doing this." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Option one:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Import the VHD using XenCenter. In XenCenter, go to Tools>Virtual Appliance Tools>Disk Image Import." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the VHD, then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name the VM, choose the NFS VHD SR under Storage, enable \"Run Operating System Fixups\" and choose the NFS ISO SR." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Next, then Finish. A VM should be created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Option two" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run XenConvert, under From choose VHD, under To choose XenServer. Click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Input the XenServer host info, then click Next." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name the VM, then click Next, then Convert. A VM should be created" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once you have a VM created from the Hyper-V VHD, prepare it using the following steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Boot the VM, uninstall Hyper-V Integration Services, and reboot." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install XenServer Tools, then reboot." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the VM as desired. For example, run sysprep on Windows VMs. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Either option above will create a VM in HVM mode. This is fine for Windows VMs, but Linux VMs may not perform optimally. Converting a Linux VM to PV mode will require additional steps and will vary by distribution." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shut down the VM and copy the VHD from the NFS storage to a web server; for example, mount the NFS share on the web server and copy it, or from the XenServer host use sftp or scp to upload it to the web server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In &PRODUCT;, create a new template using the following values:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL. Give the URL for the VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type. Use the appropriate OS. For PV mode on CentOS, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format. VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The template will be created, and you can create instances from it." +msgstr "" + diff --git a/docs/pot/create-bare-metal-template.pot b/docs/pot/create-bare-metal-template.pot new file mode 100644 index 00000000000..09ee1bcbecd --- /dev/null +++ b/docs/pot/create-bare-metal-template.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a Bare Metal Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Beta feature. Untested in &PRODUCT; 3.0.3. Provided without guarantee of performance." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you can create a bare metal template, you must have performed several other installation and setup steps to create a bare metal cluster and environment. See Bare Metal Installation in the Installation Guide. It is assumed you already have a directory named \"win7_64bit\" on your CIFS server, containing the image for the bare metal instance. This directory and image are set up as part of the Bare Metal Installation procedure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create Template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog box, enter the following values." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Short name for the template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Display Text. Description of the template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL. The directory name which contains image file on your CIFS server. For example, win7_64bit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone. All Zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type. Select the OS type of the ISO image. Choose other if the OS Type of the ISO is not listed or if the ISO is not bootable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor. BareMetal." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format. BareMetal." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password Enabled. No." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. No." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Featured. Choose Yes if you would like this template to be more prominent for users to select. Only administrators may make templates featured." +msgstr "" + diff --git a/docs/pot/create-new-projects.pot b/docs/pot/create-new-projects.pot new file mode 100644 index 00000000000..de1b6300a5e --- /dev/null +++ b/docs/pot/create-new-projects.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New Project" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; administrators and domain administrators can create projects. If the global configuration parameter allow.user.create.projects is set to true, end users can also create projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select view, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click New Project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Give the project a name and description for display to users, then click Create Project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A screen appears where you can immediately add more members to the project. This is optional. Click Next when you are ready to move on." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Save." +msgstr "" + diff --git a/docs/pot/create-template-from-existing-vm.pot b/docs/pot/create-template-from-existing-vm.pot new file mode 100644 index 00000000000..fbb0012970a --- /dev/null +++ b/docs/pot/create-template-from-existing-vm.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a Template from an Existing Virtual Machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once you have at least one VM set up in the way you want, you can use it as the prototype for other VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create and start a virtual machine using any of the techniques given in ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make any desired configuration changes on the running VM, then click Stop." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait for the VM to stop. When the status shows Stopped, go to the next step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create Template and provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name and Display Text. These will be shown in the UI, so choose something descriptive." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type. This helps &PRODUCT; and the hypervisor perform certain operations and make assumptions that improve the performance of the guest. Select one of the following." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the operating system of the stopped VM is listed, choose it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the OS type of the stopped VM is not listed, choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to boot from this template in PV mode, choose Other PV (32-bit) or Other PV (64-bit). This choice is available only for XenServere:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note: Generally you should not choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will in general not work. In those cases you should choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Choose Yes to make this template accessible to all users of this &PRODUCT; installation. The template will appear in the Community Templates list. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password Enabled. Choose Yes if your template has the &PRODUCT; password change script installed. See Adding Password Management to Your Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new template will be visible in the Templates section when the template creation process has been completed. The template is then available when creating a new VM" +msgstr "" + diff --git a/docs/pot/create-template-from-snapshot.pot b/docs/pot/create-template-from-snapshot.pot new file mode 100644 index 00000000000..1e53985d5ba --- /dev/null +++ b/docs/pot/create-template-from-snapshot.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a Template from a Snapshot" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you do not want to stop the VM in order to use the Create Template menu item (as described in ), you can create a template directly from any snapshot through the &PRODUCT; UI." +msgstr "" + diff --git a/docs/pot/create-templates-overview.pot b/docs/pot/create-templates-overview.pot new file mode 100644 index 00000000000..fe715ee402c --- /dev/null +++ b/docs/pot/create-templates-overview.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating Templates: Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; ships with a default template for the CentOS operating system. There are a variety of ways to add more templates. Administrators and end users can add templates. The typical sequence of events is:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Launch a VM instance that has the operating system you want. Make any other desired configuration changes to the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Convert the volume into a template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are other ways to add templates to &PRODUCT;. For example, you can take a snapshot of the VM's volume and create a template from the snapshot, or import a VHD from another system into &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The various techniques for creating templates are described in the next few sections." +msgstr "" + diff --git a/docs/pot/create-vpn-connection-vpc.pot b/docs/pot/create-vpn-connection-vpc.pot new file mode 100644 index 00000000000..7f9e3a98a7d --- /dev/null +++ b/docs/pot/create-vpn-connection-vpc.pot @@ -0,0 +1,160 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a VPN Connection" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you create for the account are listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ASLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Site-to-Site VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Site-to-Site VPN page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the Select View drop-down, ensure that VPN Connection is selected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create VPN Connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Create VPN Connection dialog is displayed:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the desired customer gateway, then click OK to confirm." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Within a few moments, the VPN Connection is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following information on the VPN connection is displayed:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "State" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IPSec Preshared Key" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IKE Policy" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESP Policy" +msgstr "" + diff --git a/docs/pot/create-vpn-customer-gateway.pot b/docs/pot/create-vpn-customer-gateway.pot new file mode 100644 index 00000000000..69990a2a48d --- /dev/null +++ b/docs/pot/create-vpn-customer-gateway.pot @@ -0,0 +1,180 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating and Updating a VPN Customer Gateway" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VPN customer gateway can be connected to only one VPN gateway at a time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To add a VPN Customer Gateway:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPN Customer Gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add site-to-site VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: A unique name for the VPN customer gateway you create." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway: The IP address for the remote gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CIDR list: The guest CIDR list of the remote subnets. Enter a CIDR or a comma-separated list of CIDRs. Ensure that a guest CIDR list is not overlapped with the VPC’s CIDR, or another guest CIDR. The CIDR must be RFC1918-compliant." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IPsec Preshared Key: Preshared keying is a method where the endpoints of the VPN share a secret key. This key value is used to authenticate the customer gateway and the VPC VPN gateway to each other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IKE peers (VPN end points) authenticate each other by computing and sending a keyed hash of data that includes the Preshared key. If the receiving peer is able to create the same hash independently by using its Preshared key, it knows that both peers must share the same secret, thus authenticating the customer gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IKE Encryption: The Internet Key Exchange (IKE) policy for phase-1. The supported encryption algorithms are AES128, AES192, AES256, and 3DES. Authentication is accomplished through the Preshared Keys." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The phase-1 is the first phase in the IKE process. In this initial negotiation phase, the two VPN endpoints agree on the methods to be used to provide security for the underlying IP traffic. The phase-1 authenticates the two VPN gateways to each other, by confirming that the remote gateway has a matching Preshared Key." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IKE Hash: The IKE hash for phase-1. The supported hash algorithms are SHA1 and MD5." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IKE DH: A public-key cryptography protocol which allows two parties to establish a shared secret over an insecure communications channel. The 1536-bit Diffie-Hellman group is used within IKE to establish session keys. The supported options are None, Group-5 (1536-bit) and Group-2 (1024-bit)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESP Encryption: Encapsulating Security Payload (ESP) algorithm within phase-2. The supported encryption algorithms are AES128, AES192, AES256, and 3DES." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The phase-2 is the second phase in the IKE process. The purpose of IKE phase-2 is to negotiate IPSec security associations (SA) to set up the IPSec tunnel. In phase-2, new keying material is extracted from the Diffie-Hellman key exchange in phase-1, to provide session keys to use in protecting the VPN data flow." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESP Hash: Encapsulating Security Payload (ESP) hash for phase-2. Supported hash algorithms are SHA1 and MD5." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Perfect Forward Secrecy: Perfect Forward Secrecy (or PFS) is the property that ensures that a session key derived from a set of long-term public and private keys will not be compromised. This property enforces a new Diffie-Hellman key exchange. It provides the keying material that has greater key material life and thereby greater resistance to cryptographic attacks. The available options are None, Group-5 (1536-bit) and Group-2 (1024-bit). The security of the key exchanges increase as the DH groups grow larger, as does the time of the exchanges." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When PFS is turned on, for every negotiation of a new phase-2 SA the two gateways must generate a new set of phase-1 keys. This adds an extra layer of protection that PFS adds, which ensures if the phase-2 SA’s have expired, the keys used for new phase-2 SA’s have not been generated from the current phase-1 keying material." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IKE Lifetime (seconds): The phase-1 lifetime of the security association in seconds. Default is 86400 seconds (1 day). Whenever the time expires, a new phase-1 exchange is performed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESP Lifetime (seconds): The phase-2 lifetime of the security association in seconds. Default is 3600 seconds (1 hour). Whenever the value is exceeded, a re-key is initiated to provide a new IPsec encryption and authentication session keys." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Dead Peer Detection: A method to detect an unavailable Internet Key Exchange (IKE) peer. Select this option if you want the virtual router to query the liveliness of its IKE peer at regular intervals. It’s recommended to have the same configuration of DPD on both side of VPN connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Updating and Removing a VPN Customer Gateway" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can update a customer gateway either with no VPN connection, or related VPN connection is in error state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the VPN customer gateway you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To modify the required parameters, click the Edit VPN Customer Gateway button edit.png: button to edit a VPN customer gateway " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To remove the VPN customer gateway, click the Delete VPN Customer Gateway button delete.png: button to remove a VPN customer gateway " +msgstr "" + diff --git a/docs/pot/create-vpn-gateway-for-vpc.pot b/docs/pot/create-vpn-gateway-for-vpc.pot new file mode 100644 index 00000000000..de02f8d4b2f --- /dev/null +++ b/docs/pot/create-vpn-gateway-for-vpc.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a VPN gateway for the VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Site-to-Site VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are creating the VPN gateway for the first time, selecting Site-to-Site VPN prompts you to create a VPN gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the confirmation dialog, click Yes to confirm." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Within a few moments, the VPN gateway is created. You will be prompted to view the details of the VPN gateway you have created. Click Yes to confirm." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following details are displayed in the VPN Gateway page:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Domain" +msgstr "" + diff --git a/docs/pot/create-vr-network-offering.pot b/docs/pot/create-vr-network-offering.pot new file mode 100644 index 00000000000..0c3a0e1ac77 --- /dev/null +++ b/docs/pot/create-vr-network-offering.pot @@ -0,0 +1,140 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating and Changing a Virtual Router Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create the network offering in association with a virtual router system service offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First, create a system service offering, for example: VRsystemofferingHA." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information on creating a system service offering, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the Select Offering drop-down, choose Network Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Network Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog, make the following choices:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Any desired name for the network offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description. A short description of the offering that can be displayed to users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Rate. Allowed data transfer rate in MB per second." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Traffic Type. The type of network traffic that will be carried on the network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Type. Choose whether the guest network is isolated or shared. For a description of these terms, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify VLAN. (Isolated guest networks only) Indicate whether a VLAN should be specified when this offering is used." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported Services. Select one or more of the possible network services. For some services, you must also choose the service provider; for example, if you select Load Balancer, you can choose the &PRODUCT; virtual router or any other load balancers that have been configured in the cloud. Depending on which services you choose, additional fields may appear in the rest of the dialog box. For more information, see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System Offering. Choose the system service offering that you want virtual routers to use in this network. In this case, the default “System Offering For Software Router†and the custom “VRsystemofferingHA†are available and displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK and the network offering is created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To change the network offering of a guest network to the virtual router service offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Network from the left navigation pane." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the guest network that you want to offer this network service to." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Edit button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the Network Offering drop-down, select the virtual router network offering you have just created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/create-windows-template.pot b/docs/pot/create-windows-template.pot new file mode 100644 index 00000000000..64b3ae89f14 --- /dev/null +++ b/docs/pot/create-windows-template.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a Windows Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Windows templates must be prepared with Sysprep before they can be provisioned on multiple machines. Sysprep allows you to create a generic Windows template and avoid any possible SID conflicts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An overview of the procedure is as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upload your Windows ISO." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a VM Instance with this ISO." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Follow the steps in Sysprep for Windows Server 2008 R2 (below) or Sysprep for Windows Server 2003 R2, depending on your version of Windows Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The preparation steps are complete. Now you can actually create the template as described in Creating the Windows Template." +msgstr "" + diff --git a/docs/pot/creating-compute-offerings.pot b/docs/pot/creating-compute-offerings.pot new file mode 100644 index 00000000000..92051fd6379 --- /dev/null +++ b/docs/pot/creating-compute-offerings.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New Compute Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a new compute offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in with admin privileges to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Service Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select Offering, choose Compute Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Compute Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog, make the following choices:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name: Any desired name for the service offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description: A short description of the offering that can be displayed to users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage type: The type of disk that should be allocated. Local allocates from storage attached directly to the host where the system VM is running. Shared allocates from storage accessible via NFS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# of CPU cores: The number of cores which should be allocated to a system VM with this offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU (in MHz): The CPU speed of the cores that the system VM is allocated. For example, “2000†would provide for a 2 GHz clock." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Memory (in MB): The amount of memory in megabytes that the system VM should be allocated. For example, “2048†would provide for a 2 GB RAM allocation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Rate: Allowed data transfer rate in MB per second." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Offer HA: If yes, the administrator can choose to have the system VM be monitored and as highly available as possible." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage Tags: The tags that should be associated with the primary storage used by the system VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Tags: (Optional) Any tags that you use to organize your hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU cap: Whether to limit the level of CPU usage even if spare capacity is available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public: Indicate whether the service offering should be available all domains or only some domains. Choose Yes to make it available to all domains. Choose No to limit the scope to a subdomain; &PRODUCT; will then prompt for the subdomain's name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/creating-disk-offerings.pot b/docs/pot/creating-disk-offerings.pot new file mode 100644 index 00000000000..c4aa06933dc --- /dev/null +++ b/docs/pot/creating-disk-offerings.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New Disk Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a system service offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in with admin privileges to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Service Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select Offering, choose Disk Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Disk Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog, make the following choices:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Any desired name for the system offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description. A short description of the offering that can be displayed to users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Custom Disk Size. If checked, the user can set their own disk size. If not checked, the root administrator must define a value in Disk Size." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk Size. Appears only if Custom Disk Size is not selected. Define the volume size in GB." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional)Storage Tags. The tags that should be associated with the primary storage for this disk. Tags are a comma separated list of attributes of the storage. For example \"ssd,blue\". Tags are also added on Primary Storage. &PRODUCT; matches tags on a disk offering to tags on the storage. If a tag is present on a disk offering that tag (or tags) must also be present on Primary Storage for the volume to be provisioned. If no such primary storage exists, allocation from the disk offering will fail.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Indicate whether the service offering should be available all domains or only some domains. Choose Yes to make it available to all domains. Choose No to limit the scope to a subdomain; &PRODUCT; will then prompt for the subdomain's name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/creating-network-offerings.pot b/docs/pot/creating-network-offerings.pot new file mode 100644 index 00000000000..c1183db966a --- /dev/null +++ b/docs/pot/creating-network-offerings.pot @@ -0,0 +1,225 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a network offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in with admin privileges to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Service Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select Offering, choose Network Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Network Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog, make the following choices:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Any desired name for the network offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description. A short description of the offering that can be displayed to users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Rate. Allowed data transfer rate in MB per second" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Traffic Type. The type of network traffic that will be carried on the network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Type. Choose whether the guest network is isolated or shared. For a description of these terms, see " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify VLAN. (Isolated guest networks only) Indicate whether a VLAN should be specified when this offering is used" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported Services. Select one or more of the possible network services. For some services, you must also choose the service provider; for example, if you select Load Balancer, you can choose the &PRODUCT; virtual router or any other load balancers that have been configured in the cloud. Depending on which services you choose, additional fields may appear in the rest of the dialog box." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Based on the guest network type selected, you can see the following supported services:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported Services" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Isolated" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shared" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DHCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Load Balancer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you select Load Balancer, you can choose the &PRODUCT; virtual router or any other load balancers that have been configured in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you select Source NAT, you can choose the &PRODUCT; virtual router or any other Source NAT providers that have been configured in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Static NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you select Static NAT, you can choose the &PRODUCT; virtual router or any other Static NAT providers that have been configured in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Port Forwarding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you select Port Forwarding, you can choose the &PRODUCT; virtual router or any other Port Forwarding providers that have been configured in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Not Supported" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User Data" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Security Groups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System Offering. If the service provider for any of the services selected in Supported Services is a virtual router, the System Offering field appears. Choose the system service offering that you want virtual routers to use in this network. For example, if you selected Load Balancer in Supported Services and selected a virtual router to provide load balancing, the System Offering field appears so you can choose between the &PRODUCT; default system service offering and any custom system service offerings that have been defined by the &PRODUCT; root administrator. For more information, see System Service Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Redundant router capability. (v3.0.3 and greater) Available only when Virtual Router is selected as the Source NAT provider. Select this option if you want to use two virtual routers in the network for uninterrupted connection: one operating as the master virtual router and the other as the backup. The master virtual router receives requests from and sends responses to the user’s VM. The backup virtual router is activated only when the master is down. After the failover, the backup becomes the master virtual router. &PRODUCT; deploys the routers on different hosts to ensure reliability if one host is down." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Conserve mode. Indicate whether to use conserve mode. In this mode, network resources are allocated only when the first virtual machine starts in the network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags. Network tag to specify which physical network to use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/creating-new-volumes.pot b/docs/pot/creating-new-volumes.pot new file mode 100644 index 00000000000..bf5d94dab4f --- /dev/null +++ b/docs/pot/creating-new-volumes.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New Volume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can add more data disk volumes to a guest VM at any time, up to the limits of your storage capacity. Both &PRODUCT; administrators and users can add volumes to VM instances. When you create a new volume, it is stored as an entity in &PRODUCT;, but the actual storage resources are not allocated on the physical storage device until you attach the volume. This optimization allows the &PRODUCT; to provision the volume nearest to the guest that will use it when the first attachment is made." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a new volume, click Add Volume, provide the following details, and click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Give the volume a unique name so you can find it later." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Availability Zone. Where do you want the storage to reside? This should be close to the VM that will use the volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk Offering. Choose the characteristics of the storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new volume appears in the list of volumes with the state “Allocated.†The volume data is stored in &PRODUCT;, but the volume is not yet ready for use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To start using the volume, continue to Attaching a Volume" +msgstr "" + diff --git a/docs/pot/creating-system-service-offerings.pot b/docs/pot/creating-system-service-offerings.pot new file mode 100644 index 00000000000..914376f0f5f --- /dev/null +++ b/docs/pot/creating-system-service-offerings.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating a New System Service Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a system service offering:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in with admin privileges to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Service Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select Offering, choose System Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add System Service Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the dialog, make the following choices:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. Any desired name for the system offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description. A short description of the offering that can be displayed to users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System VM Type. Select the type of system virtual machine that this offering is intended to support." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage type. The type of disk that should be allocated. Local allocates from storage attached directly to the host where the system VM is running. Shared allocates from storage accessible via NFS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "# of CPU cores. The number of cores which should be allocated to a system VM with this offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU (in MHz). The CPU speed of the cores that the system VM is allocated. For example, \"2000\" would provide for a 2 GHz clock." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Memory (in MB). The amount of memory in megabytes that the system VM should be allocated. For example, \"2048\" would provide for a 2 GB RAM allocation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Rate. Allowed data transfer rate in MB per second." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Offer HA. If yes, the administrator can choose to have the system VM be monitored and as highly available as possible." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage Tags. The tags that should be associated with the primary storage used by the system VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Tags. (Optional) Any tags that you use to organize your hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CPU cap. Whether to limit the level of CPU usage even if spare capacity is available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Indicate whether the service offering should be available all domains or only some domains. Choose Yes to make it available to all domains. Choose No to limit the scope to a subdomain; &PRODUCT; will then prompt for the subdomain's name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/creating-vms.pot b/docs/pot/creating-vms.pot new file mode 100644 index 00000000000..c6b7f456d65 --- /dev/null +++ b/docs/pot/creating-vms.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Creating VMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual machines are usually created from a template. Users can also create blank virtual machines. A blank virtual machine is a virtual machine without an OS template. Users can attach an ISO file and install the OS from the CD/DVD-ROM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a VM from a template:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Instance." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select a template, then follow the steps in the wizard. (For more information about how the templates came to be in this list, see Working with Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure that the hardware you have allows starting the selected service offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Submit and your VM will be created and started." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For security reason, the internal name of the VM is visible only to the root admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Starting with v3.0.3, you can create a VM without starting it. You can determine whether the VM needs to be started as part of the VM deployment. A new request parameter, startVM, is introduced in the deployVm API to support this feature. For more information, see the Developer's Guide" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a VM from an ISO:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(XenServer) Windows VMs running on XenServer require PV drivers, which may be provided in the template or added after the VM is created. The PV drivers are necessary for essential management functions such as mounting additional volumes and ISO images, live migration, and graceful shutdown." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select ISO Boot, and follow the steps in the wizard." +msgstr "" + diff --git a/docs/pot/customizing-dns.pot b/docs/pot/customizing-dns.pot new file mode 100644 index 00000000000..75d56931a9c --- /dev/null +++ b/docs/pot/customizing-dns.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Customizing the Network Domain Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The root administrator can optionally assign a custom DNS suffix at the level of a network, account, domain, zone, or entire &PRODUCT; installation, and a domain administrator can do so within their own domain. To specify a custom domain name and put it into effect, follow these steps." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the DNS suffix at the desired scope" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At the network level, the DNS suffix can be assigned through the UI when creating a new network, as described in or with the updateNetwork command in the &PRODUCT; API." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At the account, domain, or zone level, the DNS suffix can be assigned with the appropriate &PRODUCT; API commands: createAccount, editAccount, createDomain, editDomain, createZone, or editZone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At the global level, use the configuration parameter guest.domain.suffix. You can also use the &PRODUCT; API command updateConfiguration. After modifying this global configuration, restart the Management Server to put the new setting into effect." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To make the new DNS suffix take effect for an existing network, call the &PRODUCT; API command updateNetwork. This step is not necessary when the DNS suffix was specified while creating a new network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The source of the network domain that is used depends on the following rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For all networks, if a network domain is specified as part of a network's own configuration, that value is used." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For an account-specific network, the network domain specified for the account is used. If none is specified, the system looks for a value in the domain, zone, and global configuration, in that order." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For a domain-specific network, the network domain specified for the domain is used. If none is specified, the system looks for a value in the zone and global configuration, in that order." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For a zone-specific network, the network domain specified for the zone is used. If none is specified, the system looks for a value in the global configuration." +msgstr "" + diff --git a/docs/pot/database-replication.pot b/docs/pot/database-replication.pot new file mode 100644 index 00000000000..6efcacf0b5b --- /dev/null +++ b/docs/pot/database-replication.pot @@ -0,0 +1,254 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Database Replication (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports database replication from one MySQL node to another. This is achieved using standard MySQL replication. You may want to do this as insurance against MySQL server or storage loss. MySQL replication is implemented using a master/slave model. The master is the node that the Management Servers are configured to use. The slave is a standby node that receives all write operations from the master and applies them to a local, redundant copy of the database. The following steps are a guide to implementing MySQL replication." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Creating a replica is not a backup solution. You should develop a backup procedure for the MySQL data that is distinct from replication." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that this is a fresh install with no data in the master." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit my.cnf on the master and add the following in the [mysqld] section below datadir." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"log_bin=mysql-bin\n" +"server_id=1\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The server_id must be unique with respect to other servers. The recommended way to achieve this is to give the master an ID of 1 and each slave a sequential number greater than 1, so that the servers are numbered 1, 2, 3, etc." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the MySQL service:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# service mysqld restart\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a replication account on the master and give it privileges. We will use the \"cloud-repl\" user with the password \"password\". This assumes that master and slave run on the 172.16.1.0/24 network." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# mysql -u root\n" +"mysql> create user 'cloud-repl'@'172.16.1.%' identified by 'password';\n" +"mysql> grant replication slave on *.* TO 'cloud-repl'@'172.16.1.%';\n" +"mysql> flush privileges;\n" +"mysql> flush tables with read lock;\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Leave the current MySQL session running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a new shell start a second MySQL session." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Retrieve the current position of the database." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# mysql -u root\n" +"mysql> show master status;\n" +"+------------------+----------+--------------+------------------+\n" +"| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |\n" +"+------------------+----------+--------------+------------------+\n" +"| mysql-bin.000001 | 412 | | |\n" +"+------------------+----------+--------------+------------------+\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note the file and the position that are returned by your instance." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Exit from this session." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Complete the master setup. Returning to your first session on the master, release the locks and exit MySQL." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"mysql> unlock tables;\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install and configure the slave. On the slave server, run the following commands." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# yum install mysql-server\n" +"# chkconfig mysqld on\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit my.cnf and add the following lines in the [mysqld] section below datadir." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"server_id=2\n" +"innodb_rollback_on_timeout=1\n" +"innodb_lock_wait_timeout=600\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart MySQL." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Instruct the slave to connect to and replicate from the master. Replace the IP address, password, log file, and position with the values you have used in the previous steps." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"mysql> change master to\n" +" -> master_host='172.16.1.217',\n" +" -> master_user='cloud-repl',\n" +" -> master_password='password',\n" +" -> master_log_file='mysql-bin.000001',\n" +" -> master_log_pos=412;\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then start replication on the slave." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"mysql> start slave;\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Optionally, open port 3306 on the slave as was done on the master earlier." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This is not required for replication to work. But if you choose not to do this, you will need to do it when failover to the replica occurs." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Failover" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This will provide for a replicated database that can be used to implement manual failover for the Management Servers. &PRODUCT; failover from one MySQL instance to another is performed by the administrator. In the event of a database failure you should:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the Management Servers (via service cloud-management stop)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the replica's configuration to be a master and restart it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the replica's port 3306 is open to the Management Servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make a change so that the Management Server uses the new database. The simplest process here is to put the IP address of the new database server into each Management Server's /etc/cloud/management/db.properties." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Servers:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# service cloud-management start\n" +" " +msgstr "" + diff --git a/docs/pot/dates-in-usage-record.pot b/docs/pot/dates-in-usage-record.pot new file mode 100644 index 00000000000..5ad955581c2 --- /dev/null +++ b/docs/pot/dates-in-usage-record.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Dates in the Usage Record" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Usage records include a start date and an end date. These dates define the period of time for which the raw usage number was calculated. If daily aggregation is used, the start date is midnight on the day in question and the end date is 23:59:59 on the day in question (with one exception; see below). A virtual machine could have been deployed at noon on that day, stopped at 6pm on that day, then started up again at 11pm. When usage is calculated on that day, there will be 7 hours of running VM usage (usage type 1) and 12 hours of allocated VM usage (usage type 2). If the same virtual machine runs for the entire next day, there will 24 hours of both running VM usage (type 1) and allocated VM usage (type 2)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note: The start date is not the time a virtual machine was started, and the end date is not the time when a virtual machine was stopped. The start and end dates give the time range within which usage was calculated." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For network usage, the start date and end date again define the range in which the number of bytes transferred was calculated. If a user downloads 10 MB and uploads 1 MB in one day, there will be two records, one showing the 10 megabytes received and one showing the 1 megabyte sent." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is one case where the start date and end date do not correspond to midnight and 11:59:59pm when daily aggregation is used. This occurs only for network usage records. When the usage server has more than one day's worth of unprocessed data, the old data will be included in the aggregation period. The start date in the usage record will show the date and time of the earliest event. For other types of usage, such as IP addresses and VMs, the old unprocessed data is not included in daily aggregation." +msgstr "" + diff --git a/docs/pot/dedicated-ha-hosts.pot b/docs/pot/dedicated-ha-hosts.pot new file mode 100644 index 00000000000..131d48a7627 --- /dev/null +++ b/docs/pot/dedicated-ha-hosts.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Dedicated HA Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(v3.0.3 and greater) One or more hosts can be designated for use only by HA-enabled VMs that are restarting due to a host failure. Setting up a pool of such dedicated HA hosts as the recovery destination for all HA-enabled VMs is useful to:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make it easier to determine which VMs have been restarted as part of the &PRODUCT; high-availability function. If a VM is running on a dedicated HA host, then it must be an HA-enabled VM whose original host failed. (With one exception: It is possible for an administrator to manually migrate any VM to a dedicated HA host.)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Keep HA-enabled VMs from restarting on hosts which may be reserved for other purposes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The dedicated HA option is set through a special host tag when the host is created. To allow the administrator to dedicate hosts to only HA-enabled VMs, set the global configuration variable ha.tag to the desired tag (for example, \"ha_host\"), and restart the Management Server. Enter the value in the Host Tags field when adding the host(s) that you want to dedicate to HA-enabled VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you set ha.tag, be sure to actually use that tag on at least one host in your cloud. If the tag specified in ha.tag is not set for any host in the cloud, the HA-enabled VMs will fail to restart after a crash." +msgstr "" + diff --git a/docs/pot/default-account-resource-limit.pot b/docs/pot/default-account-resource-limit.pot new file mode 100644 index 00000000000..a74111d206c --- /dev/null +++ b/docs/pot/default-account-resource-limit.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Default Account Resource Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can limit resource use by accounts. The default limits are set using global configuration parameters, and they affect all accounts within a cloud. The relevant parameters are those beginning with max.account (max.account.snapshots, etc.).." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To override a default limit for a particular account, set a per-account resource limit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation tree, click Accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the account you want to modify. The current limits are displayed. A value of -1 shows that there is no limit in place" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Edit button editbutton.png: edits the settings. " +msgstr "" + diff --git a/docs/pot/default-template.pot b/docs/pot/default-template.pot new file mode 100644 index 00000000000..63b08f4c818 --- /dev/null +++ b/docs/pot/default-template.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "The Default Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; includes a CentOS template. This template is downloaded by the Secondary Storage VM after the primary and secondary storage are configured. You can use this template in your production deployment or you can delete it and use custom templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The root password for the default template is \"password\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A default template is provided for each of XenServer, KVM, and vSphere. The templates that are downloaded depend on the hypervisor type that is available in your cloud. Each template is approximately 2.5 GB physical size." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default template includes the standard iptables rules, which will block most access to the template excluding ssh." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# iptables --list\n" +"Chain INPUT (policy ACCEPT)\n" +"target prot opt source destination\n" +"RH-Firewall-1-INPUT all -- anywhere anywhere\n" +"\n" +"Chain FORWARD (policy ACCEPT)\n" +"target prot opt source destination\n" +"RH-Firewall-1-INPUT all -- anywhere anywhere\n" +"\n" +"Chain OUTPUT (policy ACCEPT)\n" +"target prot opt source destination\n" +"\n" +"Chain RH-Firewall-1-INPUT (2 references)\n" +"target prot opt source destination\n" +"ACCEPT all -- anywhere anywhere\n" +"ACCEPT icmp -- anywhere anywhere icmp any\n" +"ACCEPT esp -- anywhere anywhere\n" +"ACCEPT ah -- anywhere anywhere\n" +"ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns\n" +"ACCEPT udp -- anywhere anywhere udp dpt:ipp\n" +"ACCEPT tcp -- anywhere anywhere tcp dpt:ipp\n" +"ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED\n" +"ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh\n" +"REJECT all -- anywhere anywhere reject-with icmp-host-\n" +"" +msgstr "" + diff --git a/docs/pot/delete-reset-vpn.pot b/docs/pot/delete-reset-vpn.pot new file mode 100644 index 00000000000..54b2143fe13 --- /dev/null +++ b/docs/pot/delete-reset-vpn.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Restarting and Removing a VPN Connection" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ASLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Site-to-Site VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Site-to-Site VPN page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the Select View drop-down, ensure that VPN Connection is selected." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPN connections you created are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the VPN connection you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Details tab is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To remove a VPN connection, click the Delete VPN connection button remove-vpn.png: button to remove a VPN connection " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To restart a VPN connection, click the Reset VPN connection button present in the Details tab. reset-vpn.png: button to reset a VPN connection " +msgstr "" + diff --git a/docs/pot/delete-templates.pot b/docs/pot/delete-templates.pot new file mode 100644 index 00000000000..d1cf15f1e92 --- /dev/null +++ b/docs/pot/delete-templates.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Deleting Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Templates may be deleted. In general, when a template spans multiple Zones, only the copy that is selected for deletion will be deleted; the same template in other Zones will not be deleted. The provided CentOS template is an exception to this. If the provided CentOS template is deleted, it will be deleted from all Zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When templates are deleted, the VMs instantiated from them will continue to run. However, new VMs cannot be created based on the deleted template." +msgstr "" + diff --git a/docs/pot/deleting-vms.pot b/docs/pot/deleting-vms.pot new file mode 100644 index 00000000000..236b460ad19 --- /dev/null +++ b/docs/pot/deleting-vms.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Deleting VMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Users can delete their own virtual machines. A running virtual machine will be abruptly stopped before it is deleted. Administrators can delete any virtual machines." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To delete a virtual machine:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the VM that you want to delete." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Destroy Instance button Destroyinstance.png: button to destroy an instance " +msgstr "" + diff --git a/docs/pot/dell62xx-hardware.pot b/docs/pot/dell62xx-hardware.pot new file mode 100644 index 00000000000..b55f4d1271e --- /dev/null +++ b/docs/pot/dell62xx-hardware.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Dell 62xx" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following steps show how a Dell 62xx is configured for zone-level layer-3 switching. These steps assume VLAN 201 is used to route untagged private IPs for pod 1, and pod 1’s layer-2 switch is connected to Ethernet port 1/g1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Dell 62xx Series switch supports up to 1024 VLANs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure all the VLANs in the database." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vlan database\n" +"vlan 200-999\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure Ethernet port 1/g1." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "interface ethernet 1/g1\n" +"switchport mode general\n" +"switchport general pvid 201\n" +"switchport general allowed vlan add 201 untagged\n" +"switchport general allowed vlan add 300-999 tagged\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The statements configure Ethernet port 1/g1 as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 201 is the native untagged VLAN for port 1/g1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All VLANs (300-999) are passed to all the pod-level layer-2 switches." +msgstr "" + diff --git a/docs/pot/dell62xx-layer2.pot b/docs/pot/dell62xx-layer2.pot new file mode 100644 index 00000000000..a0b588c003f --- /dev/null +++ b/docs/pot/dell62xx-layer2.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Dell 62xx" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following steps show how a Dell 62xx is configured for pod-level layer-2 switching." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure all the VLANs in the database." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vlan database\n" +"vlan 300-999\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 201 is used to route untagged private IP addresses for pod 1, and pod 1 is connected to this layer-2 switch." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "interface range ethernet all\n" +"switchport mode general\n" +"switchport general allowed vlan add 300-999 tagged\n" +"exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The statements configure all Ethernet ports to function as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All ports are configured the same way." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All VLANs (300-999) are passed through all the ports of the layer-2 switch." +msgstr "" + diff --git a/docs/pot/deployment-architecture-overview.pot b/docs/pot/deployment-architecture-overview.pot new file mode 100644 index 00000000000..3ce4056de44 --- /dev/null +++ b/docs/pot/deployment-architecture-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Deployment Architecture Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A &PRODUCT; installation consists of two parts: the Management Server and the cloud infrastructure that it manages. When you set up and manage a &PRODUCT; cloud, you provision resources such as hosts, storage devices, and IP addresses into the Management Server, and the Management Server manages those resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The minimum production installation consists of one machine running the &PRODUCT; Management Server and another machine to act as the cloud infrastructure (in this case, a very simple infrastructure consisting of one host running hypervisor software). In its smallest deployment, a single machine can act as both the Management Server and the hypervisor host (using the KVM hypervisor)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A more full-featured installation consists of a highly-available multi-node Management Server installation and up to tens of thousands of hosts using any of several advanced networking setups. For information about deployment options, see Choosing a Deployment Architecture." +msgstr "" + diff --git a/docs/pot/detach-move-volumes.pot b/docs/pot/detach-move-volumes.pot new file mode 100644 index 00000000000..405ce9bfc74 --- /dev/null +++ b/docs/pot/detach-move-volumes.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Attaching a Volume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This procedure is different from moving disk volumes from one storage pool to another. See VM Storage Migration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A volume can be detached from a guest VM and attached to another guest. Both &PRODUCT; administrators and users can detach volumes from VMs and move them to other VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the two VMs are in different clusters, and the volume is large, it may take several minutes for the volume to be moved to the new VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Storage, and choose Volumes in Select View. Alternatively, if you know which VM the volume is attached to, you can click Instances, click the VM name, and click View Volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the volume you want to detach, then click the Detach Disk button DetachDiskButton.png: button to detach a volume " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To move the volume to another VM, follow the steps in Attaching a Volume ." +msgstr "" + diff --git a/docs/pot/devcloud-usage-mode.pot b/docs/pot/devcloud-usage-mode.pot new file mode 100644 index 00000000000..50a687b6174 --- /dev/null +++ b/docs/pot/devcloud-usage-mode.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "DevCloud Usage Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DevCloud can be used in several different ways:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Full sandbox. Where &PRODUCT; is run within the DevCloud instance started in Virtual Box." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In this mode, the &PRODUCT; management server runs within the instance and nested virtualization allows instantiation of tiny VMs within DevCloud itself. &PRODUCT; code modifications are done within DevCloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following diagram shows the architecture of the SandBox mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A deployment environment. Where &PRODUCT; code is developed in the localhost of the developer and the resulting build is deployed within DevCloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This mode was used in the testing procedure of &PRODUCT; 4.0.0 incubating release. See the following screencast to see how: http://vimeo.com/54621457" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A host-only mode. Where DevCloud is used only as a host. &PRODUCT; management server is run in the localhost of the developer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This mode makes use of a host-only interface defined in the Virtual Box preferences. Check the following screencast to see how: http://vimeo.com/54610161" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following schematic shows the architecture of the Host-Only mode." +msgstr "" + diff --git a/docs/pot/devcloud.pot b/docs/pot/devcloud.pot new file mode 100644 index 00000000000..7d9f6f94a12 --- /dev/null +++ b/docs/pot/devcloud.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "DevCloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DevCloud is the &PRODUCT; sandbox. It is provided as a Virtual Box appliance. It is meant to be used as a development environment to easily test new &PRODUCT; development. It has also been used for training and &PRODUCT; demos since it provides a Cloud in a box." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DevCloud is provided as a convenience by community members. It is not an official &PRODUCT; release artifact." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; source code however, contains tools to build your own DevCloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DevCloud is under development and should be considered a Work In Progress (WIP), the wiki is the most up to date documentation:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/pot/developer-getting-started.pot b/docs/pot/developer-getting-started.pot new file mode 100644 index 00000000000..b0c3703a124 --- /dev/null +++ b/docs/pot/developer-getting-started.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Getting Started" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To get started using the &PRODUCT; API, you should have the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL of the &PRODUCT; server you wish to integrate with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both the API Key and Secret Key for an account. This should have been generated by the administrator of the cloud instance and given to you." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Familiarity with HTTP GET/POST and query strings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Knowledge of either XML or JSON." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Knowledge of a programming language that can generate HTTP requests; for example, Java or PHP." +msgstr "" + diff --git a/docs/pot/developer-introduction.pot b/docs/pot/developer-introduction.pot new file mode 100644 index 00000000000..5ce4fe3872c --- /dev/null +++ b/docs/pot/developer-introduction.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Introduction to the &PRODUCT; API" +msgstr "" + diff --git a/docs/pot/disable-enable-zones-pods-clusters.pot b/docs/pot/disable-enable-zones-pods-clusters.pot new file mode 100644 index 00000000000..064346f09fe --- /dev/null +++ b/docs/pot/disable-enable-zones-pods-clusters.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Disabling and Enabling Zones, Pods, and Clusters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can enable or disable a zone, pod, or cluster without permanently removing it from the cloud. This is useful for maintenance or when there are problems that make a portion of the cloud infrastructure unreliable. No new allocations will be made to a disabled zone, pod, or cluster until its state is returned to Enabled. When a zone, pod, or cluster is first added to the cloud, it is Disabled by default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To disable and enable a zone, pod, or cluster:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as administrator" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Zones, click View More." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are disabling or enabling a zone, find the name of the zone in the list, and click the Enable/Disable button. enable-disable.png: button to enable or disable zone, pod, or cluster. " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are disabling or enabling a pod or cluster, click the name of the zone that contains the pod or cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Pods or Clusters node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the pod or cluster name in the list." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Enable/Disable button. " +msgstr "" + diff --git a/docs/pot/disk-volume-usage-record-format.pot b/docs/pot/disk-volume-usage-record-format.pot new file mode 100644 index 00000000000..67e4dff727b --- /dev/null +++ b/docs/pot/disk-volume-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Disk Volume Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For disk volumes, the following fields exist in a usage record." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage – String representation of the usage, including the units of usage (e.g. 'Hrs' for hours)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – The volume ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "offeringid – The ID of the disk offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "type – Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "templateid – ROOT template ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "size – The amount of storage allocated" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/dns-dhcp.pot b/docs/pot/dns-dhcp.pot new file mode 100644 index 00000000000..ef86c0ed7d8 --- /dev/null +++ b/docs/pot/dns-dhcp.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "DNS and DHCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Virtual Router provides DNS and DHCP services to the guests. It proxies DNS requests to the DNS server configured on the Availability Zone." +msgstr "" + diff --git a/docs/pot/domains.pot b/docs/pot/domains.pot new file mode 100644 index 00000000000..9278a41978c --- /dev/null +++ b/docs/pot/domains.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Domains" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the LDAP server requires SSL, you need to enable it in the ldapConfig command by setting the parameters ssl, truststore, and truststorepass. Before enabling SSL for ldapConfig, you need to get the certificate which the LDAP server is using and add it to a trusted keystore. You will need to know the path to the keystore and the password." +msgstr "" + diff --git a/docs/pot/enable-disable-static-nat-vpc.pot b/docs/pot/enable-disable-static-nat-vpc.pot new file mode 100644 index 00000000000..a45a1354d0a --- /dev/null +++ b/docs/pot/enable-disable-static-nat-vpc.pot @@ -0,0 +1,135 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling or Disabling Static NAT on a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A static NAT rule maps a public IP address to the private IP address of a VM in a VPC to allow Internet traffic to it. This section tells how to enable or disable static NAT for a particular IP address in a VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If port forwarding rules are already in effect for an IP address, you cannot enable static NAT to that IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If a guest VM is part of more than one network, static NAT rules will function only if they are defined on the default network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC to which you want to deploy the VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP Addresses page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Details tab,click the Static NAT button. enable-disable.png: button to enable Statid NAT. The button toggles between Enable and Disable, depending on whether static NAT is currently enabled for the IP address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are enabling static NAT, a dialog appears as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the tier and the destination VM, then click Apply." +msgstr "" + diff --git a/docs/pot/enable-disable-static-nat.pot b/docs/pot/enable-disable-static-nat.pot new file mode 100644 index 00000000000..1b4bab178e3 --- /dev/null +++ b/docs/pot/enable-disable-static-nat.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling or Disabling Static NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If port forwarding rules are already in effect for an IP address, you cannot enable static NAT to that IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If a guest VM is part of more than one network, static NAT rules will function only if they are defined on the default network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network where you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Static NAT button. ReleaseIPButton.png: button to release an IP The button toggles between Enable and Disable, depending on whether static NAT is currently enabled for the IP address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are enabling static NAT, a dialog appears where you can choose the destination VM and click Apply" +msgstr "" + diff --git a/docs/pot/enable-security-groups.pot b/docs/pot/enable-security-groups.pot new file mode 100644 index 00000000000..4af60756ebd --- /dev/null +++ b/docs/pot/enable-security-groups.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling Security Groups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order for security groups to function in a zone, the security groups feature must first be enabled for the zone. The administrator can do this when creating a new zone, by selecting a network offering that includes security groups. The procedure is described in Basic Zone Configuration in the Advanced Installation Guide." +msgstr "" + diff --git a/docs/pot/enabling-api-call-expiration.pot b/docs/pot/enabling-api-call-expiration.pot new file mode 100644 index 00000000000..d21abe2d156 --- /dev/null +++ b/docs/pot/enabling-api-call-expiration.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling API Call Expiration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can set an expiry timestamp on API calls to prevent replay attacks over non-secure channels, such as HTTP. The server tracks the expiry timestamp you have specified and rejects all the subsequent API requests that come in after this validity period." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable this feature, add the following parameters to the API request:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "signatureVersion=3: If the signatureVersion parameter is missing or is not equal to 3, the expires parameter is ignored in the API request." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "expires=YYYY-MM-DDThh:mm:ssZ: Specifies the date and time at which the signature included in the request is expired. The timestamp is expressed in the YYYY-MM-DDThh:mm:ssZ format, as specified in the ISO 8601 standard." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "expires=2011-10-10T12:00:00+0530" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A sample API request with expiration is given below:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://<IPAddress>:8080/client/api?command=listZones&signatureVersion=3&expires=2011-10-10T12:00:00+0530&apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ&signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D" +msgstr "" + diff --git a/docs/pot/enabling-port-8096.pot b/docs/pot/enabling-port-8096.pot new file mode 100644 index 00000000000..21836fe010d --- /dev/null +++ b/docs/pot/enabling-port-8096.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling Port 8096" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Port 8096, which allows API calls without authentication, is closed and disabled by default on any fresh 3.0.1 installations. You can enable 8096 (or another port) for this purpose as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that the first Management Server is installed and running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the global configuration parameter integration.api.port to the desired port." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Management Server host machine, create an iptables rule allowing access to that port." +msgstr "" + diff --git a/docs/pot/end-user-ui-overview.pot b/docs/pot/end-user-ui-overview.pot new file mode 100644 index 00000000000..9e0e5684fed --- /dev/null +++ b/docs/pot/end-user-ui-overview.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "End User's UI Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; UI helps users of cloud infrastructure to view and use their cloud resources, including virtual machines, templates and ISOs, data volumes and snapshots, guest networks, and IP addresses. If the user is a member or administrator of one or more &PRODUCT; projects, the UI can provide a project-oriented view." +msgstr "" + diff --git a/docs/pot/error-handling.pot b/docs/pot/error-handling.pot new file mode 100644 index 00000000000..d96cbdaa4ae --- /dev/null +++ b/docs/pot/error-handling.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Error Handling" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If an error occurs while processing an API request, the appropriate response in the format specified is returned. Each error response consists of an error code and an error text describing what possibly can go wrong. For an example error response, see page 12." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An HTTP error code of 401 is always returned if API request was rejected due to bad signatures, missing API Keys, or the user simply did not have the permissions to execute the command." +msgstr "" + diff --git a/docs/pot/event-log-queries.pot b/docs/pot/event-log-queries.pot new file mode 100644 index 00000000000..b6ecf6cc703 --- /dev/null +++ b/docs/pot/event-log-queries.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Event Log Queries" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Database logs can be queried from the user interface. The list of events captured by the system includes:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual machine creation, deletion, and on-going management operations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual router creation, deletion, and on-going management operations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Template creation and deletion" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network/load balancer rules creation and deletion" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage volume creation and deletion" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User login and logout" +msgstr "" + diff --git a/docs/pot/event-types.pot b/docs/pot/event-types.pot new file mode 100644 index 00000000000..fc06fb73878 --- /dev/null +++ b/docs/pot/event-types.pot @@ -0,0 +1,575 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Event Types" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.EXTRACT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SG.REVOKE.INGRESS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.DESTROY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.UPLOAD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "HOST.RECONNECT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.START" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.CLEANUP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MAINT.CANCEL" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.STOP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MAINT.CANCEL.PS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.REBOOT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MAINT.PREPARE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.UPGRADE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME.ATTACH" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MAINT.PREPARE.PS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VM.RESETPASSWORD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME.DETACH" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN.REMOTE.ACCESS.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME.UPLOAD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN.USER.ADD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.DESTROY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICEOFFERING.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN.USER.REMOVE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.START" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICEOFFERING.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.RESTART" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.STOP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICEOFFERING.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "UPLOAD.CUSTOM.CERTIFICATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.REBOOT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DOMAIN.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ROUTER.HA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DOMAIN.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "STATICNAT.DISABLE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DOMAIN.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.DESTROY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOT.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.DESTROY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.START" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOT.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.START" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.STOP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOTPOLICY.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.STOP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.REBOOT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOTPOLICY.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.REBOOT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PROXY.HA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOTPOLICY.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SSVM.H" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VNC.CONNECT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VNC.DISCONNECT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NET.IPASSIGN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NET.IPRELEASE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NET.RULEADD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NET.RULEDELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NET.RULEMODIFY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LB.ASSIGN.TO.RULE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LB.REMOVE.FROM.RULE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LB.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LB.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LB.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.LOGIN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.LOGOUT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "USER.DISABLE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.UPDATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.COPY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.DOWNLOAD.START" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.DOWNLOAD.SUCCESS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE.DOWNLOAD.FAILED" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.COPY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.ATTACH" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.DETACH" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.EXTRACT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO.UPLOAD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICE.OFFERING.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICE.OFFERING.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SERVICE.OFFERING.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DISK.OFFERING.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DISK.OFFERING.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DISK.OFFERING.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.OFFERING.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.OFFERING.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK.OFFERING.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "POD.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "POD.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "POD.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ZONE.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ZONE.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ZONE.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN.IP.RANGE.CREATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN.IP.RANGE.DELETE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CONFIGURATION.VALUE.EDIT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SG.AUTH.INGRESS" +msgstr "" + diff --git a/docs/pot/events-log.pot b/docs/pot/events-log.pot new file mode 100644 index 00000000000..bdfb9c23ea9 --- /dev/null +++ b/docs/pot/events-log.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Event Logs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are two types of events logged in the &PRODUCT; Event Log. Standard events log the success or failure of an event and can be used to identify jobs or processes that have failed. There are also long running job events. Events for asynchronous jobs log when a job is scheduled, when it starts, and when it completes. Other long running synchronous jobs log when a job starts, and when it completes. Long running synchronous and asynchronous event logs can be used to gain more information on the status of a pending job or can be used to identify a job that is hanging or has not started. The following sections provide more information on these events.." +msgstr "" + diff --git a/docs/pot/events.pot b/docs/pot/events.pot new file mode 100644 index 00000000000..24a646eec0f --- /dev/null +++ b/docs/pot/events.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Events" +msgstr "" + diff --git a/docs/pot/example-LDAP-configuration-commands.pot b/docs/pot/example-LDAP-configuration-commands.pot new file mode 100644 index 00000000000..693bf19fabd --- /dev/null +++ b/docs/pot/example-LDAP-configuration-commands.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Example LDAP Configuration Commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To understand the examples in this section, you need to know the basic concepts behind calling the &PRODUCT; API, which are explained in the Developer’s Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following shows an example invocation of ldapConfig with an ApacheDS LDAP server" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://127.0.0.1:8080/client/api?command=ldapConfig&hostname=127.0.0.1&searchbase=ou%3Dtesting%2Co%3Dproject&queryfilter=%28%26%28uid%3D%25u%29%29&binddn=cn%3DJohn+Singh%2Cou%3Dtesting%2Co%project&bindpass=secret&port=10389&ssl=true&truststore=C%3A%2Fcompany%2Finfo%2Ftrusted.ks&truststorepass=secret&response=json&apiKey=YourAPIKey&signature=YourSignatureHash" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The command must be URL-encoded. Here is the same example without the URL encoding:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://127.0.0.1:8080/client/api?command=ldapConfig\n" +"&hostname=127.0.0.1\n" +"&searchbase=ou=testing,o=project\n" +"&queryfilter=(&(%uid=%u))\n" +"&binddn=cn=John+Singh,ou=testing,o=project\n" +"&bindpass=secret\n" +"&port=10389\n" +"&ssl=true\n" +"&truststore=C:/company/info/trusted.ks\n" +"&truststorepass=secret\n" +"&response=json\n" +"&apiKey=YourAPIKey&signature=YourSignatureHash\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following shows a similar command for Active Directory. Here, the search base is the testing group within a company, and the users are matched up based on email address." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://10.147.29.101:8080/client/api?command=ldapConfig&hostname=10.147.28.250&searchbase=OU%3Dtesting%2CDC%3Dcompany&queryfilter=%28%26%28mail%3D%25e%29%29 &binddn=CN%3DAdministrator%2COU%3Dtesting%2CDC%3Dcompany&bindpass=1111_aaaa&port=389&response=json&apiKey=YourAPIKey&signature=YourSignatureHash" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The next few sections explain some of the concepts you will need to know when filling out the ldapConfig parameters." +msgstr "" + diff --git a/docs/pot/example-response-from-listUsageRecords.pot b/docs/pot/example-response-from-listUsageRecords.pot new file mode 100644 index 00000000000..50b39f40a6e --- /dev/null +++ b/docs/pot/example-response-from-listUsageRecords.pot @@ -0,0 +1,64 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Example response from listUsageRecords" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All &PRODUCT; API requests are submitted in the form of a HTTP GET/POST with an associated command and any parameters. A request is composed of the following whether in HTTP or HTTPS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <listusagerecordsresponse>\n" +" <count>1816</count>\n" +" <usagerecord>\n" +" <account>user5</account>\n" +" <accountid>10004</accountid>\n" +" <domainid>1</domainid>\n" +" <zoneid>1</zoneid>\n" +" <description>i-3-4-WC running time (ServiceOffering: 1) (Template: 3)</description>\n" +" <usage>2.95288 Hrs</usage>\n" +" <usagetype>1</usagetype>\n" +" <rawusage>2.95288</rawusage>\n" +" <virtualmachineid>4</virtualmachineid>\n" +" <name>i-3-4-WC</name>\n" +" <offeringid>1</offeringid>\n" +" <templateid>3</templateid>\n" +" <usageid>245554</usageid>\n" +" <type>XenServer</type>\n" +" <startdate>2009-09-15T00:00:00-0700</startdate>\n" +" <enddate>2009-09-18T16:14:26-0700</enddate>\n" +" </usagerecord>\n" +"\n" +" … (1,815 more usage records)\n" +" </listusagerecordsresponse>\n" +" " +msgstr "" + diff --git a/docs/pot/export-template.pot b/docs/pot/export-template.pot new file mode 100644 index 00000000000..8316f4bb966 --- /dev/null +++ b/docs/pot/export-template.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Exporting Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "End users and Administrators may export templates from the &PRODUCT;. Navigate to the template in the UI and choose the Download function from the Actions menu." +msgstr "" + diff --git a/docs/pot/external-firewalls-and-load-balancers.pot b/docs/pot/external-firewalls-and-load-balancers.pot new file mode 100644 index 00000000000..8c628710e11 --- /dev/null +++ b/docs/pot/external-firewalls-and-load-balancers.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "External Firewalls and Load Balancers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; is capable of replacing its Virtual Router with an external Juniper SRX device and an optional external NetScaler or F5 load balancer for gateway and load balancing services. In this case, the VMs use the SRX as their gateway." +msgstr "" + diff --git a/docs/pot/external-fw-topology-req.pot b/docs/pot/external-fw-topology-req.pot new file mode 100644 index 00000000000..f218b10e870 --- /dev/null +++ b/docs/pot/external-fw-topology-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "External Firewall Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When external firewall integration is in place, the public IP VLAN must still be trunked to the Hosts. This is required to support the Secondary Storage VM and Console Proxy VM." +msgstr "" + diff --git a/docs/pot/external-guest-firewall-integration.pot b/docs/pot/external-guest-firewall-integration.pot new file mode 100644 index 00000000000..5d7c7d19eaa --- /dev/null +++ b/docs/pot/external-guest-firewall-integration.pot @@ -0,0 +1,251 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "External Guest Firewall Integration for Juniper SRX (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Available only for guests using advanced networking." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides for direct management of the Juniper SRX series of firewalls. This enables &PRODUCT; to establish static NAT mappings from public IPs to guest VMs, and to use the Juniper device in place of the virtual router for firewall services. You can have one or more Juniper SRX per zone. This feature is optional. If Juniper integration is not provisioned, &PRODUCT; will use the virtual router for these services." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Juniper SRX can optionally be used in conjunction with an external load balancer. External Network elements can be deployed in a side-by-side or inline configuration." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; requires the Juniper to be configured as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported SRX software version is 10.3 or higher." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install your SRX appliance according to the vendor's instructions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Connect one interface to the management network and one interface to the public network. Alternatively, you can connect the same interface to both networks and a use a VLAN for the public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure \"vlan-tagging\" is enabled on the private interface." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Record the public and private interface names. If you used a VLAN for the public interface, add a \".[VLAN TAG]\" after the interface name. For example, if you are using ge-0/0/3 for your public interface and VLAN tag 301, your public interface name would be \"ge-0/0/3.301\". Your private interface name should always be untagged because the &PRODUCT; software automatically creates tagged logical interfaces." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a public security zone and a private security zone. By default, these will already exist and will be called \"untrust\" and \"trust\". Add the public interface to the public zone and the private interface to the private zone. Note down the security zone names." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure there is a security policy from the private zone to the public zone that allows all traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note the username and password of the account you want the &PRODUCT; software to log in to when it is programming rules." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the \"ssh\" and \"xnm-clear-text\" system services are enabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If traffic metering is desired:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "a. Create an incoming firewall filter and an outgoing firewall filter. These filters should be the same names as your public security zone name and private security zone name respectively. The filters should be set to be \"interface-specific\". For example, here is the configuration where the public zone is \"untrust\" and the private zone is \"trust\":" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "root@cloud-srx# show firewall\n" +"filter trust {\n" +" interface-specific;\n" +"}\n" +"filter untrust {\n" +" interface-specific;\n" +"}" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add the firewall filters to your public interface. For example, a sample configuration output (for public interface ge-0/0/3.0, public security zone untrust, and private security zone trust) is:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ge-0/0/3 {\n" +" unit 0 {\n" +" family inet {\n" +" filter {\n" +" input untrust;\n" +" output trust;\n" +" }\n" +" address 172.25.0.252/16;\n" +" }\n" +" }\n" +"}" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure all VLANs are brought to the private interface of the SRX." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the &PRODUCT; Management Server is installed, log in to the &PRODUCT; UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Zones, click View More." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the zone you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Network tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Network Service Providers node of the diagram, click Configure. (You might have to scroll down to see this.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click SRX." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Add New SRX button (+) and provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address: The IP address of the SRX." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username: The user name of the account on the SRX that &PRODUCT; should use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password: The password of the account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Interface. The name of the public interface on the SRX. For example, ge-0/0/2. A \".x\" at the end of the interface indicates the VLAN that is in use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Interface: The name of the private interface on the SRX. For example, ge-0/0/1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Usage Interface: (Optional) Typically, the public interface is used to meter traffic. If you want to use a different interface, specify its name here" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of Retries: The number of times to attempt a command on the SRX before failing. The default value is 2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Timeout (seconds): The time to wait for a command on the SRX before considering it failed. Default is 300 seconds." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Network: The name of the public network on the SRX. For example, trust." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Network: The name of the private network on the SRX. For example, untrust." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Capacity: The number of networks the device can handle" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Dedicated: When marked as dedicated, this device will be dedicated to a single account. When Dedicated is checked, the value in the Capacity field has no significance implicitly, its value is 1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Global Settings. Set the parameter external.network.stats.interval to indicate how often you want &PRODUCT; to fetch network usage statistics from the Juniper SRX. If you are not using the SRX to gather network usage statistics, set to 0." +msgstr "" + diff --git a/docs/pot/external-guest-lb-integration.pot b/docs/pot/external-guest-lb-integration.pot new file mode 100644 index 00000000000..e1939dbf142 --- /dev/null +++ b/docs/pot/external-guest-lb-integration.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "External Guest Load Balancer Integration (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; can optionally use a Citrix NetScaler or BigIP F5 load balancer to provide load balancing services to guests. If this is not enabled, &PRODUCT; will use the software load balancer in the virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To install and enable an external load balancer for &PRODUCT; management:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up the appliance according to the vendor's directions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Connect it to the networks carrying public traffic and management traffic (these could be the same network)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Record the IP address, username, password, public interface name, and private interface name. The interface names will be something like \"1.1\" or \"1.2\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure that the VLANs are trunked to the management network interface." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the &PRODUCT; Management Server is installed, log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Zones, click View More." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the zone you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Network tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Network Service Providers node of the diagram, click Configure. (You might have to scroll down to see this.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click NetScaler or F5." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Add button (+) and provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For NetScaler:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address: The IP address of the SRX." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username/Password: The authentication credentials to access the device. &PRODUCT; uses these credentials to access the device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type: The type of device that is being added. It could be F5 Big Ip Load Balancer, NetScaler VPX, NetScaler MPX, or NetScaler SDX. For a comparison of the NetScaler types, see the &PRODUCT; Administration Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public interface: Interface of device that is configured to be part of the public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private interface: Interface of device that is configured to be part of the private network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of retries. Number of times to attempt a command on the device before considering the operation failed. Default is 2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Capacity: The number of networks the device can handle." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Dedicated: When marked as dedicated, this device will be dedicated to a single account. When Dedicated is checked, the value in the Capacity field has no significance implicitly, its value is 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The installation and provisioning of the external load balancer is finished. You can proceed to add VMs and NAT or load balancing rules." +msgstr "" + diff --git a/docs/pot/extracting-source.pot b/docs/pot/extracting-source.pot new file mode 100644 index 00000000000..eb739a6dd0a --- /dev/null +++ b/docs/pot/extracting-source.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Extracting source" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extracting the &PRODUCT; release is relatively simple and can be done with a single command as follows:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ tar -jxvf apache-cloudstack-4.0.0-incubating-src.tar.bz2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can now move into the directory:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ cd ./apache-cloudstack-4.0.0-incubating-src" +msgstr "" + diff --git a/docs/pot/feature-overview.pot b/docs/pot/feature-overview.pot new file mode 100644 index 00000000000..3f50f9f969b --- /dev/null +++ b/docs/pot/feature-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "What Can &PRODUCT; Do?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multiple Hypervisor Support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; works with a variety of hypervisors, and a single cloud deployment can contain multiple hypervisor implementations. The current release of &PRODUCT; supports pre-packaged enterprise solutions like Citrix XenServer and VMware vSphere, as well as KVM or Xen running on Ubuntu or CentOS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Massively Scalable Infrastructure Management" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; can manage tens of thousands of servers installed in multiple geographically distributed datacenters. The centralized management server scales linearly, eliminating the need for intermediate cluster-level management servers. No single component failure can cause cloud-wide outage. Periodic maintenance of the management server can be performed without affecting the functioning of virtual machines running in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Automatic Configuration Management" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; automatically configures each guest virtual machine’s networking and storage settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; internally manages a pool of virtual appliances to support the cloud itself. These appliances offer services such as firewalling, routing, DHCP, VPN access, console proxy, storage access, and storage replication. The extensive use of virtual appliances simplifies the installation, configuration, and ongoing management of a cloud deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Graphical User Interface" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; offers an administrator's Web interface, used for provisioning and managing the cloud, as well as an end-user's Web interface, used for running VMs and managing VM templates. The UI can be customized to reflect the desired service provider or enterprise look and feel." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "API and Extensibility" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides an API that gives programmatic access to all the management features available in the UI. The API is maintained and documented. This API enables the creation of command line tools and new user interfaces to suit particular needs. See the Developer’s Guide and API Reference, both available at Apache CloudStack Guides and Apache CloudStack API Reference respectively." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; pluggable allocation architecture allows the creation of new types of allocators for the selection of storage and Hosts. See the Allocator Implementation Guide (http://docs.cloudstack.org/CloudStack_Documentation/Allocator_Implementation_Guide)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "High Availability" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; has a number of features to increase the availability of the system. The Management Server itself may be deployed in a multi-node installation where the servers are load balanced. MySQL may be configured to use replication to provide for a manual failover in the event of database loss. For the hosts, &PRODUCT; supports NIC bonding and the use of separate networks for storage as well as iSCSI Multipath." +msgstr "" + diff --git a/docs/pot/firewall-rules.pot b/docs/pot/firewall-rules.pot new file mode 100644 index 00000000000..6c661014436 --- /dev/null +++ b/docs/pot/firewall-rules.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Firewall Rules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default, all incoming traffic to the public IP address is rejected by the firewall. To allow external traffic, you can open firewall ports by specifying firewall rules. You can optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to allow only incoming requests from certain IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You cannot use firewall rules to open ports for an elastic IP address. When elastic IP is used, outside access is instead controlled through the use of security groups. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Firewall rules can be created using the Firewall tab in the Management Server UI. This tab is not displayed by default when &PRODUCT; is installed. To display the Firewall tab, the &PRODUCT; administrator must set the global configuration parameter firewall.rule.ui.enabled to \"true.\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To create a firewall rule:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network where you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configuration tab and fill in the following values." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source CIDR. (Optional) To accept only traffic from IP addresses within a particular address block, enter a CIDR or a comma-separated list of CIDRs. Example: 192.168.0.0/22. Leave empty to allow all CIDRs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. The communication protocol in use on the opened port(s)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start Port and End Port. The port(s) you want to open on the firewall. If you are opening a single port, use the same number in both fields" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ICMP Type and ICMP Code. Used only if Protocol is set to ICMP. Provide the type and code required by the ICMP protocol to fill out the ICMP header. Refer to ICMP documentation for more details if you are not sure what to enter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add" +msgstr "" + diff --git a/docs/pot/first_ms_node_install.pot b/docs/pot/first_ms_node_install.pot new file mode 100644 index 00000000000..6ecb5b7f0cb --- /dev/null +++ b/docs/pot/first_ms_node_install.pot @@ -0,0 +1,64 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install the First Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure you have configured your machine according to or as appropriate for your platform." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the &PRODUCT; management server packages by issuing one of the following commands as appropriate:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# yum install cloud-client" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# apt-get install cloud-client" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(RPM-based distributions) When the installation is finished, run the following commands to start essential services:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service rpcbind start\n" +"# service nfs start\n" +"# chkconfig nfs on\n" +"# chkconfig rpcbind on\n" +" " +msgstr "" + diff --git a/docs/pot/generic-firewall-provisions.pot b/docs/pot/generic-firewall-provisions.pot new file mode 100644 index 00000000000..0f1d0a3d7d4 --- /dev/null +++ b/docs/pot/generic-firewall-provisions.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Generic Firewall Provisions" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The hardware firewall is required to serve two purposes:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protect the Management Servers. NAT and port forwarding should be configured to direct traffic from the public Internet to the Management Servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Route management network traffic between multiple zones. Site-to-site VPN should be configured between multiple zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To achieve the above purposes you must set up fixed configurations for the firewall. Firewall rules and policies need not change as users are provisioned into the cloud. Any brand of hardware firewall that supports NAT and site-to-site VPN can be used." +msgstr "" + diff --git a/docs/pot/getting-release.pot b/docs/pot/getting-release.pot new file mode 100644 index 00000000000..c2505e554b5 --- /dev/null +++ b/docs/pot/getting-release.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Getting the release" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can download the latest &PRODUCT; release from the Apache CloudStack project download page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You'll notice several links under the 'Latest release' section." +msgstr "" + +#. Tag: para +#, no-c-format +msgid " apache-cloudstack-4.0.0-incubating-src.tar.bz2 - This is the link to the release itself." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PGP - This is a detached cryptographic signature that can be used to help verify the authenticity of the release." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MD5 - An MD5 hash of the release to aid in verify the validity of the release download." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SHA512 - A SHA512 hash of the release to aid in verify the validity of the release download." +msgstr "" + diff --git a/docs/pot/global-config.pot b/docs/pot/global-config.pot new file mode 100644 index 00000000000..2b6b3015df7 --- /dev/null +++ b/docs/pot/global-config.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Global Configuration Parameters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides parameters that you can set to control many aspects of the cloud. When &PRODUCT; is first installed, and periodically thereafter, you might need to modify these settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose one of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Global Settings. This displays a list of the parameters with brief descriptions and current values." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor Capabilities. This displays a list of hypervisor versions with the maximum number of guests supported for each." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the search box to narrow down the list to those you are interested in." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Edit icon to modify a value. If you are viewing Hypervisor Capabilities, you must click the name of the hypervisor first to display the editing screen." +msgstr "" + diff --git a/docs/pot/globally-configured-limits.pot b/docs/pot/globally-configured-limits.pot new file mode 100644 index 00000000000..390e8ab4926 --- /dev/null +++ b/docs/pot/globally-configured-limits.pot @@ -0,0 +1,175 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Globally Configured Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a zone, the guest virtual network has a 24 bit CIDR by default. This limits the guest virtual network to 254 running instances. It can be adjusted as needed, but this must be done before any instances are created in the zone. For example, 10.1.1.0/22 would provide for ~1000 addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table lists limits set in the Global Configuration:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Parameter Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Definition" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.account.public.ips" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of public IP addresses that can be owned by an account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.account.snapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of snapshots that can exist for an account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.account.templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of templates that can exist for an account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.account.user.vms" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of virtual machine instances that can exist for an account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.account.volumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Number of disk volumes that can exist for an account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.template.iso.size" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum size for a downloaded template or ISO in GB" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.volume.size.gb" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum size for a volume in GB" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "network.throttling.rate" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default data transfer rate in megabits per second allowed per user (supported on XenServer)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "snapshot.max.hourly" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum recurring hourly snapshots to be retained for a volume. If the limit is reached, early snapshots from the start of the hour are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring hourly snapshots can not be scheduled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "snapshot.max.daily" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum recurring daily snapshots to be retained for a volume. If the limit is reached, snapshots from the start of the day are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring daily snapshots can not be scheduled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "snapshot.max.weekly" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum recurring weekly snapshots to be retained for a volume. If the limit is reached, snapshots from the beginning of the week are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring weekly snapshots can not be scheduled" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "snapshot.max.monthly" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum recurring monthly snapshots to be retained for a volume. If the limit is reached, snapshots from the beginning of the month are deleted so that newer ones can be saved. This limit does not apply to manual snapshots. If set to 0, recurring monthly snapshots can not be scheduled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To modify global configuration parameters, use the global configuration screen in the &PRODUCT; UI. See Setting Global Configuration Parameters" +msgstr "" + diff --git a/docs/pot/guest-ip-ranges.pot b/docs/pot/guest-ip-ranges.pot new file mode 100644 index 00000000000..f193ca7df63 --- /dev/null +++ b/docs/pot/guest-ip-ranges.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Guest IP Ranges" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP ranges for guest network traffic are set on a per-account basis by the user. This allows the users to configure their network in a fashion that will enable VPN linking between their guest network and their clients." +msgstr "" + diff --git a/docs/pot/guest-network.pot b/docs/pot/guest-network.pot new file mode 100644 index 00000000000..9f79450d7ca --- /dev/null +++ b/docs/pot/guest-network.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Guest Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a &PRODUCT; cloud, guest VMs can communicate with each other using shared infrastructure with the security and user perception that the guests have a private LAN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; virtual router is the main component providing networking features for guest traffic." +msgstr "" + diff --git a/docs/pot/guest-nw-usage-with-traffic-sentinel.pot b/docs/pot/guest-nw-usage-with-traffic-sentinel.pot new file mode 100644 index 00000000000..baafd5d447e --- /dev/null +++ b/docs/pot/guest-nw-usage-with-traffic-sentinel.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Guest Network Usage Integration for Traffic Sentinel" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To collect usage data for a guest network, &PRODUCT; needs to pull the data from an external network statistics collector installed on the network. Metering statistics for guest networks are available through &PRODUCT;’s integration with inMon Traffic Sentinel." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Traffic Sentinel is a network traffic usage data collection package. &PRODUCT; can feed statistics from Traffic Sentinel into its own usage records, providing a basis for billing users of cloud infrastructure. Traffic Sentinel uses the traffic monitoring protocol sFlow. Routers and switches generate sFlow records and provide them for collection by Traffic Sentinel, then &PRODUCT; queries the Traffic Sentinel database to obtain this information" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To construct the query, &PRODUCT; determines what guest IPs were in use during the current query interval. This includes both newly assigned IPs and IPs that were assigned in a previous time period and continued to be in use. &PRODUCT; queries Traffic Sentinel for network statistics that apply to these IPs during the time period they remained allocated in &PRODUCT;. The returned data is correlated with the customer account that owned each IP and the timestamps when IPs were assigned and released in order to create billable metering records in &PRODUCT;. When the Usage Server runs, it collects this data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up the integration between &PRODUCT; and Traffic Sentinel:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On your network infrastructure, install Traffic Sentinel and configure it to gather traffic data. For installation and configuration steps, see inMon documentation at Traffic Sentinel Documentation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Traffic Sentinel UI, configure Traffic Sentinel to accept script querying from guest users. &PRODUCT; will be the guest user performing the remote queries to gather network usage for one or more IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click File > Users > Access Control > Reports Query, then select Guest from the drop-down list." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On &PRODUCT;, add the Traffic Sentinel host by calling the &PRODUCT; API command addTrafficMonitor. Pass in the URL of the Traffic Sentinel as protocol + host + port (optional); for example, http://10.147.28.100:8080. For the addTrafficMonitor command syntax, see the API Reference at API Documentation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For information about how to call the &PRODUCT; API, see the Developer’s Guide at CloudStack API Developer's Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Configuration from the Global Settings page, and set the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "direct.network.stats.interval: How often you want &PRODUCT; to query Traffic Sentinel." +msgstr "" + diff --git a/docs/pot/guest-traffic.pot b/docs/pot/guest-traffic.pot new file mode 100644 index 00000000000..2da57bf537d --- /dev/null +++ b/docs/pot/guest-traffic.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Guest Traffic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A network can carry guest traffic only between VMs within one zone. Virtual machines in different zones cannot communicate with each other using their IP addresses; they must communicate with each other by routing through a public IP address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server automatically creates a virtual router for each network. A virtual router is a special virtual machine that runs on the hosts. Each virtual router has three network interfaces. Its eth0 interface serves as the gateway for the guest traffic and has the IP address of 10.1.1.1. Its eth1 interface is used by the system to configure the virtual router. Its eth2 interface is assigned a public IP address for public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The virtual router provides DHCP and will automatically assign an IP address for each guest VM within the IP range assigned for the network. The user can manually reconfigure guest VMs to assume different IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source NAT is automatically configured in the virtual router to forward outbound traffic for all guest VMs" +msgstr "" + diff --git a/docs/pot/ha-enabled-vm.pot b/docs/pot/ha-enabled-vm.pot new file mode 100644 index 00000000000..b91f9d1c648 --- /dev/null +++ b/docs/pot/ha-enabled-vm.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "HA-Enabled Virtual Machines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user can specify a virtual machine as HA-enabled. By default, all virtual router VMs and Elastic Load Balancing VMs are automatically configured as HA-enabled. When an HA-enabled VM crashes, &PRODUCT; detects the crash and restarts the VM automatically within the same Availability Zone. HA is never performed across different Availability Zones. &PRODUCT; has a conservative policy towards restarting VMs and ensures that there will never be two instances of the same VM running at the same time. The Management Server attempts to start the VM on another Host in the same cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "HA features work with iSCSI or NFS primary storage. HA with local storage is not supported." +msgstr "" + diff --git a/docs/pot/ha-for-hosts.pot b/docs/pot/ha-for-hosts.pot new file mode 100644 index 00000000000..c95851645d3 --- /dev/null +++ b/docs/pot/ha-for-hosts.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "HA for Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user can specify a virtual machine as HA-enabled. By default, all virtual router VMs and Elastic Load Balancing VMs are automatically configured as HA-enabled. When an HA-enabled VM crashes, &PRODUCT; detects the crash and restarts the VM automatically within the same Availability Zone. HA is never performed across different Availability Zones. &PRODUCT; has a conservative policy towards restarting VMs and ensures that there will never be two instances of the same VM running at the same time. The Management Server attempts to start the VM on another Host in the same cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "HA features work with iSCSI or NFS primary storage. HA with local storage is not supported." +msgstr "" + diff --git a/docs/pot/ha-management-server.pot b/docs/pot/ha-management-server.pot new file mode 100644 index 00000000000..62404d8e665 --- /dev/null +++ b/docs/pot/ha-management-server.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "HA for Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Management Server should be deployed in a multi-node configuration such that it is not susceptible to individual server failures. The Management Server itself (as distinct from the MySQL database) is stateless and may be placed behind a load balancer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Normal operation of Hosts is not impacted by an outage of all Management Serves. All guest VMs will continue to work." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the Management Server is down, no new VMs can be created, and the end user and admin UI, API, dynamic load distribution, and HA will cease to work." +msgstr "" + diff --git a/docs/pot/hardware-config-eg.pot b/docs/pot/hardware-config-eg.pot new file mode 100644 index 00000000000..b42f0df2429 --- /dev/null +++ b/docs/pot/hardware-config-eg.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Example Hardware Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section contains an example configuration of specific switch models for zone-level layer-3 switching. It assumes VLAN management protocols, such as VTP or GVRP, have been disabled. The example scripts must be changed appropriately if you choose to use VTP or GVRP." +msgstr "" + diff --git a/docs/pot/hardware-firewall.pot b/docs/pot/hardware-firewall.pot new file mode 100644 index 00000000000..ba3d5f1622b --- /dev/null +++ b/docs/pot/hardware-firewall.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Hardware Firewall" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All deployments should have a firewall protecting the management server; see Generic Firewall Provisions. Optionally, some deployments may also have a Juniper SRX firewall that will be the default gateway for the guest networks; see ." +msgstr "" + diff --git a/docs/pot/host-add-vsphere.pot b/docs/pot/host-add-vsphere.pot new file mode 100644 index 00000000000..4798035d2c3 --- /dev/null +++ b/docs/pot/host-add-vsphere.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Host (vSphere)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere servers, we recommend creating the cluster of hosts in vCenter and then adding the entire cluster to &PRODUCT;. See Add Cluster: vSphere." +msgstr "" + diff --git a/docs/pot/host-add-xenserver-kvm-ovm.pot b/docs/pot/host-add-xenserver-kvm-ovm.pot new file mode 100644 index 00000000000..7b984e46043 --- /dev/null +++ b/docs/pot/host-add-xenserver-kvm-ovm.pot @@ -0,0 +1,210 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Host (XenServer or KVM)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer and KVM hosts can be added to a cluster at any time." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Requirements for XenServer and KVM Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the hypervisor host does not have any VMs already running before you add it to &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configuration requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each cluster must contain only hosts with the identical hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer, do not put more than 8 hosts in a cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM, do not put more than 16 hosts in a cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For hardware requirements, see the installation section for your hypervisor in the &PRODUCT; Installation Guide." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "XenServer Host Additional Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If network bonding is in use, the administrator must cable the new host identically to other hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For all additional hosts to be added to the cluster, run the following command. This will cause the host to join the master in a XenServer pool." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# xe pool-join master-address=[master IP] master-username=root master-password=[your password]" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With all hosts added to the XenServer pool, run the cloud-setup-bond script. This script will complete the configuration and setup of the bonds on the new hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the script from the Management Server in /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver/cloud-setup-bonding.sh to the master host and ensure it is executable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ./cloud-setup-bonding.sh" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "KVM Host Additional Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If shared mountpoint storage is in use, the administrator should ensure that the new host has all the same mountpoints (with storage mounted) as the other hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the new host has the same network configuration (guest, private, and public network) as other hosts in the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using OpenVswitch bridges edit the file agent.properties on the KVM host and set the parameter network.bridge.type to openvswitch before adding the host to &PRODUCT;" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Adding a XenServer or KVM Host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have not already done so, install the hypervisor software on the host. You will need to know which version of the hypervisor software version is supported by &PRODUCT; and what additional configuration is required to ensure the host will work with &PRODUCT;. To find these installation details, see the appropriate section for your hypervisor in the &PRODUCT; Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab. In the Clusters node, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the cluster where you want to add the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View Hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Name. The DNS name or IP address of the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username. Usually root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password. This is the password for the user from your XenServer or KVM install)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host Tags (Optional). Any labels that you use to categorize hosts for ease of maintenance. For example, you can set to the cloud's HA tag (set in the ha.tag global configuration parameter) if you want this host to be used only for VMs with the \"high availability\" feature enabled. For more information, see HA-Enabled Virtual Machines as well as HA for Hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There may be a slight delay while the host is provisioned. It should automatically display in the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat for additional hosts." +msgstr "" + diff --git a/docs/pot/host-add.pot b/docs/pot/host-add.pot new file mode 100644 index 00000000000..c52ebaa7d4b --- /dev/null +++ b/docs/pot/host-add.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before adding a host to the &PRODUCT; configuration, you must first install your chosen hypervisor on the host. &PRODUCT; can manage hosts running VMs under a variety of hypervisors." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Installation Guide provides instructions on how to install each supported hypervisor and configure it for use with &PRODUCT;. See the appropriate section in the Installation Guide for information about which version of your chosen hypervisor is supported, as well as crucial additional steps to configure the hypervisor hosts for use with &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure you have performed the additional &PRODUCT;-specific configuration steps described in the hypervisor installation section for your particular hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now add the hypervisor host to &PRODUCT;. The technique to use varies depending on the hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/pot/host-allocation.pot b/docs/pot/host-allocation.pot new file mode 100644 index 00000000000..cb6bee69c35 --- /dev/null +++ b/docs/pot/host-allocation.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Host Allocation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The system automatically picks the most appropriate host to run each virtual machine. End users may specify the zone in which the virtual machine will be created. End users do not have control over which host will run the virtual machine instance." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; administrators can specify that certain hosts should have a preference for particular types of guest instances. For example, an administrator could state that a host should have a preference to run Windows guests. The default host allocator will attempt to place guests of that OS type on such hosts first. If no such host is available, the allocator will place the instance wherever there is sufficient physical capacity." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both vertical and horizontal allocation is allowed. Vertical allocation consumes all the resources of a given host before allocating any guests on a second host. This reduces power consumption in the cloud. Horizontal allocation places a guest on each host in a round-robin fashion. This may yield better performance to the guests in some cases. &PRODUCT; also allows an element of CPU over-provisioning as configured by the administrator. Over-provisioning allows the administrator to commit more CPU cycles to the allocated guests than are actually available from the hardware." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; also provides a pluggable interface for adding new allocators. These custom allocators can provide any policy the administrator desires." +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-agent.pot b/docs/pot/hypervisor-host-install-agent.pot new file mode 100644 index 00000000000..2c314d761e1 --- /dev/null +++ b/docs/pot/hypervisor-host-install-agent.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install and configure the Agent" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To manage KVM instances on the host &PRODUCT; uses a Agent. This Agent communicates with the Management server and controls all the instances on the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First we start by installing the agent:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ yum install cloud-agent" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ apt-get install cloud-agent" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host is now ready to be added to a cluster. This is covered in a later section, see . It is recommended that you continue to read the documentation before adding the host!" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-finish.pot b/docs/pot/hypervisor-host-install-finish.pot new file mode 100644 index 00000000000..ae14351d5a8 --- /dev/null +++ b/docs/pot/hypervisor-host-install-finish.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add the host to CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host is now ready to be added to a cluster. This is covered in a later section, see . It is recommended that you continue to read the documentation before adding the host!" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-firewall.pot b/docs/pot/hypervisor-host-install-firewall.pot new file mode 100644 index 00000000000..fb7a56cc6d7 --- /dev/null +++ b/docs/pot/hypervisor-host-install-firewall.pot @@ -0,0 +1,160 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring the firewall" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The hypervisor needs to be able to communicate with other hypervisors and the management server needs to be able to reach the hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order to do so we have to open the following TCP ports (if you are using a firewall):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "22 (SSH)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "1798" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "16509 (libvirt)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "5900 - 6100 (VNC consoles)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "49152 - 49216 (libvirt live migration)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It depends on the firewall you are using how to open these ports. Below you'll find examples how to open these ports in RHEL/CentOS and Ubuntu." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Open ports in RHEL/CentOS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "RHEL and CentOS use iptables for firewalling the system, you can open extra ports by executing the following iptable commands:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables -I INPUT -p tcp -m tcp --dport 22 -j ACCEPT" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables -I INPUT -p tcp -m tcp --dport 1798 -j ACCEPT" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables -I INPUT -p tcp -m tcp --dport 16509 -j ACCEPT" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables -I INPUT -p tcp -m tcp --dport 5900:6100 -j ACCEPT" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables -I INPUT -p tcp -m tcp --dport 49152:49216 -j ACCEPT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These iptable settings are not persistent accross reboots, we have to save them first." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ iptables-save > /etc/sysconfig/iptables" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Open ports in Ubuntu" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default firewall under Ubuntu is UFW (Uncomplicated FireWall), which is a Python wrapper around iptables." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To open the required ports, execute the following commands:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ufw allow proto tcp from any to any port 22" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ufw allow proto tcp from any to any port 1798" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ufw allow proto tcp from any to any port 16509" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ufw allow proto tcp from any to any port 5900:6100" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ufw allow proto tcp from any to any port 49152:49216" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default UFW is not enabled on Ubuntu. Executing these commands with the firewall disabled does not enable the firewall." +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-libvirt.pot b/docs/pot/hypervisor-host-install-libvirt.pot new file mode 100644 index 00000000000..f7eeed99085 --- /dev/null +++ b/docs/pot/hypervisor-host-install-libvirt.pot @@ -0,0 +1,140 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install and Configure libvirt" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses libvirt for managing virtual machines. Therefore it is vital that libvirt is configured correctly. Libvirt is a dependency of cloud-agent and should already be installed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order to have live migration working libvirt has to listen for unsecured TCP connections. We also need to turn off libvirts attempt to use Multicast DNS advertising. Both of these settings are in /etc/libvirt/libvirtd.conf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the following paramaters:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "listen_tls = 0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "listen_tcp = 1" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "tcp_port = 16059" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "auth_tcp = \"none\"" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mdns_adv = 0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Turning on \"listen_tcp\" in libvirtd.conf is not enough, we have to change the parameters as well:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL or CentOS modify /etc/sysconfig/libvirtd:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Uncomment the following line:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#LIBVIRTD_ARGS=\"--listen\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu: modify /etc/init/libvirt-bin.conf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the following line (at the end of the file):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "exec /usr/sbin/libvirtd -d" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "to (just add -l)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "exec /usr/sbin/libvirtd -d -l" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart libvirt" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ service libvirtd restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ service libvirt-bin restart" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-network-openvswitch.pot b/docs/pot/hypervisor-host-install-network-openvswitch.pot new file mode 100644 index 00000000000..ab01e23a156 --- /dev/null +++ b/docs/pot/hypervisor-host-install-network-openvswitch.pot @@ -0,0 +1,263 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure the network using OpenVswitch" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This is a very important section, please make sure you read this thoroughly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order to forward traffic to your instances you will need at least two bridges: public and private." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default these bridges are called cloudbr0 and cloudbr1, but you do have to make sure they are available on each hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The most important factor is that you keep the configuration consistent on all your hypervisors." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Preparing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To make sure that the native bridge module will not interfere with openvswitch the bridge module should be added to the blacklist. See the modprobe documentation for your distribution on where to find the blacklist. Make sure the module is not loaded either by rebooting or executing rmmod bridge before executing next steps." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The network configurations below depend on the ifup-ovs and ifdown-ovs scripts which are part of the openvswitch installation. They should be installed in /etc/sysconfig/network-scripts/" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Network example" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are many ways to configure your network. In the Basic networking mode you should have two (V)LAN's, one for your private network and one for the public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We assume that the hypervisor has one NIC (eth0) with three tagged VLAN's:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 100 for management of the hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 200 for public network of the instances (cloudbr0)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 300 for private network of the instances (cloudbr1)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On VLAN 100 we give the Hypervisor the IP-Address 192.168.42.11/24 with the gateway 192.168.42.1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Hypervisor and Management server don't have to be in the same subnet!" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring the network bridges" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It depends on the distribution you are using how to configure these, below you'll find examples for RHEL/CentOS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The goal is to have three bridges called 'mgmt0', 'cloudbr0' and 'cloudbr1' after this section. This should be used as a guideline only. The exact configuration will depend on your network layout." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure OpenVswitch" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The network interfaces using OpenVswitch are created using the ovs-vsctl command. This command will configure the interfaces and persist them to the OpenVswitch database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First we create a main bridge connected to the eth0 interface. Next we create three fake bridges, each connected to a specific vlan tag." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# ovs-vsctl add-br cloudbr\n" +"# ovs-vsctl add-port cloudbr eth0 \n" +"# ovs-vsctl set port cloudbr trunks=100,200,300\n" +"# ovs-vsctl add-br mgmt0 cloudbr 100\n" +"# ovs-vsctl add-br cloudbr0 cloudbr 200\n" +"# ovs-vsctl add-br cloudbr1 cloudbr 300" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure in RHEL or CentOS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The required packages were installed when openvswitch and libvirt were installed, we can proceed to configuring the network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First we configure eth0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-eth0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure it looks similair to:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=eth0\n" +"HWADDR=00:04:xx:xx:xx:xx\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=Ethernet" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We have to configure the base bridge with the trunk." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-cloudbr" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=cloudbr\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"DEVICETYPE=ovs\n" +"TYPE=OVSBridge" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We now have to configure the three VLAN bridges:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-mgmt0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=mgmt0\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=static\n" +"DEVICETYPE=ovs\n" +"TYPE=OVSBridge\n" +"IPADDR=192.168.42.11\n" +"GATEWAY=192.168.42.1\n" +"NETMASK=255.255.255.0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-cloudbr0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=cloudbr0\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"DEVICETYPE=ovs\n" +"TYPE=OVSBridge" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-cloudbr1" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=cloudbr1\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=OVSBridge\n" +"DEVICETYPE=ovs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With this configuration you should be able to restart the network, although a reboot is recommended to see if everything works properly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you have an alternative way like IPMI or ILO to reach the machine in case you made a configuration error and the network stops functioning!" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-network.pot b/docs/pot/hypervisor-host-install-network.pot new file mode 100644 index 00000000000..f46ef2ee8c6 --- /dev/null +++ b/docs/pot/hypervisor-host-install-network.pot @@ -0,0 +1,313 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure the network bridges" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This is a very important section, please make sure you read this thoroughly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section details how to configure bridges using the native implementation in Linux. Please refer to the next section if you intend to use OpenVswitch" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In order to forward traffic to your instances you will need at least two bridges: public and private." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default these bridges are called cloudbr0 and cloudbr1, but you do have to make sure they are available on each hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The most important factor is that you keep the configuration consistent on all your hypervisors." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Network example" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are many ways to configure your network. In the Basic networking mode you should have two (V)LAN's, one for your private network and one for the public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We assume that the hypervisor has one NIC (eth0) with three tagged VLAN's:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 100 for management of the hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 200 for public network of the instances (cloudbr0)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN 300 for private network of the instances (cloudbr1)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On VLAN 100 we give the Hypervisor the IP-Address 192.168.42.11/24 with the gateway 192.168.42.1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Hypervisor and Management server don't have to be in the same subnet!" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configuring the network bridges" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It depends on the distribution you are using how to configure these, below you'll find examples for RHEL/CentOS and Ubuntu." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The goal is to have two bridges called 'cloudbr0' and 'cloudbr1' after this section. This should be used as a guideline only. The exact configuration will depend on your network layout." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure in RHEL or CentOS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The required packages were installed when libvirt was installed, we can proceed to configuring the network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First we configure eth0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-eth0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure it looks similair to:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=eth0\n" +"HWADDR=00:04:xx:xx:xx:xx\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=Ethernet" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We now have to configure the three VLAN interfaces:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-eth0.100" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=eth0.100\n" +"HWADDR=00:04:xx:xx:xx:xx\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=Ethernet\n" +"VLAN=yes\n" +"IPADDR=192.168.42.11\n" +"GATEWAY=192.168.42.1\n" +"NETMASK=255.255.255.0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-eth0.200" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=eth0.200\n" +"HWADDR=00:04:xx:xx:xx:xx\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=Ethernet\n" +"VLAN=yes\n" +"BRIDGE=cloudbr0" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-eth0.300" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=eth0.300\n" +"HWADDR=00:04:xx:xx:xx:xx\n" +"ONBOOT=yes\n" +"HOTPLUG=no\n" +"BOOTPROTO=none\n" +"TYPE=Ethernet\n" +"VLAN=yes\n" +"BRIDGE=cloudbr1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now we have the VLAN interfaces configured we can add the bridges on top of them." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-cloudbr0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now we just configure it is a plain bridge without an IP-Adress" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=cloudbr0\n" +"TYPE=Bridge\n" +"ONBOOT=yes\n" +"BOOTPROTO=none\n" +"IPV6INIT=no\n" +"IPV6_AUTOCONF=no\n" +"DELAY=5\n" +"STP=yes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We do the same for cloudbr1" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/sysconfig/network-scripts/ifcfg-cloudbr1" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "DEVICE=cloudbr1\n" +"TYPE=Bridge\n" +"ONBOOT=yes\n" +"BOOTPROTO=none\n" +"IPV6INIT=no\n" +"IPV6_AUTOCONF=no\n" +"DELAY=5\n" +"STP=yes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With this configuration you should be able to restart the network, although a reboot is recommended to see if everything works properly." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you have an alternative way like IPMI or ILO to reach the machine in case you made a configuration error and the network stops functioning!" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure in Ubuntu" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the required packages were installed when you installed libvirt, so we only have to configure the network." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/network/interfaces" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Modify the interfaces file to look like this:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "auto lo\n" +"iface lo inet loopback\n" +"\n" +"# The primary network interface\n" +"auto eth0.100\n" +"iface eth0.100 inet static\n" +" address 192.168.42.11\n" +" netmask 255.255.255.240\n" +" gateway 192.168.42.1\n" +" dns-nameservers 8.8.8.8 8.8.4.4\n" +" dns-domain lab.example.org\n" +"\n" +"# Public network\n" +"auto cloudbr0\n" +"iface cloudbr0 inet manual\n" +" bridge_ports eth0.200\n" +" bridge_fd 5\n" +" bridge_stp off\n" +" bridge_maxwait 1\n" +"\n" +"# Private network\n" +"auto cloudbr1\n" +"iface cloudbr1 inet manual\n" +" bridge_ports eth0.300\n" +" bridge_fd 5\n" +" bridge_stp off\n" +" bridge_maxwait 1" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-overview.pot b/docs/pot/hypervisor-host-install-overview.pot new file mode 100644 index 00000000000..f9eb4b77c3b --- /dev/null +++ b/docs/pot/hypervisor-host-install-overview.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "KVM Installation Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to use the Linux Kernel Virtual Machine (KVM) hypervisor to run guest virtual machines, install KVM on the host(s) in your cloud. The material in this section doesn't duplicate KVM installation docs. It provides the &PRODUCT;-specific steps that are needed to prepare a KVM host to work with &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before continuing, make sure that you have applied the latest updates to your host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It is NOT recommended to run services on this host not controlled by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The procedure for installing a KVM Hypervisor Host is:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the Operating System" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install and configure libvirt" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure Security Policies (AppArmor and SELinux)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install and configure the Agent" +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-prepare-os.pot b/docs/pot/hypervisor-host-install-prepare-os.pot new file mode 100644 index 00000000000..eb37323d048 --- /dev/null +++ b/docs/pot/hypervisor-host-install-prepare-os.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare the Operating System" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The OS of the Host must be prepared to host the &PRODUCT; Agent and run KVM instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to your OS as root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check for a fully qualified hostname." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ hostname --fqdn" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This should return a fully qualified hostname such as \"kvm1.lab.example.org\". If it does not, edit /etc/hosts so that it does." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure that the machine can reach the Internet." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ping www.cloudstack.org" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Turn on NTP for time synchronization." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NTP is required to synchronize the clocks of the servers in your cloud. Unsynchronized clocks can cause unexpected problems." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install NTP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ yum install ntp" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ apt-get install openntpd" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat all of these steps on every hypervisor host." +msgstr "" + diff --git a/docs/pot/hypervisor-host-install-security-policies.pot b/docs/pot/hypervisor-host-install-security-policies.pot new file mode 100644 index 00000000000..e13fd5fa308 --- /dev/null +++ b/docs/pot/hypervisor-host-install-security-policies.pot @@ -0,0 +1,145 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configure the Security Policies" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; does various things which can be blocked by security mechanisms like AppArmor and SELinux. These have to be disabled to ensure the Agent has all the required permissions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure SELinux (RHEL and CentOS)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check to see whether SELinux is installed on your machine. If not, you can skip this section." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In RHEL or CentOS, SELinux is installed and enabled by default. You can verify this with:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ rpm -qa | grep selinux" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the SELINUX variable in /etc/selinux/config to \"permissive\". This ensures that the permissive setting will be maintained after a system reboot." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "vi /etc/selinux/config" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the following line" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "SELINUX=enforcing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "to this" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "SELINUX=permissive" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then set SELinux to permissive starting immediately, without requiring a system reboot." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ setenforce permissive" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure Apparmor (Ubuntu)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check to see whether AppArmor is installed on your machine. If not, you can skip this section." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Ubuntu AppArmor is installed and enabled by default. You can verify this with:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ dpkg --list 'apparmor'" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disable the AppArmor profiles for libvirt" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ln -s /etc/apparmor.d/usr.sbin.libvirtd /etc/apparmor.d/disable/" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ ln -s /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper /etc/apparmor.d/disable/" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ apparmor_parser -R /etc/apparmor.d/usr.sbin.libvirtd" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ apparmor_parser -R /etc/apparmor.d/usr.lib.libvirt.virt-aa-helper" +msgstr "" + diff --git a/docs/pot/hypervisor-installation.pot b/docs/pot/hypervisor-installation.pot new file mode 100644 index 00000000000..d8d76998189 --- /dev/null +++ b/docs/pot/hypervisor-installation.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Hypervisor Installation" +msgstr "" + diff --git a/docs/pot/hypervisor-kvm-install-flow.pot b/docs/pot/hypervisor-kvm-install-flow.pot new file mode 100644 index 00000000000..88595e47498 --- /dev/null +++ b/docs/pot/hypervisor-kvm-install-flow.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "KVM Hypervisor Host Installation" +msgstr "" + diff --git a/docs/pot/hypervisor-kvm-requirements.pot b/docs/pot/hypervisor-kvm-requirements.pot new file mode 100644 index 00000000000..10e56f616fa --- /dev/null +++ b/docs/pot/hypervisor-kvm-requirements.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Requirements for KVM Hypervisor Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM is included with a variety of Linux-based operating systems. Although you are not required to run these distributions, the following are recommended:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CentOS / RHEL: 6.3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ubuntu: 12.04(.1)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The main requirement for KVM hypervisors is the libvirt and Qemu version. No matter what Linux distribution you are using, make sure the following requirements are met:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "libvirt: 0.9.4 or higher" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Qemu/KVM: 1.0 or higher" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default bridge in &PRODUCT; is the Linux native bridge implementation (bridge module). &PRODUCT; includes an option to work with OpenVswitch, the requirements are listed below" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "libvirt: 0.9.11 or higher" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "openvswitch: 1.7.1 or higher" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition, the following hardware requirements apply:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Within a single cluster, the hosts must be of the same distribution version." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts within a cluster must be homogenous. The CPUs must be of the same type, count, and feature flags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Must support HVM (Intel-VT or AMD-V enabled)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "64-bit x86 CPU (more cores results in better performance)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4 GB of memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At least 1 NIC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running" +msgstr "" + diff --git a/docs/pot/hypervisor-support-for-primarystorage.pot b/docs/pot/hypervisor-support-for-primarystorage.pot new file mode 100644 index 00000000000..89d19323c7f --- /dev/null +++ b/docs/pot/hypervisor-support-for-primarystorage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Hypervisor Support for Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table shows storage options and parameters for different hypervisors." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware vSphere" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format for Disks, Templates, and Snapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMDK" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "QCOW2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "iSCSI support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Clustered LVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yes, via Shared Mountpoint" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fiber Channel support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yes, via Existing SR" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Y" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Local storage support" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage over-provisioning" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS and iSCSI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer uses a clustered LVM system to store VM images on iSCSI and Fiber Channel volumes and does not support over-provisioning in the hypervisor. The storage server itself, however, can support thin-provisioning. As a result the &PRODUCT; can still support storage over-provisioning by running on thin-provisioned storage volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM supports \"Shared Mountpoint\" storage. A shared mountpoint is a file system path local to each server in a given cluster. The path must be the same across all Hosts in the cluster, for example /mnt/primary1. This shared mountpoint is assumed to be a clustered filesystem such as OCFS2. In this case the &PRODUCT; does not attempt to mount or unmount the storage as is done with NFS. The &PRODUCT; requires that the administrator insure that the storage is available" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "With NFS storage, &PRODUCT; manages the overprovisioning. In this case the global configuration parameter storage.overprovisioning.factor controls the degree of overprovisioning. This is independent of hypervisor type." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Local storage is an option for primary storage for vSphere, XenServer, and KVM. When the local disk option is enabled, a local disk storage pool is automatically created on each host. To use local storage for the System Virtual Machines (such as the Virtual Router), set system.vm.use.local.storage to true in global configuration." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports multiple primary storage pools in a Cluster. For example, you could provision 2 NFS servers in primary storage. Or you could provision 1 iSCSI LUN initially and then add a second iSCSI LUN when the first approaches capacity." +msgstr "" + diff --git a/docs/pot/import-ami.pot b/docs/pot/import-ami.pot new file mode 100644 index 00000000000..84225fb4f2e --- /dev/null +++ b/docs/pot/import-ami.pot @@ -0,0 +1,270 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Importing Amazon Machine Images" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following procedures describe how to import an Amazon Machine Image (AMI) into &PRODUCT; when using the XenServer hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Assume you have an AMI file and this file is called CentOS_6.2_x64. Assume further that you are working on a CentOS host. If the AMI is a Fedora image, you need to be working on a Fedora host initially." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to have a XenServer host with a file-based storage repository (either a local ext3 SR or an NFS SR) to convert to a VHD once the image file has been customized on the Centos/Fedora host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up loopback on image file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mkdir -p /mnt/loop/centos62\n" +"# mount -o loop CentOS_6.2_x64 /mnt/loop/centos54\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the kernel-xen package into the image. This downloads the PV kernel and ramdisk to the image." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# yum -c /mnt/loop/centos54/etc/yum.conf --installroot=/mnt/loop/centos62/ -y install kernel-xen" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a grub entry in /boot/grub/grub.conf." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mkdir -p /mnt/loop/centos62/boot/grub\n" +"# touch /mnt/loop/centos62/boot/grub/grub.conf\n" +"# echo \"\" > /mnt/loop/centos62/boot/grub/grub.conf\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Determine the name of the PV kernel that has been installed into the image." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cd /mnt/loop/centos62\n" +"# ls lib/modules/\n" +"2.6.16.33-xenU 2.6.16-xenU 2.6.18-164.15.1.el5xen 2.6.18-164.6.1.el5.centos.plus 2.6.18-xenU-ec2-v1.0 2.6.21.7-2.fc8xen 2.6.31-302-ec2\n" +"# ls boot/initrd*\n" +"boot/initrd-2.6.18-164.6.1.el5.centos.plus.img boot/initrd-2.6.18-164.15.1.el5xen.img\n" +"# ls boot/vmlinuz*\n" +"boot/vmlinuz-2.6.18-164.15.1.el5xen boot/vmlinuz-2.6.18-164.6.1.el5.centos.plus boot/vmlinuz-2.6.18-xenU-ec2-v1.0 boot/vmlinuz-2.6.21-2952.fc8xen\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Xen kernels/ramdisk always end with \"xen\". For the kernel version you choose, there has to be an entry for that version under lib/modules, there has to be an initrd and vmlinuz corresponding to that. Above, the only kernel that satisfies this condition is 2.6.18-164.15.1.el5xen." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Based on your findings, create an entry in the grub.conf file. Below is an example entry." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "default=0\n" +"timeout=5\n" +"hiddenmenu\n" +"title CentOS (2.6.18-164.15.1.el5xen)\n" +" root (hd0,0)\n" +" kernel /boot/vmlinuz-2.6.18-164.15.1.el5xen ro root=/dev/xvda \n" +" initrd /boot/initrd-2.6.18-164.15.1.el5xen.img\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit etc/fstab, changing “sda1†to “xvda†and changing “sdb†to “xvdbâ€." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cat etc/fstab\n" +"/dev/xvda / ext3 defaults 1 1\n" +"/dev/xvdb /mnt ext3 defaults 0 0\n" +"none /dev/pts devpts gid=5,mode=620 0 0\n" +"none /proc proc defaults 0 0\n" +"none /sys sysfs defaults 0 0\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enable login via the console. The default console device in a XenServer system is xvc0. Ensure that etc/inittab and etc/securetty have the following lines respectively:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# grep xvc0 etc/inittab \n" +"co:2345:respawn:/sbin/agetty xvc0 9600 vt100-nav\n" +"# grep xvc0 etc/securetty \n" +"xvc0\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure the ramdisk supports PV disk and PV network. Customize this for the kernel version you have determined above." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# chroot /mnt/loop/centos54\n" +"# cd /boot/\n" +"# mv initrd-2.6.18-164.15.1.el5xen.img initrd-2.6.18-164.15.1.el5xen.img.bak\n" +"# mkinitrd -f /boot/initrd-2.6.18-164.15.1.el5xen.img --with=xennet --preload=xenblk --omit-scsi-modules 2.6.18-164.15.1.el5xen\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the password." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# passwd\n" +"Changing password for user root.\n" +"New UNIX password: \n" +"Retype new UNIX password: \n" +"passwd: all authentication tokens updated successfully.\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Exit out of chroot." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# exit" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check etc/ssh/sshd_config for lines allowing ssh login using a password." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# egrep \"PermitRootLogin|PasswordAuthentication\" /mnt/loop/centos54/etc/ssh/sshd_config \n" +"PermitRootLogin yes\n" +"PasswordAuthentication yes\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you need the template to be enabled to reset passwords from the &PRODUCT; UI or API, install the password change script into the image at this point. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unmount and delete loopback mount." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# umount /mnt/loop/centos54\n" +"# losetup -d /dev/loop0\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the image file to your XenServer host's file-based storage repository. In the example below, the Xenserver is \"xenhost\". This XenServer has an NFS repository whose uuid is a9c5b8c8-536b-a193-a6dc-51af3e5ff799." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# scp CentOS_6.2_x64 xenhost:/var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799/" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the Xenserver and create a VDI the same size as the image." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "[root@xenhost ~]# cd /var/run/sr-mount/a9c5b8c8-536b-a193-a6dc-51af3e5ff799\n" +"[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# ls -lh CentOS_6.2_x64\n" +"-rw-r--r-- 1 root root 10G Mar 16 16:49 CentOS_6.2_x64\n" +"[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-create virtual-size=10GiB sr-uuid=a9c5b8c8-536b-a193-a6dc-51af3e5ff799 type=user name-label=\"Centos 6.2 x86_64\"\n" +"cad7317c-258b-4ef7-b207-cdf0283a7923\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Import the image file into the VDI. This may take 10–20 minutes." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# xe vdi-import filename=CentOS_6.2_x64 uuid=cad7317c-258b-4ef7-b207-cdf0283a7923" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Locate a the VHD file. This is the file with the VDI’s UUID as its name. Compress it and upload it to your web server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# bzip2 -c cad7317c-258b-4ef7-b207-cdf0283a7923.vhd > CentOS_6.2_x64.vhd.bz2\n" +"[root@xenhost a9c5b8c8-536b-a193-a6dc-51af3e5ff799]# scp CentOS_6.2_x64.vhd.bz2 webserver:/var/www/html/templates/\n" +"" +msgstr "" + diff --git a/docs/pot/increase-management-server-max-memory.pot b/docs/pot/increase-management-server-max-memory.pot new file mode 100644 index 00000000000..77e2d58622b --- /dev/null +++ b/docs/pot/increase-management-server-max-memory.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Increase Management Server Maximum Memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the Management Server is subject to high demand, the default maximum JVM memory allocation can be insufficient. To increase the memory:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the Tomcat configuration file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/etc/cloud/management/tomcat6.conf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the command-line parameter -XmxNNNm to a higher value of N." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, if the current value is -Xmx128m, change it to -Xmx1024m or higher." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To put the new setting into effect, restart the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information about memory issues, see \"FAQ: Memory\" at Tomcat Wiki." +msgstr "" + diff --git a/docs/pot/incremental-snapshots-backup.pot b/docs/pot/incremental-snapshots-backup.pot new file mode 100644 index 00000000000..8bf7ddbbecb --- /dev/null +++ b/docs/pot/incremental-snapshots-backup.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Incremental Snapshots and Backup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Snapshots are created on primary storage where a disk resides. After a snapshot is created, it is immediately backed up to secondary storage and removed from primary storage for optimal utilization of space on primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; does incremental backups for some hypervisors. When incremental backups are supported, every N backup is a full backup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware vSphere" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Support incremental backup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "N" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Y" +msgstr "" + diff --git a/docs/pot/initial-setup-of-external-firewalls-loadbalancers.pot b/docs/pot/initial-setup-of-external-firewalls-loadbalancers.pot new file mode 100644 index 00000000000..1534cbafb58 --- /dev/null +++ b/docs/pot/initial-setup-of-external-firewalls-loadbalancers.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Initial Setup of External Firewalls and Load Balancers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the first VM is created for a new account, &PRODUCT; programs the external firewall and load balancer to work with the VM. The following objects are created on the firewall:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new logical interface to connect to the account's private VLAN. The interface IP is always the first IP of the account's private subnet (e.g. 10.1.1.1)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A source NAT rule that forwards all outgoing traffic from the account's private VLAN to the public Internet, using the account's public IP address as the source address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A firewall filter counter that measures the number of bytes of outgoing traffic for the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following objects are created on the load balancer:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new VLAN that matches the account's provisioned Zone VLAN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A self IP for the VLAN. This is always the second IP of the account's private subnet (e.g. 10.1.1.2)." +msgstr "" + diff --git a/docs/pot/initialize-and-test.pot b/docs/pot/initialize-and-test.pot new file mode 100644 index 00000000000..f6a88b9184f --- /dev/null +++ b/docs/pot/initialize-and-test.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Initialize and Test" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After everything is configured, &PRODUCT; will perform its initialization. This can take 30 minutes or more, depending on the speed of your network. When the initialization has completed successfully, the administrator's Dashboard should be displayed in the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Verify that the system is ready. In the left navigation bar, select Templates. Click on the CentOS 5.5 (64bit) no Gui (KVM) template. Check to be sure that the status is \"Download Complete.\" Do not proceed to the next step until this status is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Go to the Instances tab, and filter by My Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Instance and follow the steps in the wizard." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the zone you just added." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the template selection, choose the template to use in the VM. If this is a fresh installation, likely only the provided CentOS template is available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select a service offering. Be sure that the hardware you have allows starting the selected service offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In data disk offering, if desired, add another data disk. This is a second volume that will be available to but not mounted in the guest. For example, in Linux on XenServer you will see /dev/xvdb in the guest after rebooting the VM. A reboot is not required if you have a PV-enabled OS kernel in use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In default network, choose the primary network for the guest. In a trial installation, you would have only one option here." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Optionally give your VM a name and a group. Use any descriptive text you would like." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Launch VM. Your VM will be created and started. It might take some time to download the template and complete the VM startup. You can watch the VM’s progress in the Instances screen." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To use the VM, click the View Console button. ConsoleButton.png: button to launch a console " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Congratulations! You have successfully completed a &PRODUCT; Installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you decide to grow your deployment, you can add more hosts, primary storage, zones, pods, and clusters." +msgstr "" + diff --git a/docs/pot/install-usage-server.pot b/docs/pot/install-usage-server.pot new file mode 100644 index 00000000000..7a82178ddfb --- /dev/null +++ b/docs/pot/install-usage-server.pot @@ -0,0 +1,106 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Installing the Usage Server (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can optionally install the Usage Server once the Management Server is configured properly. The Usage Server takes data from the events in the system and enables usage-based billing for accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When multiple Management Servers are present, the Usage Server may be installed on any number of them. The Usage Servers will coordinate usage processing. A site that is concerned about availability should install Usage Servers on at least two Management Servers." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Requirements for Installing the Usage Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server must be running when the Usage Server is installed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Usage Server must be installed on the same server as a Management Server." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Steps to Install the Usage Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run ./install.sh." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# ./install.sh\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should see a few messages as the installer prepares, followed by a list of choices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose \"S\" to install the Usage Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" > S\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once installed, start the Usage Server with the following command." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# service cloud-usage start\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Administration Guide discusses further configuration of the Usage Server." +msgstr "" + diff --git a/docs/pot/installation-complete.pot b/docs/pot/installation-complete.pot new file mode 100644 index 00000000000..a2a7eb2a4ac --- /dev/null +++ b/docs/pot/installation-complete.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Installation Complete! Next Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Congratulations! You have now installed &PRODUCT; Management Server and the database it uses to persist system data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "What should you do next?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Even without adding any cloud infrastructure, you can run the UI to get a feel for what's offered and how you will interact with &PRODUCT; on an ongoing basis. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you're ready, add the cloud infrastructure and try running some virtual machines on it, so you can watch how &PRODUCT; manages the infrastructure. See ." +msgstr "" + diff --git a/docs/pot/installation-steps-overview.pot b/docs/pot/installation-steps-overview.pot new file mode 100644 index 00000000000..43c22e135b1 --- /dev/null +++ b/docs/pot/installation-steps-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Overview of Installation Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For anything more than a simple trial installation, you will need guidance for a variety of configuration choices. It is strongly recommended that you read the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choosing a Deployment Architecture" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choosing a Hypervisor: Supported Features" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Best Practices" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you have the required hardware ready. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the Management Server (choose single-node or multi-node). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the UI. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add a zone. Includes the first pod, cluster, and host. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more pods (optional). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more clusters (optional). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more hosts (optional). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more primary storage (optional). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more secondary storage (optional). See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Try using the cloud. See " +msgstr "" + diff --git a/docs/pot/installation.pot b/docs/pot/installation.pot new file mode 100644 index 00000000000..1d572b02855 --- /dev/null +++ b/docs/pot/installation.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Installation" +msgstr "" + diff --git a/docs/pot/installation_steps_overview.pot b/docs/pot/installation_steps_overview.pot new file mode 100644 index 00000000000..c3a7186e4b1 --- /dev/null +++ b/docs/pot/installation_steps_overview.pot @@ -0,0 +1,135 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Overview of Installation Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For anything more than a simple trial installation, you will need guidance for a variety of configuration choices. It is strongly recommended that you read the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choosing a Deployment Architecture" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choosing a Hypervisor: Supported Features" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Best Practices" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you have the required hardware ready" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) Fill out the preparation checklists" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the &PRODUCT; software" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the Management Server (choose single-node or multi-node)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the UI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provision your cloud infrastructure" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add a zone. Includes the first pod, cluster, and host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more pods" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more clusters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more primary storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more secondary storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Try using the cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Initialization and testing" +msgstr "" + diff --git a/docs/pot/inter-vlan-routing.pot b/docs/pot/inter-vlan-routing.pot new file mode 100644 index 00000000000..d65e88e4832 --- /dev/null +++ b/docs/pot/inter-vlan-routing.pot @@ -0,0 +1,120 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Inter-VLAN Routing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Inter-VLAN Routing is the capability to route network traffic between VLANs. This feature enables you to build Virtual Private Clouds (VPC), an isolated segment of your cloud, that can hold multi-tier applications. These tiers are deployed on different VLANs that can communicate with each other. You provision VLANs to the tiers your create, and VMs can be deployed on different tiers. The VLANs are connected to a virtual router, which facilitates communication between the VMs. In effect, you can segment VMs by means of VLANs into different networks that can host multi-tier applications, such as Web, Application, or Database. Such segmentation by means of VLANs logically separate application VMs for higher security and lower broadcasts, while remaining physically connected to the same device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This feature is supported on XenServer and VMware hypervisors." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The major advantages are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator can deploy a set of VLANs and allow users to deploy VMs on these VLANs. A guest VLAN is randomly alloted to an account from a pre-specified set of guest VLANs. All the VMs of a certain tier of an account reside on the guest VLAN allotted to that account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VLAN allocated for an account cannot be shared between multiple accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator can allow users create their own VPC and deploy the application. In this scenario, the VMs that belong to the account are deployed on the VLANs allotted to that account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both administrators and users can create multiple VPCs. The guest network NIC is plugged to the VPC virtual router when the first VM is deployed in a tier." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator can create the following gateways to send to or receive traffic from the VMs:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN Gateway: For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Gateway: The public gateway for a VPC is added to the virtual router when the virtual router is created for VPC. The public gateway is not exposed to the end users. You are not allowed to list it, nor allowed to create any static routes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Gateway: For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both administrators and users can create various possible destinations-gateway combinations. However, only one gateway of each type can be used in a deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLANs and Public Gateway: For example, an application is deployed in the cloud, and the Web application VMs communicate with the Internet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLANs, VPN Gateway, and Public Gateway: For example, an application is deployed in the cloud; the Web application VMs communicate with the Internet; and the database VMs communicate with the on-premise devices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator can define Access Control List (ACL) on the virtual router to filter the traffic among the VLANs or between the Internet and a VLAN. You can define ACL based on CIDR, port range, protocol, type code (if ICMP protocol is selected) and Ingress/Egress type." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following figure shows the possible deployment scenarios of a Inter-VLAN setup:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up a multi-tier Inter-VLAN deployment, see ." +msgstr "" + diff --git a/docs/pot/introduction.pot b/docs/pot/introduction.pot new file mode 100644 index 00000000000..d5ae7911e6a --- /dev/null +++ b/docs/pot/introduction.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Introduction" +msgstr "" + diff --git a/docs/pot/ip-forwarding-firewalling.pot b/docs/pot/ip-forwarding-firewalling.pot new file mode 100644 index 00000000000..d4aeefa0de3 --- /dev/null +++ b/docs/pot/ip-forwarding-firewalling.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "IP Forwarding and Firewalling" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default, all incoming traffic to the public IP address is rejected. All outgoing traffic from the guests is translated via NAT to the public IP address and is allowed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To allow incoming traffic, users may set up firewall rules and/or port forwarding rules. For example, you can use a firewall rule to open a range of ports on the public IP address, such as 33 through 44. Then use port forwarding rules to direct traffic from individual ports within that range to specific ports on user VMs. For example, one port forwarding rule could route incoming traffic on the public IP's port 33 to port 100 on one user VM's private IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the steps to implement these rules, see Firewall Rules and Port Forwarding." +msgstr "" + diff --git a/docs/pot/ip-load-balancing.pot b/docs/pot/ip-load-balancing.pot new file mode 100644 index 00000000000..ef46d00aebb --- /dev/null +++ b/docs/pot/ip-load-balancing.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "IP Load Balancing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user may choose to associate the same public IP for multiple guests. &PRODUCT; implements a TCP-level load balancer with the following policies." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Round-robin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Least connection" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source IP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This is similar to port forwarding but the destination may be multiple IP addresses." +msgstr "" + diff --git a/docs/pot/ipaddress-usage-record-format.pot b/docs/pot/ipaddress-usage-record-format.pot new file mode 100644 index 00000000000..99a0044ccd0 --- /dev/null +++ b/docs/pot/ipaddress-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "IP Address Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For IP address usage the following fields exist in a usage record." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account - name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid - ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid - ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid - Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description - A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage - String representation of the usage, including the units of usage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype - A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage - A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid - IP address ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate - The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "issourcenat - Whether source NAT is enabled for the IP address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "iselastic - True if the IP address is elastic." +msgstr "" + diff --git a/docs/pot/isolated-networks.pot b/docs/pot/isolated-networks.pot new file mode 100644 index 00000000000..0e550ba64ca --- /dev/null +++ b/docs/pot/isolated-networks.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Isolated Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An isolated network can be accessed only by virtual machines of a single account. Isolated networks have the following properties." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Resources such as VLAN are allocated and garbage collected dynamically" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is one network offering for the entire network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The network offering can be upgraded or downgraded but it is for the entire network" +msgstr "" + diff --git a/docs/pot/job-status.pot b/docs/pot/job-status.pot new file mode 100644 index 00000000000..8e27d84b25f --- /dev/null +++ b/docs/pot/job-status.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Job Status" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The key to using an asynchronous command is the job ID that is returned immediately once the command has been executed. With the job ID, you can periodically check the job status by making calls to queryAsyncJobResult command. The command will return three possible job status integer values:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "0 - Job is still in progress. Continue to periodically poll for any status changes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "1 - Job has successfully completed. The job will return any successful response values associated with command that was originally executed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2 - Job has failed to complete. Please check the \"jobresultcode\" tag for failure reason code and \"jobresult\" for the failure reason." +msgstr "" + diff --git a/docs/pot/kvm-topology-req.pot b/docs/pot/kvm-topology-req.pot new file mode 100644 index 00000000000..6b675244863 --- /dev/null +++ b/docs/pot/kvm-topology-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "KVM Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Servers communicate with KVM hosts on port 22 (ssh)." +msgstr "" + diff --git a/docs/pot/large_scale_redundant_setup.pot b/docs/pot/large_scale_redundant_setup.pot new file mode 100644 index 00000000000..ccfbde45a8b --- /dev/null +++ b/docs/pot/large_scale_redundant_setup.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Large-Scale Redundant Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This diagram illustrates the network architecture of a large-scale &PRODUCT; deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A layer-3 switching layer is at the core of the data center. A router redundancy protocol like VRRP should be deployed. Typically high-end core switches also include firewall modules. Separate firewall appliances may also be used if the layer-3 switch does not have integrated firewall capabilities. The firewalls are configured in NAT mode. The firewalls provide the following functions:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Forwards HTTP requests and API calls from the Internet to the Management Server. The Management Server resides on the management network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the cloud spans multiple zones, the firewalls should enable site-to-site VPN such that servers in different zones can directly reach each other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A layer-2 access switch layer is established for each pod. Multiple switches can be stacked to increase port count. In either case, redundant pairs of layer-2 switches should be deployed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server cluster (including front-end load balancers, Management Server nodes, and the MySQL database) is connected to the management network through a pair of load balancers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage servers are connected to the management network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each pod contains storage and computing servers. Each storage and computing server should have redundant NICs connected to separate layer-2 access switches." +msgstr "" + diff --git a/docs/pot/layer2-switch.pot b/docs/pot/layer2-switch.pot new file mode 100644 index 00000000000..8eab8f7e015 --- /dev/null +++ b/docs/pot/layer2-switch.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Layer-2 Switch" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The layer-2 switch is the access switching layer inside the pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It should trunk all VLANs into every computing host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It should switch traffic for the management network containing computing and storage hosts. The layer-3 switch will serve as the gateway for the management network." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Example Configurations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section contains example configurations for specific switch models for pod-level layer-2 switching. It assumes VLAN management protocols such as VTP or GVRP have been disabled. The scripts must be changed appropriately if you choose to use VTP or GVRP." +msgstr "" + diff --git a/docs/pot/lb-policy-pfwd-rule-usage-record-format.pot b/docs/pot/lb-policy-pfwd-rule-usage-record-format.pot new file mode 100644 index 00000000000..4fe042f3201 --- /dev/null +++ b/docs/pot/lb-policy-pfwd-rule-usage-record-format.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Load Balancer Policy or Port Forwarding Rule Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account - name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid - ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid - ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid - Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description - A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage - String representation of the usage, including the units of usage (e.g. 'Hrs' for hours)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype - A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage - A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid - ID of the load balancer policy or port forwarding rule" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate - The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/linux-installation.pot b/docs/pot/linux-installation.pot new file mode 100644 index 00000000000..495d96b97b6 --- /dev/null +++ b/docs/pot/linux-installation.pot @@ -0,0 +1,101 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Linux OS Installation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the following steps to begin the Linux OS installation:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download the script file cloud-set-guest-password:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Linux: " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Windows: " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy this file to /etc/init.d." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On some Linux distributions, copy the file to /etc/rc.d/init.d." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command to make the script executable:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "chmod +x /etc/init.d/cloud-set-guest-password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Depending on the Linux distribution, continue with the appropriate step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Fedora, CentOS/RHEL, and Debian, run:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "chkconfig --add cloud-set-guest-password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu with VMware tools, link the script file to the /etc/network/if-up and /etc/network/if-down folders, and run the script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "#ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-up/cloud-set-guest-password\n" +" #ln -s /etc/init.d/cloud-set-guest-password /etc/network/if-down/cloud-set-guest-password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using Ubuntu 11.04, start by creating a directory called /var/lib/dhcp3 on your Ubuntu machine (works around a known issue with this version of Ubuntu). On all Ubuntu versions: Run “sudo update-rc.d cloud-set-guest-password defaults 98â€. To test, run \"mkpasswd\" and check that it is generating a new password. If the “mkpasswd†command does not exist, run \"sudo apt-get install whois\" (or sudo apt-get install mkpasswd, depending on your Ubuntu version) and repeat." +msgstr "" + diff --git a/docs/pot/load-balancer-rules.pot b/docs/pot/load-balancer-rules.pot new file mode 100644 index 00000000000..ac3cd64404b --- /dev/null +++ b/docs/pot/load-balancer-rules.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Load Balancer Rules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A &PRODUCT; user or administrator may create load balancing rules that balance traffic received at a public IP to one or more VMs. A user creates a rule, specifies an algorithm, and assigns the rule to a set of VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you create load balancing rules while using a network service offering that includes an external load balancer device such as NetScaler, and later change the network service offering to one that uses the &PRODUCT; virtual router, you must create a firewall rule on the virtual router for each of your existing load balancing rules so that they continue to function." +msgstr "" + diff --git a/docs/pot/log-in-root-admin.pot b/docs/pot/log-in-root-admin.pot new file mode 100644 index 00000000000..08484eb3c05 --- /dev/null +++ b/docs/pot/log-in-root-admin.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Logging In as the Root Administrator" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the Management Server software is installed and running, you can run the &PRODUCT; user interface. This UI is there to help you provision, view, and manage your cloud infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Open your favorite Web browser and go to this URL. Substitute the IP address of your own Management Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://<management-server-ip-address>:8080/client" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After logging into a fresh Management Server installation, a guided tour splash screen appears. On later visits, you’ll be taken directly into the Dashboard." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you see the first-time splash screen, choose one of the following." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Continue with basic setup. Choose this if you're just trying &PRODUCT;, and you want a guided walkthrough of the simplest possible configuration so that you can get started right away. We'll help you set up a cloud with the following features: a single machine that runs &PRODUCT; software and uses NFS to provide storage; a single machine running VMs under the XenServer or KVM hypervisor; and a shared public network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The prompts in this guided tour should give you all the information you need, but if you want just a bit more detail, you can follow along in the Trial Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "I have used &PRODUCT; before. Choose this if you have already gone through a design phase and planned a more sophisticated deployment, or you are ready to start scaling up a trial cloud that you set up earlier with the basic setup screens. In the Administrator UI, you can start using the more powerful features of &PRODUCT;, such as advanced VLAN networking, high availability, additional network elements such as load balancers and firewalls, and support for multiple hypervisors including Citrix XenServer, KVM, and VMware vSphere." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The root administrator Dashboard appears." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should set a new root administrator password. If you chose basic setup, you’ll be prompted to create a new password right away. If you chose experienced user, use the steps in ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You are logging in as the root administrator. This account manages the &PRODUCT; deployment, including physical infrastructure. The root administrator can modify configuration settings to change basic functionality, create or delete user accounts, and take many actions that should be performed only by an authorized person. Please change the default password to a new, unique password." +msgstr "" + diff --git a/docs/pot/log-in.pot b/docs/pot/log-in.pot new file mode 100644 index 00000000000..2faf14b1738 --- /dev/null +++ b/docs/pot/log-in.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Log In to the UI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides a web-based UI that can be used by both administrators and end users. The appropriate version of the UI is displayed depending on the credentials used to log in. The UI is available in popular browsers including IE7, IE8, IE9, Firefox 3.5+, Firefox 4, Safari 4, and Safari 5. The URL is: (substitute your own management server IP address)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://<management-server-ip-address>:8080/client" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On a fresh Management Server installation, a guided tour splash screen appears. On later visits, you’ll see a login screen where you specify the following to proceed to your Dashboard:" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Username" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user ID of your account. The default username is admin." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The password associated with the user ID. The password for the default username is password." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Domain" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are a root user, leave this field blank." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are a user in the sub-domains, enter the full path to the domain, excluding the root domain." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, suppose multiple levels are created under the root domain, such as Comp1/hr. The users in the Comp1 domain should enter Comp1 in the Domain field, whereas the users in the Comp1/sales domain should enter Comp1/sales." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more guidance about the choices that appear when you log in to this UI, see Logging In as the Root Administrator." +msgstr "" + diff --git a/docs/pot/long-running-job-events.pot b/docs/pot/long-running-job-events.pot new file mode 100644 index 00000000000..ecb39473a44 --- /dev/null +++ b/docs/pot/long-running-job-events.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Long Running Job Events" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The events log records three types of standard events." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "INFO. This event is generated when an operation has been successfully performed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "WARN. This event is generated in the following circumstances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a network is disconnected while monitoring a template download." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a template download is abandoned." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When an issue on the storage server causes the volumes to fail over to the mirror storage server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ERROR. This event is generated when an operation has not been successfully performed" +msgstr "" + diff --git a/docs/pot/maintain-hypervisors-on-hosts.pot b/docs/pot/maintain-hypervisors-on-hosts.pot new file mode 100644 index 00000000000..5acc8771d40 --- /dev/null +++ b/docs/pot/maintain-hypervisors-on-hosts.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Maintaining Hypervisors on Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When running hypervisor software on hosts, be sure all the hotfixes provided by the hypervisor vendor are applied. Track the release of hypervisor patches through your hypervisor vendor’s support channel, and apply patches as soon as possible after they are released. &PRODUCT; will not track or notify you of required hypervisor patches. It is essential that your hosts are completely up to date with the provided hypervisor patches. The hypervisor vendor is likely to refuse to support any system that is not up to date with patches." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The lack of up-do-date hotfixes can lead to data corruption and lost VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(XenServer) For more information, see Highly Recommended Hotfixes for XenServer in the &PRODUCT; Knowledge Base" +msgstr "" + diff --git a/docs/pot/maintenance-mode-for-primary-storage.pot b/docs/pot/maintenance-mode-for-primary-storage.pot new file mode 100644 index 00000000000..85363ce5713 --- /dev/null +++ b/docs/pot/maintenance-mode-for-primary-storage.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Maintenance Mode for Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Primary storage may be placed into maintenance mode. This is useful, for example, to replace faulty RAM in a storage device. Maintenance mode for a storage device will first stop any new guests from being provisioned on the storage device. Then it will stop all guests that have any volume on that storage device. When all such guests are stopped the storage device is in maintenance mode and may be shut down. When the storage device is online again you may cancel maintenance mode for the device. The &PRODUCT; will bring the device back online and attempt to start all guests that were running at the time of the entry into maintenance mode." +msgstr "" + diff --git a/docs/pot/making-api-request.pot b/docs/pot/making-api-request.pot new file mode 100644 index 00000000000..a3faea0b69a --- /dev/null +++ b/docs/pot/making-api-request.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Making API Requests" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All &PRODUCT; API requests are submitted in the form of a HTTP GET/POST with an associated command and any parameters. A request is composed of the following whether in HTTP or HTTPS:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; API URL: This is the web services API entry point(for example, http://www.cloud.com:8080/client/api)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Command: The web services command you wish to execute, such as start a virtual machine or create a disk volume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Parameters: Any additional required or optional parameters for the command" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A sample API GET request looks like the following:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://localhost:8080/client/api?command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=2&zoneId=4&apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ&signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Or in a more readable format:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"1. http://localhost:8080/client/api\n" +"2. ?command=deployVirtualMachine\n" +"3. &serviceOfferingId=1\n" +"4. &diskOfferingId=1\n" +"5. &templateId=2\n" +"6. &zoneId=4\n" +"7. &apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXqjB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ\n" +"8. &signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The first line is the &PRODUCT; API URL. This is the Cloud instance you wish to interact with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The second line refers to the command you wish to execute. In our example, we are attempting to deploy a fresh new virtual machine. It is preceded by a (?) to separate itself from the &PRODUCT; API URL." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Lines 3-6 are the parameters for this given command. To see the command and its request parameters, please refer to the appropriate section in the &PRODUCT; API documentation. Each parameter field-value pair (field=value) is preceded by an ampersand character (&)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Line 7 is the user API Key that uniquely identifies the account. See Signing API Requests on page 7." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Line 8 is the signature hash created to authenticate the user account executing the API command. See Signing API Requests on page 7." +msgstr "" + diff --git a/docs/pot/manage-cloud.pot b/docs/pot/manage-cloud.pot new file mode 100644 index 00000000000..a263fef34c9 --- /dev/null +++ b/docs/pot/manage-cloud.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Managing the Cloud" +msgstr "" + diff --git a/docs/pot/management-server-install-client.pot b/docs/pot/management-server-install-client.pot new file mode 100644 index 00000000000..e663f7f213a --- /dev/null +++ b/docs/pot/management-server-install-client.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install the Management Server on the First Host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The first step in installation, whether you are installing the Management Server on one host or many, is to install the software on a single node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are planning to install the Management Server on multiple nodes for high availability, do not proceed to the additional nodes yet. That step will come later." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Management server can be installed using either RPM or DEB packages. These packages will depend on everything you need to run the Management server." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Downloading vhd-util" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This procedure is required only for installations where XenServer is installed on the hypervisor hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before setting up the Management Server, download vhd-util from vhd-util." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the Management Server is RHEL or CentOS, copy vhd-util to /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the Management Server is Ubuntu, copy vhd-util to /usr/lib/cloud/common/scripts/vm/hypervisor/xenserver/vhd-util." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Install on CentOS/RHEL" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We start by installing the required packages:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "yum install cloud-client" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Install on Ubuntu" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "apt-get install cloud-client" +msgstr "" + diff --git a/docs/pot/management-server-install-complete.pot b/docs/pot/management-server-install-complete.pot new file mode 100644 index 00000000000..a171be6f1d6 --- /dev/null +++ b/docs/pot/management-server-install-complete.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Installation Complete! Next Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Congratulations! You have now installed &PRODUCT; Management Server and the database it uses to persist system data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "What should you do next?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Even without adding any cloud infrastructure, you can run the UI to get a feel for what's offered and how you will interact with &PRODUCT; on an ongoing basis. See Log In to the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you're ready, add the cloud infrastructure and try running some virtual machines on it, so you can watch how &PRODUCT; manages the infrastructure. See Provision Your Cloud Infrastructure." +msgstr "" + diff --git a/docs/pot/management-server-install-db-external.pot b/docs/pot/management-server-install-db-external.pot new file mode 100644 index 00000000000..7b0f6474c56 --- /dev/null +++ b/docs/pot/management-server-install-db-external.pot @@ -0,0 +1,219 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install the Database on a Separate Node" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section describes how to install MySQL on a standalone machine, separate from the Management Server. This technique is intended for a deployment that includes several Management Server nodes. If you have a single-node Management Server deployment, you will typically use the same node for MySQL. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The management server doesn't require a specific distribution for the MySQL node. You can use a distribution or Operating System of your choice. Using the same distribution as the management server is recommended, but not required. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install MySQL from the package repository from your distribution:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "yum install mysql-server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "apt-get install mysql-server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the MySQL configuration (/etc/my.cnf or /etc/mysql/my.cnf, depending on your OS) and insert the following lines in the [mysqld] section. You can put these lines below the datadir line. The max_connections parameter should be set to 350 multiplied by the number of Management Servers you are deploying. This example assumes two Management Servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu, you can also create /etc/mysql/conf.d/cloudstack.cnf file and add these directives there. Don't forget to add [mysqld] on the first line of the file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "innodb_rollback_on_timeout=1\n" +"innodb_lock_wait_timeout=600\n" +"max_connections=700\n" +"log-bin=mysql-bin\n" +"binlog-format = 'ROW'\n" +"bind-address = 0.0.0.0" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start or restart MySQL to put the new configuration into effect." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL/CentOS, MySQL doesn't automatically start after installation. Start it manually." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service mysqld start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu, restart MySQL." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service mysqld restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(CentOS and RHEL only; not required on Ubuntu)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL and CentOS, MySQL does not set a root password by default. It is very strongly recommended that you set a root password as a security precaution." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command to secure your installation. You can answer \"Y\" to all questions except \"Disallow root login remotely?\". Remote root login is required to set up the databases." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysql_secure_installation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If a firewall is present on the system, open TCP port 3306 so external MySQL connections can be established." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu, UFW is the default firewall. Open the port with this command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ufw allow mysql" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL/CentOS:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the /etc/sysconfig/iptables file and add the following line at the beginning of the INPUT chain." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "-A INPUT -p tcp --dport 3306 -j ACCEPT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now reload the iptables rules." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service iptables restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Return to the root shell on your first Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up the database. The following command creates the cloud user on the database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In dbpassword, specify the password to be assigned to the cloud user. You can choose to provide no password." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In deploy-as, specify the username and password of the user deploying the database. In the following command, it is assumed the root user is deploying the database and creating the cloud user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For encryption_type, use file or web to indicate the technique used to pass in the database encryption password. Default: file. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For management_server_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; properties file. Default: password. It is highly recommended that you replace this with a more secure value. See About Password and Key Encryption." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For database_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; database. Default: password. It is highly recommended that you replace this with a more secure value. See ." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "cloud-setup-databases cloud:<dbpassword>@<ip address mysql server> \\\n" +"--deploy-as=root:<password> \\\n" +"-e <encryption_type> \\\n" +"-m <management_server_key> \\\n" +"-k <database_key>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When this script is finished, you should see a message like “Successfully initialized the database.â€" +msgstr "" + diff --git a/docs/pot/management-server-install-db-local.pot b/docs/pot/management-server-install-db-local.pot new file mode 100644 index 00000000000..36af4d0ff0e --- /dev/null +++ b/docs/pot/management-server-install-db-local.pot @@ -0,0 +1,198 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install the Database on the Management Server Node" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section describes how to install MySQL on the same machine with the Management Server. This technique is intended for a simple deployment that has a single Management Server node. If you have a multi-node Management Server deployment, you will typically use a separate node for MySQL. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install MySQL from the package repository from your distribution:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "yum install mysql-server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "apt-get install mysql-server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the MySQL configuration (/etc/my.cnf or /etc/mysql/my.cnf, depending on your OS) and insert the following lines in the [mysqld] section. You can put these lines below the datadir line. The max_connections parameter should be set to 350 multiplied by the number of Management Servers you are deploying. This example assumes one Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu, you can also create a file /etc/mysql/conf.d/cloudstack.cnf and add these directives there. Don't forget to add [mysqld] on the first line of the file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "innodb_rollback_on_timeout=1\n" +"innodb_lock_wait_timeout=600\n" +"max_connections=350\n" +"log-bin=mysql-bin\n" +"binlog-format = 'ROW'" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start or restart MySQL to put the new configuration into effect." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL/CentOS, MySQL doesn't automatically start after installation. Start it manually." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service mysqld start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu, restart MySQL." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service mysqld restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(CentOS and RHEL only; not required on Ubuntu)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL and CentOS, MySQL does not set a root password by default. It is very strongly recommended that you set a root password as a security precaution." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command to secure your installation. You can answer \"Y\" to all questions." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysql_secure_installation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up the database. The following command creates the \"cloud\" user on the database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In dbpassword, specify the password to be assigned to the \"cloud\" user. You can choose to provide no password although that is not recommended." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In deploy-as, specify the username and password of the user deploying the database. In the following command, it is assumed the root user is deploying the database and creating the \"cloud\" user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For encryption_type, use file or web to indicate the technique used to pass in the database encryption password. Default: file. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For management_server_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; properties file. Default: password. It is highly recommended that you replace this with a more secure value. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) For database_key, substitute the default key that is used to encrypt confidential parameters in the &PRODUCT; database. Default: password. It is highly recommended that you replace this with a more secure value. See ." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "cloud-setup-databases cloud:<dbpassword>@localhost \\\n" +"--deploy-as=root:<password> \\\n" +"-e <encryption_type> \\\n" +"-m <management_server_key> \\\n" +"-k <database_key>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When this script is finished, you should see a message like “Successfully initialized the database.â€" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are running the KVM hypervisor on the same machine with the Management Server, edit /etc/sudoers and add the following line:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "Defaults:cloud !requiretty" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This type of single-machine setup is recommended only for a trial installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that the database is set up, you can finish configuring the OS for the Management Server. This command will set up iptables, sudoers, and start the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cloud-setup-management" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should see the message “&PRODUCT; Management Server setup is done.â€" +msgstr "" + diff --git a/docs/pot/management-server-install-db.pot b/docs/pot/management-server-install-db.pot new file mode 100644 index 00000000000..cca61e42ac4 --- /dev/null +++ b/docs/pot/management-server-install-db.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Install the database server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; management server uses a MySQL database server to store its data. When you are installing the management server on a single node, you can install the MySQL server locally. For an installation that has multiple management server nodes, we assume the MySQL database also runs on a separate node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; has been tested with MySQL 5.1 and 5.5. These versions are included in RHEL/CentOS and Ubuntu." +msgstr "" + diff --git a/docs/pot/management-server-install-flow.pot b/docs/pot/management-server-install-flow.pot new file mode 100644 index 00000000000..43c2a0cc68e --- /dev/null +++ b/docs/pot/management-server-install-flow.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Management Server Installation" +msgstr "" + diff --git a/docs/pot/management-server-install-multi-node.pot b/docs/pot/management-server-install-multi-node.pot new file mode 100644 index 00000000000..22d80b6f21d --- /dev/null +++ b/docs/pot/management-server-install-multi-node.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare and Start Additional Management Servers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For your second and subsequent Management Servers, you will install the Management Server software, connect it to the database, and set up the OS for the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Perform the steps in and or as appropriate." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This step is required only for installations where XenServer is installed on the hypervisor hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download vhd-util from vhd-util" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the Management Server is RHEL or CentOS, copy vhd-util to /usr/lib64/cloud/common/scripts/vm/hypervisor/xenserver." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the Management Server is Ubuntu, copy vhd-util to /usr/lib/cloud/common/scripts/vm/hypervisor/xenserver/vhd-util." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that necessary services are started and set to start on boot." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service rpcbind start\n" +"# service nfs start\n" +"# chkconfig nfs on\n" +"# chkconfig rpcbind on\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the database client. Note the absence of the --deploy-as argument in this case. (For more details about the arguments to this command, see .)" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cloud-setup-databases cloud:dbpassword@dbhost -e encryption_type -m management_server_key -k database_key\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure the OS and start the Management Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cloud-setup-management" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server on this node should now be running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps on each additional Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure to configure a load balancer for the Management Servers. See Management Server Load Balancing." +msgstr "" + diff --git a/docs/pot/management-server-install-nfs-shares.pot b/docs/pot/management-server-install-nfs-shares.pot new file mode 100644 index 00000000000..b269c4955e7 --- /dev/null +++ b/docs/pot/management-server-install-nfs-shares.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:58\n" +"PO-Revision-Date: 2013-02-02T20:11:58\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare NFS Shares" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; needs a place to keep primary and secondary storage (see Cloud Infrastructure Overview). Both of these can be NFS shares. This section tells how to set up the NFS shares before adding the storage to &PRODUCT;." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Alternative Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS is not the only option for primary or secondary storage. For example, you may use a Ceph RDB cluster, GlusterFS, iSCSI, and otthers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The requirements for primary and secondary storage are described in:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A production installation typically uses a separate NFS server. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can also use the Management Server node as the NFS server. This is more typical of a trial installation, but is technically possible in a larger deployment. See ." +msgstr "" + diff --git a/docs/pot/management-server-install-overview.pot b/docs/pot/management-server-install-overview.pot new file mode 100644 index 00000000000..5eb76440894 --- /dev/null +++ b/docs/pot/management-server-install-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Management Server Installation Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section describes installing the Management Server. There are two slightly different installation flows, depending on how many Management Server nodes will be in your cloud:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A single Management Server node, with MySQL on the same node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multiple Management Server nodes, with MySQL on a node separate from the Management Servers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In either case, each machine must meet the system requirements described in System Requirements." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the sake of security, be sure the public Internet can not access port 8096 or port 8250 on the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The procedure for installing the Management Server is:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the Operating System" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(XenServer only) Download and install vhd-util." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the First Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install and Configure the MySQL database" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare NFS Shares" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare and Start Additional Management Servers (optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the System VM Template" +msgstr "" + diff --git a/docs/pot/management-server-install-prepare-os.pot b/docs/pot/management-server-install-prepare-os.pot new file mode 100644 index 00000000000..e8360ff6800 --- /dev/null +++ b/docs/pot/management-server-install-prepare-os.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare the Operating System" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The OS must be prepared to host the Management Server using the following steps. These steps must be performed on each Management Server node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to your OS as root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check for a fully qualified hostname." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "hostname --fqdn" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This should return a fully qualified hostname such as \"managament1.lab.example.org\". If it does not, edit /etc/hosts so that it does." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure that the machine can reach the Internet." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ping www.cloudstack.org" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Turn on NTP for time synchronization." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NTP is required to synchronize the clocks of the servers in your cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install NTP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On RHEL or CentOS:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "yum install ntp" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "apt-get install openntpd" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat all of these steps on every host where the Management Server will be installed." +msgstr "" + diff --git a/docs/pot/management-server-install-systemvm.pot b/docs/pot/management-server-install-systemvm.pot new file mode 100644 index 00000000000..d6d238c049b --- /dev/null +++ b/docs/pot/management-server-install-systemvm.pot @@ -0,0 +1,111 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare the System VM Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage must be seeded with a template that is used for &PRODUCT; system VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Management Server, run one or more of the following cloud-install-sys-tmplt commands to retrieve and decompress the system VM template. Run the command for each hypervisor type that you expect end users to run in this Zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If your secondary storage mount point is not named /mnt/secondary, substitute your own mount point name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you set the &PRODUCT; database encryption type to \"web\" when you set up the database, you must now add the parameter -s <management-server-secret-key>. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This process will require approximately 5 GB of free space on the local file system and up to 30 minutes each time it runs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2 -h xenserver -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/burbank/burbank-systemvm-08012012.ova -h vmware -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2 -h kvm -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using a separate NFS server, perform this step. If you are using the Management Server as the NFS server, you MUST NOT perform this step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the script has finished, unmount secondary storage and remove the created directory." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# umount /mnt/secondary\n" +"# rmdir /mnt/secondary" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps for each secondary storage server." +msgstr "" + diff --git a/docs/pot/management-server-lb.pot b/docs/pot/management-server-lb.pot new file mode 100644 index 00000000000..df9ded46302 --- /dev/null +++ b/docs/pot/management-server-lb.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Zone VLAN and Running VM Maximums" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; can use a load balancer to provide a virtual IP for multiple Management Servers. The administrator is responsible for creating the load balancer rules for the Management Servers. The application requires persistence or stickiness across multiple sessions. The following chart lists the ports that should be load balanced and whether or not persistence is required." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Even if persistence is not required, enabling it is permitted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source Port" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Destination Port" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Persistence Required?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "80 or 443" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "8080 (or 20400 with AJP)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "HTTP (or AJP)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Yes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "8250" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "8096" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "HTTP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "No" +msgstr "" + diff --git a/docs/pot/management-server-overview.pot b/docs/pot/management-server-overview.pot new file mode 100644 index 00000000000..0f79f5e856a --- /dev/null +++ b/docs/pot/management-server-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Management Server Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server is the &PRODUCT; software that manages cloud resources. By interacting with the Management Server through its UI or API, you can configure and manage your cloud infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server runs on a dedicated server or VM. It controls allocation of virtual machines to hosts and assigns storage and IP addresses to the virtual machine instances. The Management Server runs in a Tomcat container and requires a MySQL database for persistence." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The machine must meet the system requirements described in System Requirements." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provides the web user interface for the administrator and a reference user interface for end users." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provides the APIs for &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Manages the assignment of guest VMs to particular hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Manages the assignment of public and private IP addresses to particular accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Manages the allocation of storage to guests as virtual disks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Manages snapshots, templates, and ISO images, possibly replicating them across data centers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provides a single point of configuration for the cloud." +msgstr "" + diff --git a/docs/pot/manual-live-migration.pot b/docs/pot/manual-live-migration.pot new file mode 100644 index 00000000000..80043620c32 --- /dev/null +++ b/docs/pot/manual-live-migration.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Moving VMs Between Hosts (Manual Live Migration)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator can move a running VM from one host to another without interrupting service to users or going into maintenance mode. This is called manual live migration, and can be done under the following conditions:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The root administrator is logged in. Domain admins and users can not perform manual live migration of VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VM is running. Stopped VMs can not be live migrated." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The destination host must be in the same cluster as the original host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VM must not be using local disk storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The destination host must have enough available capacity. If not, the VM will remain in the \"migrating\" state until memory becomes available." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To manually live migrate a virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose the VM that you want to migrate." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Migrate Instance button Migrateinstance.png: button to migrate an instance " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "From the list of hosts, choose the one to which you want to move the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/marvin.pot b/docs/pot/marvin.pot new file mode 100644 index 00000000000..f693be5c0a0 --- /dev/null +++ b/docs/pot/marvin.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Marvin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Marvin is the &PRODUCT; automation framework. It originated as a tool for integration testing but is now also used to build DevCloud as well as to provide a Python &PRODUCT; API binding." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Marvin's complete documenation is on the wiki at https://cwiki.apache.org/CLOUDSTACK/testing-with-python.html" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The source code is located at tools/marvin" +msgstr "" + diff --git a/docs/pot/max-result-page-returned.pot b/docs/pot/max-result-page-returned.pot new file mode 100644 index 00000000000..031e59f2916 --- /dev/null +++ b/docs/pot/max-result-page-returned.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Maximum Result Pages Returned" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For each cloud, there is a default upper limit on the number of results that any API command will return in a single page. This is to help prevent overloading the cloud servers and prevent DOS attacks. For example, if the page size limit is 500 and a command returns 10,000 results, the command will return 20 pages." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default page size limit can be different for each cloud. It is set in the global configuration parameter default.page.size. If your cloud has many users with lots of VMs, you might need to increase the value of this parameter. At the same time, be careful not to set it so high that your site can be taken down by an enormous return from an API call. For more information about how to set global configuration parameters, see \"Describe Your Deployment\" in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To decrease the page size limit for an individual API command, override the global setting with the page and pagesize parameters, which are available in any list* command (listCapabilities, listDiskOfferings, etc.)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both parameters must be specified together." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The value of the pagesize parameter must be smaller than the value of default.page.size. That is, you can not increase the number of possible items in a result page, only decrease it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For syntax information on the list* commands, see the API Reference." +msgstr "" + diff --git a/docs/pot/migrate-datadisk-volume-new-storage-pool.pot b/docs/pot/migrate-datadisk-volume-new-storage-pool.pot new file mode 100644 index 00000000000..d9e2f9716b9 --- /dev/null +++ b/docs/pot/migrate-datadisk-volume-new-storage-pool.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Migrating a Data Disk Volume to a New Storage Pool" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Detach the data disk from the VM. See Detaching and Moving Volumes (but skip the “reattach†step at the end. You will do that after migrating to new storage)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Call the &PRODUCT; API command migrateVolume and pass in the volume ID and the ID of any storage pool in the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch for the volume status to change to Migrating, then back to Ready." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Attach the volume to any desired VM running in the same cluster as the new storage server. See Attaching a Volume " +msgstr "" + diff --git a/docs/pot/migrate-vm-rootvolume-volume-new-storage-pool.pot b/docs/pot/migrate-vm-rootvolume-volume-new-storage-pool.pot new file mode 100644 index 00000000000..7da0f8d0751 --- /dev/null +++ b/docs/pot/migrate-vm-rootvolume-volume-new-storage-pool.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Migrating a VM Root Volume to a New Storage Pool" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When migrating the root disk volume, the VM must first be stopped, and users can not access the VM. After migration is complete, the VM can be restarted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as a user or admin." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Detach the data disk from the VM. See Detaching and Moving Volumes (but skip the “reattach†step at the end. You will do that after migrating to new storage)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Call the &PRODUCT; API command migrateVirtualMachine with the ID of the VM to migrate and the IDs of a destination host and destination storage pool in the same zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch for the VM status to change to Migrating, then back to Stopped." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the VM." +msgstr "" + diff --git a/docs/pot/minimum-system-requirements.pot b/docs/pot/minimum-system-requirements.pot new file mode 100644 index 00000000000..c7862b4b6e1 --- /dev/null +++ b/docs/pot/minimum-system-requirements.pot @@ -0,0 +1,150 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Minimum System Requirements" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Management Server, Database, and Storage System Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The machines that will run the Management Server and MySQL database must meet the following requirements. The same machines can also be used to provide primary and secondary storage, such as via localdisk or NFS. The Management Server may be placed on a virtual machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Operating system:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Preferred: CentOS/RHEL 6.3+ or Ubuntu 12.04(.1)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "64-bit x86 CPU (more cores results in better performance)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4 GB of memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "50 GB of local disk (When running secondary storage on the management server 500GB is recommended)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At least 1 NIC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Statically allocated IP address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fully qualified domain name as returned by the hostname command" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Host/Hypervisor System Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host is where the cloud services run in the form of guest virtual machines. Each host is one machine that meets the following requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Must support HVM (Intel-VT or AMD-V enabled)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hardware virtualization support required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "36 GB of local disk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If DHCP is used for hosts, ensure that no conflict occurs between DHCP server used for these hosts and the DHCP router created by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Latest hotfixes applied to hypervisor software" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you deploy &PRODUCT;, the hypervisor host must not have any VMs already running" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts within a cluster must be homogenous. The CPUs must be of the same type, count, and feature flags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts have additional requirements depending on the hypervisor. See the requirements listed at the top of the Installation section for your chosen hypervisor:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure you fulfill the additional hypervisor requirements and installation steps provided in this Guide. Hypervisor hosts must be properly prepared to work with CloudStack. For example, the requirements for XenServer are listed under Citrix XenServer Installation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/pot/modify-delete-service-offerings.pot b/docs/pot/modify-delete-service-offerings.pot new file mode 100644 index 00000000000..02835318331 --- /dev/null +++ b/docs/pot/modify-delete-service-offerings.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Modifying or Deleting a Service Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Service offerings cannot be changed once created. This applies to both compute offerings and disk offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A service offering can be deleted. If it is no longer in use, it is deleted immediately and permanently. If the service offering is still in use, it will remain in the database until all the virtual machines referencing it have been deleted. After deletion by the administrator, a service offering will not be available to end users that are creating new instances." +msgstr "" + diff --git a/docs/pot/multi_node_management_server.pot b/docs/pot/multi_node_management_server.pot new file mode 100644 index 00000000000..edada3cbebe --- /dev/null +++ b/docs/pot/multi_node_management_server.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Multi-Node Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Management Server is deployed on one or more front-end servers connected to a single MySQL database. Optionally a pair of hardware load balancers distributes requests from the web. A backup management server set may be deployed using MySQL replication at a remote site to add DR capabilities." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator must decide the following." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Whether or not load balancers will be used." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "How many Management Servers will be deployed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Whether MySQL replication will be deployed to enable disaster recovery." +msgstr "" + diff --git a/docs/pot/multi_node_overview.pot b/docs/pot/multi_node_overview.pot new file mode 100644 index 00000000000..c67e8a79233 --- /dev/null +++ b/docs/pot/multi_node_overview.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Management Server Multi-Node Installation Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section describes installing multiple Management Servers and installing MySQL on a node separate from the Management Servers. The machines must meet the system requirements described in System Requirements." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the sake of security, be sure the public Internet can not access port 8096 or port 8250 on the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The procedure for a multi-node installation is:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the Operating System" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the First Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install and Configure the Database" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare NFS Shares" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare and Start Additional Management Servers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare the System VM Template" +msgstr "" + diff --git a/docs/pot/multi_site_deployment.pot b/docs/pot/multi_site_deployment.pot new file mode 100644 index 00000000000..822c64a19ea --- /dev/null +++ b/docs/pot/multi_site_deployment.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Multi-Site Deployment" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; platform scales well into multiple sites through the use of zones. The following diagram shows an example of a multi-site deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Data Center 1 houses the primary Management Server as well as zone 1. The MySQL database is replicated in real time to the secondary Management Server installation in Data Center 2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This diagram illustrates a setup with a separate storage network. Each server has four NICs, two connected to pod-level network switches and two connected to storage network switches." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are two ways to configure the storage network:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Bonded NIC and redundant switches can be deployed for NFS. In NFS deployments, redundant switches and bonded NICs still result in one network (one CIDR block+ default gateway address)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "iSCSI can take advantage of two separate storage networks (two CIDR blocks each with its own default gateway). Multipath iSCSI client can failover and load balance between separate storage networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This diagram illustrates the differences between NIC bonding and Multipath I/O (MPIO). NIC bonding configuration involves only one network. MPIO involves two separate networks." +msgstr "" + diff --git a/docs/pot/multiple-system-vm-vmware.pot b/docs/pot/multiple-system-vm-vmware.pot new file mode 100644 index 00000000000..1ef8e4357fa --- /dev/null +++ b/docs/pot/multiple-system-vm-vmware.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Multiple System VM Support for VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Every &PRODUCT; zone has single System VM for template processing tasks such as downloading templates, uploading templates, and uploading ISOs. In a zone where VMware is being used, additional System VMs can be launched to process VMware-specific tasks such as taking snapshots and creating private templates. The &PRODUCT; management server launches additional System VMs for VMware-specific tasks as the load increases. The management server monitors and weights all commands sent to these System VMs and performs dynamic load balancing and scaling-up of more System VMs." +msgstr "" + diff --git a/docs/pot/network-offering-usage-record-format.pot b/docs/pot/network-offering-usage-record-format.pot new file mode 100644 index 00000000000..b50371eb7ef --- /dev/null +++ b/docs/pot/network-offering-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Offering Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage – String representation of the usage, including the units of usage (e.g. 'Hrs' for hours)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – ID of the network offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "offeringid – Network offering ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "virtualMachineId – The ID of the virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/network-offerings.pot b/docs/pot/network-offerings.pot new file mode 100644 index 00000000000..5493e2bdcbe --- /dev/null +++ b/docs/pot/network-offerings.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the most up-to-date list of supported network services, see the &PRODUCT; UI or call listNetworkServices." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A network offering is a named set of network services, such as:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DHCP" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "DNS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Source NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Static NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Port Forwarding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Load Balancing" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Firewall" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Optional) Name one of several available providers to use for a given service, such as Juniper for the firewall" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) Network tag to specify which physical network to use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When creating a new VM, the user chooses one of the available network offerings, and that determines which network services the VM can use." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator can create any number of custom network offerings, in addition to the default network offerings provided by &PRODUCT;. By creating multiple custom network offerings, you can set up your cloud to offer different classes of service on a single multi-tenant physical network. For example, while the underlying physical wiring may be the same for two tenants, tenant A may only need simple firewall protection for their website, while tenant B may be running a web server farm and require a scalable firewall solution, load balancing solution, and alternate networks for accessing the database backend." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you create load balancing rules while using a network service offering that includes an external load balancer device such as NetScaler, and later change the network service offering to one that uses the &PRODUCT; virtual router, you must create a firewall rule on the virtual router for each of your existing load balancing rules so that they continue to function." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When creating a new virtual network, the &PRODUCT; administrator chooses which network offering to enable for that network. Each virtual network is associated with one network offering. A virtual network can be upgraded or downgraded by changing its associated network offering. If you do this, be sure to reprogram the physical network to match." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; also has internal network offerings for use by &PRODUCT; system VMs. These network offerings are not visible to users but can be modified by administrators." +msgstr "" + diff --git a/docs/pot/network-rate.pot b/docs/pot/network-rate.pot new file mode 100644 index 00000000000..ca9784b9c0d --- /dev/null +++ b/docs/pot/network-rate.pot @@ -0,0 +1,195 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Throttling" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network throttling is the process of controlling the network access and bandwidth usage based on certain rules. &PRODUCT; controls this behaviour of the guest networks in the cloud by using the network rate parameter. This parameter is defined as the default data transfer rate in Mbps (Megabits Per Second) allowed in a guest network. It defines the upper limits for network utilization. If the current utilization is below the allowed upper limits, access is granted, else revoked." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can throttle the network bandwidth either to control the usage above a certain limit for some accounts, or to control network congestion in a large cloud environment. The network rate for your cloud can be configured on the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Service Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Global parameter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If network rate is set to NULL in service offering, the value provided in the vm.network.throttling.rate global parameter is applied. If the value is set to NULL for network offering, the value provided in the network.throttling.rate global parameter is considered." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the default public, storage, and management networks, network rate is set to 0. This implies that the public, storage, and management networks will have unlimited bandwidth by default. For default guest networks, network rate is set to NULL. In this case, network rate is defaulted to the global parameter value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table gives you an overview of how network rate is applied on different types of networks in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Rate Is Taken from" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest network of Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Guest Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public network of Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage network of Secondary Storage VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System Network Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management network of Secondary Storage VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage network of Console Proxy VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management network of Console Proxy VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage network of Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management network of Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public network of Secondary Storage VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public network of Console Proxy VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default network of a guest VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Compute Offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional networks of a guest VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Corresponding Network Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A guest VM must have a default network, and can also have many additional networks. Depending on various parameters, such as the host and virtual switch used, you can observe a difference in the network rate in your cloud. For example, on a VMware host the actual network rate varies based on where they are configured (compute offering, network offering, or both); the network type (shared or isolated); and traffic direction (ingress or egress)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The network rate set for a network offering used by a particular network in &PRODUCT; is used for the traffic shaping policy of a port group, for example: port group A, for that network: a particular subnet or VLAN on the actual network. The virtual routers for that network connects to the port group A, and by default instances in that network connects to this port group. However, if an instance is deployed with a compute offering with the network rate set, and if this rate is used for the traffic shaping policy of another port group for the network, for example port group B, then instances using this compute offering are connected to the port group B, instead of connecting to port group A." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The traffic shaping policy on standard port groups in VMware only applies to the egress traffic, and the net effect depends on the type of network used in &PRODUCT;. In shared networks, ingress traffic is unlimited for &PRODUCT;, and egress traffic is limited to the rate that applies to the port group used by the instance if any. If the compute offering has a network rate configured, this rate applies to the egress traffic, otherwise the network rate set for the network offering applies. For isolated networks, the network rate set for the network offering, if any, effectively applies to the ingress traffic. This is mainly because the network rate set for the network offering applies to the egress traffic from the virtual router to the instance. The egress traffic is limited by the rate that applies to the port group used by the instance if any, similar to shared networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network rate of network offering = 10 Mbps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network rate of compute offering = 200 Mbps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In shared networks, ingress traffic will not be limited for &PRODUCT;, while egress traffic will be limited to 200 Mbps. In an isolated network, ingress traffic will be limited to 10 Mbps and egress to 200 Mbps." +msgstr "" + diff --git a/docs/pot/network-service-providers.pot b/docs/pot/network-service-providers.pot new file mode 100644 index 00000000000..7bdf8d7998a --- /dev/null +++ b/docs/pot/network-service-providers.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Service Providers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the most up-to-date list of supported network service providers, see the &PRODUCT; UI or call listNetworkServiceProviders." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A service provider (also called a network element) is hardware or virtual appliance that makes a network service possible; for example, a firewall appliance can be installed in the cloud to provide firewall service. On a single network, multiple providers can provide the same network service. For example, a firewall service may be provided by Cisco or Juniper devices in the same physical network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can have multiple instances of the same service provider in a network (say, more than one Juniper SRX device)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If different providers are set up to provide the same service on the network, the administrator can create network offerings so users can specify which network service provider they prefer (along with the other choices offered in network offerings). Otherwise, &PRODUCT; will choose which provider to use whenever the service is called for." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Supported Network Service Providers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; ships with an internal list of the supported service providers, and you can choose from this list when creating a network offering." +msgstr "" + diff --git a/docs/pot/network-setup.pot b/docs/pot/network-setup.pot new file mode 100644 index 00000000000..37153fb6de9 --- /dev/null +++ b/docs/pot/network-setup.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Achieving the correct networking setup is crucial to a successful &PRODUCT; installation. This section contains information to help you make decisions and follow the right procedures to get your network set up correctly." +msgstr "" + diff --git a/docs/pot/network-usage-record-format.pot b/docs/pot/network-usage-record-format.pot new file mode 100644 index 00000000000..75d6481534d --- /dev/null +++ b/docs/pot/network-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Network Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For network usage (bytes sent/received), the following fields exist in a usage record." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – Device ID (virtual router ID or external device ID)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "type – Device type (domain router, external load balancer, etc.)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/networking-in-a-pod.pot b/docs/pot/networking-in-a-pod.pot new file mode 100644 index 00000000000..3cbf807cfe0 --- /dev/null +++ b/docs/pot/networking-in-a-pod.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Networking in a Pod" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Figure 2 illustrates network setup within a single pod. The hosts are connected to a pod-level switch. At a minimum, the hosts should have one physical uplink to each switch. Bonded NICs are supported as well. The pod-level switch is a pair of redundant gigabit switches with 10 G uplinks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Servers are connected as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage devices are connected to only the network that carries management traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts are connected to networks for both management traffic and public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts are also connected to one or more networks carrying guest traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "We recommend the use of multiple physical Ethernet cards to implement each network interface as well as redundant switch fabric in order to maximize throughput and improve reliability." +msgstr "" + diff --git a/docs/pot/networking-in-a-zone.pot b/docs/pot/networking-in-a-zone.pot new file mode 100644 index 00000000000..99481c81b27 --- /dev/null +++ b/docs/pot/networking-in-a-zone.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Networking in a Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Figure 3 illustrates the network setup within a single zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A firewall for management traffic operates in the NAT mode. The network typically is assigned IP addresses in the 192.168.0.0/16 Class B private address space. Each pod is assigned IP addresses in the 192.168.*.0/24 Class C private address space." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each zone has its own set of public IP addresses. Public IP addresses from different zones do not overlap." +msgstr "" + diff --git a/docs/pot/networking-overview.pot b/docs/pot/networking-overview.pot new file mode 100644 index 00000000000..24c56a960a2 --- /dev/null +++ b/docs/pot/networking-overview.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Networking Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; offers two types of networking scenario:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Basic. For AWS-style networking. Provides a single network where guest isolation can be provided through layer-3 means such as security groups (IP address source filtering)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Advanced. For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more details, see Network Setup." +msgstr "" + diff --git a/docs/pot/networking_overview.pot b/docs/pot/networking_overview.pot new file mode 100644 index 00000000000..aedc7ae3867 --- /dev/null +++ b/docs/pot/networking_overview.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Networking Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack offers two types of networking scenario:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Basic. For AWS-style networking. Provides a single network where guest isolation can be provided through layer-3 means such as security groups (IP address source filtering)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Advanced. For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more details, see Network Setup." +msgstr "" + diff --git a/docs/pot/networks-for-users-overview.pot b/docs/pot/networks-for-users-overview.pot new file mode 100644 index 00000000000..62eed8c41b4 --- /dev/null +++ b/docs/pot/networks-for-users-overview.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Overview of Setting Up Networking for Users" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "People using cloud infrastructure have a variety of needs and preferences when it comes to the networking services provided by the cloud. As a &PRODUCT; administrator, you can do the following things to set up networking for your users:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up physical networks in zones" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up several different providers for the same service on a single physical network (for example, both Cisco and Juniper firewalls)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Bundle different types of network services into network offerings, so users can choose the desired network services for any given virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add new network offerings as time goes on so end users can upgrade to a better class of service on their network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide more ways for a network to be accessed by a user, such as through a project of which the user is a member" +msgstr "" + diff --git a/docs/pot/networks.pot b/docs/pot/networks.pot new file mode 100644 index 00000000000..6f08ba2d5d7 --- /dev/null +++ b/docs/pot/networks.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Managing Networks and Traffic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a &PRODUCT;, guest VMs can communicate with each other using shared infrastructure with the security and user perception that the guests have a private LAN. The &PRODUCT; virtual router is the main component providing networking features for guest traffic." +msgstr "" + diff --git a/docs/pot/nfs-shares-on-management-server.pot b/docs/pot/nfs-shares-on-management-server.pot new file mode 100644 index 00000000000..bec36a1ee5e --- /dev/null +++ b/docs/pot/nfs-shares-on-management-server.pot @@ -0,0 +1,240 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using the Management Server as the NFS Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section tells how to set up NFS shares for primary and secondary storage on the same node with the Management Server. This is more typical of a trial installation, but is technically possible in a larger deployment. It is assumed that you will have less than 16TB of storage on the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The exact commands for the following steps may vary depending on your operating system version." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Ubuntu/Debian systems, you'll need to install the nfs-kernel-server package:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"$ sudo apt-get install nfs-kernel-server\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Management Server host, create two directories that you will use for primary and secondary storage. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# mkdir -p /export/primary\n" +"# mkdir -p /export/secondary\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the new directories as NFS exports, edit /etc/exports. Export the NFS share(s) with rw,async,no_root_squash. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/exports" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Insert the following line." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/export *(rw,async,no_root_squash)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Export the /export directory." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# exportfs -a" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the /etc/sysconfig/nfs file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/sysconfig/nfs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Uncomment the following lines:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"LOCKD_TCPPORT=32803\n" +"LOCKD_UDPPORT=32769\n" +"MOUNTD_PORT=892\n" +"RQUOTAD_PORT=875\n" +"STATD_PORT=662\n" +"STATD_OUTGOING_PORT=2020\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the /etc/sysconfig/iptables file." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/sysconfig/iptables" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add the following lines at the beginning of the INPUT chain where <NETWORK> is the network that you'll be using:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p udp --dport 111 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 111 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 2049 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 32803 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p udp --dport 32769 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 892 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p udp --dport 892 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 875 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p udp --dport 875 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p tcp --dport 662 -j ACCEPT\n" +"-A INPUT -s <NETWORK> -m state --state NEW -p udp --dport 662 -j ACCEPT \n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following commands:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# service iptables restart\n" +"# service iptables save\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If NFS v4 communication is used between client and server, add your domain to /etc/idmapd.conf on both the hypervisor host and Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/idmapd.conf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remove the character # from the beginning of the Domain line in idmapd.conf and replace the value in the file with your own domain. In the example below, the domain is company.com." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "Domain = company.com" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reboot the Management Server host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Two NFS shares called /export/primary and /export/secondary are now set up." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It is recommended that you test to be sure the previous steps have been successful." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the hypervisor host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure NFS and rpcbind are running. The commands might be different depending on your OS. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# service rpcbind start\n" +"# service nfs start\n" +"# chkconfig nfs on\n" +"# chkconfig rpcbind on\n" +"# reboot \n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log back in to the hypervisor host and try to mount the /export directories. For example (substitute your own management server name):" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# mkdir /primarymount\n" +"# mount -t nfs <management-server-name>:/export/primary /primarymount\n" +"# umount /primarymount\n" +"# mkdir /secondarymount\n" +"# mount -t nfs <management-server-name>:/export/secondary /secondarymount\n" +"# umount /secondarymount \n" +" " +msgstr "" + diff --git a/docs/pot/nfs-shares-on-separate-server.pot b/docs/pot/nfs-shares-on-separate-server.pot new file mode 100644 index 00000000000..6dc037a9813 --- /dev/null +++ b/docs/pot/nfs-shares-on-separate-server.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using a Separate NFS Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section tells how to set up NFS shares for secondary and (optionally) primary storage on an NFS server running on a separate node from the Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The exact commands for the following steps may vary depending on your operating system version." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(KVM only) Ensure that no volume is already mounted at your NFS mount point." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the storage server, create an NFS share for secondary storage and, if you are using NFS for primary storage as well, create a second NFS share. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"# mkdir -p /export/primary\n" +"# mkdir -p /export/secondary\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To configure the new directories as NFS exports, edit /etc/exports. Export the NFS share(s) with rw,async,no_root_squash. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# vi /etc/exports" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Insert the following line." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/export *(rw,async,no_root_squash)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Export the /export directory." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# exportfs -a" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the management server, create a mount point for secondary storage. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mkdir -p /mnt/secondary" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Mount the secondary storage on your Management Server. Replace the example NFS server name and NFS share paths below with your own." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# mount -t nfs nfsservername:/nfs/share/secondary /mnt/secondary" +msgstr "" + diff --git a/docs/pot/offerings.pot b/docs/pot/offerings.pot new file mode 100644 index 00000000000..7f22cbed35d --- /dev/null +++ b/docs/pot/offerings.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In this chapter we discuss compute, disk, and system service offerings. Network offerings are discussed in the section on setting up networking for users." +msgstr "" + diff --git a/docs/pot/ongoing-config-of-external-firewalls-lb.pot b/docs/pot/ongoing-config-of-external-firewalls-lb.pot new file mode 100644 index 00000000000..1976fc00f76 --- /dev/null +++ b/docs/pot/ongoing-config-of-external-firewalls-lb.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Ongoing Configuration of External Firewalls and Load Balancers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional user actions (e.g. setting a port forward) will cause further programming of the firewall and load balancer. A user may request additional public IP addresses and forward traffic received at these IPs to specific VMs. This is accomplished by enabling static NAT for a public IP address, assigning the IP to a VM, and specifying a set of protocols and port ranges to open. When a static NAT rule is created, &PRODUCT; programs the zone's external firewall with the following objects:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A static NAT rule that maps the public IP address to the private IP address of a VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A security policy that allows traffic within the set of protocols and port ranges that are specified." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A firewall filter counter that measures the number of bytes of incoming traffic to the public IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The number of incoming and outgoing bytes through source NAT, static NAT, and load balancing rules is measured and saved on each external element. This data is collected on a regular basis and stored in the &PRODUCT; database." +msgstr "" + diff --git a/docs/pot/over-provisioning-service-offering-limits.pot b/docs/pot/over-provisioning-service-offering-limits.pot new file mode 100644 index 00000000000..1be8e13a1af --- /dev/null +++ b/docs/pot/over-provisioning-service-offering-limits.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Over-Provisioning and Service Offering Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; performs CPU over-provisioning based on an over-provisioning ratio configured by the administrator. This is defined by the cpu.overprovisioning.factor global configuration variable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; performs CPU over-provisioning based on an over-provisioning ratio configured by the administrator. This is defined by the cpu.overprovisioning.factor global configuration variable" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Service offerings limits (e.g. 1 GHz, 1 core) are strictly enforced for core count. For example, a guest with a service offering of one core will have only one core available to it regardless of other activity on the Host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Service offering limits for gigahertz are enforced only in the presence of contention for CPU resources. For example, suppose that a guest was created with a service offering of 1 GHz on a Host that has 2 GHz cores, and that guest is the only guest running on the Host. The guest will have the full 2 GHz available to it. When multiple guests are attempting to use the CPU a weighting factor is used to schedule CPU resources. The weight is based on the clock speed in the service offering. Guests receive a CPU allocation that is proportionate to the GHz in the service offering. For example, a guest created from a 2 GHz service offering will receive twice the CPU allocation as a guest created from a 1 GHz service offering. &PRODUCT; does not perform memory over-provisioning." +msgstr "" + diff --git a/docs/pot/ovm-install.pot b/docs/pot/ovm-install.pot new file mode 100644 index 00000000000..aba639b633c --- /dev/null +++ b/docs/pot/ovm-install.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Installing OVM for &PRODUCT;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TODO" +msgstr "" + diff --git a/docs/pot/ovm-requirements.pot b/docs/pot/ovm-requirements.pot new file mode 100644 index 00000000000..263f46ebf38 --- /dev/null +++ b/docs/pot/ovm-requirements.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Requirements for OVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TODO" +msgstr "" + diff --git a/docs/pot/per-domain-limits.pot b/docs/pot/per-domain-limits.pot new file mode 100644 index 00000000000..4ac3828d230 --- /dev/null +++ b/docs/pot/per-domain-limits.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Per-Domain Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; allows the configuration of limits on a domain basis. With a domain limit in place, all users still have their account limits. They are additionally limited, as a group, to not exceed the resource limits set on their domain. Domain limits aggregate the usage of all accounts in the domain as well as all accounts in all subdomains of that domain. Limits set at the root domain level apply to the sum of resource usage by the accounts in all domains and sub-domains below that root domain." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set a domain limit:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation tree, click Domains." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the domain you want to modify. The current domain limits are displayed. A value of -1 shows that there is no limit in place." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Edit button editbutton.png: edits the settings. " +msgstr "" + diff --git a/docs/pot/performance-monitoring.pot b/docs/pot/performance-monitoring.pot new file mode 100644 index 00000000000..b5afcfb7012 --- /dev/null +++ b/docs/pot/performance-monitoring.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Performance Monitoring" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host and guest performance monitoring is available to end users and administrators. This allows the user to monitor their utilization of resources and determine when it is appropriate to choose a more powerful service offering or larger disk." +msgstr "" + diff --git a/docs/pot/physical-network-configuration-settings.pot b/docs/pot/physical-network-configuration-settings.pot new file mode 100644 index 00000000000..204f7f2ad68 --- /dev/null +++ b/docs/pot/physical-network-configuration-settings.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configurable Characteristics of Physical Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides configuration settings you can use to set up a physical network in a zone, including:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "What type of network traffic it carries (guest, public, management, storage)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLANs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unique name that the hypervisor can use to find that particular network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enabled or disabled. When a network is first set up, it is disabled – not in use yet. The administrator sets the physical network to enabled, and it begins to be used. The administrator can later disable the network again, which prevents any new virtual networks from being created on that physical network; the existing network traffic continues even though the state is disabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Speed" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags, so network offerings can be matched to physical networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Isolation method" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-about.pot b/docs/pot/plugin-niciranvp-about.pot new file mode 100644 index 00000000000..fb39acbc17d --- /dev/null +++ b/docs/pot/plugin-niciranvp-about.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "The Nicira NVP Plugin" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-devicemanagement.pot b/docs/pot/plugin-niciranvp-devicemanagement.pot new file mode 100644 index 00000000000..34bcc0ebf58 --- /dev/null +++ b/docs/pot/plugin-niciranvp-devicemanagement.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Device-management" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack 4.0.x each Nicira NVP setup is considered a \"device\" that can be added and removed from a physical network. To complete the configuration of the Nicira NVP plugin a device needs to be added to the physical network using the \"addNiciraNVPDevice\" API call. The plugin is now enabled on the physical network and any guest networks created on that network will be provisioned using the Nicra NVP Controller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The plugin introduces a set of new API calls to manage the devices, see below or refer to the API reference." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addNiciraNvpDevice" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "physicalnetworkid: the UUID of the physical network on which the device is configured" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "hostname: the IP address of the NVP controller" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "username: the username for access to the NVP API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "password: the password for access to the NVP API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "transportzoneuuid: the UUID of the transportzone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "deleteNiciraNVPDevice" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "nvpdeviceid: the UUID of the device" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNiciraNVPDevices" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-features.pot b/docs/pot/plugin-niciranvp-features.pot new file mode 100644 index 00000000000..0c4154bfbb8 --- /dev/null +++ b/docs/pot/plugin-niciranvp-features.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Features of the Nicira NVP Plugin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack release 4.0.0-incubating this plugin supports the Connectivity service. This service is responsible for creating Layer 2 networks supporting the networks created by Guests. In other words when an tennant creates a new network, instead of the traditional VLAN a logical network will be created by sending the appropriate calls to the Nicira NVP Controller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The plugin has been tested with Nicira NVP versions 2.1.0, 2.2.0 and 2.2.1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack 4.0.0-incubating only the XenServer hypervisor is supported for use in combination with Nicira NVP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack 4.1.0-incubating both KVM and XenServer hypervisors are supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack 4.0.0-incubating the UI components for this plugin are not complete, configuration is done by sending commands to the API." +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-guide.pot b/docs/pot/plugin-niciranvp-guide.pot new file mode 100644 index 00000000000..665e4ff217f --- /dev/null +++ b/docs/pot/plugin-niciranvp-guide.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Plugin Guide for the Nicira NVP Plugin" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-introduction.pot b/docs/pot/plugin-niciranvp-introduction.pot new file mode 100644 index 00000000000..2f50cf01fa6 --- /dev/null +++ b/docs/pot/plugin-niciranvp-introduction.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Introduction to the Nicira NVP Plugin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Nicira NVP plugin allows CloudStack to use the Nicira solution for virtualized network as a provider for CloudStack networks and services." +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-preparations.pot b/docs/pot/plugin-niciranvp-preparations.pot new file mode 100644 index 00000000000..c3bdbaea3fd --- /dev/null +++ b/docs/pot/plugin-niciranvp-preparations.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prerequisites" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before enabling the Nicira NVP plugin the NVP Controller needs to be configured. Please review the NVP User Guide on how to do that." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack needs to have at least one physical network with the isolation method set to \"STT\". This network should be enabled for the Guest traffic type." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Guest traffic type should be configured with the traffic label that matches the name of the Integration Bridge on the hypervisor. See the Nicira NVP User Guide for more details on how to set this up in XenServer or KVM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you have the following information ready:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP address of the NVP Controller" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The username to access the API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The password to access the API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The UUID of the Transport Zone that contains the hypervisors in this Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The UUID of the Physical Network that will used for the Guest networks" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-provider.pot b/docs/pot/plugin-niciranvp-provider.pot new file mode 100644 index 00000000000..1f1b1e914e1 --- /dev/null +++ b/docs/pot/plugin-niciranvp-provider.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Enabling the service provider" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To allow CloudStack to use the Nicira NVP Plugin the network service provider needs to be enabled on the physical network. The following sequence of API calls will enable the network service provider" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "addNetworkServiceProvider" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "name = \"NiciraNvp\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "physicalnetworkid = <the uuid of the physical network>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "updateNetworkServiceProvider" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "id = <the provider uuid returned by the previous call>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "state = \"Enabled\"" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-revisions.pot b/docs/pot/plugin-niciranvp-revisions.pot new file mode 100644 index 00000000000..ea63a27dca9 --- /dev/null +++ b/docs/pot/plugin-niciranvp-revisions.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Revision History" +msgstr "" + +#. Tag: firstname +#, no-c-format +msgid "Hugo" +msgstr "" + +#. Tag: surname +#, no-c-format +msgid "Trippaers" +msgstr "" + +#. Tag: member +#, no-c-format +msgid "Documentation created for 4.0.0-incubating version of the NVP Plugin" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-tables.pot b/docs/pot/plugin-niciranvp-tables.pot new file mode 100644 index 00000000000..5e1570f9984 --- /dev/null +++ b/docs/pot/plugin-niciranvp-tables.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Database tables" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following tables are added to the cloud database for the Nicira NVP Plugin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "nicira_nvp_nic_map, contains a mapping from nic to logical switch port" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "id" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "logicalswitch, uuid of the logical switch this port is connected to" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "logicalswitchport, uuid of the logical switch port for this nic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "nic, the CloudStack uuid for this nic, reference to the nics table" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "external_nicira_nvp_devices, contains all configured devices" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "uuid" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "physical_network_id, the physical network this device is configured on" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "provider_name, set to \"NiciraNvp\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "device_name, display name for this device" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "host_id, reference to the host table with the device configuration" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-troubleshooting.pot b/docs/pot/plugin-niciranvp-troubleshooting.pot new file mode 100644 index 00000000000..45cdc9aa099 --- /dev/null +++ b/docs/pot/plugin-niciranvp-troubleshooting.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Troubleshooting the Nicira NVP Plugin" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-ui.pot b/docs/pot/plugin-niciranvp-ui.pot new file mode 100644 index 00000000000..80d69bd636c --- /dev/null +++ b/docs/pot/plugin-niciranvp-ui.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Configuring the Nicira NVP plugin from the UI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In CloudStack 4.1.0-incubating the Nicira NVP plugin and its resources can be configured in the infrastructure tab of the UI. Navigate to the physical network with STT isolation and configure the network elements. The NiciraNvp is listed here." +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-usage.pot b/docs/pot/plugin-niciranvp-usage.pot new file mode 100644 index 00000000000..165ea6d7413 --- /dev/null +++ b/docs/pot/plugin-niciranvp-usage.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using the Nicira NVP Plugin" +msgstr "" + diff --git a/docs/pot/plugin-niciranvp-uuidreferences.pot b/docs/pot/plugin-niciranvp-uuidreferences.pot new file mode 100644 index 00000000000..8cbf4774251 --- /dev/null +++ b/docs/pot/plugin-niciranvp-uuidreferences.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "UUID References" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The plugin maintains several references in the CloudStack database to items created on the NVP Controller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Every guest network this is created will have its broadcast type set to Lswitch and if the network is in state \"Implemented\", the broadcast URI will have the UUID of the Logical Switch that was created for this network on the NVP Controller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Nics that are connected to one of the Logical Switches will have their Logical Switch Port UUID listed in the nicira_nvp_nic_map table" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All devices created on the NVP Controller will have a tag set to domain-account of the owner of the network, this string can be used to search for items in the NVP Controller." +msgstr "" + diff --git a/docs/pot/pod-add.pot b/docs/pot/pod-add.pot new file mode 100644 index 00000000000..857b5a1360d --- /dev/null +++ b/docs/pot/pod-add.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Pod" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you created a new zone, &PRODUCT; adds the first pod for you. You can add more pods at any time using the procedure in this section." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone to which you want to add a pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute and Storage tab. In the Pods node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enter the following details in the dialog." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateway. The gateway for the hosts in that pod." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Netmask. The network prefix that defines the pod's subnet. Use CIDR notation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start/End Reserved System IP. The IP range in the management network that &PRODUCT; uses to manage various system VMs, such as Secondary Storage VMs, Console Proxy VMs, and DHCP. For more information, see System Reserved IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/port-forwarding.pot b/docs/pot/port-forwarding.pot new file mode 100644 index 00000000000..47f16ff90dc --- /dev/null +++ b/docs/pot/port-forwarding.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Port Forwarding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A port forward service is a set of port forwarding rules that define a policy. A port forward service is then applied to one or more guest VMs. The guest VM then has its inbound network access managed according to the policy defined by the port forwarding service. You can optionally specify one or more CIDRs to filter the source IPs. This is useful when you want to allow only incoming requests from certain IP addresses to be forwarded." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A guest VM can be in any number of port forward services. Port forward services can be defined but have no members. If a guest VM is part of more than one network, port forwarding rules will function only if they are defined on the default network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You cannot use port forwarding to open ports for an elastic IP address. When elastic IP is used, outside access is instead controlled through the use of security groups. See Security Groups." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up port forwarding:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have not already done so, add a public IP address range to a zone in &PRODUCT;. See Adding a Zone and Pod in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add one or more VM instances to &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the guest network where the VMs are running." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose an existing IP address or acquire a new IP address. (See Acquiring a New IP Address on page 73.) Click the name of the IP address in the list." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configuration tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Port Forwarding node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Fill in the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Port. The port to which public traffic will be addressed on the IP address you acquired in the previous step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Port. The port on which the instance is listening for forwarded public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. The communication protocol in use between the two ports." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add." +msgstr "" + diff --git a/docs/pot/prepare-system-vm-template.pot b/docs/pot/prepare-system-vm-template.pot new file mode 100644 index 00000000000..6429e4ee078 --- /dev/null +++ b/docs/pot/prepare-system-vm-template.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prepare the System VM Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage must be seeded with a template that is used for &PRODUCT; system VMs. Citrix provides you with the necessary binary package of the system VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Management Server, run one or more of the following cloud-install-sys-tmplt commands to retrieve and decompress the system VM template. Run the command for each hypervisor type that you expect end users to run in this Zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If your secondary storage mount point is not named /mnt/secondary, substitute your own mount point name." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you set the &PRODUCT; database encryption type to \"web\" when you set up the database, you must now add the parameter -s <management-server-secret-key>. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This process will require approximately 5 GB of free space on the local file system and up to 30 minutes each time it runs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.vhd.bz2 -h xenserver -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.ova -h vmware -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# /usr/lib64/cloud/common/scripts/storage/secondary/cloud-install-sys-tmplt -m /mnt/secondary -u http://download.cloud.com/templates/acton/acton-systemvm-02062012.qcow2.bz2 -h kvm -s <optional-management-server-secret-key> -F" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using a separate NFS server, perform this step." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not perform this step if you are using the Management Server as the NFS server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the script has finished, unmount secondary storage and remove the created directory." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# umount /mnt/secondary\n" +"# rmdir /mnt/secondary" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps for each secondary storage server." +msgstr "" + diff --git a/docs/pot/primary-storage-add.pot b/docs/pot/primary-storage-add.pot new file mode 100644 index 00000000000..c414a11103a --- /dev/null +++ b/docs/pot/primary-storage-add.pot @@ -0,0 +1,190 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add Primary Storage" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "System Requirements for Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hardware requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Any standards-compliant iSCSI or NFS server that is supported by the underlying hypervisor." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The storage server should be a machine with a large number of disks. The disks should ideally be managed by a hardware RAID controller." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Minimum required capacity depends on your needs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When setting up primary storage, follow these restrictions:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Primary storage cannot be added until a host has been added to the cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you do not provision shared primary storage, you must set the global configuration parameter system.vm.local.storage.required to true, or else you will not be able to start VMs." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Adding Primary Stroage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you create a new zone, the first primary storage is added as part of that procedure. You can add primary storage servers at any time, such as when adding a new cluster or adding more servers to an existing cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure there is nothing stored on the server. Adding the server to &PRODUCT; will destroy any existing data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI (see )." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure. In Zones, click View More, then click the zone in which you want to add the primary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Compute tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Primary Storage node of the diagram, click View All." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Primary Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following information in the dialog. The information required varies depending on your choice in Protocol." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pod. The pod for the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cluster. The cluster for the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name. The name of the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Protocol. For XenServer, choose either NFS, iSCSI, or PreSetup. For KVM, choose NFS or SharedMountPoint. For vSphere choose either VMFS (iSCSI or FiberChannel) or NFS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server (for NFS, iSCSI, or PreSetup). The IP address or DNS name of the storage device." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Server (for VMFS). The IP address or DNS name of the vCenter server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for NFS). In NFS this is the exported path from the server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for VMFS). In vSphere this is a combination of the datacenter name and the datastore name. The format is \"/\" datacenter name \"/\" datastore name. For example, \"/cloud.dc.VM/cluster1datastore\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Path (for SharedMountPoint). With KVM this is the path on each host that is where this primary storage is mounted. For example, \"/mnt/primary\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SR Name-Label (for PreSetup). Enter the name-label of the SR that has been set up outside &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Target IQN (for iSCSI). In iSCSI this is the IQN of the target. For example, iqn.1986-03.com.sun:02:01ec9bb549-1271378984." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Lun # (for iSCSI). In iSCSI this is the LUN number. For example, 3." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tags (optional). The comma-separated list of tags for this storage device. It should be an equivalent set or superset of the tags on your disk offerings.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The tag sets on primary storage across clusters in a Zone must be identical. For example, if cluster A provides primary storage that has tags T1 and T2, all other clusters in the Zone must also provide primary storage that has tags T1 and T2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK." +msgstr "" + diff --git a/docs/pot/primary-storage-outage-and-data-loss.pot b/docs/pot/primary-storage-outage-and-data-loss.pot new file mode 100644 index 00000000000..4801afdf6e4 --- /dev/null +++ b/docs/pot/primary-storage-outage-and-data-loss.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Primary Storage Outage and Data Loss" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a primary storage outage occurs the hypervisor immediately stops all VMs stored on that storage device. Guests that are marked for HA will be restarted as soon as practical when the primary storage comes back on line. With NFS, the hypervisor may allow the virtual machines to continue running depending on the nature of the issue. For example, an NFS hang will cause the guest VMs to be suspended until storage connectivity is restored.Primary storage is not designed to be backed up. Individual volumes in primary storage can be backed up using snapshots." +msgstr "" + diff --git a/docs/pot/primary-storage.pot b/docs/pot/primary-storage.pot new file mode 100644 index 00000000000..5fb36b3022d --- /dev/null +++ b/docs/pot/primary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section gives concepts and technical details about &PRODUCT; primary storage. For information about how to install and configure primary storage through the &PRODUCT; UI, see the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/pot/private-public-template.pot b/docs/pot/private-public-template.pot new file mode 100644 index 00000000000..b982f60f491 --- /dev/null +++ b/docs/pot/private-public-template.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Private and Public Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a user creates a template, it can be designated private or public." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private templates are only available to the user who created them. By default, an uploaded template is private." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a user marks a template as “public,†the template becomes available to all users in all accounts in the user's domain, as well as users in any other domains that have access to the Zone where the template is stored. This depends on whether the Zone, in turn, was defined as private or public. A private Zone is assigned to a single domain, and a public Zone is accessible to any domain. If a public template is created in a private Zone, it is available only to users in the domain assigned to that Zone. If a public template is created in a public Zone, it is available to all users in all domains." +msgstr "" + diff --git a/docs/pot/projects-overview.pot b/docs/pot/projects-overview.pot new file mode 100644 index 00000000000..e5fd8f122c8 --- /dev/null +++ b/docs/pot/projects-overview.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Overview of Projects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Projects are used to organize people and resources. &PRODUCT; users within a single domain can group themselves into project teams so they can collaborate and share virtual resources such as VMs, snapshots, templates, data disks, and IP addresses. &PRODUCT; tracks resource usage per project as well as per user, so the usage can be billed to either a user account or a project. For example, a private cloud within a software company might have all members of the QA department assigned to one project, so the company can track the resources used in testing while the project members can more easily isolate their efforts from other users of the same cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can configure &PRODUCT; to allow any user to create a new project, or you can restrict that ability to just &PRODUCT; administrators. Once you have created a project, you become that project’s administrator, and you can add others within your domain to the project. &PRODUCT; can be set up either so that you can add people directly to a project, or so that you have to send an invitation which the recipient must accept. Project members can view and manage all virtual resources created by anyone in the project (for example, share VMs). A user can be a member of any number of projects and can switch views in the &PRODUCT; UI to show only project-related information, such as project VMs, fellow project members, project-related alerts, and so on." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The project administrator can pass on the role to another project member. The project administrator can also add more members, remove members from the project, set new resource limits (as long as they are below the global defaults set by the &PRODUCT; administrator), and delete the project. When the administrator removes a member from the project, resources created by that user, such as VM instances, remain with the project. This brings us to the subject of resource ownership and which resources can be used by a project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Resources created within a project are owned by the project, not by any particular &PRODUCT; account, and they can be used only within the project. A user who belongs to one or more projects can still create resources outside of those projects, and those resources belong to the user’s account; they will not be counted against the project’s usage or resource limits. You can create project-level networks to isolate traffic within the project and provide network services such as port forwarding, load balancing, VPN, and static NAT. A project can also make use of certain types of resources from outside the project, if those resources are shared. For example, a shared network or public template is available to any project in the domain. A project can get access to a private template if the template’s owner will grant permission. A project can use any service offering or disk offering available in its domain; however, you can not create private service and disk offerings at the project level.." +msgstr "" + diff --git a/docs/pot/projects.pot b/docs/pot/projects.pot new file mode 100644 index 00000000000..2b6939a713f --- /dev/null +++ b/docs/pot/projects.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Projects to Organize Users and Resources" +msgstr "" + diff --git a/docs/pot/provisioning-auth-api.pot b/docs/pot/provisioning-auth-api.pot new file mode 100644 index 00000000000..671e64173f0 --- /dev/null +++ b/docs/pot/provisioning-auth-api.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Provisioning and Authentication API" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; expects that a customer will have their own user provisioning infrastructure. It provides APIs to integrate with these existing systems where the systems call out to &PRODUCT; to add/remove users.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports pluggable authenticators. By default, &PRODUCT; assumes it is provisioned with the user’s password, and as a result authentication is done locally. However, external authentication is possible as well. For example, see Using an LDAP Server for User Authentication." +msgstr "" + diff --git a/docs/pot/provisioning-steps-overview.pot b/docs/pot/provisioning-steps-overview.pot new file mode 100644 index 00000000000..8d2873aefee --- /dev/null +++ b/docs/pot/provisioning-steps-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Overview of Provisioning Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After the Management Server is installed and running, you can add the compute resources for it to manage. For an overview of how a &PRODUCT; cloud infrastructure is organized, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To provision the cloud infrastructure, or to scale it up at any time, follow these procedures:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Change the root password. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add a zone. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more pods (optional). See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more clusters (optional). See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add more hosts (optional). See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add primary storage. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Add secondary storage. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Initialize and test the new cloud. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you have finished these steps, you will have a deployment with the following basic structure:" +msgstr "" + diff --git a/docs/pot/provisioning-steps.pot b/docs/pot/provisioning-steps.pot new file mode 100644 index 00000000000..cb3d44c369f --- /dev/null +++ b/docs/pot/provisioning-steps.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Steps to Provisioning Your Cloud Infrastructure" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section tells how to add zones, pods, clusters, hosts, storage, and networks to your cloud. If you are unfamiliar with these entities, please begin by looking through ." +msgstr "" + diff --git a/docs/pot/query-filter.pot b/docs/pot/query-filter.pot new file mode 100644 index 00000000000..ff221b07aa6 --- /dev/null +++ b/docs/pot/query-filter.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Query Filter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The query filter is used to find a mapped user in the external LDAP server. The query filter should uniquely map the &PRODUCT; user to LDAP user for a meaningful authentication. For more information about query filter syntax, consult the documentation for your LDAP server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; query filter wildcards are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Query Filter Wildcard" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "%u" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "%e" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Email address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "%n" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First and last name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following examples assume you are using Active Directory, and refer to user attributes from the Active Directory schema." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the &PRODUCT; user name is the same as the LDAP user ID:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "(uid=%u)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the &PRODUCT; user name is the LDAP display name:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "(displayName=%u)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To find a user by email address:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "(mail=%e)" +msgstr "" + diff --git a/docs/pot/re-install-hosts.pot b/docs/pot/re-install-hosts.pot new file mode 100644 index 00000000000..5f21c743b86 --- /dev/null +++ b/docs/pot/re-install-hosts.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Re-Installing Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can re-install a host after placing it in maintenance mode and then removing it. If a host is down and cannot be placed in maintenance mode, it should still be removed before the re-install." +msgstr "" + diff --git a/docs/pot/release-ip-address.pot b/docs/pot/release-ip-address.pot new file mode 100644 index 00000000000..3f70c4d19a7 --- /dev/null +++ b/docs/pot/release-ip-address.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Releasing an IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the network where you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click View IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP address you want to release." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Release IP button ReleaseIPButton.png: button to release an IP ." +msgstr "" + diff --git a/docs/pot/release-ip-for-vpc.pot b/docs/pot/release-ip-for-vpc.pot new file mode 100644 index 00000000000..49d743a4ea4 --- /dev/null +++ b/docs/pot/release-ip-for-vpc.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Releasing an IP Address Alloted to a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP address is a limited resource. If you no longer need a particular IP, you can disassociate it from its VPC and return it to the pool of available addresses. An IP address can be released from its tier, only when all the networking ( port forwarding, load balancing, or StaticNAT ) rules are removed for this IP address. The released IP address will still belongs to the same VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC whose IP you want to release." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The VPC page is displayed where all the tiers you created are listed in a diagram." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Settings icon." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following options are displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network ACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The IP Addresses page is displayed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the IP you want to release." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Details tab, click the Release IP button release-ip-icon.png: button to release an IP. " +msgstr "" + diff --git a/docs/pot/remove-member-from-project.pot b/docs/pot/remove-member-from-project.pot new file mode 100644 index 00000000000..9933fe45ea4 --- /dev/null +++ b/docs/pot/remove-member-from-project.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removing a Member From a Project" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a member is removed from a project, the member’s resources continue to be owned by the project. The former project member cannot create any new resources within the project or use any of the project’s existing resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A member of a project can be removed by the project administrator, the domain administrator of the domain the project belongs to or of its parent domain, or the &PRODUCT; root administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Accounts tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the member." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Delete button. deletebutton.png: Removes a member " +msgstr "" + diff --git a/docs/pot/remove-tier.pot b/docs/pot/remove-tier.pot new file mode 100644 index 00000000000..ac674250681 --- /dev/null +++ b/docs/pot/remove-tier.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removing Tiers" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can remove a tier from a VPC. A removed tier cannot be revoked. When a tier is removed, only the resources of the tier are expunged. All the network rules (port forwarding, load balancing and staticNAT) and the IP addresses associated to the tier are removed. The IP address still be belonging to the same VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPC that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure button of the VPC for which you want to set up tiers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Configure VPC page is displayed. Locate the tier you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Remove VPC button:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait for some time for the tier to be removed." +msgstr "" + diff --git a/docs/pot/remove-vpc.pot b/docs/pot/remove-vpc.pot new file mode 100644 index 00000000000..5627b1eacb5 --- /dev/null +++ b/docs/pot/remove-vpc.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Editing, Restarting, and Removing a Virtual Private Cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that all the tiers are removed before you remove a VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or end user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Select view, select VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the VPCs that you have created for the account is listed in the page." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the VPC you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To remove, click the Remove VPC button remove-vpc.png: button to remove a VPC " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can edit the name and description of a VPC. To do that, select the VPC, then click the Edit button. edit-icon.png: button to edit a VPC " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To restart a VPC, select the VPC, then click the Restart button. restart-vpc.png: button to restart a VPC " +msgstr "" + diff --git a/docs/pot/removed-API-commands.pot b/docs/pot/removed-API-commands.pot new file mode 100644 index 00000000000..3a068c23b83 --- /dev/null +++ b/docs/pot/removed-API-commands.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removed API commands" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "createConfiguration (Adds configuration value)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "configureSimulator (Configures simulator)" +msgstr "" + diff --git a/docs/pot/removing-hosts.pot b/docs/pot/removing-hosts.pot new file mode 100644 index 00000000000..335eeef81db --- /dev/null +++ b/docs/pot/removing-hosts.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removing Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hosts can be removed from the cloud as needed. The procedure to remove a host depends on the hypervisor type." +msgstr "" + diff --git a/docs/pot/removing-vsphere-hosts.pot b/docs/pot/removing-vsphere-hosts.pot new file mode 100644 index 00000000000..02db0a5e4da --- /dev/null +++ b/docs/pot/removing-vsphere-hosts.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removing vSphere Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To remove this type of host, first place it in maintenance mode, as described in . Then use &PRODUCT; to remove the host. &PRODUCT; will not direct commands to a host that has been removed using &PRODUCT;. However, the host may still exist in the vCenter cluster." +msgstr "" + diff --git a/docs/pot/removing-xenserver-kvm-hosts.pot b/docs/pot/removing-xenserver-kvm-hosts.pot new file mode 100644 index 00000000000..fa092ae4683 --- /dev/null +++ b/docs/pot/removing-xenserver-kvm-hosts.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Removing XenServer and KVM Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A node cannot be removed from a cluster until it has been placed in maintenance mode. This will ensure that all of the VMs on it have been migrated to other Hosts. To remove a Host from the cloud:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Place the node in maintenance mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM, stop the cloud-agent service." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the UI option to remove the node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then you may power down the Host, re-use its IP address, re-install it, etc" +msgstr "" + diff --git a/docs/pot/requirements-templates.pot b/docs/pot/requirements-templates.pot new file mode 100644 index 00000000000..5d1a8e7ae5f --- /dev/null +++ b/docs/pot/requirements-templates.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Requirements for Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer, install PV drivers / Xen tools on each template that you create. This will enable live migration and clean guest shutdown." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere, install VMware Tools on each template that you create. This will enable console view to work properly." +msgstr "" + diff --git a/docs/pot/resizing-volumes.pot b/docs/pot/resizing-volumes.pot new file mode 100644 index 00000000000..457d1bace2a --- /dev/null +++ b/docs/pot/resizing-volumes.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Resizing Volumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; does not provide the ability to resize root disks or data disks; the disk size is fixed based on the template used to create the VM. However, the tool VHD Resizer), while not officially supported by Cloud.com or Citrix, might provide a workaround. To increase disk size with VHD Resizer:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Get the VHD from the secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Import it into VHD Resizer." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Resize the VHD." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Upload the new VHD." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a new VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Take a snapshot, then create a new template from that snapshot." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see How to Resize a Provisioning Server 5 Virtual Disk at the Citrix Knowledge Center" +msgstr "" + diff --git a/docs/pot/response-formats.pot b/docs/pot/response-formats.pot new file mode 100644 index 00000000000..706fcc811e1 --- /dev/null +++ b/docs/pot/response-formats.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Response Formats: XML and JSON" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CloudStack supports two formats as the response to an API call. The default response is XML. If you would like the response to be in JSON, add &response=json to the Command String." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Sample XML Response:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" <listipaddressesresponse> \n" +" <allocatedipaddress>\n" +" <ipaddress>192.168.10.141</ipaddress> \n" +" <allocated>2009-09-18T13:16:10-0700</allocated> \n" +" <zoneid>4</zoneid> \n" +" <zonename>WC</zonename> \n" +" <issourcenat>true</issourcenat> \n" +" </allocatedipaddress>\n" +" </listipaddressesresponse>\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Sample JSON Response:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" { \"listipaddressesresponse\" : \n" +" { \"allocatedipaddress\" :\n" +" [ \n" +" { \n" +" \"ipaddress\" : \"192.168.10.141\", \n" +" \"allocated\" : \"2009-09-18T13:16:10-0700\",\n" +" \"zoneid\" : \"4\", \n" +" \"zonename\" : \"WC\", \n" +" \"issourcenat\" : \"true\" \n" +" } \n" +" ]\n" +" } \n" +" } \n" +" " +msgstr "" + diff --git a/docs/pot/responses.pot b/docs/pot/responses.pot new file mode 100644 index 00000000000..629746bffc4 --- /dev/null +++ b/docs/pot/responses.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Responses" +msgstr "" + diff --git a/docs/pot/roles.pot b/docs/pot/roles.pot new file mode 100644 index 00000000000..9dba537d770 --- /dev/null +++ b/docs/pot/roles.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Roles" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; API supports three access roles:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Root Admin. Access to all features of the cloud, including both virtual and physical resource management." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Domain Admin. Access to only the virtual resources of the clouds that belong to the administrator’s domain." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User. Access to only the features that allow management of the user’s virtual instances, storage, and network." +msgstr "" + diff --git a/docs/pot/root-admin-ui-overview.pot b/docs/pot/root-admin-ui-overview.pot new file mode 100644 index 00000000000..5f0df53fee7 --- /dev/null +++ b/docs/pot/root-admin-ui-overview.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Root Administrator's UI Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; UI helps the &PRODUCT; administrator provision, view, and manage the cloud infrastructure, domains, user accounts, projects, and configuration settings. The first time you start the UI after a fresh Management Server installation, you can choose to follow a guided tour to provision your cloud infrastructure. On subsequent logins, the dashboard of the logged-in user appears. The various links in this screen and the navigation bar on the left provide access to a variety of administrative functions. The root administrator can also use the UI to perform all the same tasks that are present in the end-user’s UI." +msgstr "" + diff --git a/docs/pot/runtime-allocation-virtual-network-resources.pot b/docs/pot/runtime-allocation-virtual-network-resources.pot new file mode 100644 index 00000000000..df343402c43 --- /dev/null +++ b/docs/pot/runtime-allocation-virtual-network-resources.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Runtime Allocation of Virtual Network Resources" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you define a new virtual network, all your settings for that network are stored in &PRODUCT;. The actual network resources are activated only when the first virtual machine starts in the network. When all virtual machines have left the virtual network, the network resources are garbage collected so they can be allocated again. This helps to conserve network resources.." +msgstr "" + diff --git a/docs/pot/runtime-behavior-of-primary-storage.pot b/docs/pot/runtime-behavior-of-primary-storage.pot new file mode 100644 index 00000000000..1862b3f892b --- /dev/null +++ b/docs/pot/runtime-behavior-of-primary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Runtime Behavior of Primary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Root volumes are created automatically when a virtual machine is created. Root volumes are deleted when the VM is destroyed. Data volumes can be created and dynamically attached to VMs. Data volumes are not deleted when VMs are destroyed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Administrators should monitor the capacity of primary storage devices and add additional primary storage as needed. See the Advanced Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Administrators add primary storage to the system by creating a &PRODUCT; storage pool. Each storage pool is associated with a cluster." +msgstr "" + diff --git a/docs/pot/runtime-internal-comm-req.pot b/docs/pot/runtime-internal-comm-req.pot new file mode 100644 index 00000000000..78738beeec4 --- /dev/null +++ b/docs/pot/runtime-internal-comm-req.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Runtime Internal Communications Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Servers communicate with each other to coordinate tasks. This communication uses TCP on ports 8250 and 9090." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The console proxy VMs connect to all hosts in the zone over the management traffic network. Therefore the management traffic network of any given pod in the zone must have connectivity to the management traffic network of all other pods in the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The secondary storage VMs and console proxy VMs connect to the Management Server on port 8250. If you are using multiple Management Servers, the load balanced IP address of the Management Servers on port 8250 must be reachable." +msgstr "" + diff --git a/docs/pot/scheduled-maintenance-maintenance-mode-hosts.pot b/docs/pot/scheduled-maintenance-maintenance-mode-hosts.pot new file mode 100644 index 00000000000..f83df48da7c --- /dev/null +++ b/docs/pot/scheduled-maintenance-maintenance-mode-hosts.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Scheduled Maintenance and Maintenance Mode for Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can place a host into maintenance mode. When maintenance mode is activated, the host becomes unavailable to receive new guest VMs, and the guest VMs already running on the host are seamlessly migrated to another host not in maintenance mode. This migration uses live migration technology and does not interrupt the execution of the guest." +msgstr "" + diff --git a/docs/pot/search-base.pot b/docs/pot/search-base.pot new file mode 100644 index 00000000000..99efd746d56 --- /dev/null +++ b/docs/pot/search-base.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Search Base" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An LDAP query is relative to a given node of the LDAP directory tree, called the search base. The search base is the distinguished name (DN) of a level of the directory tree below which all users can be found. The users can be in the immediate base directory or in some subdirectory. The search base may be equivalent to the organization, group, or domain name. The syntax for writing a DN varies depending on which LDAP server you are using. A full discussion of distinguished names is outside the scope of our documentation. The following table shows some examples of search bases to find users in the testing department.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LDAP Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Example Search Base DN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ApacheDS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ou=testing,o=project" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Active Directory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OU=testing, DC=company" +msgstr "" + diff --git a/docs/pot/search-user-bind-dn.pot b/docs/pot/search-user-bind-dn.pot new file mode 100644 index 00000000000..5cb326c9f03 --- /dev/null +++ b/docs/pot/search-user-bind-dn.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Search User Bind DN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The bind DN is the user on the external LDAP server permitted to search the LDAP directory within the defined search base. When the DN is returned, the DN and passed password are used to authenticate the &PRODUCT; user with an LDAP bind. A full discussion of bind DNs is outside the scope of our documentation. The following table shows some examples of bind DNs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LDAP Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Example Bind DN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ApacheDS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "cn=Administrator,dc=testing,ou=project,ou=org" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Active Directory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CN=Administrator, OU=testing, DC=company, DC=com" +msgstr "" + diff --git a/docs/pot/secondary-storage-add.pot b/docs/pot/secondary-storage-add.pot new file mode 100644 index 00000000000..419cb15e5c5 --- /dev/null +++ b/docs/pot/secondary-storage-add.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Add Secondary Storage" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "System Requirements for Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NFS storage appliance or Linux NFS server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) OpenStack Object Storage (Swift) (see http://swift.openstack.org)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "100GB minimum capacity" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A secondary storage device must be located in the same zone as the guest VMs it serves." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each Secondary Storage server must be available to all hosts in the zone." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Adding Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When you create a new zone, the first secondary storage is added as part of that procedure. You can add secondary storage servers at any time to add more servers to an existing zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure there is nothing stored on the server. Adding the server to &PRODUCT; will destroy any existing data." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are going to use Swift for cloud-wide secondary storage, you must add the Swift storage to &PRODUCT; before you add the local zone secondary storage servers. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To prepare for local zone secondary storage, you should have created and mounted an NFS share during Management Server installation. See .See Preparing NFS Shares in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure you prepared the system VM template during Management Server installation. See .See Prepare the System VM Template in the Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now that the secondary storage server for per-zone storage is prepared, add it to &PRODUCT;. Secondary storage is added as part of the procedure for adding a new zone. See ." +msgstr "" + diff --git a/docs/pot/secondary-storage-outage-and-data-loss.pot b/docs/pot/secondary-storage-outage-and-data-loss.pot new file mode 100644 index 00000000000..bc00e1c560b --- /dev/null +++ b/docs/pot/secondary-storage-outage-and-data-loss.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Secondary Storage Outage and Data Loss" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For a Zone that has only one secondary storage server, a secondary storage outage will have feature level impact to the system but will not impact running guest VMs. It may become impossible to create a VM with the selected template for a user. A user may also not be able to save snapshots or examine/restore saved snapshots. These features will automatically be available when the secondary storage comes back online." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Secondary storage data loss will impact recently added user data including templates, snapshots, and ISO images. Secondary storage should be backed up periodically. Multiple secondary storage servers can be provisioned within each zone to increase the scalability of the system." +msgstr "" + diff --git a/docs/pot/secondary-storage-vm.pot b/docs/pot/secondary-storage-vm.pot new file mode 100644 index 00000000000..8f9354a9350 --- /dev/null +++ b/docs/pot/secondary-storage-vm.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Secondary Storage VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the hosts, &PRODUCT;’s Secondary Storage VM mounts and writes to secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Submissions to secondary storage go through the Secondary Storage VM. The Secondary Storage VM can retrieve templates and ISO images from URLs using a variety of protocols." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The secondary storage VM provides a background task that takes care of a variety of secondary storage activities: downloading a new template to a Zone, copying templates between Zones, and snapshot backups." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The administrator can log in to the secondary storage VM if needed." +msgstr "" + diff --git a/docs/pot/secondary-storage.pot b/docs/pot/secondary-storage.pot new file mode 100644 index 00000000000..3139de6a919 --- /dev/null +++ b/docs/pot/secondary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section gives concepts and technical details about &PRODUCT; secondary storage. For information about how to install and configure secondary storage through the &PRODUCT; UI, see the Advanced Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/pot/security-groups.pot b/docs/pot/security-groups.pot new file mode 100644 index 00000000000..c7c8480d9eb --- /dev/null +++ b/docs/pot/security-groups.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Security Groups" +msgstr "" + diff --git a/docs/pot/security-req.pot b/docs/pot/security-req.pot new file mode 100644 index 00000000000..373e3ba840c --- /dev/null +++ b/docs/pot/security-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Security Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The public Internet must not be able to access port 8096 or port 8250 on the Management Server." +msgstr "" + diff --git a/docs/pot/send-projects-membership-invitation.pot b/docs/pot/send-projects-membership-invitation.pot new file mode 100644 index 00000000000..f77e51f2d17 --- /dev/null +++ b/docs/pot/send-projects-membership-invitation.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Sending Project Membership Invitations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use these steps to add a new member to a project if the invitations feature is enabled in the cloud as described in . If the invitations feature is not turned on, use the procedure in Adding Project Members From the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the project you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Invitations tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Add by, select one of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Account – The invitation will appear in the user’s Invitations tab in the Project View. See Using the Project View." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Email – The invitation will be sent to the user’s email address. Each emailed invitation includes a unique code called a token which the recipient will provide back to &PRODUCT; when accepting the invitation. Email invitations will work only if the global parameters related to the SMTP server have been set. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type the user name or email address of the new member you want to add, and click Invite. Type the &PRODUCT; user name if you chose Account in the previous step. If you chose Email, type the email address. You can invite only people who have an account in this cloud within the same domain as the project. However, you can send the invitation to any email address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To view and manage the invitations you have sent, return to this tab. When an invitation is accepted, the new member will appear in the project’s Accounts tab." +msgstr "" + diff --git a/docs/pot/separate_storage_network.pot b/docs/pot/separate_storage_network.pot new file mode 100644 index 00000000000..421246003b0 --- /dev/null +++ b/docs/pot/separate_storage_network.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Separate Storage Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the large-scale redundant setup described in the previous section, storage traffic can overload the management network. A separate storage network is optional for deployments. Storage protocols such as iSCSI are sensitive to network delays. A separate storage network ensures guest network traffic contention does not impact storage performance." +msgstr "" + diff --git a/docs/pot/service-offerings.pot b/docs/pot/service-offerings.pot new file mode 100644 index 00000000000..59d9de44e72 --- /dev/null +++ b/docs/pot/service-offerings.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer and Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer and Maintenance Mode" +msgstr "" + diff --git a/docs/pot/set-database-buffer-pool-size.pot b/docs/pot/set-database-buffer-pool-size.pot new file mode 100644 index 00000000000..c29786c53e9 --- /dev/null +++ b/docs/pot/set-database-buffer-pool-size.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Set Database Buffer Pool Size" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It is important to provide enough memory space for the MySQL database to cache data and indexes:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Edit the Tomcat configuration file:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/etc/my.cnf" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Insert the following line in the [mysqld] section, below the datadir line. Use a value that is appropriate for your situation. We recommend setting the buffer pool at 40% of RAM if MySQL is on the same server as the management server or 70% of RAM if MySQL has a dedicated server. The following example assumes a dedicated server with 1024M of RAM." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "innodb_buffer_pool_size=700M" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the MySQL service." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service mysqld restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information about the buffer pool, see \"The InnoDB Buffer Pool\" at MySQL Reference Manual." +msgstr "" + diff --git a/docs/pot/set-global-project-resource-limits.pot b/docs/pot/set-global-project-resource-limits.pot new file mode 100644 index 00000000000..ece55dbe370 --- /dev/null +++ b/docs/pot/set-global-project-resource-limits.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting the Global Project Resource Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search box, type max.projects and click the search button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search results, you will see the parameters you can use to set per-project maximum resource amounts that apply to all projects in the cloud. No project can have more resources, but an individual project can have lower limits. Click the edit button to set each parameter. editbutton.png: Edits parameters " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.project.public.ips" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum number of public IP addresses that can be owned by any project in the cloud. See About Public IP Addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.project.snapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum number of snapshots that can be owned by any project in the cloud. See Working with Snapshots." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.project.templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum number of templates that can be owned by any project in the cloud. See Working with Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.project.uservms" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum number of guest virtual machines that can be owned by any project in the cloud. See Working With Virtual Machines." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "max.project.volumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum number of data volumes that can be owned by any project in the cloud. See Working with Volumes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart" +msgstr "" + diff --git a/docs/pot/set-monitor-total-vm-limits-per-host.pot b/docs/pot/set-monitor-total-vm-limits-per-host.pot new file mode 100644 index 00000000000..50fe4321303 --- /dev/null +++ b/docs/pot/set-monitor-total-vm-limits-per-host.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Set and Monitor Total VM Limits per Host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator should monitor the total number of VM instances in each cluster, and disable allocation to the cluster if the total is approaching the maximum that the hypervisor can handle. Be sure to leave a safety margin to allow for the possibility of one or more hosts failing, which would increase the VM load on the other hosts as the VMs are automatically redeployed. Consult the documentation for your chosen hypervisor to find the maximum permitted number of VMs per host, then use &PRODUCT; global configuration settings to set this as the default limit. Monitor the VM activity in each cluster at all times. Keep the total number of VMs below a safe level that allows for the occasional host failure. For example, if there are N hosts in the cluster, and you want to allow for one host in the cluster to be down at any given time, the total number of VM instances you can permit in the cluster is at most (N-1) * (per-host-limit). Once a cluster reaches this number of VMs, use the &PRODUCT; UI to disable allocation of more VMs to the cluster." +msgstr "" + diff --git a/docs/pot/set-per-project-resource-limits.pot b/docs/pot/set-per-project-resource-limits.pot new file mode 100644 index 00000000000..b791974010c --- /dev/null +++ b/docs/pot/set-per-project-resource-limits.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Per-Project Resource Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; root administrator or the domain administrator of the domain where the project resides can set new resource limits for an individual project. The project owner can set resource limits only if the owner is also a domain or root administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The new limits must be below the global default limits set by the &PRODUCT; administrator (as described in ). If the project already owns more of a given type of resource than the new maximum, the resources are not affected; however, the project can not add any new resources of that type until the total drops below the new limit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the project you want to work with." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Resources tab. This tab lists the current maximum amount that the project is allowed to own for each type of resource." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type new values for one or more resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Apply." +msgstr "" + diff --git a/docs/pot/set-projects-creator-permissions.pot b/docs/pot/set-projects-creator-permissions.pot new file mode 100644 index 00000000000..230e3651f9f --- /dev/null +++ b/docs/pot/set-projects-creator-permissions.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Project Creator Permissions" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can configure &PRODUCT; to allow any user to create a new project, or you can restrict that ability to just &PRODUCT; administrators." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search box, type allow.user.create.projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the edit button to set the parameter. editbutton.png: Edits parameters " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "allow.user.create.projects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set to true to allow end users to create projects. Set to false if you want only the &PRODUCT; root administrator and domain administrators to create projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart" +msgstr "" + diff --git a/docs/pot/set-resource-limits-for-projects.pot b/docs/pot/set-resource-limits-for-projects.pot new file mode 100644 index 00000000000..e833c546456 --- /dev/null +++ b/docs/pot/set-resource-limits-for-projects.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Resource Limits for Projects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator can set global default limits to control the amount of resources that can be owned by each project in the cloud. This serves to prevent uncontrolled usage of resources such as snapshots, IP addresses, and virtual machine instances. Domain administrators can override these resource limits for individual projects with their domains, as long as the new limits are below the global defaults set by the &PRODUCT; root administrator. The root administrator can also set lower resource limits for any project in the cloud" +msgstr "" + diff --git a/docs/pot/set-up-invitations.pot b/docs/pot/set-up-invitations.pot new file mode 100644 index 00000000000..0ea9fe7cce8 --- /dev/null +++ b/docs/pot/set-up-invitations.pot @@ -0,0 +1,160 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Up Invitations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; can be set up either so that project administrators can add people directly to a project, or so that it is necessary to send an invitation which the recipient must accept. The invitation can be sent by email or through the user’s &PRODUCT; account. If you want administrators to use invitations to add members to projects, turn on and set up the invitations feature in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in as administrator to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search box, type project and click the search button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search box, type project and click the search button. searchbutton.png: Searches projects " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search results, you will see a few other parameters you need to set to control how invitations behave. The table below shows global configuration parameters related to project invitations. Click the edit button to set each parameter" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configuration Parameters" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.invite.required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set to true to turn on the invitations feature." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.email.sender" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The email address to show in the From field of invitation emails." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.invite.timeout" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Amount of time to allow for a new member to respond to the invitation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.smtp.host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name of the host that acts as an email server to handle invitations." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.smtp.password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) Password required by the SMTP server. You must also set project.smtp.username and set project.smtp.useAuth to true." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.smtp.port" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SMTP server’s listening port." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.smtp.useAuth" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set to true if the SMTP server requires a username and password." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "project.smtp.username" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) User name required by the SMTP server for authentication. You must also set project.smtp.password and set project.smtp.useAuth to true.." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service cloud-management restart" +msgstr "" + diff --git a/docs/pot/set-up-network-for-users.pot b/docs/pot/set-up-network-for-users.pot new file mode 100644 index 00000000000..48c1cb76270 --- /dev/null +++ b/docs/pot/set-up-network-for-users.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Up Networking for Users" +msgstr "" + diff --git a/docs/pot/set-usage-limit.pot b/docs/pot/set-usage-limit.pot new file mode 100644 index 00000000000..f39f0d6292b --- /dev/null +++ b/docs/pot/set-usage-limit.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Usage Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides several administrator control points for capping resource usage by users. Some of these limits are global configuration parameters. Others are applied at the ROOT domain and may be overridden on a per-account basis." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Aggregate limits may be set on a per-domain basis. For example, you may limit a domain and all subdomains to the creation of 100 VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section covers the following topics:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Globally Configured Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Default Account Resource Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Per Domain Limits" +msgstr "" + diff --git a/docs/pot/set-zone-vlan-run-vm-max.pot b/docs/pot/set-zone-vlan-run-vm-max.pot new file mode 100644 index 00000000000..6fc47e67b84 --- /dev/null +++ b/docs/pot/set-zone-vlan-run-vm-max.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Zone VLAN and Running VM Maximums" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the external networking case, every VM in a zone must have a unique guest IP address. There are two variables that you need to consider in determining how to configure &PRODUCT; to support this: how many Zone VLANs do you expect to have and how many VMs do you expect to have running in the Zone at any one time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the following table to determine how to configure &PRODUCT; for your deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "guest.vlan.bits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum Running VMs per Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Maximum Zone VLANs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "12" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4096" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4094" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "11" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "8192" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2048" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "10" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "16384" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "1024" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "32768" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "512" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Based on your deployment's needs, choose the appropriate value of guest.vlan.bits. Set it as described in Edit the Global Configuration Settings (Optional) section and restart the Management Server." +msgstr "" + diff --git a/docs/pot/shared-networks.pot b/docs/pot/shared-networks.pot new file mode 100644 index 00000000000..9d8085dcb81 --- /dev/null +++ b/docs/pot/shared-networks.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Shared Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A shared network can be accessed by virtual machines that belong to many different accounts. Network Isolation on shared networks is accomplished using techniques such as security groups (supported only in basic zones in &PRODUCT; 3.0.3)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shared Networks are created by the administrator" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shared Networks can be designated to a certain domain" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shared Network resources such as VLAN and physical network that it maps to are designated by the administrator" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Shared Networks are isolated by security groups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Network is a shared network that is not shown to the end users" +msgstr "" + diff --git a/docs/pot/signing-api-requests.pot b/docs/pot/signing-api-requests.pot new file mode 100644 index 00000000000..10d171473d7 --- /dev/null +++ b/docs/pot/signing-api-requests.pot @@ -0,0 +1,140 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Signing API Requests" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Whether you access the CloudStack API with HTTP or HTTPS, it must still be signed so that CloudStack can verify the caller has been authenticated and authorized to execute the command. Make sure that you have both the API Key and Secret Key provided by the CloudStack administrator for your account before proceeding with the signing process." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To show how to sign a request, we will re-use the previous example." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://http://localhost:8080/client/api?command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=2&zoneId=4&apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ&signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Breaking this down, we have several distinct parts to this URL." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Base URL: This is the base URL to the CloudStack Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://localhost:8080" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "API Path: This is the path to the API Servlet that processes the incoming requests." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "/client/api?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Command String: This part of the query string comprises of the command, its parameters, and the API Key that identifies the account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "As with all query string parameters of field-value pairs, the \"field\" component is case insensitive while all \"value\" values are case sensitive." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=2&zoneId=4&apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Signature: This is the hashed signature of the Base URL that is generated using a combination of the user’s Secret Key and the HMAC SHA-1 hashing algorithm." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Every API request has the format Base URL+API Path+Command String+Signature." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To generate the signature." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For each field-value pair (as separated by a '&') in the Command String, URL encode each value so that it can be safely sent via HTTP GET." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure all spaces are encoded as \"%20\" rather than \"+\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Lower case the entire Command String and sort it alphabetically via the field for each field-value pair. The result of this step would look like the following." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "apikey=mivr6x7u6bn_sdahobpjnejpgest35exq-jb8cg20yi3yaxxcgpyuairmfi_ejtvwz0nukkjbpmy3y2bcikwfq&command=deployvirtualmachine&diskofferingid=1&serviceofferingid=1&templateid=2&zoneid=4" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Take the sorted Command String and run it through the HMAC SHA-1 hashing algorithm (most programming languages offer a utility method to do this) with the user’s Secret Key. Base64 encode the resulting byte array in UTF-8 so that it can be safely transmitted via HTTP. The final string produced after Base64 encoding should be \"Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D\"." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By reconstructing the final URL in the format Base URL+API Path+Command String+Signature, the final URL should look like:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "http://localhost:8080/client/api?command=deployVirtualMachine&serviceOfferingId=1&diskOfferingId=1&templateId=2&zoneId=4&apiKey=miVr6X7u6bN_sdahOBpjNejPgEsT35eXq-jB8CG20YI3yaxXcgpyuaIRmFI_EJTVwZ0nUkkJbPmY3y2bciKwFQ&signature=Lxx1DM40AjcXU%2FcaiK8RAP0O1hU%3D" +msgstr "" + diff --git a/docs/pot/site-to-site-vpn.pot b/docs/pot/site-to-site-vpn.pot new file mode 100644 index 00000000000..e3be2197d5c --- /dev/null +++ b/docs/pot/site-to-site-vpn.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Setting Up a Site-to-Site VPN Connection" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A Site-to-Site VPN connection helps you establish a secure connection from an enterprise datacenter to the cloud infrastructure. This allows users to access the guest VMs by establishing a VPN connection to the virtual router of the account from a device in the datacenter of the enterprise. Having this facility eliminates the need to establish VPN connections to individual VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The supported endpoints on the remote datacenters are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cisco ISR with IOS 12.4 or later" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Juniper J-Series routers with JunOS 9.5 or later" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the specific Cisco and Juniper devices listed above, the expectation is that any Cisco or Juniper device running on the supported operating systems are able to establish VPN connections." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To set up a Site-to-Site VPN connection, perform the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a Virtual Private Cloud (VPC)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a VPN Customer Gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a VPN gateway for the VPC that you created." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create VPN connection from the VPC VPN gateway to the customer VPN gateway." +msgstr "" + diff --git a/docs/pot/small_scale_deployment.pot b/docs/pot/small_scale_deployment.pot new file mode 100644 index 00000000000..033f3c425a3 --- /dev/null +++ b/docs/pot/small_scale_deployment.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Small-Scale Deployment" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This diagram illustrates the network architecture of a small-scale &PRODUCT; deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A firewall provides a connection to the Internet. The firewall is configured in NAT mode. The firewall forwards HTTP requests and API calls from the Internet to the Management Server. The Management Server resides on the management network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A layer-2 switch connects all physical servers and storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A single NFS server functions as both the primary and secondary storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server is connected to the management network." +msgstr "" + diff --git a/docs/pot/snapshot-restore.pot b/docs/pot/snapshot-restore.pot new file mode 100644 index 00000000000..5d4d1f55147 --- /dev/null +++ b/docs/pot/snapshot-restore.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Snapshot Restore" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are two paths to restoring snapshots. Users can create a volume from the snapshot. The volume can then be mounted to a VM and files recovered as needed. Alternatively, a template may be created from the snapshot of a root disk. The user can then boot a VM from this template to effect recovery of the root disk." +msgstr "" + diff --git a/docs/pot/source-build.pot b/docs/pot/source-build.pot new file mode 100644 index 00000000000..304d2eb36db --- /dev/null +++ b/docs/pot/source-build.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building &PRODUCT; from Source" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prior to the 4.0.0 incubating release, Ant was used to build &PRODUCT;. Starting with 4.0.0 a migration to Maven is underway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The website and the wiki contain up to date information on the build procedure at:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "https://cwiki.apache.org/CLOUDSTACK/building-with-maven.html" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://incubator.apache.org/cloudstack/develop/environment.html" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The overarching steps to build &PRODUCT; are:." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Install the prerequisites and setup your environment" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Understand that various Maven profiles and build targets" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Deploy and test your build" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If needed, learn how to build binaries" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Learning Maven is outside the scope of this documentation." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Go to the Maven website at http://maven.apache.org/guides/getting-started/index.html" +msgstr "" + diff --git a/docs/pot/source-prereqs.pot b/docs/pot/source-prereqs.pot new file mode 100644 index 00000000000..b22b5f7144a --- /dev/null +++ b/docs/pot/source-prereqs.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Prerequisites for building Apache CloudStack" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are a number of prerequisites needed to build &PRODUCT;. This document assumes compilation on a Linux system that uses RPMs or DEBs for package management." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The minimum bootstrapped prerequisites for building &PRODUCT; includes the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ant" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "maven (version 3)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Java (Java 6/OpenJDK 1.6)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rpmbuild or dpkg-dev" +msgstr "" + diff --git a/docs/pot/source.pot b/docs/pot/source.pot new file mode 100644 index 00000000000..525c0b43d42 --- /dev/null +++ b/docs/pot/source.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Building from Source" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The official &PRODUCT; release is always in source code form. While there may exist convenience binaries in various forms from a number of places, the source is the canonical release will be source. In this document we'll cover acquiring the source release, building that into binary, deployable packages." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "While building and deploying directly from source is certainly possible, the reality of Infrastructure-as-a-Service cloud computing implies a need to deploy packages on a potentially large number of systems, which RPMs and DEBs fill nicely." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Building and deploying directly from source is thus outside the scope of this document, but is documented in the INSTALL.md file in the release." +msgstr "" + diff --git a/docs/pot/ssl.pot b/docs/pot/ssl.pot new file mode 100644 index 00000000000..037169bea8f --- /dev/null +++ b/docs/pot/ssl.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "SSL (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides HTTP access in its default installation. There are a number of technologies and sites which choose to implement SSL. As a result, we have left &PRODUCT; to expose HTTP under the assumption that a site will implement its typical practice." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses Tomcat as its servlet container. For sites that would like &PRODUCT; to terminate the SSL session, Tomcat’s SSL access may be enabled. Tomcat SSL configuration is described at http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html." +msgstr "" + diff --git a/docs/pot/standard-events.pot b/docs/pot/standard-events.pot new file mode 100644 index 00000000000..adb22613c10 --- /dev/null +++ b/docs/pot/standard-events.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Standard Events" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The events log records three types of standard events." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "INFO. This event is generated when an operation has been successfully performed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "WARN. This event is generated in the following circumstances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a network is disconnected while monitoring a template download." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a template download is abandoned." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When an issue on the storage server causes the volumes to fail over to the mirror storage server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ERROR. This event is generated when an operation has not been successfully performed" +msgstr "" + diff --git a/docs/pot/static-nat.pot b/docs/pot/static-nat.pot new file mode 100644 index 00000000000..60f01be8e33 --- /dev/null +++ b/docs/pot/static-nat.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Static NAT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A static NAT rule maps a public IP address to the private IP address of a VM in order to allow Internet traffic into the VM. The public IP address always remains the same, which is why it is called \"static\" NAT. This section tells how to enable or disable static NAT for a particular IP address." +msgstr "" + diff --git a/docs/pot/sticky-session-policies-for-lb-rules.pot b/docs/pot/sticky-session-policies-for-lb-rules.pot new file mode 100644 index 00000000000..cbe4ae616ea --- /dev/null +++ b/docs/pot/sticky-session-policies-for-lb-rules.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Sticky Session Policies for Load Balancer Rules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Sticky sessions are used in Web-based applications to ensure continued availability of information across the multiple requests in a user's session. For example, if a shopper is filling a cart, you need to remember what has been purchased so far. The concept of \"stickiness\" is also referred to as persistence or maintaining state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Any load balancer rule defined in &PRODUCT; can have a stickiness policy. The policy consists of a name, stickiness method, and parameters. The parameters are name-value pairs or flags, which are defined by the load balancer vendor. The stickiness method could be load balancer-generated cookie, application-generated cookie, or source-based. In the source-based method, the source IP address is used to identify the user and locate the user’s stored data. In the other methods, cookies are used. The cookie generated by the load balancer or application is included in request and response URLs to create persistence. The cookie name can be specified by the administrator or automatically generated. A variety of options are provided to control the exact behavior of cookies, such as how they are generated and whether they are cached." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the most up to date list of available stickiness methods, see the &PRODUCT; UI or call listNetworks and check the SupportedStickinessMethods capability." +msgstr "" + diff --git a/docs/pot/stop-restart-management-server.pot b/docs/pot/stop-restart-management-server.pot new file mode 100644 index 00000000000..dec05253f6a --- /dev/null +++ b/docs/pot/stop-restart-management-server.pot @@ -0,0 +1,65 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Stopping and Restarting the Management Server" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The root administrator will need to stop and restart the Management Server from time to time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, after changing a global configuration parameter, a restart is required. If you have multiple Management Server nodes, restart all of them to put the new parameter value into effect consistently throughout the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To stop the Management Server, issue the following command at the operating system prompt on the Management Server node:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management stop" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To start the Management Server:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management start" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To stop the Management Server:" +msgstr "" + diff --git a/docs/pot/stopped-vm.pot b/docs/pot/stopped-vm.pot new file mode 100644 index 00000000000..8f5f7c1b3fe --- /dev/null +++ b/docs/pot/stopped-vm.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Stopped VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; now supports creating a VM without starting it. You can determine whether the VM needs to be started as part of the VM deployment. A VM can now be deployed in two ways: create and start a VM (the default method); or create a VM and leave it in the stopped state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A new request parameter, startVM, is introduced in the deployVm API to support the stopped VM feature." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The possible values are:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "true - The VM starts as a part of the VM deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "false - The VM is left in the stopped state at the end of the VM deployment." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default value is true." +msgstr "" + diff --git a/docs/pot/stopping-and-starting-vms.pot b/docs/pot/stopping-and-starting-vms.pot new file mode 100644 index 00000000000..2228d58c246 --- /dev/null +++ b/docs/pot/stopping-and-starting-vms.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Stopping and Starting VMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Any user can access their own virtual machines. The administrator can access all VMs running in the cloud." +msgstr "" + diff --git a/docs/pot/storage-nw-topology-req.pot b/docs/pot/storage-nw-topology-req.pot new file mode 100644 index 00000000000..9786961851f --- /dev/null +++ b/docs/pot/storage-nw-topology-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Storage Network Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The secondary storage NFS export is mounted by the secondary storage VM. Secondary storage traffic goes over the management traffic network, even if there is a separate storage network. Primary storage traffic goes over the storage network, if available. If you choose to place secondary storage NFS servers on the storage network, you must make sure there is a route from the management traffic network to the storage network." +msgstr "" + diff --git a/docs/pot/storage-overview.pot b/docs/pot/storage-overview.pot new file mode 100644 index 00000000000..a2cad3573f4 --- /dev/null +++ b/docs/pot/storage-overview.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Storage Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; defines two types of storage: primary and secondary. Primary storage can be accessed by either iSCSI or NFS. Additionally, direct attached storage may be used for primary storage. Secondary storage is always accessed using NFS." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is no ephemeral storage in &PRODUCT;. All volumes on all nodes are persistent." +msgstr "" + diff --git a/docs/pot/storage-tags.pot b/docs/pot/storage-tags.pot new file mode 100644 index 00000000000..8ed6ccf2214 --- /dev/null +++ b/docs/pot/storage-tags.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Storage Tags" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage may be \"tagged\". A tag is a text string attribute associated with primary storage, a Disk Offering, or a Service Offering. Tags allow administrators to provide additional information about the storage. For example, that is a \"SSD\" or it is \"slow\". Tags are not interpreted by &PRODUCT;. They are matched against tags placed on service and disk offerings. &PRODUCT; requires all tags on service and disk offerings to exist on the primary storage before it allocates root or data disks on the primary storage. Service and disk offering tags are used to identify the requirements of the storage that those offerings have. For example, the high end service offering may require \"fast\" for its root disk volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The interaction between tags, allocation, and volume copying across clusters and pods can be complex. To simplify the situation, use the same set of tags on the primary storage for all clusters in a pod. Even if different devices are used to present those tags, the set of exposed tags can be the same." +msgstr "" + diff --git a/docs/pot/storage.pot b/docs/pot/storage.pot new file mode 100644 index 00000000000..cc72673f6d9 --- /dev/null +++ b/docs/pot/storage.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working With Storage" +msgstr "" + diff --git a/docs/pot/suspend-project.pot b/docs/pot/suspend-project.pot new file mode 100644 index 00000000000..e2c6c7d3d01 --- /dev/null +++ b/docs/pot/suspend-project.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Suspending or Deleting a Project" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a project is suspended, it retains the resources it owns, but they can no longer be used. No new resources or members can be added to a suspended project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a project is deleted, its resources are destroyed, and member accounts are removed from the project. The project’s status is shown as Disabled pending final deletion." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A project can be suspended or deleted by the project administrator, the domain administrator of the domain the project belongs to or of its parent domain, or the &PRODUCT; root administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, click Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Select View, choose Projects." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the name of the project." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click one of the buttons:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To delete, use deletebutton.png: Removes a project " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To suspend, use deletebutton.png: suspends a project " +msgstr "" + diff --git a/docs/pot/sys-offering-sysvm.pot b/docs/pot/sys-offering-sysvm.pot new file mode 100644 index 00000000000..995ae9a3c5e --- /dev/null +++ b/docs/pot/sys-offering-sysvm.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Changing the Default System Offering for System VMs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can manually change the system offering for a particular System VM. Additionally, as a &PRODUCT; administrator, you can also change the default system offering used for System VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a new system offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see Creating a New System Service Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Back up the database:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysqldump -u root -p cloud | bzip2 > cloud_backup.sql.bz2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Open an MySQL prompt:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "mysql -u cloud -p cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following queries on the cloud database." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the disk_offering table, identify the original default offering and the new offering you want to use by default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Take a note of the ID of the new offering." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "select id,name,unique_name,type from disk_offering;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the original default offering, set the value of unique_name to NULL." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# update disk_offering set unique_name = NULL where id = 10;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that you use the correct value for the ID." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the new offering that you want to use by default, set the value of unique_name as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For the default Console Proxy VM (CPVM) offering,set unique_name to 'Cloud.com-ConsoleProxy'. For the default Secondary Storage VM (SSVM) offering, set unique_name to 'Cloud.com-SecondaryStorage'. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "update disk_offering set unique_name = 'Cloud.com-ConsoleProxy' where id = 16;" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart &PRODUCT; Management Server. Restarting is required because the default offerings are loaded into the memory at startup." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "service cloud-management restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Destroy the existing CPVM or SSVM offerings and wait for them to be recreated. The new CPVM or SSVM are configured with the new offering." +msgstr "" + diff --git a/docs/pot/sys-reliability-and-ha.pot b/docs/pot/sys-reliability-and-ha.pot new file mode 100644 index 00000000000..f6820688aa7 --- /dev/null +++ b/docs/pot/sys-reliability-and-ha.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Reliability and High Availability" +msgstr "" + diff --git a/docs/pot/sysprep-for-windows-server-2003R2.pot b/docs/pot/sysprep-for-windows-server-2003R2.pot new file mode 100644 index 00000000000..c975206ed97 --- /dev/null +++ b/docs/pot/sysprep-for-windows-server-2003R2.pot @@ -0,0 +1,160 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Sysprep for Windows Server 2003 R2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Earlier versions of Windows have a different sysprep tool. Follow these steps for Windows Server 2003 R2." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extract the content of \\support\\tools\\deploy.cab on the Windows installation CD into a directory called c:\\sysprep on the Windows 2003 R2 VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run c:\\sysprep\\setupmgr.exe to create the sysprep.inf file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Create New to create a new Answer File." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enter “Sysprep setup†for the Type of Setup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the appropriate OS version and edition." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the License Agreement screen, select “Yes fully automate the installationâ€." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide your name and organization." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Leave display settings at default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set the appropriate time zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide your product key." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select an appropriate license mode for your deployment" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select “Automatically generate computer nameâ€." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Type a default administrator password. If you enable the password reset feature, the users will not actually use this password. This password will be reset by the instance manager after the guest boots up." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Leave Network Components at “Typical Settingsâ€." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the “WORKGROUP†option." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Leave Telephony options at default." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select appropriate Regional Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select appropriate language settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not install printers." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Do not specify “Run Once commandsâ€." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need not specify an identification string." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Save the Answer File as c:\\sysprep\\sysprep.inf." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command to sysprep the image:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "c:\\sysprep\\sysprep.exe -reseal -mini -activated" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After this step the machine will automatically shut down" +msgstr "" + diff --git a/docs/pot/sysprep-windows-server-2008R2.pot b/docs/pot/sysprep-windows-server-2008R2.pot new file mode 100644 index 00000000000..91202d855da --- /dev/null +++ b/docs/pot/sysprep-windows-server-2008R2.pot @@ -0,0 +1,147 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Preparation for Windows Server 2008 R2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For Windows 2008 R2, you run Windows System Image Manager to create a custom sysprep response XML file. Windows System Image Manager is installed as part of the Windows Automated Installation Kit (AIK). Windows AIK can be downloaded from the Microsoft Download Center at the following location:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Microsoft Download Center." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use the following steps to run sysprep for Windows 2008 R2:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The steps outlined here are derived from the excellent guide by Charity Shelbourne, originally published at Windows Server 2008 Sysprep Mini-Setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download and install the Windows AIK" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Windows AIK should not be installed on the Windows 2008 R2 VM you just created. Windows AIK should not be part of the template you create. It is only used to create the sysprep answer file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the install.wim file in the \\sources directory of the Windows 2008 R2 installation DVD to the hard disk. This is a very large file and may take a long time to copy. Windows AIK requires the WIM file to be writable." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Start the Windows System Image Manager, which is part of the Windows AIK." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Windows Image pane, right click “Select a Windows image or catalog file†to load the install.wim file you just copied." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select the Windows 2008 R2 Edition" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You may be prompted with a warning that the catalog file cannot be opened. Click Yes to create a new catalog file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Answer File pane, right click to create a new answer file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Generate the answer file from the Windows System Image Manager using the following steps:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The first page you need to automate is the Language and Country or Region Selection page. To automate this, expand Components in your Windows Image pane, right-click and add the Microsoft-Windows-International-Core setting to Pass 7 oobeSystem. In your Answer File pane, configure the InputLocale, SystemLocale, UILanguage, and UserLocale with the appropriate settings for your language and country or region. Should you have a question about any of these settings, you can right-click on the specific setting and select Help. This will open the appropriate CHM help file with more information, including examples on the setting you are attempting to configure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to automate the Software License Terms Selection page, otherwise known as the End-User License Agreement (EULA). To do this, expand the Microsoft-Windows-Shell-Setup component. High-light the OOBE setting, and add the setting to the Pass 7 oobeSystem. In Settings, set HideEULAPage true." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the license key is properly set. If you use MAK key, you can just enter the MAK key on the Windows 2008 R2 VM. You need not input the MAK into the Windows System Image Manager. If you use KMS host for activation you need not enter the Product Key. Details of Windows Volume Activation can be found at " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to automate is the Change Administrator Password page. Expand the Microsoft-Windows-Shell-Setup component (if it is not still expanded), expand UserAccounts, right-click on AdministratorPassword, and add the setting to the Pass 7 oobeSystem configuration pass of your answer file. Under Settings, specify a password next to Value." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You may read the AIK documentation and set many more options that suit your deployment. The steps above are the minimum needed to make Windows unattended setup work." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Save the answer file as unattend.xml. You can ignore the warning messages that appear in the validation window." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the unattend.xml file into the c:\\windows\\system32\\sysprep directory of the Windows 2008 R2 Virtual Machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once you place the unattend.xml file in c:\\windows\\system32\\sysprep directory, you run the sysprep tool as follows:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "cd c:\\Windows\\System32\\sysprep\n" +"sysprep.exe /oobe /generalize /shutdown\n" +"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Windows 2008 R2 VM will automatically shut down after sysprep is complete." +msgstr "" + diff --git a/docs/pot/system-reserved-ip-addresses.pot b/docs/pot/system-reserved-ip-addresses.pot new file mode 100644 index 00000000000..5caf9fa39b8 --- /dev/null +++ b/docs/pot/system-reserved-ip-addresses.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Reserved IP Addresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In each zone, you need to configure a range of reserved IP addresses for the management network. This network carries communication between the &PRODUCT; Management Server and various system VMs, such as Secondary Storage VMs, Console Proxy VMs, and DHCP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The reserved IP addresses must be unique across the cloud. You cannot, for example, have a host in one zone which has the same private IP address as a host in another zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The hosts in a pod are assigned private IP addresses. These are typically RFC1918 addresses. The Console Proxy and Secondary Storage system VMs are also allocated private IP addresses in the CIDR of the pod that they are created in." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure computing servers and Management Servers use IP addresses outside of the System Reserved IP range. For example, suppose the System Reserved IP range starts at 192.168.154.2 and ends at 192.168.154.7. &PRODUCT; can use .2 to .7 for System VMs. This leaves the rest of the pod CIDR, from .8 to .254, for the Management Server and hypervisor hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In all zones:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide private IPs for the system in each pod and provision them in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For KVM and XenServer, the recommended number of private IPs per pod is one per host. If you expect a pod to grow, add enough private IPs now to accommodate the growth." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a zone that uses advanced networking:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For zones with advanced networking, we recommend provisioning enough private IPs for your total number of customers, plus enough for the required &PRODUCT; System VMs. Typically, about 10 additional IPs are required for the System VMs. For more information about System VMs, see Working with System Virtual Machines in the Administrator's Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When advanced networking is being used, the number of private IP addresses available in each pod varies depending on which hypervisor is running on the nodes in that pod. Citrix XenServer and KVM use link-local addresses, which in theory provide more than 65,000 private IP addresses within the address block. As the pod grows over time, this should be more than enough for any reasonable number of hosts as well as IP addresses for guest virtual routers. VMWare ESXi, by contrast uses any administrator-specified subnetting scheme, and the typical administrator provides only 255 IPs per pod. Since these are shared by physical machines, the guest virtual router, and other entities, it is possible to run out of private IPs when scaling up a pod whose nodes are running ESXi." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To ensure adequate headroom to scale private IP space in an ESXi pod that uses advanced networking, use one or both of the following techniques:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specify a larger CIDR block for the subnet. A subnet mask with a /20 suffix will provide more than 4,000 IP addresses." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create multiple pods, each with its own subnet. For example, if you create 10 pods and each pod has 255 IPs, this will provide 2,550 IP addresses." +msgstr "" + diff --git a/docs/pot/system-service-offerings.pot b/docs/pot/system-service-offerings.pot new file mode 100644 index 00000000000..726d0d0f2ce --- /dev/null +++ b/docs/pot/system-service-offerings.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "System service offerings provide a choice of CPU speed, number of CPUs, tags, and RAM size, just as other service offerings do. But rather than being used for virtual machine instances and exposed to users, system service offerings are used to change the default properties of virtual routers, console proxies, and other system VMs. System service offerings are visible only to the &PRODUCT; root administrator. &PRODUCT; provides default system service offerings. The &PRODUCT; root administrator can create additional custom system service offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When &PRODUCT; creates a virtual router for a guest network, it uses default settings which are defined in the system service offering associated with the network offering. You can upgrade the capabilities of the virtual router by applying a new network offering that contains a different system service offering. All virtual routers in that network will begin using the settings from the new service offering." +msgstr "" + diff --git a/docs/pot/system-vm-template.pot b/docs/pot/system-vm-template.pot new file mode 100644 index 00000000000..9b739867a7f --- /dev/null +++ b/docs/pot/system-vm-template.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "The System VM Template" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The System VMs come from a single template. The System VM has the following characteristics:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Debian 6.0 (\"Squeeze\"), 2.6.32 kernel with the latest security patches from the Debian security APT repository" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Has a minimal set of packages installed thereby reducing the attack surface" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "32-bit for enhanced performance on Xen/VMWare" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "pvops kernel with Xen PV drivers, KVM virtio drivers, and VMware tools for optimum performance on all hypervisors" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Xen tools inclusion allows performance monitoring" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Latest versions of HAProxy, iptables, IPsec, and Apache from debian repository ensures improved security and speed" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Latest version of JRE from Sun/Oracle ensures improved security and speed" +msgstr "" + diff --git a/docs/pot/tagging-resources.pot b/docs/pot/tagging-resources.pot new file mode 100644 index 00000000000..935fc5f5193 --- /dev/null +++ b/docs/pot/tagging-resources.pot @@ -0,0 +1,140 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Tags to Organize Resources in the Cloud" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A tag is a key-value pair that stores metadata about a resource in the cloud. Tags are useful for categorizing resources. For example, you can tag a user VM with a value that indicates the user's city of residence. In this case, the key would be \"city\" and the value might be \"Toronto\" or \"Tokyo.\" You can then request &PRODUCT; to find all resources that have a given tag; for example, VMs for users in a given city." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can tag a user virtual machine, volume, snapshot, guest network, template, ISO, firewall rule, port forwarding rule, public IP address, security group, load balancer rule, project, VPC, network ACL, or static route. You can not tag a remote access VPN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can work with tags through the UI or through the API commands createTags, deleteTags, and listTags. You can define multiple tags for each resource. There is no limit on the number of tags you can define. Each tag can be up to 255 characters long. Users can define tags on the resources they own, and administrators can define tags on any resources in the cloud." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "An optional input parameter, \"tags,\" exists on many of the list* API commands. The following example shows how to use this new parameter to find all the volumes having tag region=canada OR tag city=Toronto:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "command=listVolumes\n" +" &listAll=true\n" +" &tags[0].key=region\n" +" &tags[0].value=canada\n" +" &tags[1].key=city\n" +" &tags[1].value=Toronto" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following API commands have the \"tags\" input parameter:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVirtualMachines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVolumes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSnapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listTemplates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listIsos" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listFirewallRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPortForwardingRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listPublicIpAddresses" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listSecurityGroups" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listLoadBalancerRules" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listProjects" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listVPCs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listNetworkACLs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "listStaticRoutes" +msgstr "" + diff --git a/docs/pot/template-iso-snapshot-usage-record-format.pot b/docs/pot/template-iso-snapshot-usage-record-format.pot new file mode 100644 index 00000000000..c76cb5baa34 --- /dev/null +++ b/docs/pot/template-iso-snapshot-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Template, ISO, and Snapshot Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage – String representation of the usage, including the units of usage (e.g. 'Hrs' for hours)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – The ID of the the template, ISO, or snapshot" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "offeringid – The ID of the disk offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "templateid – – Included only for templates (usage type 7). Source template ID." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "size – Size of the template, ISO, or snapshot" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/templates.pot b/docs/pot/templates.pot new file mode 100644 index 00000000000..90eac76c4b3 --- /dev/null +++ b/docs/pot/templates.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Templates" +msgstr "" + diff --git a/docs/pot/time-zones.pot b/docs/pot/time-zones.pot new file mode 100644 index 00000000000..b5573031c86 --- /dev/null +++ b/docs/pot/time-zones.pot @@ -0,0 +1,330 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Time Zones" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following time zone identifiers are accepted by &PRODUCT;. There are several places that have a time zone as a required or optional parameter. These include scheduling recurring snapshots, creating a user, and specifying the usage time zone in the Configuration table." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Etc/GMT+12" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Etc/GMT+11" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pacific/Samoa" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pacific/Honolulu" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "US/Alaska" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Los_Angeles" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Mexico/BajaNorte" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "US/Arizona" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "US/Mountain" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Chihuahua" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Chicago" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Costa_Rica" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Mexico_City" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Canada/Saskatchewan" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Bogota" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/New_York" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Caracas" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Asuncion" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Cuiaba" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Halifax" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/La_Paz" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Santiago" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/St_Johns" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Araguaina" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Argentina/Buenos_Aires" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Cayenne" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Godthab" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "America/Montevideo" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Etc/GMT+2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Atlantic/Azores" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Atlantic/Cape_Verde" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Africa/Casablanca" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Etc/UTC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Atlantic/Reykjavik" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Europe/London" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "CET" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Europe/Bucharest" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Africa/Johannesburg" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Beirut" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Africa/Cairo" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Jerusalem" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Europe/Minsk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Europe/Moscow" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Africa/Nairobi" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Karachi" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Kolkata" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Bangkok" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Shanghai" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Kuala_Lumpur" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Australia/Perth" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Taipei" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Tokyo" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Asia/Seoul" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Australia/Adelaide" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Australia/Darwin" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Australia/Brisbane" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Australia/Canberra" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pacific/Guam" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Pacific/Auckland" +msgstr "" + diff --git a/docs/pot/tools.pot b/docs/pot/tools.pot new file mode 100644 index 00000000000..08a478c9279 --- /dev/null +++ b/docs/pot/tools.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Tools" +msgstr "" + diff --git a/docs/pot/topology-req.pot b/docs/pot/topology-req.pot new file mode 100644 index 00000000000..3eb0f27ebf3 --- /dev/null +++ b/docs/pot/topology-req.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Topology Requirements" +msgstr "" + diff --git a/docs/pot/troubleshooting-alerts.pot b/docs/pot/troubleshooting-alerts.pot new file mode 100644 index 00000000000..be428933b9f --- /dev/null +++ b/docs/pot/troubleshooting-alerts.pot @@ -0,0 +1,68 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Alerts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following is the list of alert type numbers." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"MEMORY = 0\n" +"CPU = 1\n" +"STORAGE =2\n" +"STORAGE_ALLOCATED = 3\n" +"PUBLIC_IP = 4\n" +"PRIVATE_IP = 5\n" +"HOST = 6\n" +"USERVM = 7\n" +"DOMAIN_ROUTER = 8\n" +"CONSOLE_PROXY = 9\n" +"ROUTING = 10// lost connection to default route (to the gateway)\n" +"STORAGE_MISC = 11 // lost connection to default route (to the gateway)\n" +"USAGE_SERVER = 12 // lost connection to default route (to the gateway)\n" +"MANAGMENT_NODE = 13 // lost connection to default route (to the gateway)\n" +"DOMAIN_ROUTER_MIGRATE = 14\n" +"CONSOLE_PROXY_MIGRATE = 15\n" +"USERVM_MIGRATE = 16\n" +"VLAN = 17\n" +"SSVM = 18\n" +"USAGE_SERVER_RESULT = 19\n" +"STORAGE_DELETE = 20;\n" +"UPDATE_RESOURCE_COUNT = 21; //Generated when we fail to update the resource count\n" +"USAGE_SANITY_RESULT = 22;\n" +"DIRECT_ATTACHED_PUBLIC_IP = 23;\n" +"LOCAL_STORAGE = 24;\n" +"RESOURCE_LIMIT_EXCEEDED = 25; //Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only\n" +"\n" +" " +msgstr "" + diff --git a/docs/pot/troubleshooting-lb-rules-fails.pot b/docs/pot/troubleshooting-lb-rules-fails.pot new file mode 100644 index 00000000000..224d0b880cb --- /dev/null +++ b/docs/pot/troubleshooting-lb-rules-fails.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Load balancer rules fail after changing network offering" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After changing the network offering on a network, load balancer rules stop working." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Load balancing rules were created while using a network service offering that includes an external load balancer device such as NetScaler, and later the network service offering changed to one that uses the &PRODUCT; virtual router." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a firewall rule on the virtual router for each of your existing load balancing rules so that they continue to function." +msgstr "" + diff --git a/docs/pot/troubleshooting-recover-lost-virtual-router.pot b/docs/pot/troubleshooting-recover-lost-virtual-router.pot new file mode 100644 index 00000000000..8affe2a2fd6 --- /dev/null +++ b/docs/pot/troubleshooting-recover-lost-virtual-router.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Recovering a Lost Virtual Router" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A virtual router is running, but the host is disconnected. A virtual router no longer functions as expected." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Virtual router is lost or down." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are sure that a virtual router is down forever, or no longer functions as expected, destroy it. You must create one afresh while keeping the backup router up and running (it is assumed this is in a redundant router setup):" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Force stop the router. Use the stopRouter API with forced=true parameter to do so." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Before you continue with destroying this router, ensure that the backup router is running. Otherwise the network connection will be lost." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Destroy the router by using the destroyRouter API." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Recreate the missing router by using the restartNetwork API with cleanup=false parameter. For more information about redundant router setup, see Creating a New Network Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information about the API syntax, see the API Reference at API Reference." +msgstr "" + diff --git a/docs/pot/troubleshooting-unable-to-deploy-vms.pot b/docs/pot/troubleshooting-unable-to-deploy-vms.pot new file mode 100644 index 00000000000..ebc0f213003 --- /dev/null +++ b/docs/pot/troubleshooting-unable-to-deploy-vms.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Unable to deploy VMs from uploaded vSphere template" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When attempting to create a VM, the VM will not deploy." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the template was created by uploading an OVA file that was created using vSphere Client, it is possible the OVA contained an ISO image. If it does, the deployment of VMs from the template will fail." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remove the ISO and re-upload the template." +msgstr "" + diff --git a/docs/pot/troubleshooting-unable-to-power-on-vm.pot b/docs/pot/troubleshooting-unable-to-power-on-vm.pot new file mode 100644 index 00000000000..f2b5e71b73c --- /dev/null +++ b/docs/pot/troubleshooting-unable-to-power-on-vm.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Unable to power on virtual machine on VMware" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual machine does not power on. You might see errors like:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unable to open Swap File" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unable to access a file since it is locked" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Unable to access Virtual machine configuration" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A known issue on VMware machines. ESX hosts lock certain critical virtual machine files and file systems to prevent concurrent changes. Sometimes the files are not unlocked when the virtual machine is powered off. When a virtual machine attempts to power on, it can not access these critical files, and the virtual machine is unable to power on." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware Knowledge Base Article" +msgstr "" + diff --git a/docs/pot/troubleshooting-working-with-server-logs.pot b/docs/pot/troubleshooting-working-with-server-logs.pot new file mode 100644 index 00000000000..367936c4881 --- /dev/null +++ b/docs/pot/troubleshooting-working-with-server-logs.pot @@ -0,0 +1,76 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with Server Logs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Management Server logs all web site, middle tier, and database activities for diagnostics purposes in /var/log/cloud/management/. The &PRODUCT; logs a variety of error messages. We recommend this command to find the problematic output in the Management Server log:." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When copying and pasting a command, be sure the command has pasted as a single line before executing. Some document viewers may introduce unwanted line breaks in copied text." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" grep -i -E 'exception|unable|fail|invalid|leak|warn|error' /var/log/cloud/management/management-server.log\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; processes requests with a Job ID. If you find an error in the logs and you are interested in debugging the issue you can grep for this job ID in the management server log. For example, suppose that you find the following ERROR message:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" 2010-10-04 13:49:32,595 ERROR [cloud.vm.UserVmManagerImpl] (Job-Executor-11:job-1076) Unable to find any host for [User|i-8-42-VM-untagged]\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Note that the job ID is 1076. You can track back the events relating to job 1076 with the following grep:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +" grep \"job-1076)\" management-server.log\n" +" " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; Agent Server logs its activities in /var/log/cloud/agent/." +msgstr "" + diff --git a/docs/pot/troubleshooting.pot b/docs/pot/troubleshooting.pot new file mode 100644 index 00000000000..b233f5a9f7d --- /dev/null +++ b/docs/pot/troubleshooting.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Troubleshooting" +msgstr "" + diff --git a/docs/pot/troublesht-dataloss-on-exp-primary-storage.pot b/docs/pot/troublesht-dataloss-on-exp-primary-storage.pot new file mode 100644 index 00000000000..43272a472c3 --- /dev/null +++ b/docs/pot/troublesht-dataloss-on-exp-primary-storage.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Data Loss on Exported Primary Storage" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Loss of existing data on primary storage which has been exposed as a Linux NFS server export on an iSCSI volume." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "It is possible that a client from outside the intended pool has mounted the storage. When this occurs, the LVM is wiped and all data in the volume is lost" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When setting up LUN exports, restrict the range of IP addresses that are allowed access by specifying a subnet mask. For example:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "echo “/export 192.168.1.0/24(rw,async,no_root_squash)†> /etc/exports" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Adjust the above command to suit your deployment needs." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "More Information" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See the export procedure in the \"Secondary Storage\" section of the &PRODUCT; Installation Guide" +msgstr "" + diff --git a/docs/pot/troublesht-mtn-mode-not-working-on-vCenter.pot b/docs/pot/troublesht-mtn-mode-not-working-on-vCenter.pot new file mode 100644 index 00000000000..e49786b6044 --- /dev/null +++ b/docs/pot/troublesht-mtn-mode-not-working-on-vCenter.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Maintenance mode not working on vCenter" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Symptom" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Host was placed in maintenance mode, but still appears live in vCenter." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Cause" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; administrator UI was used to place the host in scheduled maintenance mode. This mode is separate from vCenter's maintenance mode." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Solution" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use vCenter to place the host in maintenance mode." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "More Information" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See " +msgstr "" + diff --git a/docs/pot/tuning.pot b/docs/pot/tuning.pot new file mode 100644 index 00000000000..0c4544734bd --- /dev/null +++ b/docs/pot/tuning.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Tuning" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This section provides tips on how to improve the performance of your cloud." +msgstr "" + diff --git a/docs/pot/ui.pot b/docs/pot/ui.pot new file mode 100644 index 00000000000..59f89ccf5f1 --- /dev/null +++ b/docs/pot/ui.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "User Interface" +msgstr "" + diff --git a/docs/pot/upgrade-virtual-router-with-service-offering.pot b/docs/pot/upgrade-virtual-router-with-service-offering.pot new file mode 100644 index 00000000000..51de0692e61 --- /dev/null +++ b/docs/pot/upgrade-virtual-router-with-service-offering.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Upgrading a Virtual Router with System Service Offerings" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When &PRODUCT; creates a virtual router, it uses default settings which are defined in a default system service offering. See . All the virtual routers in a single guest network use the same system service offering. You can upgrade the capabilities of the virtual router by creating and applying a custom system service offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Define your custom system service offering. See . In System VM Type, choose Domain Router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Associate the system service offering with a network offering. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apply the network offering to the network where you want the virtual routers to use the new system service offering. If this is a new network, follow the steps in Adding an Additional Guest Network on page 66. To change the service offering for existing virtual routers, follow the steps in ." +msgstr "" + diff --git a/docs/pot/upload-existing-volume-to-vm.pot b/docs/pot/upload-existing-volume-to-vm.pot new file mode 100644 index 00000000000..167f1e9e062 --- /dev/null +++ b/docs/pot/upload-existing-volume-to-vm.pot @@ -0,0 +1,150 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Uploading an Existing Volume to a Virtual Machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Existing data can be made accessible to a virtual machine. This is called uploading a volume to the VM. For example, this is useful to upload data from a local file system and attach it to a VM. Root administrators, domain administrators, and end users can all upload existing volumes to VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The upload is performed using HTTP. The uploaded volume is placed in the zone's secondary storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You cannot upload a volume if the preconfigured volume limit has already been reached. The default limit for the cloud is set in the global configuration parameter max.account.volumes, but administrators can also set per-domain limits that are different from the global default. See Setting Usage Limits" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To upload a volume:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) Create an MD5 hash (checksum) of the disk image file that you are going to upload. After uploading the data disk, &PRODUCT; will use this value to verify that no data corruption has occurred." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as an administrator or user" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Storage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Upload Volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name and Description. Any desired name and a brief description that can be shown in the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Availability Zone. Choose the zone where you want to store the volume. VMs running on hosts in this zone can attach the volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format. Choose one of the following to indicate the disk image format of the volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk Image Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "XenServer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VHD" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OVA" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "KVM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "QCOW2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL. The secure HTTP or HTTPS URL that &PRODUCT; can use to access your disk. The type of file at the URL must match the value chosen in Format. For example, if Format is VHD, the URL might look like the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "http://yourFileServerIP/userdata/myDataDisk.vhd" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MD5 checksum. (Optional) Use the hash that you created in step 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait until the status of the volume shows that the upload is complete. Click Instances - Volumes, find the name you specified in step 5, and make sure the status is Uploaded." +msgstr "" + diff --git a/docs/pot/upload-template.pot b/docs/pot/upload-template.pot new file mode 100644 index 00000000000..9d6e56ce3de --- /dev/null +++ b/docs/pot/upload-template.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Uploading Templates" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "vSphere Templates and ISOs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are uploading a template that was created using vSphere Client, be sure the OVA file does not contain an ISO. If it does, the deployment of VMs from the template will fail." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Templates are uploaded based on a URL. HTTP is the supported access protocol. Templates are frequently large files. You can optionally gzip them to decrease upload times." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To upload a template:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create Template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name and Display Text. These will be shown in the UI, so choose something descriptive." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL. The Management Server will download the file from the specified URL, such as http://my.web.server/filename.vhd.gz." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Zone. Choose the zone where you want the template to be available, or All Zones to make it available throughout &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "OS Type: This helps &PRODUCT; and the hypervisor perform certain operations and make assumptions that improve the performance of the guest. Select one of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the operating system of the stopped VM is listed, choose it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the OS type of the stopped VM is not listed, choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should not choose an older version of the OS than the version in the image. For example, choosing CentOS 5.4 to support a CentOS 6.2 image will in general not work. In those cases you should choose Other." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Format. The format of the template upload file, such as VHD or OVA." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password Enabled. Choose Yes if your template has the &PRODUCT; password change script installed. See Adding Password Management to Your Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Extractable. Choose Yes if the template is available for extraction. If this option is selected, end users can download a full image of a template." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public. Choose Yes to make this template accessible to all users of this &PRODUCT; installation. The template will appear in the Community Templates list. See " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Featured. Choose Yes if you would like this template to be more prominent for users to select. The template will appear in the Featured Templates list. Only an administrator can make a template Featured." +msgstr "" + diff --git a/docs/pot/usage-record-format.pot b/docs/pot/usage-record-format.pot new file mode 100644 index 00000000000..3142d0445f8 --- /dev/null +++ b/docs/pot/usage-record-format.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Usage Record Format" +msgstr "" + diff --git a/docs/pot/usage-types.pot b/docs/pot/usage-types.pot new file mode 100644 index 00000000000..cb246352dc7 --- /dev/null +++ b/docs/pot/usage-types.pot @@ -0,0 +1,245 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Usage Types" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following table shows all usage types." +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Type ID" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Type Name" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Description" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "1" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "RUNNING_VM" +msgstr "" + +#. Tag: entry +#, no-c-format +msgid "Tracks the total running time of a VM per usage record period. If the VM is upgraded during the usage period, you will get a separate Usage Record for the new upgraded VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "2" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ALLOCATED_VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time the VM has been created to the time when it has been destroyed. This usage type is also useful in determining usage for specific templates such as Windows-based templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "3" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP_ADDRESS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the public IP address owned by the account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK_BYTES_SENT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total number of bytes sent by all the VMs for an account. Cloud.com does not currently track network traffic per VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK_BYTES_RECEIVED" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total number of bytes received by all the VMs for an account. Cloud.com does not currently track network traffic per VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "6" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VOLUME" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time a disk volume has been created to the time when it has been destroyed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "7" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "TEMPLATE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time a template (either created from a snapshot or uploaded to the cloud) has been created to the time it has been destroyed. The size of the template is also returned." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "8" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time an ISO has been uploaded to the time it has been removed from the cloud. The size of the ISO is also returned." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "9" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SNAPSHOT" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time from when a snapshot has been created to the time it have been destroyed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "11" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "LOAD_BALANCER_POLICY" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the total time a load balancer policy has been created to the time it has been removed. Cloud.com does not track whether a VM has been assigned to a policy." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "12" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "PORT_FORWARDING_RULE" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Tracks the time from when a port forwarding rule was created until the time it was removed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "13" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NETWORK_OFFERING" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The time from when a network offering was assigned to a VM until it is removed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "14" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN_USERS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The time from when a VPN user is created until it is removed." +msgstr "" + diff --git a/docs/pot/use-project-view.pot b/docs/pot/use-project-view.pot new file mode 100644 index 00000000000..e89b390b07c --- /dev/null +++ b/docs/pot/use-project-view.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using the Project View" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are a member of a project, you can use &PRODUCT;’s project view to see project members, resources consumed, and more. The project view shows only information related to one project. It is a useful way to filter out other information so you can concentrate on a project status and resources." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Project View." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The project dashboard appears, showing the project’s VMs, volumes, users, events, network settings, and more. From the dashboard, you can:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Accounts tab to view and manage project members. If you are the project administrator, you can add new members, remove members, or change the role of a member from user to admin. Only one member at a time can have the admin role, so if you set another user’s role to admin, your role will change to regular user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(If invitations are enabled) Click the Invitations tab to view and manage invitations that have been sent to new project members but not yet accepted. Pending invitations will remain in this list until the new member accepts, the invitation timeout is reached, or you cancel the invitation." +msgstr "" + diff --git a/docs/pot/user-data-and-meta-data.pot b/docs/pot/user-data-and-meta-data.pot new file mode 100644 index 00000000000..239cd72a20e --- /dev/null +++ b/docs/pot/user-data-and-meta-data.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:11:59\n" +"PO-Revision-Date: 2013-02-02T20:11:59\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "User Data and Meta Data" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; provides API access to attach user data to a deployed VM. Deployed VMs also have access to instance metadata via the virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "User data can be accessed once the IP address of the virtual router is known. Once the IP address is known, use the following steps to access the user data:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following command to find the virtual router." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# cat /var/lib/dhclient/dhclient-eth0.leases | grep dhcp-server-identifier | tail -1" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Access user data by running the following command using the result of the above command" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# curl http://10.1.1.1/latest/user-data" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Meta Data can be accessed similarly, using a URL of the form http://10.1.1.1/latest/meta-data/{metadata type}. (For backwards compatibility, the previous URL http://10.1.1.1/latest/{metadata type} is also supported.) For metadata type, use one of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "service-offering. A description of the VMs service offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "availability-zone. The Zone name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "local-ipv4. The guest IP of the VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "local-hostname. The hostname of the VM" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "public-ipv4. The first public IP for the router. (E.g. the first IP of eth2)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "public-hostname. This is the same as public-ipv4" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "instance-id. The instance name of the VM" +msgstr "" + diff --git a/docs/pot/user-services-overview.pot b/docs/pot/user-services-overview.pot new file mode 100644 index 00000000000..7fc57020ed7 --- /dev/null +++ b/docs/pot/user-services-overview.pot @@ -0,0 +1,70 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "User Services Overview" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the physical and logical infrastructure of your cloud, and the &PRODUCT; software and servers, you also need a layer of user services so that people can actually make use of the cloud. This means not just a user UI, but a set of options and resources that users can choose from, such as templates for creating virtual machines, disk storage, and more. If you are running a commercial service, you will be keeping track of what services and resources users are consuming and charging them for that usage. Even if you do not charge anything for people to use your cloud – say, if the users are strictly internal to your organization, or just friends who are sharing your cloud – you can still keep track of what services they use and how much of them." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Service Offerings, Disk Offerings, Network Offerings, and Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A user creating a new instance can make a variety of choices about its characteristics and capabilities. &PRODUCT; provides several ways to present users with choices when creating a new instance:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Service Offerings, defined by the &PRODUCT; administrator, provide a choice of CPU speed, number of CPUs, RAM size, tags on the root disk, and other choices. See Creating a New Compute Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk Offerings, defined by the &PRODUCT; administrator, provide a choice of disk size for primary data storage. See Creating a New Disk Offering." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Offerings, defined by the &PRODUCT; administrator, describe the feature set that is available to end users from the virtual router or external networking devices on a given guest network. See Network Offerings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Templates, defined by the &PRODUCT; administrator or by any &PRODUCT; user, are the base OS images that the user can choose from when creating a new instance. For example, &PRODUCT; includes CentOS as a template. See Working with Templates." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to these choices that are provided for users, there is another type of service offering which is available only to the &PRODUCT; root administrator, and is used for configuring virtual infrastructure resources. For more information, see Upgrading a Virtual Router with System Service Offerings." +msgstr "" + diff --git a/docs/pot/using-multiple-guest-networks.pot b/docs/pot/using-multiple-guest-networks.pot new file mode 100644 index 00000000000..c3a6c564332 --- /dev/null +++ b/docs/pot/using-multiple-guest-networks.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Multiple Guest Networks" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In zones that use advanced networking, additional networks for guest traffic may be added at any time after the initial installation. You can also customize the domain name associated with the network by specifying a DNS suffix for each network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VM's networks are defined at VM creation time. A VM cannot add or remove networks after it has been created, although the user can go into the guest and remove the IP address from the NIC on a particular network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each VM has just one default network. The virtual router's DHCP reply will set the guest's default gateway as that for the default network. Multiple non-default networks may be added to a guest in addition to the single, required default network. The administrator can control which networks are available as the default network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional networks can either be available to all accounts or be assigned to a specific account. Networks that are available to all accounts are zone-wide. Any user with access to the zone can create a VM with access to that network. These zone-wide networks provide little or no isolation between guests.Networks that are assigned to a specific account provide strong isolation." +msgstr "" + diff --git a/docs/pot/using-netscaler-load-balancers.pot b/docs/pot/using-netscaler-load-balancers.pot new file mode 100644 index 00000000000..289490169e5 --- /dev/null +++ b/docs/pot/using-netscaler-load-balancers.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Using a NetScaler Load Balancer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Citrix NetScaler is supported as an external network element for load balancing in zones that use advanced networking (also called advanced zones). Set up an external load balancer when you want to provide load balancing through means other than &PRODUCT;’s provided virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The NetScaler can be set up in direct (outside the firewall) mode. It must be added before any load balancing rules are deployed on guest VMs in the zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The functional behavior of the NetScaler with &PRODUCT; is the same as described in the &PRODUCT; documentation for using an F5 external load balancer. The only exception is that the F5 supports routing domains, and NetScaler does not. NetScaler can not yet be used as a firewall." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Citrix NetScaler comes in three varieties. The following table summarizes how these variants are treated in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NetScaler ADC Type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Description of Capabilities" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; Supported Features" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "MPX" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Physical appliance. Capable of deep packet inspection. Can act as application firewall and load balancer" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In advanced zones, load balancer functionality fully supported without limitation. In basic zones, static NAT, elastic IP (EIP), and elastic load balancing (ELB) are also provided" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPX" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual appliance. Can run as VM on XenServer, ESXi, and Hyper-V hypervisors. Same functionality as MPX" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported only on ESXi. Same functional support as for MPX. &PRODUCT; will treat VPX and MPX as the same device type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "SDX" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Physical appliance. Can create multiple fully isolated VPX instances on a single appliance to support multi-tenant usage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; will dynamically provision, configure, and manage the lifecycle of VPX instances on the SDX. Provisioned instances are added into &PRODUCT; automatically – no manual configuration by the administrator is required. Once a VPX instance is added into &PRODUCT;, it is treated the same as a VPX on an ESXi host." +msgstr "" + diff --git a/docs/pot/using-sshkeys.pot b/docs/pot/using-sshkeys.pot new file mode 100644 index 00000000000..d594e8a1238 --- /dev/null +++ b/docs/pot/using-sshkeys.pot @@ -0,0 +1,238 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using SSH Keys for Authentication" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the username and password authentication, &PRODUCT; supports using SSH keys to log in to the cloud infrastructure for additional security. You can use the createSSHKeyPair API to generate the SSH keys." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Because each cloud user has their own SSH key, one cloud user cannot log in to another cloud user's instances unless they share their SSH key files. Using a single SSH key pair, you can manage multiple instances." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating an Instance Template that Supports SSH Keys" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a instance template that supports SSH Keys." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Create a new instance by using the template provided by cloudstack." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information on creating a new instance, see" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download the cloudstack script from The SSH Key Gen Scriptto the instance you have created." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "wget http://downloads.sourceforge.net/project/cloudstack/SSH%20Key%20Gen%20Script/cloud-set-guest-sshkey.in?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fcloudstack%2Ffiles%2FSSH%2520Key%2520Gen%2520Script%2F&ts=1331225219&use_mirror=iweb" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the file to /etc/init.d." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "cp cloud-set-guest-sshkey.in /etc/init.d/" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Give the necessary permissions on the script:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "chmod +x /etc/init.d/cloud-set-guest-sshkey.in" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the script while starting up the operating system:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "chkconfig --add cloud-set-guest-sshkey.in" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Stop the instance." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating the SSH Keypair" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You must make a call to the createSSHKeyPair api method. You can either use the &PRODUCT; Python API library or the curl commands to make the call to the cloudstack api." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, make a call from the cloudstack server to create a SSH keypair called \"keypair-doc\" for the admin account in the root domain:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that you adjust these values to meet your needs. If you are making the API call from a different server, your URL/PORT will be different, and you will need to use the API keys." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Run the following curl command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "curl --globoff \"http://localhost:8096/?command=createSSHKeyPair&name=keypair-doc&account=admin&domainid=5163440e-c44b-42b5-9109-ad75cae8e8a2\"" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The output is something similar to what is given below:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><createsshkeypairresponse cloud-stack-version=\"3.0.0.20120228045507\"><keypair><name>keypair-doc</name><fingerprint>f6:77:39:d5:5e:77:02:22:6a:d8:7f:ce:ab:cd:b3:56</fingerprint><privatekey>-----BEGIN RSA PRIVATE KEY-----\n" +"MIICXQIBAAKBgQCSydmnQ67jP6lNoXdX3noZjQdrMAWNQZ7y5SrEu4wDxplvhYci\n" +"dXYBeZVwakDVsU2MLGl/K+wefwefwefwefwefJyKJaogMKn7BperPD6n1wIDAQAB\n" +"AoGAdXaJ7uyZKeRDoy6wA0UmF0kSPbMZCR+UTIHNkS/E0/4U+6lhMokmFSHtu\n" +"mfDZ1kGGDYhMsdytjDBztljawfawfeawefawfawfawQQDCjEsoRdgkduTy\n" +"QpbSGDIa11Jsc+XNDx2fgRinDsxXI/zJYXTKRhSl/LIPHBw/brW8vzxhOlSOrwm7\n" +"VvemkkgpAkEAwSeEw394LYZiEVv395ar9MLRVTVLwpo54jC4tsOxQCBlloocK\n" +"lYaocpk0yBqqOUSBawfIiDCuLXSdvBo1Xz5ICTM19vgvEp/+kMuECQBzm\n" +"nVo8b2Gvyagqt/KEQo8wzH2THghZ1qQ1QRhIeJG2aissEacF6bGB2oZ7Igim5L14\n" +"4KR7OeEToyCLC2k+02UCQQCrniSnWKtDVoVqeK/zbB32JhW3Wullv5p5zUEcd\n" +"KfEEuzcCUIxtJYTahJ1pvlFkQ8anpuxjSEDp8x/18bq3\n" +"-----END RSA PRIVATE KEY-----\n" +"</privatekey></keypair></createsshkeypairresponse>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Copy the key data into a file. The file looks like this:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "-----BEGIN RSA PRIVATE KEY-----\n" +"MIICXQIBAAKBgQCSydmnQ67jP6lNoXdX3noZjQdrMAWNQZ7y5SrEu4wDxplvhYci\n" +"dXYBeZVwakDVsU2MLGl/K+wefwefwefwefwefJyKJaogMKn7BperPD6n1wIDAQAB\n" +"AoGAdXaJ7uyZKeRDoy6wA0UmF0kSPbMZCR+UTIHNkS/E0/4U+6lhMokmFSHtu\n" +"mfDZ1kGGDYhMsdytjDBztljawfawfeawefawfawfawQQDCjEsoRdgkduTy\n" +"QpbSGDIa11Jsc+XNDx2fgRinDsxXI/zJYXTKRhSl/LIPHBw/brW8vzxhOlSOrwm7\n" +"VvemkkgpAkEAwSeEw394LYZiEVv395ar9MLRVTVLwpo54jC4tsOxQCBlloocK\n" +"lYaocpk0yBqqOUSBawfIiDCuLXSdvBo1Xz5ICTM19vgvEp/+kMuECQBzm\n" +"nVo8b2Gvyagqt/KEQo8wzH2THghZ1qQ1QRhIeJG2aissEacF6bGB2oZ7Igim5L14\n" +"4KR7OeEToyCLC2k+02UCQQCrniSnWKtDVoVqeK/zbB32JhW3Wullv5p5zUEcd\n" +"KfEEuzcCUIxtJYTahJ1pvlFkQ8anpuxjSEDp8x/18bq3\n" +"-----END RSA PRIVATE KEY-----" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Save the file." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Creating an Instance" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "After you save the SSH keypair file, you must create an instance by using the template that you created at . Ensure that you use the same SSH key name that you created at ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You cannot create the instance by using the GUI at this time and associate the instance with the newly created SSH keypair." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A sample curl command to create a new instance is:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "curl --globoff http://localhost:<port numbet>/?command=deployVirtualMachine\\&zoneId=1\\&serviceOfferingId=18727021-7556-4110-9322-d625b52e0813\\&templateId=e899c18a-ce13-4bbf-98a9-625c5026e0b5\\&securitygroupids=ff03f02f-9e3b-48f8-834d-91b822da40c5\\&account=admin\\&domainid=1\\&keypair=keypair-doc" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Substitute the template, service offering and security group IDs (if you are using the security group feature) that are in your cloud environment." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Logging In Using the SSH Keypair" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To test your SSH key generation is successful, check whether you can log in to the cloud setup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For exaple, from a Linux OS, run:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "ssh -i ~/.ssh/keypair-doc <ip address>" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The -i parameter tells the ssh client to use a ssh key found at ~/.ssh/keypair-doc." +msgstr "" + diff --git a/docs/pot/using-swift-for-secondary-storage.pot b/docs/pot/using-swift-for-secondary-storage.pot new file mode 100644 index 00000000000..72863d80bd1 --- /dev/null +++ b/docs/pot/using-swift-for-secondary-storage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Swift for Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports OpenStack Object Storage ( Swift) for secondary storage. When using Swift, you configure Swift storage for the entire &PRODUCT;, then set up NFS secondary storage for each zone as usual. The NFS storage in each zone acts as a staging area through which all templates and other secondary storage data pass before being forwarded to Swift. The Swift storage acts as a cloud-wide resource, making templates and other data available to any zone in the cloud. There is no hierarchy in the Swift storage, just one Swift container per storage object. Any secondary storage in the whole cloud can pull a container from Swift at need. It is not necessary to copy templates and snapshots from one zone to another, as would be required when using zone NFS alone. Everything is available everywhere" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Swift storage must be set up before you add NFS secondary storage to zones. This is accomplished through some additional configuration steps on a fresh Management Server installation, before you add the first zone. The procedure is described in Adding a Zone in the Advanced Installation Guide." +msgstr "" + diff --git a/docs/pot/using-vpn-with-mac.pot b/docs/pot/using-vpn-with-mac.pot new file mode 100644 index 00000000000..d54cfb378df --- /dev/null +++ b/docs/pot/using-vpn-with-mac.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using VPN with Mac OS X" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Mac OS X, in Network Preferences - Advanced, make sure Send all traffic over VPN connection is not checked." +msgstr "" + diff --git a/docs/pot/using-vpn-with-windows.pot b/docs/pot/using-vpn-with-windows.pot new file mode 100644 index 00000000000..ccde5a2111e --- /dev/null +++ b/docs/pot/using-vpn-with-windows.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using VPN with Windows" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The procedure to use VPN varies by Windows version. Generally, the user must edit the VPN properties and make sure that the default route is not the VPN. The following steps are for Windows L2TP clients on Windows Vista. The commands should be similar for other Windows versions." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI and click on the source NAT IP for the account. The VPN tab should display the IPsec preshared key. Make a note of this and the source NAT IP. The UI also lists one or more users and their passwords. Choose one of these users, or, if none exists, add a user and password." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Windows box, go to Control Panel, then select Network and Sharing center. Click Setup a connection or network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the next dialog, select No, create a new connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the next dialog, select Use my Internet Connection (VPN)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the next dialog, enter the source NAT IP from step 1 and give the connection a name. Check Don't connect now." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the next dialog, enter the user name and password selected in step 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Create." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Go back to the Control Panel and click Network Connections to see the new connection. The connection is not active yet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Right-click the new connection and select Properties. In the Properties dialog, select the Networking tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In Type of VPN, choose L2TP IPsec VPN, then click IPsec settings. Select Use preshared key. Enter the preshared key from Step 1." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The connection is ready for activation. Go back to Control Panel -> Network Connections and double-click the created connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Enter the user name and password from Step 1." +msgstr "" + diff --git a/docs/pot/vcenter-maintenance-mode.pot b/docs/pot/vcenter-maintenance-mode.pot new file mode 100644 index 00000000000..71536afea33 --- /dev/null +++ b/docs/pot/vcenter-maintenance-mode.pot @@ -0,0 +1,80 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "vCenter and Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enter maintenance mode on a vCenter host, both vCenter and &PRODUCT; must be used in concert. &PRODUCT; and vCenter have separate maintenance modes that work closely together." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Place the host into &PRODUCT;'s \"scheduled maintenance\" mode. This does not invoke the vCenter maintenance mode, but only causes VMs to be migrated off the host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the &PRODUCT; maintenance mode is requested, the host first moves into the Prepare for Maintenance state. In this state it cannot be the target of new guest VM starts. Then all VMs will be migrated off the server. Live migration will be used to move VMs off the host. This allows the guests to be migrated to other hosts with no disruption to the guests. After this migration is completed, the host will enter the Ready for Maintenance mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Wait for the \"Ready for Maintenance\" indicator to appear in the UI." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Now use vCenter to perform whatever actions are necessary to maintain the host. During this time, the host cannot be the target of new VM allocations." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the maintenance tasks are complete, take the host out of maintenance mode as follows:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "First use vCenter to exit the vCenter maintenance mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This makes the host ready for &PRODUCT; to reactivate it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Then use &PRODUCT;'s administrator UI to cancel the &PRODUCT; maintenance mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When the host comes back online, the VMs that were migrated off of it may be migrated back to it manually and new VMs can be added." +msgstr "" + diff --git a/docs/pot/verifying-source.pot b/docs/pot/verifying-source.pot new file mode 100644 index 00000000000..9b2d586aacf --- /dev/null +++ b/docs/pot/verifying-source.pot @@ -0,0 +1,115 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Verifying the downloaded release" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There are a number of mechanisms to check the authenticity and validity of a downloaded release." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Getting the KEYS" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To enable you to verify the GPG signature, you will need to download the KEYS file." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You next need to import those keys, which you can do by running the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# gpg --import KEYS" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "GPG" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; project provides a detached GPG signature of the release. To check the signature, run the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ gpg --verify apache-cloudstack-4.0.0-incubating-src.tar.bz2.asc" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the signature is valid you will see a line of output that contains 'Good signature'." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "MD5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the cryptographic signature, &PRODUCT; has an MD5 checksum that you can use to verify the download matches the release. You can verify this hash by executing the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ gpg --print-md MD5 apache-cloudstack-4.0.0-incubating-src.tar.bz2 | diff - apache-cloudstack-4.0.0-incubating-src.tar.bz2.md5" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If this successfully completes you should see no output. If there is any output from them, then there is a difference between the hash you generated locally and the hash that has been pulled from the server." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "SHA512" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In addition to the MD5 hash, the &PRODUCT; project provides a SHA512 cryptographic hash to aid in assurance of the validity of the downloaded release. You can verify this hash by executing the following command:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "$ gpg --print-md SHA512 apache-cloudstack-4.0.0-incubating-src.tar.bz2 | diff - apache-cloudstack-4.0.0-incubating-src.tar.bz2.sha" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If this command successfully completes you should see no output. If there is any output from them, then there is a difference between the hash you generated locally and the hash that has been pulled from the server." +msgstr "" + diff --git a/docs/pot/virtual-machine-usage-record-format.pot b/docs/pot/virtual-machine-usage-record-format.pot new file mode 100644 index 00000000000..5a8763a481a --- /dev/null +++ b/docs/pot/virtual-machine-usage-record-format.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Virtual Machine Usage Record Format" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For running and allocated virtual machine usage, the following fields exist in a usage record:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "account – name of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "accountid – ID of the account" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "domainid – ID of the domain in which this account resides" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "zoneid – Zone where the usage occurred" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "description – A string describing what the usage record is tracking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usage – String representation of the usage, including the units of usage (e.g. 'Hrs' for VM running time)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usagetype – A number representing the usage type (see Usage Types)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "rawusage – A number representing the actual usage in hours" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "virtualMachineId – The ID of the virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "name – The name of the virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "offeringid – The ID of the service offering" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "templateid – The ID of the template or the ID of the parent template. The parent template value is present when the current template was created from a volume." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "usageid – Virtual machine" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "type – Hypervisor" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "startdate, enddate – The range of time for which the usage is aggregated; see Dates in the Usage Record" +msgstr "" + diff --git a/docs/pot/virtual-machines.pot b/docs/pot/virtual-machines.pot new file mode 100644 index 00000000000..9991bc8ff61 --- /dev/null +++ b/docs/pot/virtual-machines.pot @@ -0,0 +1,30 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working With Virtual Machines" +msgstr "" + diff --git a/docs/pot/virtual-router.pot b/docs/pot/virtual-router.pot new file mode 100644 index 00000000000..d5748aef125 --- /dev/null +++ b/docs/pot/virtual-router.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Virtual Router" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The virtual router is a type of System Virtual Machine. The virtual router is one of the most frequently used service providers in &PRODUCT;. The end user has no direct access to the virtual router. Users can ping the virtual router and take actions that affect it (such as setting up port forwarding), but users do not have SSH access into the virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "There is no mechanism for the administrator to log in to the virtual router. Virtual routers can be restarted by administrators, but this will interrupt public network access and other services for end users. A basic test in debugging networking issues is to attempt to ping the virtual router from a guest VM. Some of the characteristics of the virtual router are determined by its associated system service offering." +msgstr "" + diff --git a/docs/pot/vlan-allocation-eg.pot b/docs/pot/vlan-allocation-eg.pot new file mode 100644 index 00000000000..52608ca0353 --- /dev/null +++ b/docs/pot/vlan-allocation-eg.pot @@ -0,0 +1,130 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VLAN Allocation Example" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLANs are required for public and guest traffic. The following is an example of a VLAN allocation scheme:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN IDs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Traffic type" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Scope" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "less than 500" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management traffic. Reserved for administrative purposes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; software can access this, hypervisors, system VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "500-599" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN carrying public traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "600-799" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLANs carrying guest traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; accounts. Account-specific VLAN is chosen from this pool." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "800-899" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; accounts. Account-specific VLAN chosen by &PRODUCT; admin to assign to that account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "900-999" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN carrying guest traffic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; accounts. Can be scoped by project, domain, or all accounts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "greater than 1000" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reserved for future use" +msgstr "" + diff --git a/docs/pot/vlan-provisioning.pot b/docs/pot/vlan-provisioning.pot new file mode 100644 index 00000000000..406027d3248 --- /dev/null +++ b/docs/pot/vlan-provisioning.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VLAN Provisioning" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; automatically creates and destroys interfaces bridged to VLANs on the hosts. In general the administrator does not need to manage this process." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; manages VLANs differently based on hypervisor type. For XenServer or KVM, the VLANs are created on only the hosts where they will be used and then they are destroyed when all guests that require them have been terminated or moved to another host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For vSphere the VLANs are provisioned on all hosts in the cluster even if there is no guest running on a particular Host that requires the VLAN. This allows the administrator to perform live migration and other functions in vCenter without having to create the VLAN on the destination Host. Additionally, the VLANs are not removed from the Hosts when they are no longer needed." +msgstr "" + diff --git a/docs/pot/vm-lifecycle.pot b/docs/pot/vm-lifecycle.pot new file mode 100644 index 00000000000..0430f66714c --- /dev/null +++ b/docs/pot/vm-lifecycle.pot @@ -0,0 +1,75 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VM Lifecycle" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual machines can be in the following states:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Once a virtual machine is destroyed, it cannot be recovered. All the resources used by the virtual machine will be reclaimed by the system. This includes the virtual machine’s IP address." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A stop will attempt to gracefully shut down the operating system, which typically involves terminating all the running applications. If the operation system cannot be stopped, it will be forcefully terminated. This has the same effect as pulling the power cord to a physical machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A reboot is a stop followed by a start." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; preserves the state of the virtual machine hard disk until the machine is destroyed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A running virtual machine may fail because of hardware or network issues. A failed virtual machine is in the down state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The system places the virtual machine into the down state if it does not receive the heartbeat from the hypervisor for three minutes." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The user can manually restart the virtual machine from the down state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The system will start the virtual machine from the down state automatically if the virtual machine is marked as HA-enabled." +msgstr "" + diff --git a/docs/pot/vm-storage-migration.pot b/docs/pot/vm-storage-migration.pot new file mode 100644 index 00000000000..4e0ca1f5f1a --- /dev/null +++ b/docs/pot/vm-storage-migration.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VM Storage Migration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Supported in XenServer, KVM, and VMware." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This procedure is different from moving disk volumes from one VM to another. See Detaching and Moving Volumes ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can migrate a virtual machine’s root disk volume or any additional data disk volume from one storage pool to another in the same zone." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can use the storage migration feature to achieve some commonly desired administration goals, such as balancing the load on storage pools and increasing the reliability of virtual machines by moving them away from any storage pool that is experiencing issues." +msgstr "" + diff --git a/docs/pot/vmware-install.pot b/docs/pot/vmware-install.pot new file mode 100644 index 00000000000..c5c97349e5c --- /dev/null +++ b/docs/pot/vmware-install.pot @@ -0,0 +1,618 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VMware vSphere Installation and Configuration" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to use the VMware vSphere hypervisor to run guest virtual machines, install vSphere on the host(s) in your cloud." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Preparation Checklist for VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For a smoother installation, gather the following information before you start:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Information listed in " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Information listed in " +msgstr "" + +#. Tag: title +#, no-c-format +msgid "vCenter Checklist" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You will need the following information about vCenter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Requirement" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Value" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Notes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter User" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This user must have admin privileges." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter User Password" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Password for the above user." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Datacenter Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name of the datacenter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Cluster Name" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Name of the cluster." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Networking Checklist for VMware" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You will need the following information about VLAN." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN Information" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESXi VLAN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN on which all your ESXi hypervisors reside." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESXI VLAN IP Address" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "IP Address Range in the ESXi VLAN. One address per Virtual Router is used from this range." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESXi VLAN IP Gateway" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESXi VLAN Netmask" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management Server VLAN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN on which the &PRODUCT; Management server is installed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public VLAN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN for the Public Network." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public VLAN Gateway" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public VLAN Netmask" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public VLAN IP Address Range" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Range of Public IP Addresses available for &PRODUCT; use. These addresses will be used for virtual router on &PRODUCT; to route private traffic to external networks." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN Range for Customer use" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A contiguous range of non-routable VLANs. One VLAN will be assigned for each customer." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "vSphere Installation Steps" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you haven't already, you'll need to download and purchase vSphere from the VMware Website (https://www.vmware.com/tryvmware/index.php?p=vmware-vsphere&lp=1) and install it by following the VMware vSphere Installation Guide." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Following installation, perform the following configuration, which are described in the next few sections:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Optional" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ESXi host setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NIC bonding" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure host physical networking, virtual switch, vCenter Management Network, and extended port range" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Multipath storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Prepare storage for iSCSI" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Configure clusters in vCenter and add hosts to them, or add hosts without clusters to vCenter" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "ESXi Host setup" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All ESXi hosts should enable CPU hardware virtualization support in BIOS. Please note hardware virtualization support is not enabled by default on most servers." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Physical Host Networking" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should have a plan for cabling the vSphere hosts. Proper network configuration is required before adding a vSphere host to &PRODUCT;. To configure an ESXi host, you can use vClient to add it as standalone host to vCenter first. Once you see the host appearing in the vCenter inventory tree, click the host node in the inventory tree, and navigate to the Configuration tab." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the host configuration tab, click the \"Hardware/Networking\" link to bring up the networking configuration page as above." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure Virtual Switch" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A default virtual switch vSwitch0 is created. &PRODUCT; requires all ESXi hosts in the cloud to use the same set of virtual switch names. If you change the default virtual switch name, you will need to configure one or more &PRODUCT; configuration variables as well." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Separating Traffic" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; allows you to use vCenter to configure three separate networks per ESXi host. These networks are identified by the name of the vSwitch they are connected to. The allowed networks for configuration are public (for traffic to/from the public internet), guest (for guest-guest traffic), and private (for management and usually storage traffic). You can use the default virtual switch for all three, or create one or two other vSwitches for those traffic types." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you want to separate traffic in this way you should first create and configure vSwitches in vCenter according to the vCenter instructions. Take note of the vSwitch names you have used for each traffic type. You will configure &PRODUCT; to use these vSwitches." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Increasing Ports" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "By default a virtual switch on ESXi hosts is created with 56 ports. We recommend setting it to 4088, the maximum number of ports allowed. To do that, click the \"Properties...\" link for virtual switch (note this is not the Properties link for Networking)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In vSwitch properties dialog, select the vSwitch and click Edit. You should see the following dialog:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In this dialog, you can change the number of switch ports. After you've done that, ESXi hosts are required to reboot in order for the setting to take effect." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure vCenter Management Network" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the vSwitch properties dialog box, you may see a vCenter management network. This same network will also be used as the &PRODUCT; management network. &PRODUCT; requires the vCenter management network to be configured properly. Select the management network item in the dialog, then click Edit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure the following values are set:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VLAN ID set to the desired ID" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vMotion enabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Management traffic enabled." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If the ESXi hosts have multiple VMKernel ports, and ESXi is not using the default value \"Management Network\" as the management network name, you must follow these guidelines to configure the management network port group so that &PRODUCT; can find it:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use one label for the management network port across all ESXi hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the &PRODUCT; UI, go to Configuration - Global Settings and set vmware.management.portgroup to the management network label from the ESXi hosts." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Extend Port Range for &PRODUCT; Console Proxy" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Applies only to VMware vSphere version 4.x)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You need to extend the range of firewall ports that the console proxy works with on the hosts. This is to enable the console proxy to work with VMware-based VMs. The default additional port range is 59000-60000. To extend the port range, log in to the VMware ESX service console on each host and run the following commands:" +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "\n" +"esxcfg-firewall -o 59000-60000,tcp,in,vncextras\n" +"esxcfg-firewall -o 59000-60000,tcp,out,vncextras\n" +" " +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Configure NIC Bonding for vSphere" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NIC bonding on vSphere hosts may be done according to the vSphere installation guide." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Storage Preparation for vSphere (iSCSI only)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use of iSCSI requires preparatory work in vCenter. You must add an iSCSI target and create an iSCSI datastore." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you are using NFS, skip this section." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Enable iSCSI initiator for ESXi hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In vCenter, go to hosts and Clusters/Configuration, and click Storage Adapters link. You will see:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select iSCSI software adapter and click Properties." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the Configure... button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Check Enabled to enable the initiator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click OK to save." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Add iSCSI target" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Under the properties dialog, add the iSCSI target info:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Repeat these steps for all ESXi hosts in the cluster." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Create an iSCSI datastore" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You should now create a VMFS datastore. Follow these steps to do so:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Select Home/Inventory/Datastores." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Right click on the datacenter node." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose Add Datastore... command." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Follow the wizard to create a iSCSI datastore." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "This procedure should be done on one host in the cluster. It is not necessary to do this on all hosts." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Multipathing for vSphere (Optional)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Storage multipathing on vSphere nodes may be done according to the vSphere installation guide." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Add Hosts or Configure Clusters (vSphere)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Use vCenter to create a vCenter cluster and add your desired hosts to the cluster. You will later add the entire cluster to &PRODUCT;. (see )." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Applying Hotfixes to a VMware vSphere Host" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disconnect the VMware vSphere cluster from &PRODUCT;. It should remain disconnected long enough to apply the hotfix on the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as root." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Navigate to the VMware cluster, click Actions, and select Unmanage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the cluster status until it shows Unmanaged." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Perform the following on each of the ESXi hosts in the cluster:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Move each of the ESXi hosts in the cluster to maintenance mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Ensure that all the VMs are migrated to other hosts in that cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If there is only one host in that cluster, shutdown all the VMs and move the host into maintenance mode." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Apply the patch on the ESXi host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the host if prompted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Cancel the maintenance mode on the host." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Reconnect the cluster to &PRODUCT;:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Navigate to the VMware cluster, click Actions, and select Manage." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Watch the status to see that all the hosts come up. It might take several minutes for the hosts to come up." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Alternatively, verify the host state is properly synchronized and updated in the &PRODUCT; database." +msgstr "" + diff --git a/docs/pot/vmware-requirements.pot b/docs/pot/vmware-requirements.pot new file mode 100644 index 00000000000..38aab24fb82 --- /dev/null +++ b/docs/pot/vmware-requirements.pot @@ -0,0 +1,210 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "System Requirements for vSphere Hosts" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Software requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere and vCenter, both version 4.1 or 5.0." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vSphere Standard is recommended. Note however that customers need to consider the CPU constraints in place with vSphere licensing. See http://www.vmware.com/files/pdf/vsphere_pricing.pdf and discuss with your VMware sales representative." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter Server Standard is recommended." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Be sure all the hotfixes provided by the hypervisor vendor are applied. Track the release of hypervisor patches through your hypervisor vendor's support channel, and apply patches as soon as possible after they are released. &PRODUCT; will not track or notify you of required hypervisor patches. It is essential that your hosts are completely up to date with the provided hypervisor patches. The hypervisor vendor is likely to refuse to support any system that is not up to date with patches." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Apply All Necessary Hotfixes" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The lack of up-do-date hotfixes can lead to data corruption and lost VMs." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Hardware requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The host must be certified as compatible with vSphere. See the VMware Hardware Compatibility Guide at http://www.vmware.com/resources/compatibility/search.php." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts must be 64-bit and must support HVM (Intel-VT or AMD-V enabled)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts within a cluster must be homogenous. That means the CPUs must be of the same type, count, and feature flags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "64-bit x86 CPU (more cores results in better performance)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Hardware virtualization support required" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "4 GB of memory" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "36 GB of local disk" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "At least 1 NIC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Statically allocated IP Address" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "vCenter Server requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Processor - 2 CPUs 2.0GHz or higher Intel or AMD x86 processors. Processor requirements may be higher if the database runs on the same machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Memory - 3GB RAM. RAM requirements may be higher if your database runs on the same machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Disk storage - 2GB. Disk requirements may be higher if your database runs on the same machine." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Microsoft SQL Server 2005 Express disk requirements. The bundled database requires up to 2GB free disk space to decompress the installation archive." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Networking - 1Gbit or 10Gbit." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information, see \"vCenter Server and the vSphere Client Hardware Requirements\" at http://pubs.vmware.com/vsp40/wwhelp/wwhimpl/js/html/wwhelp.htm#href=install/c_vc_hw.html." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Other requirements:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VMware vCenter Standard Edition 4.1 or 5.0 must be installed and available to manage the vSphere hosts." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "vCenter must be configured to use the standard port 443 so that it can communicate with the &PRODUCT; Management Server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You must re-install VMware ESXi if you are going to re-use a host from a previous install." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; requires VMware vSphere 4.1 or 5.0. VMware vSphere 4.0 is not supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All hosts must be 64-bit and must support HVM (Intel-VT or AMD-V enabled). All hosts within a cluster must be homogenous. That means the CPUs must be of the same type, count, and feature flags." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The &PRODUCT; management network must not be configured as a separate virtual network. The &PRODUCT; management network is the same as the vCenter management network, and will inherit its configuration. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; requires ESXi. ESX is not supported." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All resources used for &PRODUCT; must be used for &PRODUCT; only. &PRODUCT; cannot share instance of ESXi or storage with other management consoles. Do not share the same storage volumes that will be used by &PRODUCT; with a different set of ESXi servers that are not managed by &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Put all target ESXi hypervisors in a cluster in a separate Datacenter in vCenter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The cluster that will be managed by &PRODUCT; should not contain any VMs. Do not run the management server, vCenter or any other VMs on the cluster that is designated for &PRODUCT; use. Create a separate cluster for use of &PRODUCT; and make sure that they are no VMs in this cluster." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All the required VLANS must be trunked into all network switches that are connected to the ESXi hypervisor hosts. These would include the VLANS for Management, Storage, vMotion, and guest VLANs. The guest VLAN (used in Advanced Networking; see Network Setup) is a contiguous range of VLANs that will be managed by &PRODUCT;." +msgstr "" + diff --git a/docs/pot/vmware-topology-req.pot b/docs/pot/vmware-topology-req.pot new file mode 100644 index 00000000000..05e0e55487b --- /dev/null +++ b/docs/pot/vmware-topology-req.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VMware Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Server and secondary storage VMs must be able to access vCenter and all ESXi hosts in the zone. To allow the necessary access through the firewall, keep port 443 open." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Servers communicate with VMware vCenter servers on port 443 (HTTPs)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Servers communicate with the System VMs on port 3922 (ssh) on the management traffic network." +msgstr "" + diff --git a/docs/pot/volume-deletion-garbage-collection.pot b/docs/pot/volume-deletion-garbage-collection.pot new file mode 100644 index 00000000000..16ca680565e --- /dev/null +++ b/docs/pot/volume-deletion-garbage-collection.pot @@ -0,0 +1,60 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Volume Deletion and Garbage Collection" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The deletion of a volume does not delete the snapshots that have been created from the volume" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a VM is destroyed, data disk volumes that are attached to the VM are not deleted." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Volumes are permanently destroyed using a garbage collection process. The global configuration variables expunge.delay and expunge.interval determine when the physical deletion of volumes will occur." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "expunge.delay: determines how old the volume must be before it is destroyed, in seconds" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "expunge.interval: determines how often to run the garbage collection check" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Administrators should adjust these values depending on site policies around data retention." +msgstr "" + diff --git a/docs/pot/volume-status.pot b/docs/pot/volume-status.pot new file mode 100644 index 00000000000..08640053661 --- /dev/null +++ b/docs/pot/volume-status.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Volume Status" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a snapshot operation is triggered by means of a recurring snapshot policy, a snapshot is skipped if a volume has remained inactive since its last snapshot was taken. A volume is considered to be inactive if it is either detached or attached to a VM that is not running. &PRODUCT; ensures that at least one snapshot is taken since the volume last became inactive." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a snapshot is taken manually, a snapshot is always created regardless of whether a volume has been active or not." +msgstr "" + diff --git a/docs/pot/vpc.pot b/docs/pot/vpc.pot new file mode 100644 index 00000000000..9841ebca29e --- /dev/null +++ b/docs/pot/vpc.pot @@ -0,0 +1,240 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "About Virtual Private Clouds" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; Virtual Private Cloud is a private, isolated part of &PRODUCT;. A VPC can have its own virtual network topology that resembles a traditional physical network. You can launch VMs in the virtual network that can have private addresses in the range of your choice, for example: 10.0.0.0/16. You can define network tiers within your VPC network range, which in turn enables you to group similar kinds of instances based on IP address range." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For example, if a VPC has the private range 10.0.0.0/16, its guest networks can have the network ranges 10.0.1.0/24, 10.0.2.0/24, 10.0.3.0/24, and so on." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Major Components of a VPC:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VPC is comprised of the following network components:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPC: A VPC acts as a container for multiple isolated networks that can communicate with each other via its virtual router." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Network Tiers: Each tier acts as an isolated network with its own VLANs and CIDR list, where you can place groups of resources, such as VMs. The tiers are segmented by means of VLANs. The NIC of each tier acts as its gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Virtual Router: A virtual router is automatically created and started when you create a VPC. The virtual router connect the tiers and direct traffic among the public gateway, the VPN gateways, and the NAT instances. For each tier, a corresponding NIC and IP exist in the virtual router. The virtual router provides DNS and DHCP services through its IP." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Public Gateway: The traffic to and from the Internet routed to the VPC through the public gateway. In a VPC, the public gateway is not exposed to the end user; therefore, static routes are not support for the public gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Private Gateway: All the traffic to and from a private network routed to the VPC through the private gateway. For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPN Gateway: The VPC side of a VPN connection." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site-to-Site VPN Connection: A hardware-based VPN connection between your VPC and your datacenter, home network, or co-location facility. For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Customer Gateway: The customer side of a VPN Connection. For more information, see ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "NAT Instance: An instance that provides Port Address Translation for instances to access the Internet via the public gateway. For more information, see ." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Network Architecture in a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In a VPC, the following four basic options of network architectures are present:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPC with a public gateway only" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPC with public and private gateways" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPC with public and private gateways and site-to-site VPN access" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "VPC with a private gateway only and site-to-site VPN access" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Connectivity Options for a VPC" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "You can connect your VPC to:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Internet through the public gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The corporate datacenter by using a site-to-site VPN connection through the VPN gateway." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Both the Internet and your corporate datacenter by using both the public gateway and a VPN gateway." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "VPC Network Considerations" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Consider the following before you create a VPC:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VPC, by default, is created in the enabled state." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A VPC can be created in Advance zone only, and can't belong to more than one zone at a time." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default number of VPCs an account can create is 20. However, you can change it by using the max.account.vpcs global parameter, which controls the maximum number of VPCs an account is allowed to create." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The default number of tiers an account can create within a VPC is 3. You can configure this number by using the vpc.max.networks parameter." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Each tier should have an unique CIDR in the VPC. Ensure that the tier's CIDR should be within the VPC CIDR range." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A tier belongs to only one VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "All network tiers inside the VPC should belong to the same account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "When a VPC is created, by default, a SourceNAT IP is allocated to it. The Source NAT IP is released only when the VPC is removed." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A public IP can be used for only one purpose at a time. If the IP is a sourceNAT, it cannot be used for StaticNAT or port forwarding." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The instances only have a private IP address that you provision. To communicate with the Internet, enable NAT to an instance that you launch in your VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Only new networks can be added to a VPC. The maximum number of networks per VPC is limited by the value you specify in the vpc.max.networks parameter. The default value is three." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The load balancing service can be supported by only one tier inside the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If an IP address is assigned to a tier:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "That IP can't be used by more than one tier at a time in the VPC. For example, if you have tiers A and B, and a public IP1, you can create a port forwarding rule by using the IP either for A or B, but not for both." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "That IP can't be used for StaticNAT, load balancing, or port forwarding rules for another guest network inside the VPC." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Remote access VPN is not supported in VPC networks." +msgstr "" + diff --git a/docs/pot/vpn.pot b/docs/pot/vpn.pot new file mode 100644 index 00000000000..d8c1dafdf7d --- /dev/null +++ b/docs/pot/vpn.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "VPN" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; account owners can create virtual private networks (VPN) to access their virtual machines. If the guest network is instantiated from a network offering that offers the Remote Access VPN service, the virtual router (based on the System VM) is used to provide the service. &PRODUCT; provides a L2TP-over-IPsec-based remote access VPN service to guest virtual networks. Since each network gets its own virtual router, VPNs are not shared across the networks. VPN clients native to Windows, Mac OS X and iOS can be used to connect to the guest networks. The account owner can create and manage users for their VPN. &PRODUCT; does not use its account database for this purpose but uses a separate table. The VPN user database is shared across all the VPNs created by the account owner. All VPN users get access to all VPNs created by the account owner." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Make sure that not all traffic goes through the VPN. That is, the route installed by the VPN should be only for the guest network and not for all traffic." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Road Warrior / Remote Access. Users want to be able to connect securely from a home or office to a private network in the cloud. Typically, the IP address of the connecting client is dynamic and cannot be preconfigured on the VPN server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Site to Site. In this scenario, two private subnets are connected over the public Internet with a secure VPN tunnel. The cloud user’s subnet (for example, an office network) is connected through a gateway to the network in the cloud. The address of the user’s gateway must be preconfigured on the VPN server in the cloud. Note that although L2TP-over-IPsec can be used to set up Site-to-Site VPNs, this is not the primary intent of this feature." +msgstr "" + diff --git a/docs/pot/whatis.pot b/docs/pot/whatis.pot new file mode 100644 index 00000000000..2c3216d27e3 --- /dev/null +++ b/docs/pot/whatis.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "What Is &PRODUCT;?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; is an open source software platform that pools computing resources to build public, private, and hybrid Infrastructure as a Service (IaaS) clouds. &PRODUCT; manages the network, storage, and compute nodes that make up a cloud infrastructure. Use &PRODUCT; to deploy, manage, and configure cloud computing environments." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Typical users are service providers and enterprises. With &PRODUCT;, you can:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up an on-demand, elastic cloud computing service. Service providers can sell self service virtual machine instances, storage volumes, and networking configurations over the Internet." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Set up an on-premise private cloud for use by employees. Rather than managing virtual machines in the same way as physical machines, with &PRODUCT; an enterprise can offer self-service virtual machines to users without involving IT departments." +msgstr "" + diff --git a/docs/pot/whats-in-this-adminguide.pot b/docs/pot/whats-in-this-adminguide.pot new file mode 100644 index 00000000000..ba033be316f --- /dev/null +++ b/docs/pot/whats-in-this-adminguide.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Who Should Read This" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If you have already installed &PRODUCT; or you want to learn more about the ongoing operation and maintenance of a &PRODUCT;-powered cloud, read this documentation. It will help you start using, configuring, and managing the ongoing operation of your cloud." +msgstr "" + diff --git a/docs/pot/whats-new.pot b/docs/pot/whats-new.pot new file mode 100644 index 00000000000..50d7f5af404 --- /dev/null +++ b/docs/pot/whats-new.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "What's New in the API?" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The following describes any new major features of each &PRODUCT; version as it applies to API usage." +msgstr "" + +#. Tag: title +#, no-c-format +msgid "What's New in the API for 4.0" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "What's New in the API for 3.0" +msgstr "" + diff --git a/docs/pot/who-should-read-installation.pot b/docs/pot/who-should-read-installation.pot new file mode 100644 index 00000000000..cb90df98e01 --- /dev/null +++ b/docs/pot/who-should-read-installation.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Who Should Read This" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For those who have already gone through a design phase and planned a more sophisticated deployment, or those who are ready to start scaling up a trial installation. With the following procedures, you can start using the more powerful features of &PRODUCT;, such as advanced VLAN networking, high availability, additional network elements such as load balancers and firewalls, and support for multiple hypervisors including Citrix XenServer, KVM, and VMware vSphere." +msgstr "" + diff --git a/docs/pot/windows-installation.pot b/docs/pot/windows-installation.pot new file mode 100644 index 00000000000..23fddc97e32 --- /dev/null +++ b/docs/pot/windows-installation.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Windows OS Installation" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Download the installer, CloudInstanceManager.msi, from Download page and run the installer in the newly created Windows VM." +msgstr "" + diff --git a/docs/pot/work-with-usage.pot b/docs/pot/work-with-usage.pot new file mode 100644 index 00000000000..996b6a0dd3c --- /dev/null +++ b/docs/pot/work-with-usage.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with Usage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Usage Server is an optional, separately-installed part of &PRODUCT; that provides aggregated usage records which you can use to create billing integration for &PRODUCT;. The Usage Server works by taking data from the events log and creating summary usage records that you can access using the listUsageRecords API call." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The usage records show the amount of resources, such as VM run time or template storage space, consumed by guest instances." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Usage Server runs at least once per day. It can be configured to run multiple times per day." +msgstr "" + diff --git a/docs/pot/working-with-hosts.pot b/docs/pot/working-with-hosts.pot new file mode 100644 index 00000000000..0f12cec59e8 --- /dev/null +++ b/docs/pot/working-with-hosts.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working With Hosts" +msgstr "" + +#. Tag: title +#, no-c-format +msgid "Adding Hosts" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Additional hosts can be added at any time to provide more capacity for guest VMs. For requirements and instructions, see ." +msgstr "" + diff --git a/docs/pot/working-with-iso.pot b/docs/pot/working-with-iso.pot new file mode 100644 index 00000000000..bf6af43cbc7 --- /dev/null +++ b/docs/pot/working-with-iso.pot @@ -0,0 +1,50 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with ISOs" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports ISOs and their attachment to guest VMs. An ISO is a read-only file that has an ISO/CD-ROM style file system. Users can upload their own ISOs and mount them on their guest VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISOs are uploaded based on a URL. HTTP is the supported protocol. Once the ISO is available via HTTP specify an upload URL such as http://my.web.server/filename.iso." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISOs may be public or private, like templates.ISOs are not hypervisor-specific. That is, a guest on vSphere can mount the exact same image that a guest on KVM can mount." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "ISO images may be stored in the system and made available with a privacy level similar to templates. ISO images are classified as either bootable or not bootable. A bootable ISO image is one that contains an OS image. &PRODUCT; allows a user to boot a guest VM off of an ISO image. Users can also attach ISO images to guest VMs. For example, this enables installing PV drivers into Windows. ISO images are not hypervisor-specific." +msgstr "" + diff --git a/docs/pot/working-with-snapshots.pot b/docs/pot/working-with-snapshots.pot new file mode 100644 index 00000000000..8f051bd468e --- /dev/null +++ b/docs/pot/working-with-snapshots.pot @@ -0,0 +1,55 @@ +#Licensed to the Apache Software Foundation (ASF) under one +#or more contributor license agreements. See the NOTICE file +#distributed with this work for additional information +#regarding copyright ownership. The ASF licenses this file +#to you under the Apache License, Version 2.0 (the +#"License"); you may not use this file except in compliance +#with the License. You may obtain a copy of the License at +#http://www.apache.org/licenses/LICENSE-2.0 +#Unless required by applicable law or agreed to in writing, +#software distributed under the License is distributed on an +#"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +#KIND, either express or implied. See the License for the +#specific language governing permissions and limitations +#under the License. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with Snapshots" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Supported for the following hypervisors: XenServer, VMware vSphere, and KVM)" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; supports snapshots of disk volumes. Snapshots are a point-in-time capture of virtual machine disks. Memory and CPU states are not captured." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Snapshots may be taken for volumes, including both root and data disks. The administrator places a limit on the number of stored snapshots per user. Users can create new volumes from the snapshot for recovery of particular files and they can create templates from snapshots to boot from a restored disk." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Users can create snapshots manually or by setting up automatic recurring snapshot policies. Users can also create disk volumes from snapshots, which may be attached to a VM like any other disk volume. Snapshots of both root disks and data disks are supported. However, &PRODUCT; does not currently support booting a VM from a recovered root disk. A disk recovered from snapshot of a root disk is treated as a regular data disk; the data on recovered disk can be accessed by attaching the disk to a VM." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A completed snapshot is copied from primary storage to secondary storage, where it is stored until deleted or purged by newer snapshot." +msgstr "" + diff --git a/docs/pot/working-with-system-vm.pot b/docs/pot/working-with-system-vm.pot new file mode 100644 index 00000000000..8ef8d8148a2 --- /dev/null +++ b/docs/pot/working-with-system-vm.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with System Virtual Machines" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; uses several types of system virtual machines to perform tasks in the cloud. In general &PRODUCT; manages these system VMs and creates, starts, and stops them as needed based on scale and immediate needs. However, the administrator should be aware of them and their roles to assist in debugging issues." +msgstr "" + diff --git a/docs/pot/working-with-templates.pot b/docs/pot/working-with-templates.pot new file mode 100644 index 00000000000..fc687a376ef --- /dev/null +++ b/docs/pot/working-with-templates.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working with Templates" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A template is a reusable configuration for virtual machines. When users launch VMs, they can choose from a list of templates in &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Specifically, a template is a virtual disk image that includes one of a variety of operating systems, optional additional software such as office applications, and settings such as access control to determine who can use the template. Each template is associated with a particular type of hypervisor, which is specified when the template is added to &PRODUCT;." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; ships with a default template. In order to present more choices to users, &PRODUCT; administrators and users can create templates and add them to &PRODUCT;." +msgstr "" + diff --git a/docs/pot/working-with-usage-data.pot b/docs/pot/working-with-usage-data.pot new file mode 100644 index 00000000000..8fdafd8eeaf --- /dev/null +++ b/docs/pot/working-with-usage-data.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Working With Usage Data" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Usage Server provides aggregated usage records which you can use to create billing integration for the &PRODUCT; platform. The Usage Server works by taking data from the events log and creating summary usage records that you can access using the listUsageRecords API call." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The usage records show the amount of resources, such as VM run time or template storage space, consumed by guest instances. In the special case of bare metal instances, no template storage resources are consumed, but records showing zero usage are still included in the Usage Server's output." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Usage Server runs at least once per day. It can be configured to run multiple times per day. Its behavior is controlled by configuration settings as described in the &PRODUCT; Administration Guide." +msgstr "" + diff --git a/docs/pot/working-with-volumes.pot b/docs/pot/working-with-volumes.pot new file mode 100644 index 00000000000..fedfc58ba47 --- /dev/null +++ b/docs/pot/working-with-volumes.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Using Swift for Secondary Storage" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "A volume provides storage to a guest VM. The volume can provide for a root disk or an additional data disk. &PRODUCT; supports additional volumes for guest VMs." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Volumes are created for a specific hypervisor type. A volume that has been attached to guest using one hypervisor type (e.g, XenServer) may not be attached to a guest that is using another hypervisor type (e.g. vSphere, KVM). This is because the different hypervisors use different disk image formats." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "&PRODUCT; defines a volume as a unit of storage available to a guest VM. Volumes are either root disks or data disks. The root disk has \"/\" in the file system and is usually the boot device. Data disks provide for additional storage (e.g. As \"/opt\" or \"D:\"). Every guest VM has a root disk, and VMs can also optionally have a data disk. End users can mount multiple data disks to guest VMs. Users choose data disks from the disk offerings created by administrators. The user can create a template from a volume as well; this is the standard procedure for private template creation. Volumes are hypervisor-specific: a volume from one hypervisor type may not be used on a guest of another hypervisor type." +msgstr "" + diff --git a/docs/pot/xenserver-maintenance-mode.pot b/docs/pot/xenserver-maintenance-mode.pot new file mode 100644 index 00000000000..a5d4aabbd09 --- /dev/null +++ b/docs/pot/xenserver-maintenance-mode.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "XenServer and Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For XenServer, you can take a server offline temporarily by using the Maintenance Mode feature in XenCenter. When you place a server into Maintenance Mode, all running VMs are automatically migrated from it to another host in the same pool. If the server is the pool master, a new master will also be selected for the pool. While a server is Maintenance Mode, you cannot create or start any VMs on it." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To place a server in Maintenance Mode:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the Resources pane, select the server, then do one of the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Right-click, then click Enter Maintenance Mode on the shortcut menu." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Server menu, click Enter Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Enter Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The server's status in the Resources pane shows when all running VMs have been successfully migrated off the server." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "To take a server out of Maintenance Mode:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Right-click, then click Exit Maintenance Mode on the shortcut menu." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On the Server menu, click Exit Maintenance Mode" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Exit Maintenance Mode" +msgstr "" + diff --git a/docs/pot/xenserver-topology-req.pot b/docs/pot/xenserver-topology-req.pot new file mode 100644 index 00000000000..765427bb680 --- /dev/null +++ b/docs/pot/xenserver-topology-req.pot @@ -0,0 +1,35 @@ +#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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "XenServer Topology Requirements" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The Management Servers communicate with XenServer hosts on ports 22 (ssh), 80 (HTTP), and 443 (HTTPs)." +msgstr "" + diff --git a/docs/pot/zone-add.pot b/docs/pot/zone-add.pot new file mode 100644 index 00000000000..f9944a306ba --- /dev/null +++ b/docs/pot/zone-add.pot @@ -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. +msgid "" +msgstr "" +"Project-Id-Version: 0\n" +"POT-Creation-Date: 2013-02-02T20:12:00\n" +"PO-Revision-Date: 2013-02-02T20:12:00\n" +"Last-Translator: Automatically generated\n" +"Language-Team: None\n" +"MIME-Version: 1.0\n" +"Content-Type: application/x-publican; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#. Tag: title +#, no-c-format +msgid "Adding a Zone" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "These steps assume you have already logged in to the &PRODUCT; UI. See ." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) If you are going to use Swift for cloud-wide secondary storage, you need to add it before you add zones." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Log in to the &PRODUCT; UI as administrator." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "If this is your first time visiting the UI, you will see the guided tour splash screen. Choose “Experienced user.†The Dashboard appears." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation bar, click Global Settings." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the search box, type swift.enable and click the search button." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click the edit button and set swift.enable to true. edit-icon.png: button to modify data " +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Restart the Management Server." +msgstr "" + +#. Tag: programlisting +#, no-c-format +msgid "# service cloud-management restart" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Refresh the &PRODUCT; UI browser tab and log back in." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "In the left navigation, choose Infrastructure." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "On Zones, click View More." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "(Optional) If you are using Swift storage, click Enable Swift. Provide the following:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "URL. The Swift URL." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Account. The Swift account." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Username. The Swift account’s username." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Key. The Swift key." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Click Add Zone. The zone creation wizard will appear." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Choose one of the following network types:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Basic. For AWS-style networking. Provides a single network where each VM instance is assigned an IP directly from the network. Guest isolation can be provided through layer-3 means such as security groups (IP address source filtering)." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "Advanced. For more sophisticated network topologies. This network model provides the most flexibility in defining guest networks and providing custom network offerings such as firewall, VPN, or load balancer support." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "For more information about the network types, see Network Setup." +msgstr "" + +#. Tag: para +#, no-c-format +msgid "The rest of the steps differ depending on whether you chose Basic or Advanced. Continue with the steps that apply to you:" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + +#. Tag: para +#, no-c-format +msgid "" +msgstr "" + diff --git a/docs/settx.sh b/docs/settx.sh new file mode 100755 index 00000000000..55063250cf9 --- /dev/null +++ b/docs/settx.sh @@ -0,0 +1,23 @@ +#!/bin/bash +#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. + +for file in `ls pot | grep .pot`; do + resource=`basename $file .pot` + echo $resource + tx set -t PO --auto-local -r ACS_DOCS.$resource "/$resource.po" \ + --source-lang=en \ + --source-file "pot/$resource.pot" --execute +done diff --git a/engine/api/pom.xml b/engine/api/pom.xml new file mode 100644 index 00000000000..7fc612f5d6c --- /dev/null +++ b/engine/api/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + cloud-engine-api + Apache CloudStack Cloud Engine API + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-api + ${project.version} + + + org.apache.cxf + cxf-bundle-jaxrs + 2.7.0 + + + org.eclipse.jetty + jetty-server + + + + + org.apache.cloudstack + cloud-framework-rest + ${project.version} + + + + install + src + test + + diff --git a/engine/api/src/org/apache/cloudstack/engine/Rules.java b/engine/api/src/org/apache/cloudstack/engine/Rules.java new file mode 100755 index 00000000000..b700fa5fcb7 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/Rules.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.engine; + +import java.util.ArrayList; +import java.util.List; + +import com.cloud.utils.StringUtils; + +/** + * Rules specifies all rules about developing and using CloudStack Orchestration + * Platforms APIs. This class is not actually used in CloudStack Orchestration + * Platform but must be read by all who wants to use and develop against + * CloudStack Orchestration Platform. + * + * Make sure to make changes here when there are changes to how the APIs should + * be used and developed. + * + * Changes to this class must be approved by the maintainer of this project. + * + */ +public class Rules { + public static List whenUsing() { + List rules = new ArrayList(); + rules.add("Always be prepared to handle RuntimeExceptions."); + return rules; + } + + public static List whenWritingNewApis() { + List rules = new ArrayList(); + rules.add("You may think you're the greatest developer in the " + + "world but every change to the API must be reviewed and approved. "); + rules.add("Every API must have unit tests written against it. And not it's unit tests"); + rules.add(""); + + + return rules; + } + + private static void printRule(String rule) { + System.out.print("API Rule: "); + String skip = ""; + int brk = 0; + while (true) { + int stop = StringUtils.formatForOutput(rule, brk, 75 - skip.length(), ' '); + if (stop < 0) { + break; + } + System.out.print(skip); + skip = " "; + System.out.println(rule.substring(brk, stop).trim()); + brk = stop; + } + } + + public static void main(String[] args) { + System.out.println("When developing against the CloudStack Orchestration Platform, you must following the following rules:"); + for (String rule : whenUsing()) { + printRule(rule); + } + System.out.println(""); + System.out.println("When writing APIs, you must follow these rules:"); + for (String rule : whenWritingNewApis()) { + printRule(rule); + } + } + +} + diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/BackupEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/BackupEntity.java new file mode 100755 index 00000000000..cc69705c571 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/BackupEntity.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 org.apache.cloudstack.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +/** + * @author ahuang + * + */ +public interface BackupEntity extends CloudStackEntity { + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/EdgeService.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/EdgeService.java new file mode 100755 index 00000000000..3283ff0e72c --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/EdgeService.java @@ -0,0 +1,23 @@ +/* + * 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.engine.cloud.entity.api; + +public interface EdgeService { + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NetworkEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NetworkEntity.java new file mode 100755 index 00000000000..c161d043581 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NetworkEntity.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 org.apache.cloudstack.engine.cloud.entity.api; + +import java.util.List; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +import com.cloud.network.Network; + +public interface NetworkEntity extends CloudStackEntity, Network { + void routeTo(NetworkEntity network); + + List listEdgeServicesTo(); + + List listVirtualMachineUuids(); + + List listVirtualMachines(); + + List listNics(); + + void addIpRange(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NicEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NicEntity.java new file mode 100755 index 00000000000..f78267add35 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/NicEntity.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 org.apache.cloudstack.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +/** + * @author ahuang + * + */ +public interface NicEntity extends CloudStackEntity { + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/SnapshotEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/SnapshotEntity.java new file mode 100755 index 00000000000..0dcccb3c892 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/SnapshotEntity.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.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +import com.cloud.storage.Snapshot; + +public interface SnapshotEntity extends CloudStackEntity, Snapshot { + /** + * Make a reservation for backing up this snapshot + * @param expiration time in seconds to expire the reservation + * @return reservation token + */ + String reserveForBackup(int expiration); + + /** + * Perform the backup according to the reservation token + * @param reservationToken token returned by reserveForBackup + */ + void backup(String reservationToken); + + /** + * restore this snapshot to this vm. + * @param vm + */ + void restore(String vm); + + /** + * Destroy this snapshot. + */ + void destroy(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/TemplateEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/TemplateEntity.java new file mode 100755 index 00000000000..f10ba5ef17f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/TemplateEntity.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 org.apache.cloudstack.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +import com.cloud.template.VirtualMachineTemplate; + +public interface TemplateEntity extends CloudStackEntity, VirtualMachineTemplate { + public long getPhysicalSize(); + public long getVirtualSize(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.java new file mode 100755 index 00000000000..1fd4e54c847 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntity.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.engine.cloud.entity.api; + +import java.util.List; + +import javax.ws.rs.BeanParam; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + + +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.CloudException; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; + + +/** + * VirtualMachineEntity represents a Virtual Machine in Cloud Orchestration + * Platform. + * + */ +@Path("vm/{id}") +@Produces({"application/json", "application/xml"}) +@XmlRootElement(name="vm") +public interface VirtualMachineEntity extends CloudStackEntity { + + /** + * @return List of uuids for volumes attached to this virtual machine. + */ + @GET + List listVolumeIds(); + + /** + * @return List of volumes attached to this virtual machine. + */ + List listVolumes(); + + /** + * @return List of uuids for nics attached to this virtual machine. + */ + List listNicUuids(); + + /** + * @return List of nics attached to this virtual machine. + */ + List listNics(); + + /** + * @return the template this virtual machine is based off. + */ + TemplateEntity getTemplate(); + + /** + * @return the list of tags associated with the virtual machine + */ + List listTags(); + + void addTag(); + + void delTag(); + + /** + * Start the virtual machine with a given deployment plan + * @param plannerToUse the Deployment Planner that should be used + * @param plan plan to which to deploy the machine + * @param exclude list of areas to exclude + * @return a reservation id + */ + String reserve(String plannerToUse, @BeanParam DeploymentPlan plan, ExcludeList exclude, String caller) throws InsufficientCapacityException, ResourceUnavailableException; + + /** + * Migrate this VM to a certain destination. + * + * @param reservationId reservation id from reserve call. + */ + void migrateTo(String reservationId, String caller); + + /** + * Deploy this virtual machine according to the reservation from before. + * @param reservationId reservation id from reserve call. + * + */ + void deploy(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException; + + /** + * Stop the virtual machine + * + */ + boolean stop(String caller) throws ResourceUnavailableException, CloudException; + + /** + * Cleans up after any botched starts. CloudStack Orchestration Platform + * will attempt a best effort to actually shutdown any resource but + * even if it cannot, it releases the resource from its database. + */ + void cleanup(); + + /** + * Destroys the VM. + */ + boolean destroy(String caller) throws AgentUnavailableException, CloudException, ConcurrentOperationException; + + /** + * Duplicate this VM in the database so that it will start new + * @param externalId + * @return a new VirtualMachineEntity + */ + VirtualMachineEntity duplicate(String externalId); + + /** + * Take a VM snapshot + */ + SnapshotEntity takeSnapshotOf(); + + /** + * Attach volume to this VM + * @param volume volume to attach + * @param deviceId deviceId to use + */ + void attach(VolumeEntity volume, short deviceId); + + /** + * Detach the volume from this VM + * @param volume volume to detach + */ + void detach(VolumeEntity volume); + + /** + * Connect the VM to a network + * @param network network to attach + * @param deviceId device id to use when a nic is created + */ + void connectTo(NetworkEntity network, short nicId); + + /** + * Disconnect the VM from this network + * @param netowrk network to disconnect from + */ + void disconnectFrom(NetworkEntity netowrk, short nicId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VolumeEntity.java b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VolumeEntity.java new file mode 100755 index 00000000000..a63c2b47cea --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/cloud/entity/api/VolumeEntity.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.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; + + +public interface VolumeEntity extends CloudStackEntity { + + /** + * Take a snapshot of the volume + */ + SnapshotEntity takeSnapshotOf(boolean full); + + /** + * Make a reservation to do storage migration + * + * @param expirationTime time in seconds the reservation is cancelled + * @return reservation token + */ + String reserveForMigration(long expirationTime); + + /** + * Migrate using a reservation. + * @param reservationToken reservation token + */ + void migrate(String reservationToken); + + /** + * Setup for a copy of this volume. + * @return destination to copy to + */ + VolumeEntity setupForCopy(); + + /** + * Perform the copy + * @param dest copy to this volume + */ + void copy(VolumeEntity dest); + + /** + * Attach to the vm + * @param vm vm to attach to + * @param deviceId device id to use + */ + void attachTo(String vm, long deviceId); + + /** + * Detach from the vm + */ + void detachFrom(); + + /** + * Destroy the volume + */ + void destroy(); + + long getSize(); + + DiskFormat getDiskType(); + + VolumeType getType(); + + StorageEntity getDataStore(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntity.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntity.java new file mode 100755 index 00000000000..9497dd381f2 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntity.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 org.apache.cloudstack.engine.datacenter.entity.api; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster.ClusterType; +import com.cloud.org.Grouping.AllocationState; +import com.cloud.org.Managed.ManagedState; + +public interface ClusterEntity extends DataCenterResourceEntity, OrganizationScope { + + long getDataCenterId(); + + long getPodId(); + + HypervisorType getHypervisorType(); + + ClusterType getClusterType(); + + AllocationState getAllocationState(); + + ManagedState getManagedState(); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java new file mode 100755 index 00000000000..08175537ded --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceEntity.java @@ -0,0 +1,104 @@ +/* + * 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.engine.datacenter.entity.api; + +import javax.ws.rs.GET; + + +import javax.ws.rs.POST; +import javax.ws.rs.Produces; + +import org.apache.cloudstack.engine.entity.api.CloudStackEntity; + +import com.cloud.utils.fsm.StateMachine2; +import com.cloud.utils.fsm.StateObject; + +/** + * This interface specifies the states and operations all physical + * and virtual resources in the data center must implement. + */ +@Produces({"application/json", "application/xml"}) +public interface DataCenterResourceEntity extends CloudStackEntity, StateObject { + + /** + * This is the state machine for how CloudStack should interact with + * + */ + public enum State { + Disabled("The resource is disabled so CloudStack should not use it. This is the initial state of all resources added to CloudStack."), + Enabled("The resource is now enabled for CloudStack to use."), + Deactivated("The resource is deactivated so CloudStack should not use it for new resource needs."); + + String _description; + + private State(String description) { + _description = description; + } + + public enum Event { + EnableRequest, + DisableRequest, + DeactivateRequest, + ActivatedRequest + } + + protected static final StateMachine2 s_fsm = new StateMachine2(); + static { + s_fsm.addTransition(Disabled, Event.EnableRequest, Enabled); + s_fsm.addTransition(Enabled, Event.DisableRequest, Disabled); + s_fsm.addTransition(Enabled, Event.DeactivateRequest, Deactivated); + s_fsm.addTransition(Deactivated, Event.ActivatedRequest, Enabled); + } + + } + + /** + * Prepare the resource to take new on new demands. + */ + @POST + boolean enable(); + + /** + * Disables the resource. Cleanup. Prepare for the resource to be removed. + */ + @POST + boolean disable(); + + /** + * Do not use the resource for new demands. + */ + @POST + boolean deactivate(); + + /** + * Reactivates a deactivated resource. + */ + @POST + boolean reactivate(); + + + @Override + @GET + State getState(); + + + public void persist(); + + String getName(); +} diff --git a/core/src/com/cloud/vm/VirtualNetwork.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntity.java similarity index 52% rename from core/src/com/cloud/vm/VirtualNetwork.java rename to engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntity.java index ace3b80769f..99f3120f93a 100644 --- a/core/src/com/cloud/vm/VirtualNetwork.java +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntity.java @@ -14,59 +14,48 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm; - -import com.cloud.network.Networks.IsolationType; -import com.cloud.network.Networks.Mode; - -/** - * VirtualNetwork describes from a management level the - * machine. - */ -public class VirtualNetwork { - /** - * The gateway for this network. - */ - public String gateway; - - /** - * Netmask - */ - public String netmask; - - /** - * ip address. null if mode is DHCP. - */ - public String ip; - - /** - * Mac Address. - */ - public String mac; - - /** - * rate limit on this network. -1 if no limit. - */ - public long rate; - - /** - * tag for virtualization. - */ - public String tag; - - /** - * mode to acquire ip address. - */ - public Mode mode; - - /** - * Isolation method for networking. - */ - public IsolationType method; - - public boolean firewalled; - - public int[] openPorts; - - public int[] closedPorts; -} +package org.apache.cloudstack.engine.datacenter.entity.api; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; + +public interface HostEntity extends DataCenterResourceEntity { + + /** + * @return total amount of memory. + */ + Long getTotalMemory(); + + /** + * @return # of cores in a machine. Note two cpus with two cores each returns 4. + */ + Integer getCpus(); + + /** + * @return speed of each cpu in mhz. + */ + Long getSpeed(); + + /** + * @return the pod. + */ + Long getPodId(); + + /** + * @return availability zone. + */ + long getDataCenterId(); + + /** + * @return type of hypervisor + */ + HypervisorType getHypervisorType(); + + /** + * @return the mac address of the host. + */ + String getGuid(); + + Long getClusterId(); + +} + diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/OrganizationScope.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/OrganizationScope.java new file mode 100755 index 00000000000..c39f5811199 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/OrganizationScope.java @@ -0,0 +1,23 @@ +/* + * 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.engine.datacenter.entity.api; + +public interface OrganizationScope { + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntity.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntity.java new file mode 100755 index 00000000000..fc870388227 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntity.java @@ -0,0 +1,43 @@ +/* + * 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.engine.datacenter.entity.api; + +import java.util.List; + +import com.cloud.dc.Pod; +import com.cloud.org.Cluster; +import com.cloud.org.Grouping.AllocationState; + +public interface PodEntity extends DataCenterResourceEntity { + + List listClusters(); + + String getCidrAddress(); + + int getCidrSize(); + + String getGateway(); + + long getDataCenterId(); + + AllocationState getAllocationState(); + + boolean getExternalDhcp(); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/StorageEntity.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/StorageEntity.java new file mode 100755 index 00000000000..2c7f443e567 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/StorageEntity.java @@ -0,0 +1,24 @@ +/* + * 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.engine.datacenter.entity.api; + +import com.cloud.storage.StoragePool; + +public interface StorageEntity extends DataCenterResourceEntity, StoragePool { +} diff --git a/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java new file mode 100755 index 00000000000..5bf35540085 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntity.java @@ -0,0 +1,43 @@ +/* + * 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.engine.datacenter.entity.api; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.apache.cloudstack.framework.ws.jackson.Url; +/** + * Describes a zone and operations that can be done in a zone. + */ +@Path("/zone/{zoneid}") +@Produces({"application/json"}) +@XmlRootElement(name="zone") +public interface ZoneEntity extends DataCenterResourceEntity { + @GET + @Path("/pods") + List listPods(); + + @Url(clazz=ProvisioningService.class, method="getPod", name="id", type=List.class) + List listPodIds(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/entity/api/CloudStackEntity.java b/engine/api/src/org/apache/cloudstack/engine/entity/api/CloudStackEntity.java new file mode 100755 index 00000000000..09130d1d995 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/entity/api/CloudStackEntity.java @@ -0,0 +1,96 @@ +/* + * 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.engine.entity.api; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.GET; +import javax.ws.rs.QueryParam; + +/** + * All entities returned by the Cloud Orchestration Platform must implement + * this interface. CloudValueEntity is an immutable representation of + * an entity exposed by Cloud Orchestration Platform. For each object, it + * defines two ids: uuid, generated by CloudStack Orchestration Platform, and + * an external id that is set by the caller when the entity is created. All + * ids must be unique for that entity. CloudValueEntity also can be converted + * to a CloudActionableEntity which contains actions the object can perform. + */ +public interface CloudStackEntity { + /** + * @return the uuid of the object. + */ + @GET + String getUuid(); + + /** + * @return the id which is often the database id. + */ + long getId(); + + /** + * @return current state for the entity + */ + @GET + String getCurrentState(); + + /** + * @return desired state for the entity + */ + @GET + String getDesiredState(); + + /** + * Get the time the entity was created + */ + @GET + Date getCreatedTime(); + + /** + * Get the time the entity was last updated + */ + @GET + Date getLastUpdatedTime(); + + /** + * @return reference to the owner of this entity + */ + @GET + String getOwner(); + + /** + * @return details stored for this entity when created. + */ + Map getDetails(); + + void addDetail(String name, String value); + + void delDetail(String name, String value); + + void updateDetail(String name, String value); + + /** + * @return list of actions that can be performed on the object in its current state + */ + List getApplicableActions(); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/exception/InsufficientCapacityException.java b/engine/api/src/org/apache/cloudstack/engine/exception/InsufficientCapacityException.java new file mode 100755 index 00000000000..c60ad3003b0 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/exception/InsufficientCapacityException.java @@ -0,0 +1,24 @@ +/* + * 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.engine.exception; + +public class InsufficientCapacityException { + + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ClusterRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ClusterRestService.java new file mode 100755 index 00000000000..216cfa81d0e --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ClusterRestService.java @@ -0,0 +1,86 @@ +/* + * 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.engine.rest.service.api; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Component +@Service("ClusterRestService") +@Produces("application/json") +public class ClusterRestService { +// @Inject + ProvisioningService _provisioningService; + + @GET @Path("/clusters") + public List listAll() { + return null; + } + + + @GET @Path("/cluster/{clusterid}") + public ClusterEntity get(@PathParam("clusterid") String clusterId) { + return null; + } + + @POST @Path("/cluster/{clusterid}/enable") + public String enable(@PathParam("clusterid") String clusterId) { + return null; + } + + @POST @Path("/cluster/{clusterid}/disable") + public String disable(@PathParam("clusterid") String clusterId) { + return null; + } + + @POST @Path("/cluster/{clusterid}/deactivate") + public String deactivate(@PathParam("clusterid") String clusterId) { + return null; + } + + @POST @Path("/cluster/{clusterid}/reactivate") + public String reactivate(@PathParam("clusterid") String clusterId) { + return null; + } + + @PUT @Path("/cluster/create") + public ClusterEntity create( + @QueryParam("xid") String xid, + @QueryParam("display-name") String displayName) { + return null; + } + + @PUT @Path("/cluster/{clusterid}/update") + public ClusterEntity update( + @QueryParam("display-name") String displayName) { + return null; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/NetworkRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/NetworkRestService.java new file mode 100755 index 00000000000..3e81a443115 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/NetworkRestService.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 org.apache.cloudstack.engine.rest.service.api; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Service("NetworkRestService") +@Component +@Produces("application/json") +public class NetworkRestService { + @PUT @Path("/network/create") + public NetworkEntity create( + @QueryParam("xid") String xid, + @QueryParam("display-name") String displayName) { + return null; + } + + @GET @Path("/network/{network-id}") + public NetworkEntity get(@PathParam("network-id") String networkId) { + return null; + } + + @GET @Path("/networks") + public List listAll() { + return null; + } + + @POST @Path("/network/{network-id}/") + public String deploy(@PathParam("network-id") String networkId) { + return null; + } + + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/PodRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/PodRestService.java new file mode 100755 index 00000000000..0811f0b9cf9 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/PodRestService.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.engine.rest.service.api; + +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Component +@Service("PodService") +@Produces({"application/json"}) +public class PodRestService { +// @Inject + ProvisioningService _provisioningService; + + @GET @Path("/pod/{pod-id}") + public PodEntity getPod(@PathParam("pod-id") String podId) { + return null; + } + + @POST @Path("/pod/{pod-id}/enable") + public String enable(@PathParam("pod-id") String podId) { + return null; + } + + @POST @Path("/pod/{pod-id}/disable") + public String disable(@PathParam("pod-id") String podId) { + return null; + } + + @POST @Path("/pod/{pod-id}/deactivate") + public String deactivate(@PathParam("pod-id") String podId) { + return null; + } + + @POST @Path("/pod/{pod-id}/reactivate") + public String reactivate(@PathParam("pod-id") String podId) { + return null; + } + + @PUT @Path("/pod/create") + public PodEntity create( + @QueryParam("xid") String xid, + @QueryParam("display-name") String displayName) { + return null; + } + + @PUT @Path("/pod/{pod-id}") + public PodEntity update( + @PathParam("pod-id") String podId, + @QueryParam("display-name") String displayName) { + return null; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VirtualMachineRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VirtualMachineRestService.java new file mode 100755 index 00000000000..2124a81261f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VirtualMachineRestService.java @@ -0,0 +1,56 @@ +/* + * 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.engine.rest.service.api; + +import java.util.List; + +import javax.ws.rs.GET; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Component +@Service("VirtualMachineRestService") +@Produces("application/xml") +public class VirtualMachineRestService { + + @GET @Path("/vm/{vmid}") + public VirtualMachineEntity get(@PathParam("vmid") String vmId) { + return null; + } + + @PUT @Path("/vm/create") + public VirtualMachineEntity create( + @QueryParam("xid") String xid, + @QueryParam("hostname") String hostname, + @QueryParam("display-name") String displayName) { + return null; + } + + @GET @Path("/vms") + public List listAll() { + return null; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VolumeRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VolumeRestService.java new file mode 100755 index 00000000000..3e5174b9d90 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/VolumeRestService.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.rest.service.api; + +import java.util.List; + +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Component +@Service("VolumeRestService") +@Produces("application/json") +public class VolumeRestService { + + @PUT @Path("/vol/create") + public VolumeEntity create( + @QueryParam("xid") String xid, + @QueryParam("display-name") String displayName) { + return null; + } + + @POST @Path("/vol/{volid}/deploy") + public String deploy(@PathParam("volid") String volumeId) { + return null; + } + + @GET @Path("/vols") + public List listAll() { + return null; + } + + @POST @Path("/vol/{volid}/attach-to") + public String attachTo( + @PathParam("volid") String volumeId, + @QueryParam("vmid") String vmId, + @QueryParam("device-order") short device) { + return null; + } + + @DELETE @Path("/vol/{volid}") + public String delete(@PathParam("volid") String volumeId) { + return null; + } + + @POST @Path("/vol/{volid}/detach") + public String detach(@QueryParam("volid") String volumeId) { + return null; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ZoneRestService.java b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ZoneRestService.java new file mode 100755 index 00000000000..7170f00747d --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/rest/service/api/ZoneRestService.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.rest.service.api; + +import java.util.List; + +import javax.ws.rs.DELETE; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.PUT; +import javax.ws.rs.Path; +import javax.ws.rs.PathParam; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +@Component +@Service("zoneService") +@Produces({"application/json"}) +public class ZoneRestService { +// @Inject + ProvisioningService _provisioningService; + + @GET @Path("/zones") + public List listAll() { + return _provisioningService.listZones(); + } + + @GET @Path("/zone/{zone-id}") + public ZoneEntity get(@PathParam("zone-id") String zoneId) { + return _provisioningService.getZone(zoneId); + } + + @POST @Path("/zone/{zone-id}/enable") + public String enable(String zoneId) { + return null; + } + + @POST @Path("/zone/{zone-id}/disable") + public String disable(@PathParam("zone-id") String zoneId) { + ZoneEntity zoneEntity = _provisioningService.getZone(zoneId); + zoneEntity.disable(); + return null; + } + + @POST @Path("/zone/{zone-id}/deactivate") + public String deactivate(@PathParam("zone-id") String zoneId) { + return null; + } + + @POST @Path("/zone/{zone-id}/activate") + public String reactivate(@PathParam("zone-id") String zoneId) { + return null; + } + + + @PUT @Path("/zone/create") + public ZoneEntity createZone(@QueryParam("xid") String xid, + @QueryParam("display-name") String displayName) { + return null; + } + + @DELETE @Path("/zone/{zone-id}") + public String deleteZone(@QueryParam("zone-id") String xid) { + return null; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/DirectoryService.java b/engine/api/src/org/apache/cloudstack/engine/service/api/DirectoryService.java new file mode 100755 index 00000000000..360e08f1748 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/service/api/DirectoryService.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 org.apache.cloudstack.engine.service.api; + +import java.net.URI; +import java.util.List; + +import com.cloud.utils.component.PluggableService; + +public interface DirectoryService { + void registerService(String serviceName, URI endpoint); + void unregisterService(String serviceName, URI endpoint); + List getEndPoints(String serviceName); + URI getLoadBalancedEndPoint(String serviceName); + + List listServices(); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/EntityService.java b/engine/api/src/org/apache/cloudstack/engine/service/api/EntityService.java new file mode 100755 index 00000000000..2743ab8523a --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/service/api/EntityService.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.engine.service.api; + +import java.util.List; + +import javax.ws.rs.Path; + +import com.cloud.network.Network; +import com.cloud.storage.Volume; +import com.cloud.vm.VirtualMachine; + +/** + * Service to retrieve CloudStack entities + * very likely to change + */ +@Path("resources") +public interface EntityService { + List listVirtualMachines(); + List listVolumes(); + List listNetworks(); + List listNics(); + List listSnapshots(); + List listTemplates(); + List listStoragePools(); + List listHosts(); + + VirtualMachine getVirtualMachine(String vm); + Volume getVolume(String volume); + Network getNetwork(String network); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/OperationsServices.java b/engine/api/src/org/apache/cloudstack/engine/service/api/OperationsServices.java new file mode 100755 index 00000000000..25a0b19d161 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/service/api/OperationsServices.java @@ -0,0 +1,57 @@ +/* + * 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.engine.service.api; + +import java.net.URL; +import java.util.List; + +import com.cloud.alert.Alert; +import com.cloud.async.AsyncJob; + +public interface OperationsServices { + List listJobs(); + + List listJobsInProgress(); + + List listJobsCompleted(); + + List listJobsCompleted(Long from); + + List listJobsInWaiting(); + + void cancelJob(String job); + + List listAlerts(); + + Alert getAlert(String uuid); + + void cancelAlert(String alert); + + void registerForAlerts(); + + String registerForEventNotifications(String type, String topic, URL url); + + boolean deregisterForEventNotifications(String notificationId); + + /** + * @return the list of event topics someone can register for + */ + List listEventTopics(); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java b/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java new file mode 100755 index 00000000000..64ef063d096 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/service/api/OrchestrationService.java @@ -0,0 +1,114 @@ +/* + * 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.engine.service.api; + +import java.net.URL; +import java.util.List; +import java.util.Map; + +import javax.ws.rs.DELETE; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; + +import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; +import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; + +import com.cloud.deploy.DeploymentPlan; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.vm.NicProfile; + +@Path("orchestration") +@Produces({"application/json", "application/xml"}) +public interface OrchestrationService { + /** + * creates a new virtual machine + * + * @param id externally unique name to reference the virtual machine + * @param owner owner reference + * @param template reference to the template + * @param hostName name of the host + * @param displayName name to look at + * @param cpu # of cpu cores + * @param speed speed of the cpu core in MHZ + * @param memory memory to allocate in bytes + * @param computeTags tags for the compute + * @param rootDiskTags tags for the root disk + * @param networks networks that this VM should join + * @return VirtualMachineEntity + */ + @POST + @Path("/createvm") + VirtualMachineEntity createVirtualMachine( + @QueryParam("id") String id, + @QueryParam("owner") String owner, + @QueryParam("template-id") String templateId, + @QueryParam("host-name") String hostName, + @QueryParam("display-name") String displayName, + @QueryParam("hypervisor") String hypervisor, + @QueryParam("cpu") int cpu, + @QueryParam("speed") int speed, + @QueryParam("ram") long memory, + @QueryParam("disk-size") Long diskSize, + @QueryParam("compute-tags") List computeTags, + @QueryParam("root-disk-tags") List rootDiskTags, + @QueryParam("network-nic-map") Map networkNicMap, + @QueryParam("deploymentplan") DeploymentPlan plan + ) throws InsufficientCapacityException; + + @POST + VirtualMachineEntity createVirtualMachineFromScratch( + @QueryParam("id") String id, + @QueryParam("owner") String owner, + @QueryParam("iso-id") String isoId, + @QueryParam("host-name") String hostName, + @QueryParam("display-name") String displayName, + @QueryParam("hypervisor") String hypervisor, + @QueryParam("os") String os, + @QueryParam("cpu") int cpu, + @QueryParam("speed") int speed, + @QueryParam("ram") long memory, + @QueryParam("disk-size") Long diskSize, + @QueryParam("compute-tags") List computeTags, + @QueryParam("root-disk-tags") List rootDiskTags, + @QueryParam("network-nic-map") Map networkNicMap, + @QueryParam("deploymentplan") DeploymentPlan plan + ) throws InsufficientCapacityException; + + @POST + NetworkEntity createNetwork(String id, String name, String domainName, String cidr, String gateway); + + @DELETE + void destroyNetwork(String networkUuid); + + @POST + VolumeEntity createVolume(); + + @DELETE + void destroyVolume(String volumeEntity); + + @POST + TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor); + + VirtualMachineEntity getVirtualMachine(@QueryParam("id") String id); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java b/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.java new file mode 100755 index 00000000000..e1ba1de587c --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/service/api/ProvisioningService.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.engine.service.api; + +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; + +import com.cloud.host.Host; +import com.cloud.host.Status; +import com.cloud.storage.StoragePool; + + +/** + * ProvisioningService registers and deregisters physical and virtual + * resources that the management server can use. + */ +public interface ProvisioningService { + + StorageEntity registerStorage(String name, List tags, Map details); + + ZoneEntity registerZone(String zoneUuid, String name, String owner, List tags, Map details); + + PodEntity registerPod(String podUuid, String name, String owner, String zoneUuid, List tags, Map details); + + ClusterEntity registerCluster(String clusterUuid, String name, String owner, List tags, Map details); + + HostEntity registerHost(String uuid, String name, String owner, List tags, Map details); + + void deregisterStorage(String uuid); + + void deregisterZone(String uuid); + + void deregisterPod(String uuid); + + void deregisterCluster(String uuid); + + void deregisterHost(String uuid); + + void changeState(String type, String entity, Status state); + + List listHosts(); + + List listPods(); + + List listZones(); + + List listStorage(); + + ZoneEntity getZone(String id); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/hypervisor/ComputeSubsystem.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/hypervisor/ComputeSubsystem.java new file mode 100644 index 00000000000..f972e816dca --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/hypervisor/ComputeSubsystem.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.engine.subsystem.api.hypervisor; + + +public interface ComputeSubsystem { + + void start(String vm, String reservationId); + + void cancel(String reservationId); + + void stop(String vm, String reservationId); + + void migrate(String vm, String reservationId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkServiceProvider.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkServiceProvider.java new file mode 100755 index 00000000000..20c5a88ac93 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkServiceProvider.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 org.apache.cloudstack.engine.subsystem.api.network; + +public interface NetworkServiceProvider { + /** + * Plug your network elements into this network + * @param network + * @param reservationId + */ + void plugInto(String network, String reservationId); + + /** + * Unplug your network elements from this network + * @param network + * @param reservationId + */ + void unplugFrom(String network, String reservationId); + + /** + * Cancel a previous work + * @param reservationId + */ + void cancel(String reservationId); + + void provideServiceTo(String vm, String network, String reservationId); + + void removeServiceFrom(String vm, String network, String reservationId); + + void cleanUp(String network, String reservationId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkSubsystem.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkSubsystem.java new file mode 100755 index 00000000000..53254cce55f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/network/NetworkSubsystem.java @@ -0,0 +1,35 @@ +/* + * 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.engine.subsystem.api.network; + +public interface NetworkSubsystem { + String create(); + + String start(String network, String reservationId); + + void shutdown(String nework, String reservationId); + + void prepare(String vm, String network, String reservationId); + + void release(String vm, String network, String reservationId); + + void cancel(String reservationId); + + void destroy(String network, String reservationId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java new file mode 100644 index 00000000000..fce7d82cb99 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ClusterScope.java @@ -0,0 +1,52 @@ +/* + * 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.engine.subsystem.api.storage; + + +public class ClusterScope implements Scope { + private ScopeType type = ScopeType.CLUSTER; + private Long clusterId; + private Long podId; + private Long zoneId; + + public ClusterScope(Long clusterId, Long podId, Long zoneId) { + this.clusterId = clusterId; + this.podId = podId; + this.zoneId = zoneId; + } + + @Override + public ScopeType getScopeType() { + return this.type; + } + + @Override + public Long getScopeId() { + return this.clusterId; + } + + public Long getPodId() { + return this.podId; + } + + public Long getZoneId() { + return this.zoneId; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CommandResult.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CommandResult.java new file mode 100644 index 00000000000..6b6139b937d --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CommandResult.java @@ -0,0 +1,52 @@ +/* + * 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.engine.subsystem.api.storage; + +public class CommandResult { + private boolean success; + private String result; + public CommandResult() { + this.success = true; + this.result = ""; + } + + public boolean isSuccess() { + return this.success; + } + + public boolean isFailed() { + return !this.success; + } + + public void setSucess(boolean success) { + this.success = success; + } + + public String getResult() { + return this.result; + } + + public void setResult(String result) { + this.result = result; + if (result != null) { + this.success = false; + } + } +} + \ No newline at end of file diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CopyCommandResult.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CopyCommandResult.java new file mode 100644 index 00000000000..571a77c3786 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CopyCommandResult.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import com.cloud.agent.api.Answer; + +public class CopyCommandResult extends CommandResult { + private final String path; + private final Answer answer; + public CopyCommandResult(String path, Answer answer) { + super(); + this.path = path; + this.answer = answer; + } + + public String getPath() { + return this.path; + } + + public Answer getAnswer() { + return this.answer; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CreateCmdResult.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CreateCmdResult.java new file mode 100644 index 00000000000..b6d5b689951 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/CreateCmdResult.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 org.apache.cloudstack.engine.subsystem.api.storage; + +public class CreateCmdResult extends CommandResult { + private String path; + private Long size; + public CreateCmdResult(String path, Long size) { + super(); + this.path = path; + this.size = size; + } + + public String getPath() { + return this.path; + } + + public Long getSize() { + return this.size; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMigrationSubSystem.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMigrationSubSystem.java new file mode 100755 index 00000000000..65928bd5537 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataMigrationSubSystem.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.net.URI; + +import com.cloud.org.Grouping; + +public interface DataMigrationSubSystem { + + Class getScopeCoverage(); + void migrate(URI source, URI dest, String reservationId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java new file mode 100644 index 00000000000..0827cf6b674 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; + +public interface DataObject { + public long getId(); + public String getUri(); + public DataStore getDataStore(); + public Long getSize(); + public DataObjectType getType(); + public DiskFormat getFormat(); + public String getUuid(); + public void processEvent(ObjectInDataStoreStateMachine.Event event); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.java new file mode 100644 index 00000000000..32ea996e638 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import com.cloud.utils.fsm.StateObject; + + +public interface DataObjectInStore extends StateObject { + public String getInstallPath(); + public void setInstallPath(String path); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectType.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectType.java new file mode 100644 index 00000000000..b4d1a57c88c --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectType.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.subsystem.api.storage; + +public enum DataObjectType { + VOLUME, + SNAPSHOT, + TEMPLATE +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java new file mode 100644 index 00000000000..f101f243047 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.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 org.apache.cloudstack.engine.subsystem.api.storage; + +public interface DataStore { + DataStoreDriver getDriver(); + DataStoreRole getRole(); + long getId(); + String getUuid(); + String getUri(); + Scope getScope(); + DataObject create(DataObject obj); + boolean delete(DataObject obj); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.java new file mode 100644 index 00000000000..cf5759b2924 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreDriver.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.util.Set; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public interface DataStoreDriver { + public String grantAccess(DataObject data, EndPoint ep); + public boolean revokeAccess(DataObject data, EndPoint ep); + public Set listObjects(DataStore store); + public void createAsync(DataObject data, AsyncCompletionCallback callback); + public void deleteAsync(DataObject data, AsyncCompletionCallback callback); + public void copyAsync(DataObject srcdata, DataObject destData, AsyncCompletionCallback callback); + public boolean canCopy(DataObject srcData, DataObject destData); + public void resize(DataObject data, AsyncCompletionCallback callback); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreLifeCycle.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreLifeCycle.java new file mode 100644 index 00000000000..95e3d0b2ef8 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreLifeCycle.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.util.Map; + +import com.cloud.agent.api.StoragePoolInfo; + + +public interface DataStoreLifeCycle { + public DataStore initialize(Map dsInfos); + + public boolean attachCluster(DataStore store, ClusterScope scope); + public boolean attachHost(DataStore store, HostScope scope, StoragePoolInfo existingInfo); + boolean attachZone(DataStore dataStore, ZoneScope scope); + + public boolean dettach(); + + public boolean unmanaged(); + + public boolean maintain(long storeId); + + public boolean cancelMaintain(long storeId); + + public boolean deleteDataStore(long storeId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java new file mode 100644 index 00000000000..15e49e133fb --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.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.engine.subsystem.api.storage; + +import java.util.List; +import java.util.Map; + + +public interface DataStoreManager { + public DataStore getDataStore(long storeId, DataStoreRole role); + public DataStore getPrimaryDataStore(long storeId); + public DataStore getDataStore(String uuid, DataStoreRole role); + public List getImageStores(Scope scope); + public DataStore registerDataStore(Map params, String providerUuid); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java new file mode 100644 index 00000000000..d29c4828713 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.subsystem.api.storage; + +import java.util.Map; + + +public interface DataStoreProvider { + public DataStoreLifeCycle getLifeCycle(); + public String getName(); + public String getUuid(); + public long getId(); + public boolean configure(Map params); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.java new file mode 100644 index 00000000000..94998133196 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.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.engine.subsystem.api.storage; + +import java.util.List; + +import com.cloud.utils.component.Manager; + +public interface DataStoreProviderManager extends Manager { + public DataStoreProvider getDataStoreProviderByUuid(String uuid); + public DataStoreProvider getDataStoreProviderById(long id); + public DataStoreProvider getDataStoreProvider(String name); + public DataStoreProvider getDefaultPrimaryDataStoreProvider(); + public List getDataStoreProviders(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreRole.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreRole.java new file mode 100644 index 00000000000..a45ca7a6c8e --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreRole.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import com.cloud.utils.exception.CloudRuntimeException; + +public enum DataStoreRole { + Primary("primary"), + Image("image"), + ImageCache("imagecache"), + Backup("backup"); + + public boolean isImageStore() { + return (this.role.equalsIgnoreCase("image") || this.role.equalsIgnoreCase("imagecache")) ? true : false; + } + + private final String role; + DataStoreRole(String type) { + this.role = type; + } + + public static DataStoreRole getRole(String role) { + if (role == null) { + throw new CloudRuntimeException("role can't be empty"); + } + if (role.equalsIgnoreCase("primary")) { + return Primary; + } else if (role.equalsIgnoreCase("image")) { + return Image; + } else if (role.equalsIgnoreCase("imagecache")) { + return ImageCache; + } else if (role.equalsIgnoreCase("backup")) { + return Backup; + } else { + throw new CloudRuntimeException("can't identify the role"); + } + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java new file mode 100644 index 00000000000..2388795410c --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java @@ -0,0 +1,23 @@ +/* + * 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.engine.subsystem.api.storage; + +public enum DataStoreStatus { + Initial, Initialized, Creating, Attaching, Up, PrepareForMaintenance, ErrorInMaintenance, CancelMaintenance, Maintenance, Removed; +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.java new file mode 100644 index 00000000000..2ff45b1bf56 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/EndPoint.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public interface EndPoint { + public long getId(); + public Answer sendMessage(Command cmd); + public void sendMessageAsync(Command cmd, AsyncCompletionCallback callback); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java new file mode 100644 index 00000000000..71d1952c625 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.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 org.apache.cloudstack.engine.subsystem.api.storage; + + +public class HostScope implements Scope { + private ScopeType type = ScopeType.HOST; + private Long hostId; + public HostScope(Long hostId) { + this.hostId = hostId; + } + @Override + public ScopeType getScopeType() { + return this.type; + } + + @Override + public Long getScopeId() { + return this.hostId; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HypervisorHostListener.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HypervisorHostListener.java new file mode 100644 index 00000000000..3ac17598bb0 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HypervisorHostListener.java @@ -0,0 +1,24 @@ +/* + * 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.engine.subsystem.api.storage; + +public interface HypervisorHostListener { + boolean hostConnect(long hostId, long poolId); + boolean hostDisconnected(long hostId, long poolId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java new file mode 100644 index 00000000000..f0d69887c7d --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + + +public interface ImageDataFactory { + TemplateInfo getTemplate(long templateId, DataStore store); + TemplateInfo getTemplate(DataObject obj, DataStore store); + TemplateInfo getTemplate(long templateId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.java new file mode 100644 index 00000000000..119f3b1d32f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import org.apache.cloudstack.framework.async.AsyncCallFuture; + +public interface ImageService { + AsyncCallFuture createTemplateAsync(TemplateInfo template, DataStore store); + AsyncCallFuture createTemplateFromSnapshotAsync(SnapshotInfo snapshot, TemplateInfo template, DataStore store); + AsyncCallFuture createTemplateFromVolumeAsync(VolumeInfo volume, TemplateInfo template, DataStore store); + AsyncCallFuture deleteTemplateAsync(TemplateInfo template); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java new file mode 100644 index 00000000000..726ce0821c5 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java @@ -0,0 +1,56 @@ +/* + * 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.engine.subsystem.api.storage; + +import com.cloud.utils.fsm.StateObject; + +public interface ObjectInDataStoreStateMachine extends StateObject { + enum State { + Allocated("The initial state"), + Creating2("This is only used with createOnlyRequested event"), + Creating("The object is being creating on data store"), + Created("The object is created"), + Ready("Template downloading is complished"), + Copying("The object is being coping"), + Destroying("Template is destroying"), + Destroyed("Template is destroyed"), + Failed("Failed to download template"); + String _description; + + private State(String description) { + _description = description; + } + + public String getDescription() { + return _description; + } + } + + enum Event { + CreateRequested, + CreateOnlyRequested, + DestroyRequested, + OperationSuccessed, + OperationFailed, + CopyingRequested, + ResizeRequested, + ExpungeRequested + + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java new file mode 100644 index 00000000000..78a1014d3c7 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreDriver.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public interface PrimaryDataStoreDriver extends DataStoreDriver { + public void takeSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback callback); + public void revertSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback callback); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.java new file mode 100644 index 00000000000..3497f7a894f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreInfo.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 org.apache.cloudstack.engine.subsystem.api.storage; + + +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePool; + +public interface PrimaryDataStoreInfo extends StoragePool { + public boolean isHypervisorSupported(HypervisorType hypervisor); + public boolean isLocalStorageSupported(); + public boolean isVolumeDiskTypeSupported(DiskFormat diskType); + + public String getUuid(); + + public StoragePoolType getPoolType(); + public PrimaryDataStoreLifeCycle getLifeCycle(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java new file mode 100644 index 00000000000..cf29d9fea09 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreLifeCycle.java @@ -0,0 +1,23 @@ +/* + * 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.engine.subsystem.api.storage; + + +public interface PrimaryDataStoreLifeCycle extends DataStoreLifeCycle { +} diff --git a/server/src/com/cloud/baremetal/BareMetalVmManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreProvider.java similarity index 86% rename from server/src/com/cloud/baremetal/BareMetalVmManager.java rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreProvider.java index 900c57fdf80..b248758bc12 100644 --- a/server/src/com/cloud/baremetal/BareMetalVmManager.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/PrimaryDataStoreProvider.java @@ -14,9 +14,3 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.baremetal; - -import com.cloud.vm.UserVmManager; - -public interface BareMetalVmManager extends UserVmManager { -} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java new file mode 100644 index 00000000000..c1596d4f5f7 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/Scope.java @@ -0,0 +1,24 @@ +/* + * 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.engine.subsystem.api.storage; + +public interface Scope { + public ScopeType getScopeType(); + public Long getScopeId(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ScopeType.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ScopeType.java new file mode 100644 index 00000000000..a3d21ce9bef --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ScopeType.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 org.apache.cloudstack.engine.subsystem.api.storage; + +public enum ScopeType { + HOST, + CLUSTER, + ZONE, + REGION, + GLOBAL; +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java new file mode 100644 index 00000000000..1ff3ff25065 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + + +public interface SnapshotDataFactory { + public SnapshotInfo getSnapshot(long snapshotId, DataStore store); + public SnapshotInfo getSnapshot(DataObject obj, DataStore store); + public SnapshotInfo getSnapshot(long snapshotId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java new file mode 100644 index 00000000000..b90404c5667 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import com.cloud.storage.Snapshot; + + +public interface SnapshotInfo extends DataObject, Snapshot { + public SnapshotInfo getParent(); + public SnapshotInfo getChild(); + public VolumeInfo getBaseVolume(); + Long getDataCenterId(); + public Long getPrevSnapshotId(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotProfile.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotProfile.java new file mode 100644 index 00000000000..50a12002cf2 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotProfile.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + +public class SnapshotProfile { + private String _uri; + public String getURI() { + return _uri; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java new file mode 100644 index 00000000000..e9492c4afc6 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.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 org.apache.cloudstack.engine.subsystem.api.storage; + + +public interface SnapshotStrategy { + public boolean canHandle(SnapshotInfo snapshot); + public SnapshotInfo takeSnapshot(VolumeInfo volume, Long snapshotId); + public SnapshotInfo backupSnapshot(SnapshotInfo snapshot); + public boolean deleteSnapshot(SnapshotInfo snapshot); + public boolean revertSnapshot(SnapshotInfo snapshot); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageEvent.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageEvent.java new file mode 100644 index 00000000000..3f64002ed9e --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageEvent.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.subsystem.api.storage; + +public enum StorageEvent { + DownloadTemplateToPrimary, + RegisterTemplate, + CreateVolumeFromTemplate; +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageOrchestrator.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageOrchestrator.java new file mode 100755 index 00000000000..fdb15c7331c --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageOrchestrator.java @@ -0,0 +1,68 @@ +/* + * 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.engine.subsystem.api.storage; + +import java.util.List; + +import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; + +import com.cloud.deploy.DeploymentPlan; + +public interface StorageOrchestrator { + + /** + * Prepares all storage ready for a VM to start + * @param vm + * @param reservationId + */ + void prepare(long vmId, DeploymentPlan plan, String reservationId); + + /** + * Releases all storage that were used for a VM shutdown + * @param vm + * @param disks + * @param reservationId + */ + void release(long vmId, String reservationId); + + /** + * Destroy all disks + * @param disks + * @param reservationId + */ + void destroy(List disks, String reservationId); + + /** + * Cancel a reservation + * @param reservationId reservation to + */ + void cancel(String reservationId); + + /** + * If attaching a volume in allocated state to a running vm, need to create this volume + */ + void prepareAttachDiskToVM(long diskId, long vmId, String reservationId); + + boolean createVolume(VolumeEntity volume, long dataStoreId, DiskFormat diskType); + boolean createVolumeFromTemplate(VolumeEntity volume, long dataStoreId, DiskFormat dis, TemplateEntity template); + VolumeEntity allocateVolumeInDb(long size, VolumeType type,String volName, Long templateId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageSubSystem.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageSubSystem.java new file mode 100644 index 00000000000..8043487d46b --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/StorageSubSystem.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 org.apache.cloudstack.engine.subsystem.api.storage; + +import java.net.URI; + +import com.cloud.org.Grouping; + +public interface StorageSubSystem { + String getType(); + Class getScope(); + + URI grantAccess(String vol, String reservationId); + URI RemoveAccess(String vol, String reservationId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java new file mode 100644 index 00000000000..c677166b39a --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + +public enum TemplateEvent { + CreateRequested, + OperationFailed, + OperationSucceeded, + DestroyRequested; +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java new file mode 100644 index 00000000000..8e03503911e --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java @@ -0,0 +1,22 @@ +/* + * 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.engine.subsystem.api.storage; + +public interface TemplateInfo extends DataObject { +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateProfile.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateProfile.java new file mode 100755 index 00000000000..e05e7db67fa --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateProfile.java @@ -0,0 +1,287 @@ +// 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.engine.subsystem.api.storage; + +import java.util.Map; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.template.VirtualMachineTemplate; + +public class TemplateProfile { + Long userId; + String name; + String displayText; + Integer bits; + Boolean passwordEnabled; + Boolean sshKeyEnbaled; + Boolean requiresHvm; + String url; + Boolean isPublic; + Boolean featured; + Boolean isExtractable; + ImageFormat format; + Long guestOsId; + Long zoneId; + HypervisorType hypervisorType; + String accountName; + Long domainId; + Long accountId; + String chksum; + Boolean bootable; + Long templateId; + VirtualMachineTemplate template; + String templateTag; + Map details; + + public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm, + String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId, + HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, Map details, Boolean sshKeyEnabled) { + this.templateId = templateId; + this.userId = userId; + this.name = name; + this.displayText = displayText; + this.bits = bits; + this.passwordEnabled = passwordEnabled; + this.requiresHvm = requiresHvm; + this.url = url; + this.isPublic = isPublic; + this.featured = featured; + this.isExtractable = isExtractable; + this.format = format; + this.guestOsId = guestOsId; + this.zoneId = zoneId; + this.hypervisorType = hypervisorType; + this.accountName = accountName; + this.domainId = domainId; + this.accountId = accountId; + this.chksum = chksum; + this.bootable = bootable; + this.details = details; + this.sshKeyEnbaled = sshKeyEnabled; + } + + public TemplateProfile(Long userId, VirtualMachineTemplate template, Long zoneId) { + this.userId = userId; + this.template = template; + this.zoneId = zoneId; + } + + public TemplateProfile(Long templateId, Long userId, String name, String displayText, Integer bits, Boolean passwordEnabled, Boolean requiresHvm, + String url, Boolean isPublic, Boolean featured, Boolean isExtractable, ImageFormat format, Long guestOsId, Long zoneId, + HypervisorType hypervisorType, String accountName, Long domainId, Long accountId, String chksum, Boolean bootable, String templateTag, Map details, Boolean sshKeyEnabled) { + this(templateId, userId, name, displayText, bits, passwordEnabled, requiresHvm, url, isPublic, featured, isExtractable, format, guestOsId, zoneId, + hypervisorType, accountName, domainId, accountId, chksum, bootable, details, sshKeyEnabled); + this.templateTag = templateTag; + } + + public Long getTemplateId() { + return templateId; + } + public void setTemplateId(Long id) { + this.templateId = id; + } + + public Long getUserId() { + return userId; + } + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + + public String getDisplayText() { + return displayText; + } + public void setDisplayText(String text) { + this.displayText = text; + } + + public Integer getBits() { + return bits; + } + public void setBits(Integer bits) { + this.bits = bits; + } + + public Boolean getPasswordEnabled() { + return passwordEnabled; + } + public void setPasswordEnabled(Boolean enabled) { + this.passwordEnabled = enabled; + } + + public Boolean getRequiresHVM() { + return requiresHvm; + } + public void setRequiresHVM(Boolean hvm) { + this.requiresHvm = hvm; + } + + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + + public Boolean getIsPublic() { + return isPublic; + } + public void setIsPublic(Boolean is) { + this.isPublic = is; + } + + public Boolean getFeatured() { + return featured; + } + public void setFeatured(Boolean featured) { + this.featured = featured; + } + + public Boolean getIsExtractable() { + return isExtractable; + } + public void setIsExtractable(Boolean is) { + this.isExtractable = is; + } + + public ImageFormat getFormat() { + return format; + } + public void setFormat(ImageFormat format) { + this.format = format; + } + + public Long getGuestOsId() { + return guestOsId; + } + public void setGuestOsId(Long id) { + this.guestOsId = id; + } + + public Long getZoneId() { + return zoneId; + } + public void setZoneId(Long id) { + this.zoneId = id; + } + + public HypervisorType getHypervisorType() { + return hypervisorType; + } + public void setHypervisorType(HypervisorType type) { + this.hypervisorType = type; + } + + public Long getDomainId() { + return domainId; + } + public void setDomainId(Long id) { + this.domainId = id; + } + + public Long getAccountId() { + return accountId; + } + public void setAccountId(Long id) { + this.accountId = id; + } + + public String getCheckSum() { + return chksum; + } + public void setCheckSum(String chksum) { + this.chksum = chksum; + } + + public Boolean getBootable() { + return this.bootable; + } + public void setBootable(Boolean bootable) { + this.bootable = bootable; + } + + public VirtualMachineTemplate getTemplate() { + return template; + } + public void setTemplate(VirtualMachineTemplate template) { + this.template = template; + } + + public String getTemplateTag() { + return templateTag; + } + + public void setTemplateTag(String templateTag) { + this.templateTag = templateTag; + } + + public Map getDetails() { + return this.details; + } + + public void setDetails(Map details) { + this.details = details; + } + + public void setSshKeyEnabled(Boolean enabled) { + this.sshKeyEnbaled = enabled; + } + + public Boolean getSshKeyEnabled() { + return this.sshKeyEnbaled; + } + + public String getImageStorageUri() { + return null; + } + + public void setLocalPath(String path) { + + } + + public String getLocalPath() { + return null; + } + + public String getJobId() { + return null; + } + + public void setTemplatePoolRefId(long id) { + + } + + public long getId() { + return 0; + } + + public long getTemplatePoolRefId() { + return 0; + } + + public long getSize() { + return 0; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.java new file mode 100644 index 00000000000..ef2488080f8 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.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 org.apache.cloudstack.engine.subsystem.api.storage; + +public enum TemplateState { + Allocated, + Creating, + Destroying, + Destroyed, + Ready; +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java new file mode 100644 index 00000000000..1518fd2eb43 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java @@ -0,0 +1,26 @@ +/* + * 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.engine.subsystem.api.storage; + + +public interface VolumeDataFactory { + VolumeInfo getVolume(long volumeId, DataStore store); + VolumeInfo getVolume(DataObject volume, DataStore store); + VolumeInfo getVolume(long volumeId); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java new file mode 100644 index 00000000000..349325af45d --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.engine.subsystem.api.storage; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Volume; + +public interface VolumeInfo extends DataObject, Volume { + public boolean isAttachedVM(); + public void addPayload(Object data); + public Object getpayload(); + public HypervisorType getHypervisorType(); + public Long getLastPoolId(); +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeProfile.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeProfile.java new file mode 100644 index 00000000000..ed4d42187be --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeProfile.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 org.apache.cloudstack.engine.subsystem.api.storage; + +public class VolumeProfile { + private String _uri; + public String getURI() { + return _uri; + } + + public String getPath() { + return null; + } + + public long getSize() { + return 0; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java new file mode 100644 index 00000000000..102c47174b1 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java @@ -0,0 +1,80 @@ +/* + * 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.engine.subsystem.api.storage; + +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.apache.cloudstack.framework.async.AsyncCallFuture; + +import com.cloud.exception.ConcurrentOperationException; + + +public interface VolumeService { + + public class VolumeApiResult extends CommandResult { + private final VolumeInfo volume; + public VolumeApiResult(VolumeInfo volume) { + this.volume = volume; + } + + public VolumeInfo getVolume() { + return this.volume; + } + } + + /** + * Creates the volume based on the given criteria + * + * @param cmd + * + * @return the volume object + */ + AsyncCallFuture createVolumeAsync(VolumeInfo volume, DataStore store); + + /** + * Delete volume + * + * @param volumeId + * @return + * @throws ConcurrentOperationException + */ + AsyncCallFuture expungeVolumeAsync(VolumeInfo volume); + + /** + * + */ + boolean cloneVolume(long volumeId, long baseVolId); + + /** + * + */ + AsyncCallFuture createVolumeFromSnapshot(VolumeInfo volume, DataStore store, SnapshotInfo snapshot); + + + VolumeEntity getVolumeEntity(long volumeId); + + AsyncCallFuture createVolumeFromTemplateAsync(VolumeInfo volume, long dataStoreId, TemplateInfo template); + AsyncCallFuture copyVolume(VolumeInfo srcVolume, DataStore destStore); + + boolean destroyVolume(long volumeId) throws ConcurrentOperationException; + + AsyncCallFuture registerVolume(VolumeInfo volume, DataStore store); + + AsyncCallFuture resize(VolumeInfo volume); + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.java new file mode 100644 index 00000000000..ac277af36de --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ZoneScope.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 org.apache.cloudstack.engine.subsystem.api.storage; + + +public class ZoneScope implements Scope { + private ScopeType type = ScopeType.ZONE; + private Long zoneId; + + public ZoneScope(Long zoneId) { + this.zoneId = zoneId; + } + + @Override + public ScopeType getScopeType() { + return this.type; + } + + @Override + public Long getScopeId() { + return this.zoneId; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/DiskFormat.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/DiskFormat.java new file mode 100644 index 00000000000..e059fa90320 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/DiskFormat.java @@ -0,0 +1,38 @@ +// 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.engine.subsystem.api.storage.disktype; + +import com.cloud.utils.exception.CloudRuntimeException; + +public enum DiskFormat { + VMDK, + VHD, + ISO, + QCOW2; + public static DiskFormat getFormat(String format) { + if (VMDK.toString().equalsIgnoreCase(format)) { + return VMDK; + } else if (VHD.toString().equalsIgnoreCase(format)) { + return VHD; + } else if (QCOW2.toString().equalsIgnoreCase(format)) { + return QCOW2; + } else if (ISO.toString().equalsIgnoreCase(format)) { + return ISO; + } + throw new CloudRuntimeException("can't find format match: " + format); + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/QCOW2.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/Unknown.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VHD.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VMDK.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskType.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeBase.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/disktype/VolumeDiskTypeHelper.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/BaseImage.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/BaseImage.java new file mode 100644 index 00000000000..9991cedfa27 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/BaseImage.java @@ -0,0 +1,23 @@ +// 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.engine.subsystem.api.storage.type; + +public class BaseImage extends VolumeTypeBase { + public BaseImage() { + this.type = "BaseImage"; + } +} diff --git a/server/src/com/cloud/baremetal/HttpCallException.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/DataDisk.java similarity index 72% rename from server/src/com/cloud/baremetal/HttpCallException.java rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/DataDisk.java index d21a37cbb74..762233e940f 100644 --- a/server/src/com/cloud/baremetal/HttpCallException.java +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/DataDisk.java @@ -14,15 +14,13 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.baremetal; +package org.apache.cloudstack.engine.subsystem.api.storage.type; -import com.cloud.utils.SerialVersionUID; +import org.springframework.stereotype.Component; -import com.cloud.exception.CloudException; - -public class HttpCallException extends CloudException { - private static final long serialVersionUID= SerialVersionUID.HttpCallException; - public HttpCallException(String msg) { - super(msg); +@Component +public class DataDisk extends VolumeTypeBase { + public DataDisk() { + this.type = "DataDisk"; } } diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Iso.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Iso.java new file mode 100644 index 00000000000..43611b461b1 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Iso.java @@ -0,0 +1,26 @@ +// 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.engine.subsystem.api.storage.type; + +import org.springframework.stereotype.Component; + +@Component +public class Iso extends VolumeTypeBase { + public Iso() { + this.type = "iso"; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/RootDisk.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/RootDisk.java new file mode 100644 index 00000000000..723d59c66cf --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/RootDisk.java @@ -0,0 +1,26 @@ +// 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.engine.subsystem.api.storage.type; + +import org.springframework.stereotype.Component; + +@Component +public class RootDisk extends VolumeTypeBase { + public RootDisk() { + this.type = "Root"; + } +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Unknown.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Unknown.java new file mode 100644 index 00000000000..6f8904a5af2 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/Unknown.java @@ -0,0 +1,24 @@ +// 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.engine.subsystem.api.storage.type; + +public class Unknown extends VolumeTypeBase { + public Unknown() { + this.type = "Unknown"; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeType.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeType.java new file mode 100644 index 00000000000..fcc1c4b3898 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeType.java @@ -0,0 +1,22 @@ +/* + * 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.engine.subsystem.api.storage.type; + +public interface VolumeType { +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.java new file mode 100644 index 00000000000..6ffd9d7c9c8 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeBase.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 org.apache.cloudstack.engine.subsystem.api.storage.type; + +public class VolumeTypeBase implements VolumeType { + protected String type = "Unknown"; + + @Override + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that instanceof String) { + if (this.toString().equalsIgnoreCase((String)that)) { + return true; + } + } else if (that instanceof VolumeTypeBase) { + VolumeTypeBase th = (VolumeTypeBase)that; + if (this.toString().equalsIgnoreCase(th.toString())) { + return true; + } + } else { + return false; + } + return false; + } + + @Override + public String toString() { + return type; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.java new file mode 100644 index 00000000000..f29dd08721f --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/type/VolumeTypeHelper.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.engine.subsystem.api.storage.type; + +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Component; + +@Component +public class VolumeTypeHelper { + static private List types; + private static VolumeType defaultType = new Unknown(); + + @Inject + public void setTypes(List types) { + VolumeTypeHelper.types = types; + } + + public static VolumeType getType(String type) { + for (VolumeType ty : types) { + if (ty.equals(type)) { + return ty; + } + } + return VolumeTypeHelper.defaultType; + } + +} diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java new file mode 100644 index 00000000000..dca83ce0b8a --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.datastore.db; + +import com.cloud.utils.db.GenericDao; + +public interface DataStoreProviderDao extends GenericDao { + public DataStoreProviderVO findByName(String name); +} diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java new file mode 100644 index 00000000000..ccb6b483253 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java @@ -0,0 +1,38 @@ +/* + * 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.storage.datastore.db; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.SearchCriteria.Op; + +@Component +class DataStoreProviderDaoImpl extends GenericDaoBase implements DataStoreProviderDao { + + @Override + public DataStoreProviderVO findByName(String name) { + SearchCriteriaService sc = SearchCriteria2.create(DataStoreProviderVO.class); + sc.addAnd(sc.getEntity().getName(), Op.EQ, name); + return sc.find(); + } + +} \ No newline at end of file diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java new file mode 100644 index 00000000000..dcdafddb175 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java @@ -0,0 +1,60 @@ +/* + * 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.storage.datastore.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +@Entity +@Table(name = "data_store_provider") +public class DataStoreProviderVO { + @Id + @TableGenerator(name = "data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "data_store_provider_seq", allocationSize = 1) + @Column(name = "id", updatable = false, nullable = false) + private long id; + + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "uuid", nullable = false) + private String uuid; + + public long getId() { + return id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getUuid() { + return this.uuid; + } +} diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java new file mode 100644 index 00000000000..1530ced30fd --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.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.storage.datastore.db; + +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus; + +import com.cloud.utils.db.GenericDao; + +public interface PrimaryDataStoreDao extends GenericDao { + + /** + * @param datacenterId + * -- the id of the datacenter (availability zone) + */ + List listByDataCenterId(long datacenterId); + + /** + * @param datacenterId + * -- the id of the datacenter (availability zone) + */ + List listBy(long datacenterId, long podId, Long clusterId); + + /** + * Set capacity of storage pool in bytes + * + * @param id + * pool id. + * @param capacity + * capacity in bytes + */ + void updateCapacity(long id, long capacity); + + /** + * Set available bytes of storage pool in bytes + * + * @param id + * pool id. + * @param available + * available capacity in bytes + */ + void updateAvailable(long id, long available); + + StoragePoolVO persist(StoragePoolVO pool, Map details); + + /** + * Find pool by name. + * + * @param name + * name of pool. + * @return the single StoragePoolVO + */ + List findPoolByName(String name); + + /** + * Find pools by the pod that matches the details. + * + * @param podId + * pod id to find the pools in. + * @param details + * details to match. All must match for the pool to be returned. + * @return List of StoragePoolVO + */ + List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details); + + List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared); + + /** + * Find pool by UUID. + * + * @param uuid + * uuid of pool. + * @return the single StoragePoolVO + */ + StoragePoolVO findPoolByUUID(String uuid); + + List listByStorageHost(String hostFqdnOrIp); + + StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid); + + List listPoolByHostPath(String host, String path); + + void updateDetails(long poolId, Map details); + + Map getDetails(long poolId); + + List searchForStoragePoolDetails(long poolId, String value); + + List findIfDuplicatePoolsExistByUUID(String uuid); + + List listByStatus(DataStoreStatus status); + + long countPoolsByStatus(DataStoreStatus... statuses); + + List listByStatusInZone(long dcId, DataStoreStatus status); + + List listPoolsByCluster(long clusterId); +} \ No newline at end of file diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java new file mode 100644 index 00000000000..023b42bda9d --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java @@ -0,0 +1,360 @@ +/* + * 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.storage.datastore.db; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus; +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Func; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class PrimaryDataStoreDaoImpl extends GenericDaoBase implements PrimaryDataStoreDao { + protected final SearchBuilder AllFieldSearch; + protected final SearchBuilder DcPodSearch; + protected final SearchBuilder DcPodAnyClusterSearch; + protected final SearchBuilder DeleteLvmSearch; + protected final GenericSearchBuilder StatusCountSearch; + + @Inject protected PrimaryDataStoreDetailsDao _detailsDao; + + private final String DetailsSqlPrefix = "SELECT storage_pool.* from storage_pool LEFT JOIN storage_pool_details ON storage_pool.id = storage_pool_details.pool_id WHERE storage_pool.removed is null and storage_pool.data_center_id = ? and (storage_pool.pod_id = ? or storage_pool.pod_id is null) and ("; + private final String DetailsSqlSuffix = ") GROUP BY storage_pool_details.pool_id HAVING COUNT(storage_pool_details.name) >= ?"; + private final String FindPoolTagDetails = "SELECT storage_pool_details.name FROM storage_pool_details WHERE pool_id = ? and value = ?"; + + public PrimaryDataStoreDaoImpl() { + AllFieldSearch = createSearchBuilder(); + AllFieldSearch.and("name", AllFieldSearch.entity().getName(), SearchCriteria.Op.EQ); + AllFieldSearch.and("uuid", AllFieldSearch.entity().getUuid(), SearchCriteria.Op.EQ); + AllFieldSearch.and("datacenterId", AllFieldSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + AllFieldSearch.and("hostAddress", AllFieldSearch.entity().getHostAddress(), SearchCriteria.Op.EQ); + AllFieldSearch.and("status", AllFieldSearch.entity().getStatus(), SearchCriteria.Op.EQ); + AllFieldSearch.and("path", AllFieldSearch.entity().getPath(), SearchCriteria.Op.EQ); + AllFieldSearch.and("podId", AllFieldSearch.entity().getPodId(), Op.EQ); + AllFieldSearch.and("clusterId", AllFieldSearch.entity().getClusterId(), Op.EQ); + AllFieldSearch.done(); + + DcPodSearch = createSearchBuilder(); + DcPodSearch.and("datacenterId", DcPodSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DcPodSearch.and().op("nullpod", DcPodSearch.entity().getPodId(), SearchCriteria.Op.NULL); + DcPodSearch.or("podId", DcPodSearch.entity().getPodId(), SearchCriteria.Op.EQ); + DcPodSearch.cp(); + DcPodSearch.and().op("nullcluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.NULL); + DcPodSearch.or("cluster", DcPodSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + DcPodSearch.cp(); + DcPodSearch.done(); + + DcPodAnyClusterSearch = createSearchBuilder(); + DcPodAnyClusterSearch.and("datacenterId", DcPodAnyClusterSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DcPodAnyClusterSearch.and().op("nullpod", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.NULL); + DcPodAnyClusterSearch.or("podId", DcPodAnyClusterSearch.entity().getPodId(), SearchCriteria.Op.EQ); + DcPodAnyClusterSearch.cp(); + DcPodAnyClusterSearch.done(); + + DeleteLvmSearch = createSearchBuilder(); + DeleteLvmSearch.and("ids", DeleteLvmSearch.entity().getId(), SearchCriteria.Op.IN); + DeleteLvmSearch.and().op("LVM", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ); + DeleteLvmSearch.or("Filesystem", DeleteLvmSearch.entity().getPoolType(), SearchCriteria.Op.EQ); + DeleteLvmSearch.cp(); + DeleteLvmSearch.done(); + + StatusCountSearch = createSearchBuilder(Long.class); + StatusCountSearch.and("status", StatusCountSearch.entity().getStatus(), SearchCriteria.Op.IN); + StatusCountSearch.select(null, Func.COUNT, null); + StatusCountSearch.done(); + } + + @Override + public List findPoolByName(String name) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("name", name); + return listIncludingRemovedBy(sc); + } + + @Override + public StoragePoolVO findPoolByUUID(String uuid) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("uuid", uuid); + return findOneIncludingRemovedBy(sc); + } + + @Override + public List findIfDuplicatePoolsExistByUUID(String uuid) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("uuid", uuid); + return listBy(sc); + } + + @Override + public List listByDataCenterId(long datacenterId) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("datacenterId", datacenterId); + return listBy(sc); + } + + @Override + public void updateAvailable(long id, long available) { + StoragePoolVO pool = createForUpdate(id); + pool.setAvailableBytes(available); + update(id, pool); + } + + @Override + public void updateCapacity(long id, long capacity) { + StoragePoolVO pool = createForUpdate(id); + pool.setCapacityBytes(capacity); + update(id, pool); + + } + + @Override + public List listByStorageHost(String hostFqdnOrIp) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("hostAddress", hostFqdnOrIp); + return listIncludingRemovedBy(sc); + } + + @Override + public List listByStatus(DataStoreStatus status) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("status", status); + return listBy(sc); + } + + @Override + public List listByStatusInZone(long dcId, DataStoreStatus status) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("status", status); + sc.setParameters("datacenterId", dcId); + return listBy(sc); + } + + @Override + public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("hostAddress", host); + sc.setParameters("path", path); + sc.setParameters("datacenterId", datacenterId); + sc.setParameters("podId", podId); + sc.setParameters("uuid", uuid); + + return findOneBy(sc); + } + + @Override + public List listBy(long datacenterId, long podId, Long clusterId) { + if (clusterId != null) { + SearchCriteria sc = DcPodSearch.create(); + sc.setParameters("datacenterId", datacenterId); + sc.setParameters("podId", podId); + + sc.setParameters("cluster", clusterId); + return listBy(sc); + } else { + SearchCriteria sc = DcPodAnyClusterSearch.create(); + sc.setParameters("datacenterId", datacenterId); + sc.setParameters("podId", podId); + return listBy(sc); + } + } + + @Override + public List listPoolByHostPath(String host, String path) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("hostAddress", host); + sc.setParameters("path", path); + + return listBy(sc); + } + + public StoragePoolVO listById(Integer id) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("id", id); + + return findOneIncludingRemovedBy(sc); + } + + @Override + @DB + public StoragePoolVO persist(StoragePoolVO pool, Map details) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + pool = super.persist(pool); + if (details != null) { + for (Map.Entry detail : details.entrySet()) { + PrimaryDataStoreDetailVO vo = new PrimaryDataStoreDetailVO(pool.getId(), detail.getKey(), detail.getValue()); + _detailsDao.persist(vo); + } + } + txn.commit(); + return pool; + } + + @DB + @Override + public List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details) { + StringBuilder sql = new StringBuilder(DetailsSqlPrefix); + if (clusterId != null) { + sql.append("storage_pool.cluster_id = ? OR storage_pool.cluster_id IS NULL) AND ("); + } + for (Map.Entry detail : details.entrySet()) { + sql.append("((storage_pool_details.name='").append(detail.getKey()).append("') AND (storage_pool_details.value='").append(detail.getValue()).append("')) OR "); + } + sql.delete(sql.length() - 4, sql.length()); + sql.append(DetailsSqlSuffix); + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + try { + pstmt = txn.prepareAutoCloseStatement(sql.toString()); + int i = 1; + pstmt.setLong(i++, dcId); + pstmt.setLong(i++, podId); + if (clusterId != null) { + pstmt.setLong(i++, clusterId); + } + pstmt.setInt(i++, details.size()); + ResultSet rs = pstmt.executeQuery(); + List pools = new ArrayList(); + while (rs.next()) { + pools.add(toEntityBean(rs, false)); + } + return pools; + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to execute " + pstmt, e); + } + } + + protected Map tagsToDetails(String[] tags) { + Map details = new HashMap(tags.length); + for (String tag : tags) { + details.put(tag, "true"); + } + return details; + } + + @Override + public List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) { + List storagePools = null; + if (tags == null || tags.length == 0) { + storagePools = listBy(dcId, podId, clusterId); + } else { + Map details = tagsToDetails(tags); + storagePools = findPoolsByDetails(dcId, podId, clusterId, details); + } + + if (shared == null) { + return storagePools; + } else { + List filteredStoragePools = new ArrayList(storagePools); + for (StoragePoolVO pool : storagePools) { + /* + * if (shared != pool.isShared()) { + * filteredStoragePools.remove(pool); } + */ + } + + return filteredStoragePools; + } + } + + @Override + @DB + public List searchForStoragePoolDetails(long poolId, String value) { + + StringBuilder sql = new StringBuilder(FindPoolTagDetails); + + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + try { + pstmt = txn.prepareAutoCloseStatement(sql.toString()); + pstmt.setLong(1, poolId); + pstmt.setString(2, value); + + ResultSet rs = pstmt.executeQuery(); + List tags = new ArrayList(); + + while (rs.next()) { + tags.add(rs.getString("name")); + } + return tags; + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to execute " + pstmt.toString(), e); + } + + } + + @Override + public void updateDetails(long poolId, Map details) { + if (details != null) { + _detailsDao.update(poolId, details); + } + } + + @Override + public Map getDetails(long poolId) { + return _detailsDao.getDetails(poolId); + } + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + super.configure(name, params); + _detailsDao.configure("DetailsDao", params); + return true; + } + + @Override + public long countPoolsByStatus(DataStoreStatus... statuses) { + SearchCriteria sc = StatusCountSearch.create(); + + sc.setParameters("status", (Object[]) statuses); + + List rs = customSearchIncludingRemoved(sc, null); + if (rs.size() == 0) { + return 0; + } + + return rs.get(0); + } + + @Override + public List listPoolsByCluster(long clusterId) { + SearchCriteria sc = AllFieldSearch.create(); + sc.setParameters("clusterId", clusterId); + + return listBy(sc); + } +} diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java new file mode 100644 index 00000000000..d1f802de949 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.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.storage.datastore.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="storage_pool_details") +public class PrimaryDataStoreDetailVO { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + long id; + + @Column(name="pool_id") + long poolId; + + @Column(name="name") + String name; + + @Column(name="value") + String value; + + public PrimaryDataStoreDetailVO(long poolId, String name, String value) { + this.poolId = poolId; + this.name = name; + this.value = value; + } + + public long getId() { + return id; + } + + public long getPoolId() { + return poolId; + } + + public void setPoolId(long poolId) { + this.poolId = poolId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + protected PrimaryDataStoreDetailVO() { + } +} diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java new file mode 100644 index 00000000000..c2b109a959e --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.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 org.apache.cloudstack.storage.datastore.db; + +import java.util.Map; + +import com.cloud.utils.db.GenericDao; + +public interface PrimaryDataStoreDetailsDao extends GenericDao { + + void update(long poolId, Map details); + Map getDetails(long poolId); +} \ No newline at end of file diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java new file mode 100644 index 00000000000..59c488cf6d4 --- /dev/null +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.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.storage.datastore.db; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component +public class PrimaryDataStoreDetailsDaoImpl extends GenericDaoBase implements PrimaryDataStoreDetailsDao { + + protected final SearchBuilder PoolSearch = null; + + protected PrimaryDataStoreDetailsDaoImpl() { + /* + super(); + PoolSearch = createSearchBuilder(); + PoolSearch.and("pool", PoolSearch.entity().getPoolId(), SearchCriteria.Op.EQ); + PoolSearch.done(); + */ + } + + @Override + public void update(long poolId, Map details) { + Transaction txn = Transaction.currentTxn(); + SearchCriteria sc = PoolSearch.create(); + sc.setParameters("pool", poolId); + + txn.start(); + expunge(sc); + for (Map.Entry entry : details.entrySet()) { + PrimaryDataStoreDetailVO detail = new PrimaryDataStoreDetailVO(poolId, entry.getKey(), entry.getValue()); + persist(detail); + } + txn.commit(); + } + + @Override + public Map getDetails(long poolId) { + SearchCriteria sc = PoolSearch.create(); + sc.setParameters("pool", poolId); + + List details = listBy(sc); + Map detailsMap = new HashMap(); + for (PrimaryDataStoreDetailVO detail : details) { + detailsMap.put(detail.getName(), detail.getValue()); + } + + return detailsMap; + } +} diff --git a/core/src/com/cloud/storage/StoragePoolVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java similarity index 52% rename from core/src/com/cloud/storage/StoragePoolVO.java rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java index cb5209f3e63..1782f16a4c1 100644 --- a/core/src/com/cloud/storage/StoragePoolVO.java +++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.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.storage; +package org.apache.cloudstack.storage.datastore.db; import java.util.Date; import java.util.UUID; @@ -28,161 +28,89 @@ import javax.persistence.Table; import javax.persistence.TableGenerator; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import javax.persistence.Transient; -import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; + import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolStatus; import com.cloud.utils.db.GenericDao; -import org.apache.cloudstack.api.InternalIdentity; @Entity @Table(name="storage_pool") -public class StoragePoolVO implements StoragePool { +public class StoragePoolVO { @Id - @TableGenerator(name="storage_pool_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="storage_pool_seq", allocationSize=1) - @Column(name="id", updatable=false, nullable = false) - private long id; - - @Column(name="name", updatable=false, nullable=false, length=255) - private String name = null; + @TableGenerator(name = "storage_pool_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "storage_pool_seq", allocationSize = 1) + @Column(name = "id", updatable = false, nullable = false) + private long id; - @Column(name="uuid", length=255) - private String uuid = null; - - @Column(name="pool_type", updatable=false, nullable=false, length=32) - @Enumerated(value=EnumType.STRING) + @Column(name = "name", updatable = false, nullable = false, length = 255) + private String name = null; + + @Column(name = "uuid", length = 255) + private String uuid = null; + + @Column(name = "pool_type", updatable = false, nullable = false, length = 32) + @Enumerated(value = EnumType.STRING) private StoragePoolType poolType; - - @Column(name=GenericDao.CREATED_COLUMN) + + @Column(name = GenericDao.CREATED_COLUMN) Date created; - - @Column(name=GenericDao.REMOVED_COLUMN) + + @Column(name = GenericDao.REMOVED_COLUMN) private Date removed; - - @Column(name="update_time", updatable=true) - @Temporal(value=TemporalType.TIMESTAMP) + + @Column(name = "update_time", updatable = true) + @Temporal(value = TemporalType.TIMESTAMP) private Date updateTime; - - @Column(name="data_center_id", updatable=true, nullable=false) + + @Column(name = "data_center_id", updatable = true, nullable = false) private long dataCenterId; - - @Column(name="pod_id", updatable=true) + + @Column(name = "pod_id", updatable = true) private Long podId; - - @Column(name="available_bytes", updatable=true, nullable=true) + + @Column(name = "available_bytes", updatable = true, nullable = true) private long availableBytes; - - @Column(name="capacity_bytes", updatable=true, nullable=true) + + @Column(name = "capacity_bytes", updatable = true, nullable = true) private long capacityBytes; - @Column(name="status", updatable=true, nullable=false) - @Enumerated(value=EnumType.STRING) + @Column(name = "status", updatable = true, nullable = false) + @Enumerated(value = EnumType.STRING) private StoragePoolStatus status; - - @Override - public long getId() { - return id; - } - - @Override - public StoragePoolStatus getStatus() { - return status; - } - public StoragePoolVO() { - // TODO Auto-generated constructor stub - } + @Column(name = "storage_provider_id", updatable = true, nullable = false) + private Long storageProviderId; - @Override - public String getName() { - return name; - } - - @Override - public String getUuid() { - return uuid; - } - - @Override - public StoragePoolType getPoolType() { - return poolType; - } - - @Override - public Date getCreated() { - return created; - } - - public Date getRemoved() { - return removed; - } - - @Override - public Date getUpdateTime() { - return updateTime; - } - - @Override - public long getDataCenterId() { - return dataCenterId; - } - - @Override - public long getAvailableBytes() { - return availableBytes; - } - - @Override - public long getCapacityBytes() { - return capacityBytes; - } - - public void setAvailableBytes(long available) { - availableBytes = available; - } - - public void setCapacityBytes(long capacity) { - capacityBytes = capacity; - } - - @Column(name="host_address") + @Column(name = "host_address") private String hostAddress; - - @Column(name="path") + + @Column(name = "path") private String path; - - @Column(name="port") + + @Column(name = "port") private int port; - @Column(name="user_info") + @Column(name = "user_info") private String userInfo; - @Column(name="cluster_id") + @Column(name = "cluster_id") private Long clusterId; - - - @Override - public Long getClusterId() { - return clusterId; - } - - public void setClusterId(Long clusterId) { - this.clusterId = clusterId; - } - - @Override - public String getHostAddress() { - return hostAddress; - } - - @Override - public String getPath() { - return path; + + @Column(name = "scope") + @Enumerated(value = EnumType.STRING) + private ScopeType scope; + + public long getId() { + return id; } - @Override - public String getUserInfo() { - return userInfo; + public StoragePoolStatus getStatus() { + return status; + } + + public StoragePoolVO() { + this.status = StoragePoolStatus.Initial; } public StoragePoolVO(long poolId, String name, String uuid, StoragePoolType type, @@ -198,124 +126,179 @@ public class StoragePoolVO implements StoragePool { this.path = hostPath; this.port = port; this.podId = podId; - this.setStatus(StoragePoolStatus.Up); + this.setStatus(StoragePoolStatus.Initial); } - + public StoragePoolVO(StoragePoolVO that) { this(that.id, that.name, that.uuid, that.poolType, that.dataCenterId, that.podId, that.availableBytes, that.capacityBytes, that.hostAddress, that.port, that.path); } - + public StoragePoolVO(StoragePoolType type, String hostAddress, int port, String path) { this.poolType = type; this.hostAddress = hostAddress; this.port = port; this.path = path; - this.setStatus(StoragePoolStatus.Up); + this.setStatus(StoragePoolStatus.Initial); this.uuid = UUID.randomUUID().toString(); } - public StoragePoolVO(StoragePoolType type, String hostAddress, int port, String path, String userInfo) { - this.poolType = type; - this.hostAddress = hostAddress; - this.port = port; - this.path = path; - this.userInfo = userInfo; - this.setStatus(StoragePoolStatus.Up); - this.uuid = UUID.randomUUID().toString(); + + public String getName() { + return name; } - - public void setStatus(StoragePoolStatus status) - { - this.status = status; + + public String getUuid() { + return uuid; } - + + public StoragePoolType getPoolType() { + return poolType; + } + + public void setPoolType(StoragePoolType protocol) { + this.poolType = protocol; + } + + public Date getCreated() { + return created; + } + + public Date getRemoved() { + return removed; + } + + public Date getUpdateTime() { + return updateTime; + } + + public long getDataCenterId() { + return dataCenterId; + } + + public long getAvailableBytes() { + return availableBytes; + } + + public Long getStorageProviderId() { + return storageProviderId; + } + + public void setStorageProviderId(Long provider) { + storageProviderId = provider; + } + + public long getCapacityBytes() { + return capacityBytes; + } + + public void setAvailableBytes(long available) { + availableBytes = available; + } + + public void setCapacityBytes(long capacity) { + capacityBytes = capacity; + } + + public Long getClusterId() { + return clusterId; + } + + public void setClusterId(Long clusterId) { + this.clusterId = clusterId; + } + + public String getHostAddress() { + return hostAddress; + } + + public void setHostAddress(String host) { + this.hostAddress = host; + } + + public String getPath() { + return path; + } + + public String getUserInfo() { + return userInfo; + } + + public void setStatus(StoragePoolStatus status) { + this.status = status; + } + public void setId(long id) { this.id = id; } - + public void setDataCenterId(long dcId) { this.dataCenterId = dcId; } - + public void setPodId(Long podId) { this.podId = podId; } - + public void setUuid(String uuid) { this.uuid = uuid; } - + public void setPath(String path) { - this.path = path; + this.path = path; } public void setUserInfo(String userInfo) { this.userInfo = userInfo; } - - @Override + public int getPort() { return port; } - - @Override - public boolean isShared() { - return poolType.isShared(); - } - - @Override - public boolean isLocal() { - return !poolType.isShared(); - } - - @Transient - public String toUri() { - /* - URI uri = new URI(); - try { - if (type == StoragePoolType.Filesystem) { - uri.setScheme("file"); - } else if (type == StoragePoolType.NetworkFilesystem) { - uri.setScheme("nfs"); - } else if (type == StoragePoolType.IscsiLUN) { - } - } catch (MalformedURIException e) { - throw new VmopsRuntimeException("Unable to form the uri " + id); - } - return uri.toString(); - */ - return null; + + public void setPort(int port) { + this.port = port; } - @Override public Long getPodId() { - return podId; - } - - public void setName(String name) { - this.name = name; - } - - public boolean isInMaintenance() { - return status == StoragePoolStatus.PrepareForMaintenance || status == StoragePoolStatus.Maintenance || status == StoragePoolStatus.ErrorInMaintenance || removed != null; - } - - @Override + return podId; + } + + public void setName(String name) { + this.name = name; + } + + public void setScope(ScopeType scope) { + this.scope = scope; + } + + public ScopeType getScope() { + return this.scope; + } + + @Override public boolean equals(Object obj) { - if (!(obj instanceof StoragePoolVO) || obj == null) { - return false; - } - StoragePoolVO that = (StoragePoolVO)obj; - return this.id == that.id; - } - - @Override - public int hashCode() { - return new Long(id).hashCode(); - } - + if (!(obj instanceof StoragePoolVO) || obj == null) { + return false; + } + StoragePoolVO that = (StoragePoolVO) obj; + return this.id == that.id; + } + + @Override + public int hashCode() { + return new Long(id).hashCode(); + } + @Override public String toString() { return new StringBuilder("Pool[").append(id).append("|").append(poolType).append("]").toString(); } + + public boolean isShared() { + return this.scope == ScopeType.HOST ? false : true; + } + + public boolean isLocal() { + return !isShared(); + } } diff --git a/engine/components-api/pom.xml b/engine/components-api/pom.xml new file mode 100644 index 00000000000..6d6ad4d14b9 --- /dev/null +++ b/engine/components-api/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + cloud-engine-components-api + Apache CloudStack Cloud Engine Internal Components API + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + + install + src + test + + diff --git a/engine/components-api/src/org/apache/cloudstack/compute/ComputeGuru.java b/engine/components-api/src/org/apache/cloudstack/compute/ComputeGuru.java new file mode 100644 index 00000000000..5dbe0c6f931 --- /dev/null +++ b/engine/components-api/src/org/apache/cloudstack/compute/ComputeGuru.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 org.apache.cloudstack.compute; + +import com.cloud.vm.VirtualMachineProfile; + +/** + * ComputeGuru understands everything about the hypervisor. + * + */ +public interface ComputeGuru { + String getVersion(); + String getHypervisor(); + void start(VirtualMachineProfile vm); + void stop(VirtualMachineProfile vm); + + +} diff --git a/engine/compute/pom.xml b/engine/compute/pom.xml new file mode 100644 index 00000000000..0875bb63f39 --- /dev/null +++ b/engine/compute/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + cloud-engine-compute + Apache CloudStack Cloud Engine Compute Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + + install + src + test + + diff --git a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.java new file mode 100755 index 00000000000..37d0e6bdb86 --- /dev/null +++ b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestrator.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 org.apache.cloudstack.compute; + +import java.util.logging.Handler; + +public interface ComputeOrchestrator { + /** + * start the vm + * @param vm vm + * @param reservationId + */ + void start(String vm, String reservationId, Handler handler); + + void cancel(String reservationId); + + void stop(String vm, String reservationId); +} diff --git a/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.java new file mode 100755 index 00000000000..12d45332f9b --- /dev/null +++ b/engine/compute/src/org/apache/cloudstack/compute/ComputeOrchestratorImpl.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 org.apache.cloudstack.compute; + +import java.util.logging.Handler; + + +public class ComputeOrchestratorImpl implements ComputeOrchestrator { + + @Override + public void cancel(String reservationId) { + } + + @Override + public void stop(String vm, String reservationId) { + // Retrieve the VM + // Locate the HypervisorGuru based on the VM type + // Call HypervisorGuru to stop the VM + } + + @Override + public void start(String vm, String reservationId, Handler handler) { + // TODO Auto-generated method stub + + } +} diff --git a/engine/network/pom.xml b/engine/network/pom.xml new file mode 100644 index 00000000000..60cb7e950ec --- /dev/null +++ b/engine/network/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + cloud-engine-network + Apache CloudStack Cloud Engine API + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + + install + src + test + + diff --git a/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java b/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.java new file mode 100755 index 00000000000..82756ac8391 --- /dev/null +++ b/engine/network/src/org/apache/cloudstack/network/NetworkOrchestrator.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 org.apache.cloudstack.network; + +public interface NetworkOrchestrator { + + /** + * Prepares for a VM to join a network + * @param vm vm + * @param reservationId reservation id + */ + void prepare(String vm, String reservationId); + + /** + * Release all reservation + */ + void release(String vm, String reservationId); + + /** + * Cancel a previous reservation + * @param reservationId + */ + void cancel(String reservationId); +} diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml new file mode 100755 index 00000000000..c98373aa353 --- /dev/null +++ b/engine/orchestration/pom.xml @@ -0,0 +1,88 @@ + + + 4.0.0 + cloud-engine-orchestration + Apache CloudStack Cloud Engine Orchestration Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-server + ${project.version} + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + test + + + maven-surefire-plugin + + true + + + + integration-test + + test + + + + + + + diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.java new file mode 100644 index 00000000000..8e58e73739a --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManager.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 org.apache.cloudstack.engine.cloud.entity.api; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; + +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.exception.ResourceUnavailableException; + +public interface VMEntityManager { + + VMEntityVO loadVirtualMachine(String vmId); + + void saveVirtualMachine(VMEntityVO vmInstanceVO); + + String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan plan, ExcludeList exclude) throws InsufficientCapacityException, ResourceUnavailableException; + + void deployVirtualMachine(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException; + + boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException; + + boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException; +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java new file mode 100755 index 00000000000..552aba43cca --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VMEntityManagerImpl.java @@ -0,0 +1,232 @@ +// 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.engine.cloud.entity.api; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMEntityDao; +import org.apache.cloudstack.engine.cloud.entity.api.db.dao.VMReservationDao; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.springframework.stereotype.Component; + +import com.cloud.dc.DataCenter; +import com.cloud.deploy.DataCenterDeployment; +import com.cloud.deploy.DeployDestination; +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InsufficientServerCapacityException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.dao.NetworkDao; +import com.cloud.org.Cluster; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.storage.StoragePool; +import com.cloud.storage.Volume; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.DiskOfferingDao; +import com.cloud.storage.dao.StoragePoolDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.user.dao.AccountDao; +import com.cloud.user.dao.UserDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.VirtualMachineProfileImpl; +import com.cloud.vm.dao.VMInstanceDao; + +@Component +public class VMEntityManagerImpl implements VMEntityManager { + + @Inject + protected VMInstanceDao _vmDao; + @Inject + protected VMTemplateDao _templateDao = null; + + @Inject + protected ServiceOfferingDao _serviceOfferingDao; + + @Inject + protected DiskOfferingDao _diskOfferingDao = null; + + @Inject + protected NetworkDao _networkDao; + + @Inject + protected AccountDao _accountDao = null; + + @Inject + protected UserDao _userDao = null; + + @Inject + protected VMEntityDao _vmEntityDao; + + @Inject + protected VMReservationDao _reservationDao; + + @Inject + protected VirtualMachineManager _itMgr; + + @Inject + protected List _planners; + + @Inject + protected VolumeDao _volsDao; + + @Inject + protected StoragePoolDao _storagePoolDao; + @Inject + DataStoreManager dataStoreMgr; + + @Override + public VMEntityVO loadVirtualMachine(String vmId) { + // TODO Auto-generated method stub + return _vmEntityDao.findByUuid(vmId); + } + + @Override + public void saveVirtualMachine(VMEntityVO entity) { + _vmEntityDao.persist(entity); + + } + + @Override + public String reserveVirtualMachine(VMEntityVO vmEntityVO, String plannerToUse, DeploymentPlan planToDeploy, ExcludeList exclude) + throws InsufficientCapacityException, ResourceUnavailableException { + + //call planner and get the deployDestination. + //load vm instance and offerings and call virtualMachineManagerImpl + //FIXME: profile should work on VirtualMachineEntity + VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid()); + VirtualMachineProfileImpl vmProfile = new VirtualMachineProfileImpl(vm); + DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vm.getPodIdToDeployIn(), null, null, null, null); + if(planToDeploy != null && planToDeploy.getDataCenterId() != 0){ + plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), planToDeploy.getPoolId(), planToDeploy.getPhysicalNetworkId()); + } + + List vols = _volsDao.findReadyRootVolumesByInstance(vm.getId()); + if(!vols.isEmpty()){ + VolumeVO vol = vols.get(0); + StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId()); + + if (!pool.isInMaintenance()) { + long rootVolDcId = pool.getDataCenterId(); + Long rootVolPodId = pool.getPodId(); + Long rootVolClusterId = pool.getClusterId(); + if (planToDeploy != null && planToDeploy.getDataCenterId() != 0) { + Long clusterIdSpecified = planToDeploy.getClusterId(); + if (clusterIdSpecified != null && rootVolClusterId != null) { + if (rootVolClusterId.longValue() != clusterIdSpecified.longValue()) { + // cannot satisfy the plan passed in to the + // planner + throw new ResourceUnavailableException("Root volume is ready in different cluster, Deployment plan provided cannot be satisfied, unable to create a deployment for " + + vm, Cluster.class, clusterIdSpecified); + } + } + plan = new DataCenterDeployment(planToDeploy.getDataCenterId(), planToDeploy.getPodId(), planToDeploy.getClusterId(), planToDeploy.getHostId(), vol.getPoolId(), null, null); + }else{ + plan = new DataCenterDeployment(rootVolDcId, rootVolPodId, rootVolClusterId, null, vol.getPoolId(), null, null); + + } + } + + } + + DeploymentPlanner planner = ComponentContext.getComponent(plannerToUse); + DeployDestination dest = null; + + if (planner.canHandle(vmProfile, plan, exclude)) { + dest = planner.plan(vmProfile, plan, exclude); + } + + if (dest != null) { + //save destination with VMEntityVO + VMReservationVO vmReservation = new VMReservationVO(vm.getId(), dest.getDataCenter().getId(), dest.getPod().getId(), dest.getCluster().getId(), dest.getHost().getId()); + Map volumeReservationMap = new HashMap(); + + if (vm.getHypervisorType() != HypervisorType.BareMetal) { + for(Volume vo : dest.getStorageForDisks().keySet()){ + volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId()); + } + vmReservation.setVolumeReservation(volumeReservationMap); + } + + vmEntityVO.setVmReservation(vmReservation); + _vmEntityDao.persist(vmEntityVO); + + return vmReservation.getUuid(); + }else{ + throw new InsufficientServerCapacityException("Unable to create a deployment for " + vmProfile, DataCenter.class, plan.getDataCenterId()); + } + + } + + @Override + public void deployVirtualMachine(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException{ + //grab the VM Id and destination using the reservationId. + + VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId); + long vmId = vmReservation.getVmId(); + + VMInstanceVO vm = _vmDao.findById(vmId); + //Pass it down + Long poolId = null; + Map storage = vmReservation.getVolumeReservation(); + if(storage != null){ + List volIdList = new ArrayList(storage.keySet()); + if(volIdList !=null && !volIdList.isEmpty()){ + poolId = storage.get(volIdList.get(0)); + } + } + + DataCenterDeployment plan = new DataCenterDeployment(vm.getDataCenterId(), vmReservation.getPodId(), vmReservation.getClusterId(), + vmReservation.getHostId(), poolId , null); + + VMInstanceVO vmDeployed = _itMgr.start(vm, null, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId()), plan); + + } + + @Override + public boolean stopvirtualmachine(VMEntityVO vmEntityVO, String caller) throws ResourceUnavailableException { + + VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid()); + return _itMgr.stop(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId())); + + } + + @Override + public boolean destroyVirtualMachine(VMEntityVO vmEntityVO, String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException{ + + VMInstanceVO vm = _vmDao.findByUuid(vmEntityVO.getUuid()); + return _itMgr.destroy(vm, _userDao.findById(new Long(caller)), _accountDao.findById(vm.getAccountId())); + + + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.java new file mode 100644 index 00000000000..2e8638eec07 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityFactory.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 org.apache.cloudstack.engine.cloud.entity.api; + +import org.springframework.beans.factory.FactoryBean; +import org.springframework.stereotype.Component; + +@Component +public class VirtualMachineEntityFactory implements FactoryBean{ + + @Override + public VirtualMachineEntityImpl getObject() throws Exception { + return new VirtualMachineEntityImpl(); + } + + @Override + public Class getObjectType() { + return VirtualMachineEntityImpl.class; + } + + @Override + public boolean isSingleton() { + return false; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java new file mode 100644 index 00000000000..13358d8548d --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/VirtualMachineEntityImpl.java @@ -0,0 +1,263 @@ +// 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.engine.cloud.entity.api; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; +import org.springframework.stereotype.Component; + +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.exception.ResourceUnavailableException; + +@Component +public class VirtualMachineEntityImpl implements VirtualMachineEntity { + + @Inject private VMEntityManager manager; + + private VMEntityVO vmEntityVO; + + public VirtualMachineEntityImpl() { + } + + public void init(String vmId) { + this.vmEntityVO = this.manager.loadVirtualMachine(vmId); + } + + public void init(String vmId, String owner, String hostName, String displayName, int cpu, int speed, long memory, List computeTags, List rootDiskTags, List networks) { + init(vmId); + this.vmEntityVO.setOwner(owner); + this.vmEntityVO.setHostname(hostName); + this.vmEntityVO.setDisplayname(displayName); + this.vmEntityVO.setSpeed(speed); + this.vmEntityVO.setComputeTags(computeTags); + this.vmEntityVO.setRootDiskTags(rootDiskTags); + this.vmEntityVO.setNetworkIds(networks); + + manager.saveVirtualMachine(vmEntityVO); + } + + public VirtualMachineEntityImpl(String vmId, VMEntityManager manager) { + this.manager = manager; + this.vmEntityVO = this.manager.loadVirtualMachine(vmId); + } + + public VirtualMachineEntityImpl(String vmId, String owner, String hostName, String displayName, int cpu, int speed, long memory, List computeTags, List rootDiskTags, List networks, VMEntityManager manager) { + this(vmId, manager); + this.vmEntityVO.setOwner(owner); + this.vmEntityVO.setHostname(hostName); + this.vmEntityVO.setDisplayname(displayName); + this.vmEntityVO.setSpeed(speed); + this.vmEntityVO.setComputeTags(computeTags); + this.vmEntityVO.setRootDiskTags(rootDiskTags); + this.vmEntityVO.setNetworkIds(networks); + + manager.saveVirtualMachine(vmEntityVO); + } + + @Override + public String getUuid() { + return vmEntityVO.getUuid(); + } + + @Override + public long getId() { + return vmEntityVO.getId(); + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + return vmEntityVO.getCreated(); + } + + @Override + public Date getLastUpdatedTime() { + return vmEntityVO.getUpdateTime(); + } + + @Override + public String getOwner() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getDetails() { + return vmEntityVO.getDetails(); + } + + @Override + public void addDetail(String name, String value) { + vmEntityVO.setDetail(name, value); + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listVolumeIds() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listVolumes() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listNicUuids() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listNics() { + // TODO Auto-generated method stub + return null; + } + + @Override + public TemplateEntity getTemplate() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listTags() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addTag() { + // TODO Auto-generated method stub + + } + + @Override + public void delTag() { + // TODO Auto-generated method stub + + } + + @Override + public String reserve(String plannerToUse, DeploymentPlan plan, + ExcludeList exclude, String caller) throws InsufficientCapacityException, ResourceUnavailableException { + return manager.reserveVirtualMachine(this.vmEntityVO, plannerToUse, plan, exclude); + } + + @Override + public void migrateTo(String reservationId, String caller) { + // TODO Auto-generated method stub + + } + + @Override + public void deploy(String reservationId, String caller) throws InsufficientCapacityException, ResourceUnavailableException{ + manager.deployVirtualMachine(reservationId, caller); + } + + @Override + public boolean stop(String caller) throws ResourceUnavailableException{ + return manager.stopvirtualmachine(this.vmEntityVO, caller); + } + + @Override + public void cleanup() { + // TODO Auto-generated method stub + + } + + @Override + public boolean destroy(String caller) throws AgentUnavailableException, OperationTimedoutException, ConcurrentOperationException { + return manager.destroyVirtualMachine(this.vmEntityVO, caller); + } + + @Override + public VirtualMachineEntity duplicate(String externalId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public SnapshotEntity takeSnapshotOf() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void attach(VolumeEntity volume, short deviceId) { + // TODO Auto-generated method stub + + } + + @Override + public void detach(VolumeEntity volume) { + // TODO Auto-generated method stub + + } + + @Override + public void connectTo(NetworkEntity network, short nicId) { + // TODO Auto-generated method stub + + } + + @Override + public void disconnectFrom(NetworkEntity netowrk, short nicId) { + // TODO Auto-generated method stub + + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.java new file mode 100644 index 00000000000..c367ee95483 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMComputeTagVO.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.engine.cloud.entity.api.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "vm_compute_tags") +public class VMComputeTagVO implements InternalIdentity{ + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vm_id") + private long vmId; + + @Column(name = "compute_tag") + private String computeTag; + + /** + * There should never be a public constructor for this class. Since it's + * only here to define the table for the DAO class. + */ + protected VMComputeTagVO() { + } + + public VMComputeTagVO(long vmId, String tag) { + this.vmId = vmId; + this.computeTag = tag; + } + + public long getId() { + return id; + } + + public long getVmId() { + return vmId; + } + + public String getComputeTag() { + return computeTag; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java new file mode 100644 index 00000000000..4fe6718e33a --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMEntityVO.java @@ -0,0 +1,577 @@ +// 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.engine.cloud.entity.api.db; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.DiscriminatorType; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.TableGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.db.Encrypt; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.StateMachine; +import com.cloud.utils.fsm.FiniteStateObject; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; + +@Entity +@Table(name="vm_instance") +@Inheritance(strategy=InheritanceType.JOINED) +@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) +public class VMEntityVO implements VirtualMachine, FiniteStateObject { + @Id + @TableGenerator(name="vm_instance_sq", table="sequence", pkColumnName="name", valueColumnName="value", pkColumnValue="vm_instance_seq", allocationSize=1) + @Column(name="id", updatable=false, nullable = false) + protected long id; + + @Column(name="name", updatable=false, nullable=false, length=255) + protected String hostName = null; + + @Encrypt + @Column(name="vnc_password", updatable=true, nullable=false, length=255) + protected String vncPassword; + + @Column(name="proxy_id", updatable=true, nullable=true) + protected Long proxyId; + + @Temporal(TemporalType.TIMESTAMP) + @Column(name="proxy_assign_time", updatable=true, nullable=true) + protected Date proxyAssignTime; + + /** + * Note that state is intentionally missing the setter. Any updates to + * the state machine needs to go through the DAO object because someone + * else could be updating it as well. + */ + @Enumerated(value=EnumType.STRING) + @StateMachine(state=State.class, event=Event.class) + @Column(name="state", updatable=true, nullable=false, length=32) + protected State state = null; + + @Column(name="private_ip_address", updatable=true) + protected String privateIpAddress; + + @Column(name="instance_name", updatable=true, nullable=false) + protected String instanceName; + + @Column(name="vm_template_id", updatable=true, nullable=true, length=17) + protected Long templateId = new Long(-1); + + @Column(name="guest_os_id", nullable=false, length=17) + protected long guestOSId; + + @Column(name="host_id", updatable=true, nullable=true) + protected Long hostId; + + @Column(name="last_host_id", updatable=true, nullable=true) + protected Long lastHostId; + + @Column(name="pod_id", updatable=true, nullable=false) + protected Long podIdToDeployIn; + + @Column(name="private_mac_address", updatable=true, nullable=true) + protected String privateMacAddress; + + @Column(name="data_center_id", updatable=true, nullable=false) + protected long dataCenterIdToDeployIn; + + @Column(name="vm_type", updatable=false, nullable=false, length=32) + @Enumerated(value=EnumType.STRING) + protected Type type; + + @Column(name="ha_enabled", updatable=true, nullable=true) + protected boolean haEnabled; + + @Column(name="limit_cpu_use", updatable=true, nullable=true) + private boolean limitCpuUse; + + @Column(name="update_count", updatable = true, nullable=false) + protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code. + + @Column(name=GenericDao.CREATED_COLUMN) + protected Date created; + + @Column(name=GenericDao.REMOVED_COLUMN) + protected Date removed; + + @Column(name="update_time", updatable=true) + @Temporal(value=TemporalType.TIMESTAMP) + protected Date updateTime; + + @Column(name="domain_id") + protected long domainId; + + @Column(name="account_id") + protected long accountId; + + @Column(name="service_offering_id") + protected long serviceOfferingId; + + @Column(name="reservation_id") + protected String reservationId; + + @Column(name="hypervisor_type") + @Enumerated(value=EnumType.STRING) + protected HypervisorType hypervisorType; + + @Column(name="ram") + protected long ram; + + @Column(name="cpu") + protected int cpu; + + @Transient + Map details; + + @Column(name="uuid") + protected String uuid = UUID.randomUUID().toString(); + + //orchestration columns + @Column(name="owner") + private String owner = null; + + @Column(name="speed") + private int speed; + + @Transient + List computeTags; + + @Transient + List rootDiskTags; + + @Column(name="host_name") + private String hostname = null; + + @Column(name="display_name") + private String displayname = null; + + @Transient + List networkIds; + + @Column(name="disk_offering_id") + protected Long diskOfferingId; + + @Transient + private VMReservationVO vmReservation; + + + public VMEntityVO(long id, + long serviceOfferingId, + String name, + String instanceName, + Type type, + Long vmTemplateId, + HypervisorType hypervisorType, + long guestOSId, + long domainId, + long accountId, + boolean haEnabled, Long diskOfferingId) { + this.id = id; + this.hostName = name != null ? name : this.uuid; + if (vmTemplateId != null) { + this.templateId = vmTemplateId; + } + this.instanceName = instanceName; + this.type = type; + this.guestOSId = guestOSId; + this.haEnabled = haEnabled; + this.vncPassword = Long.toHexString(new Random().nextLong()); + this.state = State.Stopped; + this.accountId = accountId; + this.domainId = domainId; + this.serviceOfferingId = serviceOfferingId; + this.hypervisorType = hypervisorType; + this.limitCpuUse = false; + this.diskOfferingId = diskOfferingId; + } + + public VMEntityVO(long id, + long serviceOfferingId, + String name, + String instanceName, + Type type, + Long vmTemplateId, + HypervisorType hypervisorType, + long guestOSId, + long domainId, + long accountId, + boolean haEnabled, + boolean limitResourceUse) { + this(id, serviceOfferingId, name, instanceName, type, vmTemplateId, hypervisorType, guestOSId, domainId, accountId, haEnabled, null); + this.limitCpuUse = limitResourceUse; + } + + + + protected VMEntityVO() { + } + + public Date getRemoved() { + return removed; + } + + @Override + public long getDomainId() { + return domainId; + } + + @Override + public long getAccountId() { + return accountId; + } + + @Override + public Type getType() { + return type; + } + + public long getUpdated() { + return updated; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + @Override + public HypervisorType getHypervisorType() { + return hypervisorType; + } + + @Override + public Date getCreated() { + return created; + } + + public Date getUpdateTime() { + return updateTime; + } + + @Override + public long getDataCenterId() { + return dataCenterIdToDeployIn; + } + + @Override + public String getHostName() { + return hostName; + } + + @Override + public String getInstanceName() { + return instanceName; + } + + @Override + public State getState() { + return state; + } + + // don't use this directly, use VM state machine instead, this method is added for migration tool only + @Override + public void setState(State state) { + this.state = state; + } + + @Override + public String getPrivateIpAddress() { + return privateIpAddress; + } + + public void setPrivateIpAddress(String address) { + privateIpAddress = address; + } + + public void setVncPassword(String vncPassword) { + this.vncPassword = vncPassword; + } + + @Override + public String getVncPassword() { + return vncPassword; + } + + @Override + public long getServiceOfferingId() { + return serviceOfferingId; + } + + public Long getProxyId() { + return proxyId; + } + + public void setProxyId(Long proxyId) { + this.proxyId = proxyId; + } + + public Date getProxyAssignTime() { + return this.proxyAssignTime; + } + + public void setProxyAssignTime(Date time) { + this.proxyAssignTime = time; + } + + @Override + public long getTemplateId() { + if (templateId == null) { + return -1; + } else { + return templateId; + } + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + + @Override + public long getGuestOSId() { + return guestOSId; + } + + public void setGuestOSId(long guestOSId) { + this.guestOSId = guestOSId; + } + + public void incrUpdated() { + updated++; + } + + public void decrUpdated() { + updated--; + } + + @Override + public Long getHostId() { + return hostId; + } + + @Override + public Long getLastHostId() { + return lastHostId; + } + + public void setLastHostId(Long lastHostId) { + this.lastHostId = lastHostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } + + @Override + public boolean isHaEnabled() { + return haEnabled; + } + + @Override + public boolean limitCpuUse() { + return limitCpuUse; + } + + public void setLimitCpuUse(boolean value) { + limitCpuUse = value; + } + + @Override + public String getPrivateMacAddress() { + return privateMacAddress; + } + + @Override + public Long getPodIdToDeployIn() { + return podIdToDeployIn; + } + + public void setPodId(long podId) { + this.podIdToDeployIn = podId; + } + + public void setPrivateMacAddress(String privateMacAddress) { + this.privateMacAddress = privateMacAddress; + } + + public void setDataCenterId(long dataCenterId) { + this.dataCenterIdToDeployIn = dataCenterId; + } + + public boolean isRemoved() { + return removed != null; + } + + public void setHaEnabled(boolean value) { + haEnabled = value; + } + + public void setReservationId(String reservationId) { + this.reservationId = reservationId; + } + + public String getReservationId() { + return this.reservationId; + } + + @Override + public Map getDetails() { + return details; + } + + public void setDetail(String name, String value) { + assert (details != null) : "Did you forget to load the details?"; + + details.put(name, value); + } + + public void setDetails(Map details) { + this.details = details; + } + + transient String toString; + @Override + public String toString() { + if (toString == null) { + toString = new StringBuilder("VM[").append(type.toString()).append("|").append(hostName).append("]").toString(); + } + return toString; + } + + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + (int) (id ^ (id >>> 32)); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + VMEntityVO other = (VMEntityVO) obj; + if (id != other.id) + return false; + return true; + } + + + public void setServiceOfferingId(long serviceOfferingId) { + this.serviceOfferingId = serviceOfferingId; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public int getSpeed() { + return speed; + } + + public void setSpeed(int speed) { + this.speed = speed; + } + + public List getComputeTags() { + return computeTags; + } + + public void setComputeTags(List computeTags) { + this.computeTags = computeTags; + } + + public List getRootDiskTags() { + return rootDiskTags; + } + + public void setRootDiskTags(List rootDiskTags) { + this.rootDiskTags = rootDiskTags; + } + + public String getHostname() { + return hostname; + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public String getDisplayname() { + return displayname; + } + + public void setDisplayname(String displayname) { + this.displayname = displayname; + } + + public List getNetworkIds() { + return networkIds; + } + + public void setNetworkIds(List networkIds) { + this.networkIds = networkIds; + } + + @Override + public Long getDiskOfferingId() { + return diskOfferingId; + } + + public VMReservationVO getVmReservation() { + return vmReservation; + } + + public void setVmReservation(VMReservationVO vmReservation) { + this.vmReservation = vmReservation; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.java new file mode 100644 index 00000000000..a0aa264b859 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMNetworkMapVO.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.engine.cloud.entity.api.db; + + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + + +@Entity +@Table(name = "vm_network_map") +public class VMNetworkMapVO implements InternalIdentity{ + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vm_id") + private long vmId; + + @Column(name="network_id") + private long networkId; + + + /** + * There should never be a public constructor for this class. Since it's + * only here to define the table for the DAO class. + */ + protected VMNetworkMapVO() { + } + + public VMNetworkMapVO(long vmId, long networkId) { + this.vmId = vmId; + this.networkId = networkId; + } + + + public long getId() { + return id; + } + + public long getVmId() { + return vmId; + } + + + public long getNetworkId() { + return networkId; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java new file mode 100644 index 00000000000..535290bcc8c --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMReservationVO.java @@ -0,0 +1,127 @@ +// 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.engine.cloud.entity.api.db; + +import java.util.Date; +import java.util.Map; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = "vm_reservation") +public class VMReservationVO implements Identity, InternalIdentity{ + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vm_id") + private long vmId; + + @Column(name="uuid") + private String uuid; + + @Column(name="data_center_id") + private long dataCenterId; + + @Column(name="pod_id") + private long podId; + + @Column(name="cluster_id") + private long clusterId; + + @Column(name="host_id") + private long hostId; + + @Column(name=GenericDao.CREATED_COLUMN) + private Date created; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + // VolumeId -> poolId + @Transient + Map volumeReservationMap; + + /** + * There should never be a public constructor for this class. Since it's + * only here to define the table for the DAO class. + */ + protected VMReservationVO() { + } + + public VMReservationVO(long vmId, long dataCenterId, long podId, long clusterId, long hostId) { + this.vmId = vmId; + this.dataCenterId = dataCenterId; + this.podId = podId; + this.clusterId = clusterId; + this.hostId = hostId; + this.uuid = UUID.randomUUID().toString(); + } + + + public long getId() { + return id; + } + + public long getVmId() { + return vmId; + } + + @Override + public String getUuid() { + return uuid; + } + + public long getDataCenterId() { + return dataCenterId; + } + + public Long getPodId() { + return podId; + } + + public Long getClusterId() { + return clusterId; + } + + public Long getHostId() { + return hostId; + } + + public Map getVolumeReservation(){ + return volumeReservationMap; + } + + public void setVolumeReservation(Map volumeReservationMap){ + this.volumeReservationMap = volumeReservationMap; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.java new file mode 100644 index 00000000000..a1cca3f9040 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VMRootDiskTagVO.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.engine.cloud.entity.api.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import org.apache.cloudstack.api.InternalIdentity; + +@Entity +@Table(name = "vm_root_disk_tags") +public class VMRootDiskTagVO implements InternalIdentity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vm_id") + private long vmId; + + @Column(name = "root_disk_tag") + private String rootDiskTag; + + /** + * There should never be a public constructor for this class. Since it's + * only here to define the table for the DAO class. + */ + protected VMRootDiskTagVO() { + } + + public VMRootDiskTagVO(long vmId, String rootDiskTag) { + this.vmId = vmId; + this.rootDiskTag = rootDiskTag; + } + + public long getId() { + return id; + } + + public long getVmId() { + return vmId; + } + + public String getRootDiskTag() { + return rootDiskTag; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.java new file mode 100644 index 00000000000..cbad9aba568 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/VolumeReservationVO.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.engine.cloud.entity.api.db; + +import java.util.Date; +import java.util.Map; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Transient; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.api.InternalIdentity; + +import com.cloud.utils.db.GenericDao; + +@Entity +@Table(name = "volume_reservation") +public class VolumeReservationVO implements InternalIdentity{ + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name = "vm_reservation_id") + private Long vmReservationId; + + @Column(name = "vm_id") + private long vmId; + + @Column(name="volume_id") + private long volumeId; + + @Column(name="pool_id") + private long poolId; + + // VolumeId -> poolId + @Transient + Map volumeReservationMap; + + /** + * There should never be a public constructor for this class. Since it's + * only here to define the table for the DAO class. + */ + protected VolumeReservationVO() { + } + + public VolumeReservationVO(long vmId, long volumeId, long poolId, Long vmReservationId) { + this.vmId = vmId; + this.volumeId = volumeId; + this.poolId = poolId; + this.vmReservationId = vmReservationId; + } + + + public long getId() { + return id; + } + + public long getVmId() { + return vmId; + } + + public Long geVmReservationId() { + return vmReservationId; + } + + public long getVolumeId() { + return volumeId; + } + + public Long getPoolId() { + return poolId; + } + + + public Map getVolumeReservation(){ + return volumeReservationMap; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.java new file mode 100644 index 00000000000..d01bf2f12d3 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDao.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.engine.cloud.entity.api.db.dao; + +import java.util.List; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMComputeTagVO; + +import com.cloud.utils.db.GenericDao; + +public interface VMComputeTagDao extends GenericDao{ + + void persist(long vmId, List computeTags); + + List getComputeTags(long vmId); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java new file mode 100644 index 00000000000..6037ad4ec26 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMComputeTagDaoImpl.java @@ -0,0 +1,89 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.engine.cloud.entity.api.db.dao; + + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.ejb.Local; + + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMComputeTagVO; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component +@Local(value = { VMComputeTagDao.class }) +public class VMComputeTagDaoImpl extends GenericDaoBase implements VMComputeTagDao { + + protected SearchBuilder VmIdSearch; + + public VMComputeTagDaoImpl() { + } + + @PostConstruct + public void init() { + VmIdSearch = createSearchBuilder(); + VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ); + VmIdSearch.done(); + + } + + @Override + public void persist(long vmId, List computeTags) { + Transaction txn = Transaction.currentTxn(); + + txn.start(); + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + expunge(sc); + + for (String tag : computeTags) { + if(tag != null){ + tag = tag.trim(); + if(tag.length() > 0) { + VMComputeTagVO vo = new VMComputeTagVO(vmId, tag); + persist(vo); + } + } + } + txn.commit(); + } + + @Override + public List getComputeTags(long vmId) { + + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + + List results = search(sc, null); + List computeTags = new ArrayList(results.size()); + for (VMComputeTagVO result : results) { + computeTags.add(result.getComputeTag()); + } + + return computeTags; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java new file mode 100644 index 00000000000..aa063dc0794 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDao.java @@ -0,0 +1,41 @@ +// 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.engine.cloud.entity.api.db.dao; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; + +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachine.Type; + + +/* + * Data Access Object for vm_instance table + */ +public interface VMEntityDao extends GenericDao { + + void loadVmReservation(VMEntityVO vm); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java new file mode 100644 index 00000000000..7d80e8a69ab --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMEntityDaoImpl.java @@ -0,0 +1,169 @@ +// 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.engine.cloud.entity.api.db.dao; + + +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + + +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.utils.Pair; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.Transaction; +import com.cloud.vm.NicProfile; + + + +@Component +@Local(value = { VMEntityDao.class }) +public class VMEntityDaoImpl extends GenericDaoBase implements VMEntityDao { + + public static final Logger s_logger = Logger.getLogger(VMEntityDaoImpl.class); + + + @Inject protected VMReservationDaoImpl _vmReservationDao; + + @Inject protected VMComputeTagDaoImpl _vmComputeTagDao; + + @Inject protected VMRootDiskTagDaoImpl _vmRootDiskTagsDao; + + @Inject protected VMNetworkMapDaoImpl _vmNetworkMapDao; + + + @Inject + protected NetworkDao _networkDao; + + public VMEntityDaoImpl() { + } + + @PostConstruct + protected void init() { + + } + + @Override + public void loadVmReservation(VMEntityVO vm) { + VMReservationVO vmReservation = _vmReservationDao.findByVmId(vm.getId()); + vm.setVmReservation(vmReservation); + } + + @Override + @DB + public VMEntityVO persist(VMEntityVO vm) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + + VMEntityVO dbVO = super.persist(vm); + + saveVmNetworks(vm); + loadVmNetworks(dbVO); + saveVmReservation(vm); + loadVmReservation(dbVO); + saveComputeTags(vm.getId(), vm.getComputeTags()); + loadComputeTags(dbVO); + saveRootDiskTags(vm.getId(), vm.getRootDiskTags()); + loadRootDiskTags(dbVO); + + txn.commit(); + + return dbVO; + } + + private void loadVmNetworks(VMEntityVO dbVO) { + List networksIds = _vmNetworkMapDao.getNetworks(dbVO.getId()); + + List networks = new ArrayList(); + for(Long networkId : networksIds){ + NetworkVO network = _networkDao.findById(networkId); + if(network != null){ + networks.add(network.getUuid()); + } + } + + dbVO.setNetworkIds(networks); + + } + + private void saveVmNetworks(VMEntityVO vm) { + List networks = new ArrayList(); + + List networksIds = vm.getNetworkIds(); + + if (networksIds == null || (networksIds != null && networksIds.isEmpty())) { + return; + } + + + for(String uuid : networksIds){ + NetworkVO network = _networkDao.findByUuid(uuid); + if(network != null){ + networks.add(network.getId()); + } + } + _vmNetworkMapDao.persist(vm.getId(), networks); + + } + + private void loadRootDiskTags(VMEntityVO dbVO) { + List rootDiskTags = _vmRootDiskTagsDao.getRootDiskTags(dbVO.getId()); + dbVO.setRootDiskTags(rootDiskTags); + + } + + private void loadComputeTags(VMEntityVO dbVO) { + List computeTags = _vmComputeTagDao.getComputeTags(dbVO.getId()); + dbVO.setComputeTags(computeTags); + + } + + private void saveRootDiskTags(long vmId, List rootDiskTags) { + if (rootDiskTags == null || (rootDiskTags != null && rootDiskTags.isEmpty())) { + return; + } + _vmRootDiskTagsDao.persist(vmId, rootDiskTags); + + } + + private void saveComputeTags(long vmId, List computeTags) { + if (computeTags == null || (computeTags != null && computeTags.isEmpty())) { + return; + } + + _vmComputeTagDao.persist(vmId, computeTags); + } + + private void saveVmReservation(VMEntityVO vm) { + if(vm.getVmReservation() != null){ + _vmReservationDao.persist(vm.getVmReservation()); + } + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.java new file mode 100644 index 00000000000..baa0920162b --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDao.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.engine.cloud.entity.api.db.dao; + +import java.util.List; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO; + +import com.cloud.utils.db.GenericDao; + +public interface VMNetworkMapDao extends GenericDao{ + + void persist(long vmId, List networks); + + List getNetworks(long vmId); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.java new file mode 100644 index 00000000000..378f16d519f --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMNetworkMapDaoImpl.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.engine.cloud.entity.api.db.dao; + + +import java.util.ArrayList; +import java.util.List; +import javax.annotation.PostConstruct; +import javax.ejb.Local; +import javax.inject.Inject; +import org.apache.cloudstack.engine.cloud.entity.api.db.VMNetworkMapVO; +import org.springframework.stereotype.Component; +import com.cloud.network.dao.NetworkDao; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component +@Local(value = { VMNetworkMapDao.class }) +public class VMNetworkMapDaoImpl extends GenericDaoBase implements VMNetworkMapDao { + + protected SearchBuilder VmIdSearch; + + @Inject + protected NetworkDao _networkDao; + + public VMNetworkMapDaoImpl() { + } + + @PostConstruct + public void init() { + VmIdSearch = createSearchBuilder(); + VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ); + VmIdSearch.done(); + + } + + @Override + public void persist(long vmId, List networks) { + Transaction txn = Transaction.currentTxn(); + + txn.start(); + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + expunge(sc); + + for (Long networkId : networks) { + VMNetworkMapVO vo = new VMNetworkMapVO(vmId, networkId); + persist(vo); + } + + txn.commit(); + } + + @Override + public List getNetworks(long vmId) { + + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + + List results = search(sc, null); + List networks = new ArrayList(results.size()); + for (VMNetworkMapVO result : results) { + networks.add(result.getNetworkId()); + } + + return networks; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.java new file mode 100644 index 00000000000..a312578a4ed --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDao.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 org.apache.cloudstack.engine.cloud.entity.api.db.dao; + + +import java.util.Map; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; + +import com.cloud.utils.db.GenericDao; + +public interface VMReservationDao extends GenericDao{ + + VMReservationVO findByVmId(long vmId); + + void loadVolumeReservation(VMReservationVO reservation); + + VMReservationVO findByReservationId(String reservationId); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java new file mode 100644 index 00000000000..66261dd09b6 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMReservationDaoImpl.java @@ -0,0 +1,111 @@ +// 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.engine.cloud.entity.api.db.dao; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMEntityVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO; +import org.springframework.stereotype.Component; + +import com.cloud.host.dao.HostTagsDaoImpl; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component +@Local(value = { VMReservationDao.class }) +public class VMReservationDaoImpl extends GenericDaoBase implements VMReservationDao { + + protected SearchBuilder VmIdSearch; + + @Inject protected VolumeReservationDaoImpl _volumeReservationDao; + + public VMReservationDaoImpl() { + } + + @PostConstruct + public void init() { + VmIdSearch = createSearchBuilder(); + VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ); + VmIdSearch.done(); + } + + @Override + public VMReservationVO findByVmId(long vmId) { + SearchCriteria sc = VmIdSearch.create("vmId", vmId); + VMReservationVO vmRes = findOneBy(sc); + loadVolumeReservation(vmRes); + return vmRes; + } + + + @Override + public void loadVolumeReservation(VMReservationVO reservation){ + if(reservation != null){ + List volumeResList = _volumeReservationDao.listVolumeReservation(reservation.getId()); + Map volumeReservationMap = new HashMap(); + + for(VolumeReservationVO res : volumeResList){ + volumeReservationMap.put(res.getVolumeId(), res.getPoolId()); + } + reservation.setVolumeReservation(volumeReservationMap); + } + } + + @Override + @DB + public VMReservationVO persist(VMReservationVO reservation) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + + VMReservationVO dbVO = super.persist(reservation); + + saveVolumeReservation(reservation); + loadVolumeReservation(dbVO); + + txn.commit(); + + return dbVO; + } + + private void saveVolumeReservation(VMReservationVO reservation) { + if(reservation.getVolumeReservation() != null){ + for(Long volumeId : reservation.getVolumeReservation().keySet()){ + VolumeReservationVO volumeReservation = new VolumeReservationVO(reservation.getVmId(), volumeId, reservation.getVolumeReservation().get(volumeId), reservation.getId()); + _volumeReservationDao.persist(volumeReservation); + } + } + } + + @Override + public VMReservationVO findByReservationId(String reservationId) { + VMReservationVO vmRes = super.findByUuid(reservationId); + loadVolumeReservation(vmRes); + return vmRes; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.java new file mode 100644 index 00000000000..5a4c2be07d4 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDao.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.engine.cloud.entity.api.db.dao; + +import java.util.List; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMRootDiskTagVO; + +import com.cloud.utils.db.GenericDao; + +public interface VMRootDiskTagDao extends GenericDao{ + + void persist(long vmId, List diskTags); + + List getRootDiskTags(long vmId); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.java new file mode 100644 index 00000000000..60ea5479398 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VMRootDiskTagDaoImpl.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.engine.cloud.entity.api.db.dao; + + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.ejb.Local; + + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMRootDiskTagVO; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component +@Local(value = { VMRootDiskTagDao.class }) +public class VMRootDiskTagDaoImpl extends GenericDaoBase implements VMRootDiskTagDao { + + protected SearchBuilder VmIdSearch; + + public VMRootDiskTagDaoImpl() { + } + + @PostConstruct + public void init() { + VmIdSearch = createSearchBuilder(); + VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ); + VmIdSearch.done(); + + } + + @Override + public void persist(long vmId, List rootDiskTags) { + Transaction txn = Transaction.currentTxn(); + + txn.start(); + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + expunge(sc); + + for (String tag : rootDiskTags) { + if(tag != null){ + tag = tag.trim(); + if(tag.length() > 0) { + VMRootDiskTagVO vo = new VMRootDiskTagVO(vmId, tag); + persist(vo); + } + } + } + txn.commit(); + } + + + @Override + public List getRootDiskTags(long vmId) { + SearchCriteria sc = VmIdSearch.create(); + sc.setParameters("vmId", vmId); + + List results = search(sc, null); + List computeTags = new ArrayList(results.size()); + for (VMRootDiskTagVO result : results) { + computeTags.add(result.getRootDiskTag()); + } + return computeTags; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.java new file mode 100644 index 00000000000..d6a9fe28146 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDao.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.engine.cloud.entity.api.db.dao; + +import java.util.List; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO; + +import com.cloud.utils.db.GenericDao; + +public interface VolumeReservationDao extends GenericDao{ + + VolumeReservationVO findByVmId(long vmId); + + List listVolumeReservation(long vmReservationId); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java new file mode 100644 index 00000000000..4b1b1e667d6 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/cloud/entity/api/db/dao/VolumeReservationDaoImpl.java @@ -0,0 +1,68 @@ +// 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.engine.cloud.entity.api.db.dao; + + +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.db.VMReservationVO; +import org.apache.cloudstack.engine.cloud.entity.api.db.VolumeReservationVO; +import org.springframework.stereotype.Component; + +import com.cloud.host.dao.HostTagsDaoImpl; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; + +@Component +@Local(value = { VolumeReservationDao.class }) +public class VolumeReservationDaoImpl extends GenericDaoBase implements VolumeReservationDao { + + protected SearchBuilder VmIdSearch; + protected SearchBuilder VmReservationIdSearch; + + public VolumeReservationDaoImpl() { + } + + @PostConstruct + public void init() { + VmIdSearch = createSearchBuilder(); + VmIdSearch.and("vmId", VmIdSearch.entity().getVmId(), SearchCriteria.Op.EQ); + VmIdSearch.done(); + + VmReservationIdSearch = createSearchBuilder(); + VmReservationIdSearch.and("vmReservationId", VmReservationIdSearch.entity().geVmReservationId(), SearchCriteria.Op.EQ); + VmReservationIdSearch.done(); + } + + @Override + public VolumeReservationVO findByVmId(long vmId) { + SearchCriteria sc = VmIdSearch.create("vmId", vmId); + return findOneBy(sc); + } + + @Override + public List listVolumeReservation(long vmReservationId) { + SearchCriteria sc = VmReservationIdSearch.create("vmReservationId", vmReservationId); + return listBy(sc); + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntityImpl.java new file mode 100644 index 00000000000..3471b7ae376 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ClusterEntityImpl.java @@ -0,0 +1,209 @@ +// 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.engine.datacenter.entity.api; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster.ClusterType; +import com.cloud.org.Grouping.AllocationState; +import com.cloud.org.Managed.ManagedState; +import com.cloud.utils.fsm.NoTransitionException; + + +public class ClusterEntityImpl implements ClusterEntity { + + + private DataCenterResourceManager manager; + + private EngineClusterVO clusterVO; + + + public ClusterEntityImpl(String clusterId, DataCenterResourceManager manager) { + this.manager = manager; + this.clusterVO = this.manager.loadCluster(clusterId); + } + + @Override + public boolean enable() { + try { + manager.changeState(this, Event.EnableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean disable() { + try { + manager.changeState(this, Event.DisableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean deactivate() { + try { + manager.changeState(this, Event.DeactivateRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + + @Override + public boolean reactivate() { + try { + manager.changeState(this, Event.ActivatedRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + + @Override + public State getState() { + return clusterVO.getState(); + } + + @Override + public void persist() { + manager.saveCluster(clusterVO); + } + + @Override + public String getUuid() { + return clusterVO.getUuid(); + } + + @Override + public long getId() { + return clusterVO.getId(); + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + return clusterVO.getCreated(); + } + + @Override + public Date getLastUpdatedTime() { + return clusterVO.getLastUpdated(); + } + + @Override + public String getOwner() { + return clusterVO.getOwner(); + } + + @Override + public Map getDetails() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getName() { + return clusterVO.getName(); + } + + @Override + public long getDataCenterId() { + return clusterVO.getDataCenterId(); + } + + @Override + public long getPodId() { + return clusterVO.getPodId(); + } + + @Override + public HypervisorType getHypervisorType() { + return clusterVO.getHypervisorType(); + } + + @Override + public ClusterType getClusterType() { + return clusterVO.getClusterType(); + } + + @Override + public AllocationState getAllocationState() { + return clusterVO.getAllocationState(); + } + + @Override + public ManagedState getManagedState() { + return clusterVO.getManagedState(); + } + + public void setOwner(String owner) { + clusterVO.setOwner(owner); + } + + public void setName(String name) { + clusterVO.setName(name); + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManager.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManager.java new file mode 100644 index 00000000000..ab1cbe6b0b1 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManager.java @@ -0,0 +1,50 @@ +// 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.engine.datacenter.entity.api; + + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; + +import com.cloud.utils.fsm.NoTransitionException; + + + +public interface DataCenterResourceManager { + + EngineDataCenterVO loadDataCenter(String dataCenterId); + + void saveDataCenter(EngineDataCenterVO dc); + + void savePod(EngineHostPodVO dc); + + void saveCluster(EngineClusterVO cluster); + + boolean changeState(DataCenterResourceEntity entity, Event event) throws NoTransitionException; + + EngineHostPodVO loadPod(String uuid); + + EngineClusterVO loadCluster(String uuid); + + EngineHostVO loadHost(String uuid); + + void saveHost(EngineHostVO hostVO); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManagerImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManagerImpl.java new file mode 100644 index 00000000000..3cfca3b9369 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/DataCenterResourceManagerImpl.java @@ -0,0 +1,129 @@ +// 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.engine.datacenter.entity.api; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; +import org.springframework.stereotype.Component; + + +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.fsm.StateMachine2; + +@Component +public class DataCenterResourceManagerImpl implements DataCenterResourceManager { + + @Inject + EngineDataCenterDao _dataCenterDao; + + @Inject + EngineHostPodDao _podDao; + + @Inject + EngineClusterDao _clusterDao; + + @Inject + EngineHostDao _hostDao; + + + protected StateMachine2 _stateMachine = DataCenterResourceEntity.State.s_fsm; + + @Override + public EngineDataCenterVO loadDataCenter(String dataCenterId) { + EngineDataCenterVO dataCenterVO = _dataCenterDao.findByUuid(dataCenterId); + if(dataCenterVO == null){ + throw new InvalidParameterValueException("Zone does not exist"); + } + return dataCenterVO; + } + + @Override + public void saveDataCenter(EngineDataCenterVO dc) { + _dataCenterDao.persist(dc); + + } + + @Override + public boolean changeState(DataCenterResourceEntity entity, Event event) throws NoTransitionException { + + if(entity instanceof ZoneEntity){ + return _stateMachine.transitTo(entity, event, null, _dataCenterDao); + }else if(entity instanceof PodEntity){ + return _stateMachine.transitTo(entity, event, null, _podDao); + }else if(entity instanceof ClusterEntity){ + return _stateMachine.transitTo(entity, event, null, _clusterDao); + }else if(entity instanceof HostEntity){ + return _stateMachine.transitTo(entity, event, null, _hostDao); + } + + return false; + } + + @Override + public EngineHostPodVO loadPod(String uuid) { + EngineHostPodVO pod = _podDao.findByUuid(uuid); + if(pod == null){ + throw new InvalidParameterValueException("Pod does not exist"); + } + return pod; + } + + @Override + public EngineClusterVO loadCluster(String uuid) { + EngineClusterVO cluster = _clusterDao.findByUuid(uuid); + if(cluster == null){ + throw new InvalidParameterValueException("Pod does not exist"); + } + return cluster; + } + + @Override + public void savePod(EngineHostPodVO pod) { + _podDao.persist(pod); + } + + @Override + public void saveCluster(EngineClusterVO cluster) { + _clusterDao.persist(cluster); + } + + @Override + public EngineHostVO loadHost(String uuid) { + EngineHostVO host = _hostDao.findByUuid(uuid); + if(host == null){ + throw new InvalidParameterValueException("Host does not exist"); + } + return host; + } + + @Override + public void saveHost(EngineHostVO hostVO) { + _hostDao.persist(hostVO); + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntityImpl.java new file mode 100644 index 00000000000..b4a20801a79 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/HostEntityImpl.java @@ -0,0 +1,215 @@ +// 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.engine.datacenter.entity.api; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.fsm.NoTransitionException; + +public class HostEntityImpl implements HostEntity { + + private DataCenterResourceManager manager; + + private EngineHostVO hostVO; + + public HostEntityImpl(String uuid, DataCenterResourceManager manager) { + this.manager = manager; + hostVO = manager.loadHost(uuid); + } + + @Override + public boolean enable() { + try { + manager.changeState(this, Event.EnableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean disable() { + try { + manager.changeState(this, Event.DisableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean deactivate() { + try { + manager.changeState(this, Event.DeactivateRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean reactivate() { + try { + manager.changeState(this, Event.ActivatedRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public State getState() { + return hostVO.getOrchestrationState(); + } + + @Override + public void persist() { + manager.saveHost(hostVO); + } + + @Override + public String getName() { + return hostVO.getName(); + } + + @Override + public String getUuid() { + return hostVO.getUuid(); + } + + @Override + public long getId() { + return hostVO.getId(); + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + return hostVO.getCreated(); + } + + @Override + public Date getLastUpdatedTime() { + return hostVO.getLastUpdated(); + } + + @Override + public String getOwner() { + // TODO Auto-generated method stub + return hostVO.getOwner(); + } + + + public void setDetails(Map details) { + hostVO.setDetails(details); + } + + @Override + public Map getDetails() { + return hostVO.getDetails(); + } + + @Override + public void addDetail(String name, String value) { + hostVO.setDetail(name, value); + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Long getTotalMemory() { + return hostVO.getTotalMemory(); + } + + @Override + public Integer getCpus() { + return hostVO.getCpus(); + } + + @Override + public Long getSpeed() { + return hostVO.getSpeed(); + } + + @Override + public Long getPodId() { + return hostVO.getPodId(); + } + + @Override + public long getDataCenterId() { + return hostVO.getDataCenterId(); + } + + @Override + public HypervisorType getHypervisorType() { + return hostVO.getHypervisorType(); + } + + @Override + public String getGuid() { + return hostVO.getGuid(); + } + + @Override + public Long getClusterId() { + return hostVO.getClusterId(); + } + + public void setOwner(String owner) { + hostVO.setOwner(owner); + } + + public void setName(String name) { + hostVO.setName(name); + } + + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java new file mode 100755 index 00000000000..5c66a21a73e --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/PodEntityImpl.java @@ -0,0 +1,211 @@ +/* + * 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.engine.datacenter.entity.api; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; + +import com.cloud.org.Cluster; +import com.cloud.org.Grouping.AllocationState; +import com.cloud.utils.fsm.NoTransitionException; + +public class PodEntityImpl implements PodEntity { + + + private DataCenterResourceManager manager; + + private EngineHostPodVO podVO; + + public PodEntityImpl(String uuid, DataCenterResourceManager manager) { + this.manager = manager; + podVO = manager.loadPod(uuid); + } + + @Override + public boolean enable() { + try { + manager.changeState(this, Event.EnableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean disable() { + try { + manager.changeState(this, Event.DisableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean deactivate() { + try { + manager.changeState(this, Event.DeactivateRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean reactivate() { + try { + manager.changeState(this, Event.ActivatedRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public State getState() { + return podVO.getState(); + } + + @Override + public String getUuid() { + return podVO.getUuid(); + } + + @Override + public long getId() { + return podVO.getId(); + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + return podVO.getCreated(); + } + + @Override + public Date getLastUpdatedTime() { + return podVO.getLastUpdated(); + } + + @Override + public String getOwner() { + return podVO.getOwner(); + } + + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCidrAddress() { + return podVO.getCidrAddress(); + } + + @Override + public int getCidrSize() { + return podVO.getCidrSize(); + } + + @Override + public String getGateway() { + return podVO.getGateway(); + } + + @Override + public long getDataCenterId() { + return podVO.getDataCenterId(); + } + + @Override + public String getName() { + return podVO.getName(); + } + + @Override + public AllocationState getAllocationState() { + return podVO.getAllocationState(); + } + + @Override + public boolean getExternalDhcp() { + return podVO.getExternalDhcp(); + } + + @Override + public List listClusters() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void persist() { + manager.savePod(podVO); + + } + + @Override + public Map getDetails() { + return null; + } + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + + } + + public void setOwner(String owner) { + podVO.setOwner(owner); + } + + public void setName(String name) { + podVO.setName(name); + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java new file mode 100644 index 00000000000..333a2207d66 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/ZoneEntityImpl.java @@ -0,0 +1,201 @@ +/* + * 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.engine.datacenter.entity.api; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import com.cloud.utils.fsm.FiniteStateObject; +import com.cloud.utils.fsm.NoTransitionException; + + +@Path("/zone/{id}") +public class ZoneEntityImpl implements ZoneEntity, FiniteStateObject { + + + private DataCenterResourceManager manager; + + private EngineDataCenterVO dataCenterVO; + + + public ZoneEntityImpl(String dataCenterId, DataCenterResourceManager manager) { + this.manager = manager; + this.dataCenterVO = this.manager.loadDataCenter(dataCenterId); + } + + @Override + @GET + public String getUuid() { + return dataCenterVO.getUuid(); + } + + @Override + public long getId() { + return dataCenterVO.getId(); + } + + @Override + public boolean enable() { + try { + manager.changeState(this, Event.EnableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean disable() { + try { + manager.changeState(this, Event.DisableRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean deactivate() { + try { + manager.changeState(this, Event.DeactivateRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public boolean reactivate() { + try { + manager.changeState(this, Event.ActivatedRequest); + } catch (NoTransitionException e) { + return false; + } + return true; + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return "state"; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return "desired_state"; + } + + @Override + public Date getCreatedTime() { + return dataCenterVO.getCreated(); + } + + @Override + public Date getLastUpdatedTime() { + return dataCenterVO.getLastUpdated(); + } + + @Override + public String getOwner() { + return dataCenterVO.getOwner(); + } + + + public void setOwner(String owner) { + dataCenterVO.setOwner(owner); + } + + @Override + public Map getDetails() { + return dataCenterVO.getDetails(); + } + + public void setDetails(Map details) { + dataCenterVO.setDetails(details); + } + + + @Override + public void addDetail(String name, String value) { + dataCenterVO.setDetail(name, value); + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public State getState() { + return dataCenterVO.getState(); + } + + + @Override + public List listPods() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void setState(State state) { + //use FSM to set state. + } + + @Override + public void persist() { + manager.saveDataCenter(dataCenterVO); + } + + @Override + public String getName() { + return dataCenterVO.getName(); + } + + @Override + public List listPodIds() { + List podIds = new ArrayList(); + podIds.add("pod-uuid-1"); + podIds.add("pod-uuid-2"); + return podIds; + } + + public void setName(String name) { + dataCenterVO.setName(name); + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/ClusterDetailsVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/ClusterDetailsVO.java new file mode 100644 index 00000000000..d735c47dc18 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/ClusterDetailsVO.java @@ -0,0 +1,68 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="cluster_details") +public class ClusterDetailsVO { + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="cluster_id") + private long clusterId; + + @Column(name="name") + private String name; + + @Column(name="value") + private String value; + + protected ClusterDetailsVO() { + } + + public ClusterDetailsVO(long clusterId, String name, String value) { + this.clusterId = clusterId; + this.name = name; + this.value = value; + } + + public long getClusterId() { + return clusterId; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public long getId() { + return id; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/DcDetailVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/DcDetailVO.java new file mode 100644 index 00000000000..ef59118ef81 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/DcDetailVO.java @@ -0,0 +1,67 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="data_center_details") +public class DcDetailVO { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="dc_id") + private long dcId; + + @Column(name="name") + private String name; + + @Column(name="value") + private String value; + + protected DcDetailVO() { + } + + public DcDetailVO(long dcId, String name, String value) { + this.dcId = dcId; + this.name = name; + this.value = value; + } + + public long getDcId() { + return dcId; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public long getId() { + return id; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineCluster.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineCluster.java new file mode 100644 index 00000000000..c4f1940c119 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineCluster.java @@ -0,0 +1,23 @@ +// 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.engine.datacenter.entity.api.db; + +import com.cloud.org.Cluster; + +public interface EngineCluster extends Cluster { + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java new file mode 100644 index 00000000000..00344198d7a --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineClusterVO.java @@ -0,0 +1,243 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster; +import com.cloud.org.Grouping; +import com.cloud.org.Managed.ManagedState; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.StateMachine; + +@Entity +@Table(name="cluster") +public class EngineClusterVO implements EngineCluster, Identity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name="id") + long id; + + @Column(name="name") + String name; + + @Column(name="guid") + String guid; + + @Column(name="data_center_id") + long dataCenterId; + + @Column(name="pod_id") + long podId; + + @Column(name="hypervisor_type") + String hypervisorType; + + @Column(name="cluster_type") + @Enumerated(value=EnumType.STRING) + Cluster.ClusterType clusterType; + + @Column(name="allocation_state") + @Enumerated(value=EnumType.STRING) + AllocationState allocationState; + + @Column(name="managed_state") + @Enumerated(value=EnumType.STRING) + ManagedState managedState; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name="uuid") + String uuid; + + //orchestration + + @Column(name="owner") + private String owner = null; + + @Column(name=GenericDao.CREATED_COLUMN) + protected Date created; + + @Column(name="lastUpdated", updatable=true) + @Temporal(value=TemporalType.TIMESTAMP) + protected Date lastUpdated; + + /** + * Note that state is intentionally missing the setter. Any updates to + * the state machine needs to go through the DAO object because someone + * else could be updating it as well. + */ + @Enumerated(value=EnumType.STRING) + @StateMachine(state=State.class, event=Event.class) + @Column(name="engine_state", updatable=true, nullable=false, length=32) + protected State engineState = null; + + + public EngineClusterVO() { + clusterType = Cluster.ClusterType.CloudManaged; + allocationState = Grouping.AllocationState.Enabled; + + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + public EngineClusterVO(long dataCenterId, long podId, String name) { + this.dataCenterId = dataCenterId; + this.podId = podId; + this.name = name; + this.clusterType = Cluster.ClusterType.CloudManaged; + this.allocationState = Grouping.AllocationState.Enabled; + this.managedState = ManagedState.Managed; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public long getDataCenterId() { + return dataCenterId; + } + + @Override + public long getPodId() { + return podId; + } + + @Override + public Cluster.ClusterType getClusterType() { + return clusterType; + } + + public void setClusterType(Cluster.ClusterType clusterType) { + this.clusterType = clusterType; + } + + @Override + public AllocationState getAllocationState() { + return allocationState; + } + + public void setAllocationState(AllocationState allocationState) { + this.allocationState = allocationState; + } + + @Override + public ManagedState getManagedState() { + return managedState; + } + + public void setManagedState(ManagedState managedState) { + this.managedState = managedState; + } + + public EngineClusterVO(long clusterId) { + this.id = clusterId; + } + + @Override + public int hashCode() { + return NumbersUtil.hash(id); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof EngineClusterVO)) { + return false; + } + EngineClusterVO that = (EngineClusterVO)obj; + return this.id == that.id; + } + + @Override + public HypervisorType getHypervisorType() { + return HypervisorType.getType(hypervisorType); + } + + public void setHypervisorType(String hy) { + hypervisorType = hy; + } + + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + public Date getRemoved() { + return removed; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public Date getCreated() { + return created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public State getState() { + return engineState; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenter.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenter.java new file mode 100644 index 00000000000..24e01a0b0af --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenter.java @@ -0,0 +1,23 @@ +// 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.engine.datacenter.entity.api.db; + +import com.cloud.dc.DataCenter; + +public interface EngineDataCenter extends DataCenter { + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java new file mode 100644 index 00000000000..15bed6f8c1d --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineDataCenterVO.java @@ -0,0 +1,504 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db; + +import java.util.Date; +import java.util.Map; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; + + +import com.cloud.network.Network.Provider; +import com.cloud.org.Grouping; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.StateMachine; + +@Entity +@Table(name="data_center") +public class EngineDataCenterVO implements EngineDataCenter, Identity { + + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="name") + private String name = null; + + @Column(name="description") + private String description = null; + + @Column(name="dns1") + private String dns1 = null; + + @Column(name="dns2") + private String dns2 = null; + + @Column(name="ip6Dns1") + private String ip6Dns1 = null; + + @Column(name="ip6Dns2") + private String ip6Dns2 = null; + + @Column(name="internal_dns1") + private String internalDns1 = null; + + @Column(name="internal_dns2") + private String internalDns2 = null; + + @Column(name="router_mac_address", updatable = false, nullable=false) + private String routerMacAddress = "02:00:00:00:00:01"; + + @Column(name="guest_network_cidr") + private String guestNetworkCidr = null; + + @Column(name="domain_id") + private Long domainId = null; + + @Column(name="domain") + private String domain; + + @Column(name="networktype") + @Enumerated(EnumType.STRING) + NetworkType networkType; + + @Column(name="dns_provider") + private String dnsProvider; + + @Column(name="dhcp_provider") + private String dhcpProvider; + + @Column(name="gateway_provider") + private String gatewayProvider; + + @Column(name="vpn_provider") + private String vpnProvider; + + @Column(name="userdata_provider") + private String userDataProvider; + + @Column(name="lb_provider") + private String loadBalancerProvider; + + @Column(name="firewall_provider") + private String firewallProvider; + + @Column(name="mac_address", nullable=false) + @TableGenerator(name="mac_address_sq", table="data_center", pkColumnName="id", valueColumnName="mac_address", allocationSize=1) + private long macAddress = 1; + + @Column(name="zone_token") + private String zoneToken; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + // This is a delayed load value. If the value is null, + // then this field has not been loaded yet. + // Call the dao to load it. + @Transient + Map details; + + @Column(name="allocation_state") + @Enumerated(value=EnumType.STRING) + AllocationState allocationState; + + @Column(name="uuid") + private String uuid; + + @Column(name="is_security_group_enabled") + boolean securityGroupEnabled; + + @Column(name="is_local_storage_enabled") + boolean localStorageEnabled; + + //orchestration + @Column(name="owner") + private String owner = null; + + @Column(name=GenericDao.CREATED_COLUMN) + protected Date created; + + @Column(name="lastUpdated", updatable=true) + @Temporal(value=TemporalType.TIMESTAMP) + protected Date lastUpdated; + + /** + * Note that state is intentionally missing the setter. Any updates to + * the state machine needs to go through the DAO object because someone + * else could be updating it as well. + */ + @Enumerated(value=EnumType.STRING) + @StateMachine(state=State.class, event=Event.class) + @Column(name="engine_state", updatable=true, nullable=false, length=32) + protected State engineState = null; + + + @Override + public String getDnsProvider() { + return dnsProvider; + } + + public void setDnsProvider(String dnsProvider) { + this.dnsProvider = dnsProvider; + } + + @Override + public String getDhcpProvider() { + return dhcpProvider; + } + + public void setDhcpProvider(String dhcpProvider) { + this.dhcpProvider = dhcpProvider; + } + + @Override + public String getGatewayProvider() { + return gatewayProvider; + } + + public void setGatewayProvider(String gatewayProvider) { + this.gatewayProvider = gatewayProvider; + } + + @Override + public String getLoadBalancerProvider() { + return loadBalancerProvider; + } + + public void setLoadBalancerProvider(String loadBalancerProvider) { + this.loadBalancerProvider = loadBalancerProvider; + } + + @Override + public String getFirewallProvider() { + return firewallProvider; + } + + public void setFirewallProvider(String firewallProvider) { + this.firewallProvider = firewallProvider; + } + + public EngineDataCenterVO(long id, String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix) { + this(name, description, dns1, dns2, dns3, dns4, guestCidr, domain, domainId, zoneType, zoneToken, domainSuffix, false, false, null, null); + this.id = id; + this.allocationState = Grouping.AllocationState.Enabled; + this.uuid = UUID.randomUUID().toString(); + } + + public EngineDataCenterVO(String name, String description, String dns1, String dns2, String dns3, String dns4, String guestCidr, String domain, Long domainId, NetworkType zoneType, String zoneToken, String domainSuffix, boolean securityGroupEnabled, boolean localStorageEnabled, String ip6Dns1, String ip6Dns2) { + this.name = name; + this.description = description; + this.dns1 = dns1; + this.dns2 = dns2; + this.internalDns1 = dns3; + this.internalDns2 = dns4; + this.guestNetworkCidr = guestCidr; + this.domain = domain; + this.domainId = domainId; + this.networkType = zoneType; + this.allocationState = Grouping.AllocationState.Enabled; + this.securityGroupEnabled = securityGroupEnabled; + this.localStorageEnabled = localStorageEnabled; + + if (zoneType == NetworkType.Advanced) { + loadBalancerProvider = Provider.VirtualRouter.getName(); + firewallProvider = Provider.VirtualRouter.getName(); + dhcpProvider = Provider.VirtualRouter.getName(); + dnsProvider = Provider.VirtualRouter.getName(); + gatewayProvider = Provider.VirtualRouter.getName(); + vpnProvider = Provider.VirtualRouter.getName(); + userDataProvider = Provider.VirtualRouter.getName(); + } else if (zoneType == NetworkType.Basic){ + dhcpProvider = Provider.VirtualRouter.getName(); + dnsProvider = Provider.VirtualRouter.getName(); + userDataProvider = Provider.VirtualRouter.getName(); + loadBalancerProvider = Provider.ElasticLoadBalancerVm.getName(); + } + + this.zoneToken = zoneToken; + this.domain = domainSuffix; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + @Override + public String getVpnProvider() { + return vpnProvider; + } + + public void setVpnProvider(String vpnProvider) { + this.vpnProvider = vpnProvider; + } + + @Override + public String getUserDataProvider() { + return userDataProvider; + } + + public void setUserDataProvider(String userDataProvider) { + this.userDataProvider = userDataProvider; + } + + @Override + public String getGuestNetworkCidr() + { + return guestNetworkCidr; + } + + public void setGuestNetworkCidr(String guestNetworkCidr) + { + this.guestNetworkCidr = guestNetworkCidr; + } + + @Override + public Long getDomainId() { + return domainId; + } + + public void setDomainId(Long domainId) { + this.domainId = domainId; + } + + @Override + public String getDescription() { + return description; + } + + public String getRouterMacAddress() { + return routerMacAddress; + } + + @Override + public String getDns1() { + return dns1; + } + + @Override + public String getDns2() { + return dns2; + } + + @Override + public String getInternalDns1() { + return internalDns1; + } + + @Override + public String getInternalDns2() { + return internalDns2; + } + + protected EngineDataCenterVO() { + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public void setDns1(String dns1) { + this.dns1 = dns1; + } + + public void setDns2(String dns2) { + this.dns2 = dns2; + } + + public void setInternalDns1(String dns3) { + this.internalDns1 = dns3; + } + + public void setInternalDns2(String dns4) { + this.internalDns2 = dns4; + } + + public void setRouterMacAddress(String routerMacAddress) { + this.routerMacAddress = routerMacAddress; + } + + @Override + public String getDomain() { + return domain; + } + + public void setDomain(String domain) { + this.domain = domain; + } + + public void setNetworkType(NetworkType zoneNetworkType) { + this.networkType = zoneNetworkType; + } + + @Override + public NetworkType getNetworkType() { + return networkType; + } + + @Override + public boolean isSecurityGroupEnabled() { + return securityGroupEnabled; + } + + public void setSecurityGroupEnabled(boolean enabled) { + this.securityGroupEnabled = enabled; + } + + @Override + public boolean isLocalStorageEnabled() { + return localStorageEnabled; + } + + public void setLocalStorageEnabled(boolean enabled) { + this.localStorageEnabled = enabled; + } + + @Override + public Map getDetails() { + return details; + } + + @Override + public void setDetails(Map details2) { + details = details2; + } + + public String getDetail(String name) { + assert (details != null) : "Did you forget to load the details?"; + + return details != null ? details.get(name) : null; + } + + public void setDetail(String name, String value) { + assert (details != null) : "Did you forget to load the details?"; + + details.put(name, value); + } + + @Override + public AllocationState getAllocationState() { + return allocationState; + } + + public void setAllocationState(AllocationState allocationState) { + this.allocationState = allocationState; + } + + @Override + public int hashCode() { + return NumbersUtil.hash(id); + } + + @Override + public boolean equals(Object obj) { + if (!(obj instanceof EngineDataCenterVO)) { + return false; + } + EngineDataCenterVO that = (EngineDataCenterVO)obj; + return this.id == that.id; + } + + @Override + public String getZoneToken() { + return zoneToken; + } + + public void setZoneToken(String zoneToken) { + this.zoneToken = zoneToken; + } + + public Date getRemoved() { + return removed; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getMacAddress() { + return macAddress; + } + + public void setMacAddress(long macAddress) { + this.macAddress = macAddress; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public Date getCreated() { + return created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public State getState() { + return engineState; + } + + @Override + public String getIp6Dns1() { + return ip6Dns1; + } + + public void setIp6Dns1(String ip6Dns1) { + this.ip6Dns1 = ip6Dns1; + } + + @Override + public String getIp6Dns2() { + return ip6Dns2; + } + + public void setIp6Dns2(String ip6Dns2) { + this.ip6Dns2 = ip6Dns2; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java new file mode 100644 index 00000000000..fe1b832633e --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHost.java @@ -0,0 +1,24 @@ +// 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.engine.datacenter.entity.api.db; + +import com.cloud.host.Host; + +public interface EngineHost extends Host { + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java new file mode 100644 index 00000000000..99c95406f9e --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostPodVO.java @@ -0,0 +1,245 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; + +import com.cloud.org.Grouping; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.StateMachine; + +@Entity +@Table(name = "host_pod_ref") +public class EngineHostPodVO implements EnginePod, Identity { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + long id; + + @Column(name = "name") + private String name = null; + + @Column(name = "data_center_id") + private long dataCenterId; + + @Column(name = "gateway") + private String gateway; + + @Column(name = "cidr_address") + private String cidrAddress; + + @Column(name = "cidr_size") + private int cidrSize; + + @Column(name = "description") + private String description; + + @Column(name="allocation_state") + @Enumerated(value=EnumType.STRING) + AllocationState allocationState; + + @Column(name = "external_dhcp") + private Boolean externalDhcp; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + @Column(name = "uuid") + private String uuid; + + //orchestration + @Column(name="owner") + private String owner = null; + + @Column(name=GenericDao.CREATED_COLUMN) + protected Date created; + + @Column(name="lastUpdated", updatable=true) + @Temporal(value=TemporalType.TIMESTAMP) + protected Date lastUpdated; + + /** + * Note that state is intentionally missing the setter. Any updates to + * the state machine needs to go through the DAO object because someone + * else could be updating it as well. + */ + @Enumerated(value=EnumType.STRING) + @StateMachine(state=State.class, event=Event.class) + @Column(name="engine_state", updatable=true, nullable=false, length=32) + protected State engineState = null; + + public EngineHostPodVO(String name, long dcId, String gateway, String cidrAddress, int cidrSize, String description) { + this.name = name; + this.dataCenterId = dcId; + this.gateway = gateway; + this.cidrAddress = cidrAddress; + this.cidrSize = cidrSize; + this.description = description; + this.allocationState = Grouping.AllocationState.Enabled; + this.externalDhcp = false; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + /* + * public HostPodVO(String name, long dcId) { this(null, name, dcId); } + */ + protected EngineHostPodVO() { + this.uuid = UUID.randomUUID().toString(); + } + + @Override + public long getId() { + return id; + } + + @Override + public long getDataCenterId() { + return dataCenterId; + } + + public void setDataCenterId(long dataCenterId) { + this.dataCenterId = dataCenterId; + } + + @Override + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public String getCidrAddress() { + return cidrAddress; + } + + public void setCidrAddress(String cidrAddress) { + this.cidrAddress = cidrAddress; + } + + @Override + public int getCidrSize() { + return cidrSize; + } + + public void setCidrSize(int cidrSize) { + this.cidrSize = cidrSize; + } + + @Override + public String getGateway() { + return gateway; + } + + public void setGateway(String gateway) { + this.gateway = gateway; + } + + @Override + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + @Override + public AllocationState getAllocationState() { + return allocationState; + } + + public void setAllocationState(AllocationState allocationState) { + this.allocationState = allocationState; + } + + // Use for comparisons only. + public EngineHostPodVO(Long id) { + this.id = id; + } + + @Override + public int hashCode() { + return NumbersUtil.hash(id); + } + + @Override + public boolean getExternalDhcp() { + return externalDhcp; + } + + public void setExternalDhcp(boolean use) { + externalDhcp = use; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EngineHostPodVO) { + return id == ((EngineHostPodVO)obj).id; + } else { + return false; + } + } + + public Date getRemoved() { + return removed; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + public Date getCreated() { + return created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public State getState() { + return engineState; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java new file mode 100644 index 00000000000..4b4a5600380 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EngineHostVO.java @@ -0,0 +1,778 @@ +// 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.engine.datacenter.entity.api.db; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.DiscriminatorColumn; +import javax.persistence.DiscriminatorType; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Inheritance; +import javax.persistence.InheritanceType; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import javax.persistence.Transient; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; + +import com.cloud.host.Status; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.resource.ResourceState; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.StateMachine; + +@Entity +@Table(name="host") +@Inheritance(strategy=InheritanceType.TABLE_PER_CLASS) +@DiscriminatorColumn(name="type", discriminatorType=DiscriminatorType.STRING, length=32) +public class EngineHostVO implements EngineHost, Identity { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="disconnected") + @Temporal(value=TemporalType.TIMESTAMP) + private Date disconnectedOn; + + @Column(name="name", nullable=false) + private String name = null; + + /** + * Note: There is no setter for status because it has to be set in the dao code. + */ + @Column(name="status", nullable=false) + private Status status = null; + + @Column(name="type", updatable = true, nullable=false) + @Enumerated(value=EnumType.STRING) + private Type type; + + @Column(name="private_ip_address", nullable=false) + private String privateIpAddress; + + @Column(name="private_mac_address", nullable=false) + private String privateMacAddress; + + @Column(name="private_netmask", nullable=false) + private String privateNetmask; + + @Column(name="public_netmask") + private String publicNetmask; + + @Column(name="public_ip_address") + private String publicIpAddress; + + @Column(name="public_mac_address") + private String publicMacAddress; + + @Column(name="storage_ip_address") + private String storageIpAddress; + + @Column(name="cluster_id") + private Long clusterId; + + @Column(name="storage_netmask") + private String storageNetmask; + + @Column(name="storage_mac_address") + private String storageMacAddress; + + @Column(name="storage_ip_address_2") + private String storageIpAddressDeux; + + @Column(name="storage_netmask_2") + private String storageNetmaskDeux; + + @Column(name="storage_mac_address_2") + private String storageMacAddressDeux; + + @Column(name="hypervisor_type", updatable = true, nullable=false) + @Enumerated(value=EnumType.STRING) + private HypervisorType hypervisorType; + + @Column(name="proxy_port") + private Integer proxyPort; + + @Column(name="resource") + private String resource; + + @Column(name="fs_type") + private StoragePoolType fsType; + + @Column(name="available") + private boolean available = true; + + @Column(name="setup") + private boolean setup = false; + + @Column(name="resource_state", nullable=false) + @Enumerated(value=EnumType.STRING) + private ResourceState resourceState; + + @Column(name="hypervisor_version") + private String hypervisorVersion; + + @Column(name="update_count", updatable = true, nullable=false) + protected long updated; // This field should be updated everytime the state is updated. There's no set method in the vo object because it is done with in the dao code. + + @Column(name="uuid") + private String uuid; + + // This is a delayed load value. If the value is null, + // then this field has not been loaded yet. + // Call host dao to load it. + @Transient + Map details; + + // This is a delayed load value. If the value is null, + // then this field has not been loaded yet. + // Call host dao to load it. + @Transient + List hostTags; + + @Override + public String getStorageIpAddressDeux() { + return storageIpAddressDeux; + } + + public void setStorageIpAddressDeux(String deuxStorageIpAddress) { + this.storageIpAddressDeux = deuxStorageIpAddress; + } + + @Override + public String getStorageNetmaskDeux() { + return storageNetmaskDeux; + } + + @Override + public Long getClusterId() { + return clusterId; + } + + public void setClusterId(Long clusterId) { + this.clusterId = clusterId; + } + + public void setStorageNetmaskDeux(String deuxStorageNetmask) { + this.storageNetmaskDeux = deuxStorageNetmask; + } + + @Override + public String getStorageMacAddressDeux() { + return storageMacAddressDeux; + } + + public void setStorageMacAddressDeux(String duexStorageMacAddress) { + this.storageMacAddressDeux = duexStorageMacAddress; + } + + @Override + public String getPrivateMacAddress() { + return privateMacAddress; + } + + public void setPrivateMacAddress(String privateMacAddress) { + this.privateMacAddress = privateMacAddress; + } + + public boolean isAvailable() { + return available; + } + + public void setAvailable(boolean available) { + this.available = available; + } + + @Override + public String getPrivateNetmask() { + return privateNetmask; + } + + public void setPrivateNetmask(String privateNetmask) { + this.privateNetmask = privateNetmask; + } + + @Override + public String getPublicNetmask() { + return publicNetmask; + } + + public void setPublicNetmask(String publicNetmask) { + this.publicNetmask = publicNetmask; + } + + @Override + public String getPublicIpAddress() { + return publicIpAddress; + } + + public void setPublicIpAddress(String publicIpAddress) { + this.publicIpAddress = publicIpAddress; + } + + @Override + public String getPublicMacAddress() { + return publicMacAddress; + } + + public void setPublicMacAddress(String publicMacAddress) { + this.publicMacAddress = publicMacAddress; + } + + @Override + public String getStorageIpAddress() { + return storageIpAddress; + } + + public void setStorageIpAddress(String storageIpAddress) { + this.storageIpAddress = storageIpAddress; + } + + @Override + public String getStorageNetmask() { + return storageNetmask; + } + + public void setStorageNetmask(String storageNetmask) { + this.storageNetmask = storageNetmask; + } + + @Override + public String getStorageMacAddress() { + return storageMacAddress; + } + + public boolean isSetup() { + return setup; + } + + public void setSetup(boolean setup) { + this.setup = setup; + } + + public void setStorageMacAddress(String storageMacAddress) { + this.storageMacAddress = storageMacAddress; + } + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public Map getDetails() { + return details; + } + + public String getDetail(String name) { + assert (details != null) : "Did you forget to load the details?"; + + return details != null ? details.get(name) : null; + } + + public void setDetail(String name, String value) { + assert (details != null) : "Did you forget to load the details?"; + + details.put(name, value); + } + + public void setDetails(Map details) { + this.details = details; + } + + public List getHostTags() { + return hostTags; + } + + public void setHostTags(List hostTags) { + this.hostTags = hostTags; + } + + @Column(name="data_center_id", nullable=false) + private long dataCenterId; + + @Column(name="pod_id") + private Long podId; + + @Column(name="cpus") + private Integer cpus; + + @Column(name="url") + private String storageUrl; + + @Column(name="speed") + private Long speed; + + @Column(name="ram") + private long totalMemory; + + @Column(name="parent", nullable=false) + private String parent; + + @Column(name="guid", updatable=true, nullable=false) + private String guid; + + @Column(name="capabilities") + private String caps; + + @Column(name="total_size") + private Long totalSize; + + @Column(name="last_ping") + private long lastPinged; + + @Column(name="mgmt_server_id") + private Long managementServerId; + + @Column(name="dom0_memory") + private long dom0MinMemory; + + @Column(name="version") + private String version; + + @Column(name=GenericDao.CREATED_COLUMN) + private Date created; + + @Column(name=GenericDao.REMOVED_COLUMN) + private Date removed; + + //orchestration + @Column(name="owner") + private String owner = null; + + @Column(name="lastUpdated", updatable=true) + @Temporal(value=TemporalType.TIMESTAMP) + protected Date lastUpdated; + + /** + * Note that state is intentionally missing the setter. Any updates to + * the state machine needs to go through the DAO object because someone + * else could be updating it as well. + */ + @Enumerated(value=EnumType.STRING) + @StateMachine(state=State.class, event=Event.class) + @Column(name="engine_state", updatable=true, nullable=false, length=32) + protected State engineState = null; + + + public EngineHostVO(String guid) { + this.guid = guid; + this.status = Status.Creating; + this.totalMemory = 0; + this.dom0MinMemory = 0; + this.resourceState = ResourceState.Creating; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + protected EngineHostVO() { + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + public EngineHostVO(long id, + String name, + Type type, + String privateIpAddress, + String privateNetmask, + String privateMacAddress, + String publicIpAddress, + String publicNetmask, + String publicMacAddress, + String storageIpAddress, + String storageNetmask, + String storageMacAddress, + String deuxStorageIpAddress, + String duxStorageNetmask, + String deuxStorageMacAddress, + String guid, + Status status, + String version, + String iqn, + Date disconnectedOn, + long dcId, + Long podId, + long serverId, + long ping, + String parent, + long totalSize, + StoragePoolType fsType) { + this(id, name, type, privateIpAddress, privateNetmask, privateMacAddress, publicIpAddress, publicNetmask, publicMacAddress, storageIpAddress, storageNetmask, storageMacAddress, guid, status, version, iqn, disconnectedOn, dcId, podId, serverId, ping, null, null, null, 0, null); + this.parent = parent; + this.totalSize = totalSize; + this.fsType = fsType; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + public EngineHostVO(long id, + String name, + Type type, + String privateIpAddress, + String privateNetmask, + String privateMacAddress, + String publicIpAddress, + String publicNetmask, + String publicMacAddress, + String storageIpAddress, + String storageNetmask, + String storageMacAddress, + String guid, + Status status, + String version, + String url, + Date disconnectedOn, + long dcId, + Long podId, + long serverId, + long ping, + Integer cpus, + Long speed, + Long totalMemory, + long dom0MinMemory, + String caps) { + this.id = id; + this.name = name; + this.status = status; + this.type = type; + this.privateIpAddress = privateIpAddress; + this.privateNetmask = privateNetmask; + this.privateMacAddress = privateMacAddress; + this.publicIpAddress = publicIpAddress; + this.publicNetmask = publicNetmask; + this.publicMacAddress = publicMacAddress; + this.storageIpAddress = storageIpAddress; + this.storageNetmask = storageNetmask; + this.storageMacAddress = storageMacAddress; + this.dataCenterId = dcId; + this.podId = podId; + this.cpus = cpus; + this.version = version; + this.speed = speed; + this.totalMemory = totalMemory != null ? totalMemory : 0; + this.guid = guid; + this.parent = null; + this.totalSize = null; + this.fsType = null; + this.managementServerId = serverId; + this.lastPinged = ping; + this.caps = caps; + this.disconnectedOn = disconnectedOn; + this.dom0MinMemory = dom0MinMemory; + this.storageUrl = url; + this.uuid = UUID.randomUUID().toString(); + this.engineState = State.Disabled; + } + + public void setPodId(Long podId) { + + this.podId = podId; + } + + public void setDataCenterId(long dcId) { + this.dataCenterId = dcId; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setStorageUrl(String url) { + this.storageUrl = url; + } + + public void setDisconnectedOn(Date disconnectedOn) { + this.disconnectedOn = disconnectedOn; + } + + public String getStorageUrl() { + return storageUrl; + } + + public void setName(String name) { + this.name = name; + } + + public void setPrivateIpAddress(String ipAddress) { + this.privateIpAddress = ipAddress; + } + + public void setCpus(Integer cpus) { + this.cpus = cpus; + } + + public void setSpeed(Long speed) { + this.speed = speed; + } + + public void setTotalMemory(long totalMemory) { + this.totalMemory = totalMemory; + } + + public void setParent(String parent) { + this.parent = parent; + } + + public void setCaps(String caps) { + this.caps = caps; + } + + public void setTotalSize(Long totalSize) { + this.totalSize = totalSize; + } + + public void setLastPinged(long lastPinged) { + this.lastPinged = lastPinged; + } + + public void setManagementServerId(Long managementServerId) { + this.managementServerId = managementServerId; + } + + @Override + public long getLastPinged() { + return lastPinged; + } + + @Override + public String getParent() { + return parent; + } + + @Override + public long getTotalSize() { + return totalSize; + } + + @Override + public String getCapabilities() { + return caps; + } + + @Override + public Date getCreated() { + return created; + } + + @Override + public Date getRemoved() { + return removed; + } + + @Override + public String getVersion() { + return version; + } + + public void setType(Type type) { + this.type = type; + } + + @Override + public long getId() { + return id; + } + + @Override + public String getName() { + return name; + } + + @Override + public Status getStatus() { + return status; + } + + @Override + public long getDataCenterId() { + return dataCenterId; + } + + @Override + public Long getPodId() { + return podId; + } + + @Override + public Long getManagementServerId() { + return managementServerId; + } + + @Override + public Date getDisconnectedOn() { + return disconnectedOn; + } + + @Override + public String getPrivateIpAddress() { + return privateIpAddress; + } + + @Override + public String getGuid() { + return guid; + } + + public void setGuid(String guid) { + this.guid = guid; + } + + @Override + public Integer getCpus() { + return cpus; + } + + @Override + public Long getSpeed() { + return speed; + } + + @Override + public Long getTotalMemory() { + return totalMemory; + } + + @Override + public Integer getProxyPort() { + return proxyPort; + } + + public void setProxyPort(Integer port) { + proxyPort = port; + } + + public StoragePoolType getFsType() { + return fsType; + } + + @Override + public Type getType() { + return type; + } + + @Override + public int hashCode() { + return NumbersUtil.hash(id); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof EngineHostVO) { + return ((EngineHostVO)obj).getId() == this.getId(); + } else { + return false; + } + } + + @Override + public String toString() { + return new StringBuilder("Host[").append("-").append(id).append("-").append(type).append("]").toString(); + } + + public void setHypervisorType(HypervisorType hypervisorType) { + this.hypervisorType = hypervisorType; + } + + @Override + public HypervisorType getHypervisorType() { + return hypervisorType; + } + + public void setHypervisorVersion(String hypervisorVersion) { + this.hypervisorVersion = hypervisorVersion; + } + + @Override + public String getHypervisorVersion() { + return hypervisorVersion; + } + + @Override + + // TODO, I tempoerary disable it as it breaks GenericSearchBuild when @Transient is applied + // @Transient + public Status getState() { + return status; + } + + @Override + public ResourceState getResourceState() { + return resourceState; + } + + public void setResourceState(ResourceState state) { + resourceState = state; + } + + @Override + public boolean isInMaintenanceStates() { + return (getResourceState() == ResourceState.Maintenance || getResourceState() == ResourceState.ErrorInMaintenance + || getResourceState() == ResourceState.PrepareForMaintenance); + } + + public long getUpdated() { + return updated; + } + + public long incrUpdated() { + updated++; + return updated; + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getOwner() { + return owner; + } + + public void setOwner(String owner) { + this.owner = owner; + } + + + public Date getLastUpdated() { + return lastUpdated; + } + + public State getOrchestrationState() { + return engineState; + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java new file mode 100644 index 00000000000..3983dd90420 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/EnginePod.java @@ -0,0 +1,23 @@ +// 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.engine.datacenter.entity.api.db; + +import com.cloud.dc.Pod; + +public interface EnginePod extends Pod { + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDao.java new file mode 100644 index 00000000000..ef1b3a0a57e --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDao.java @@ -0,0 +1,29 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO; + +import com.cloud.utils.db.GenericDao; + +public interface DcDetailsDao extends GenericDao { + Map findDetails(long dcId); + + void persist(long dcId, Map details); + + DcDetailVO findDetail(long dcId, String name); + + void deleteDetails(long dcId); +} \ No newline at end of file diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDaoImpl.java new file mode 100644 index 00000000000..60eec4cf913 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/DcDetailsDaoImpl.java @@ -0,0 +1,94 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; + +import org.apache.cloudstack.engine.datacenter.entity.api.db.DcDetailVO; +import org.springframework.stereotype.Component; + + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component(value="EngineDcDetailsDao") +@Local(value=DcDetailsDao.class) +public class DcDetailsDaoImpl extends GenericDaoBase implements DcDetailsDao { + protected final SearchBuilder DcSearch; + protected final SearchBuilder DetailSearch; + + protected DcDetailsDaoImpl() { + DcSearch = createSearchBuilder(); + DcSearch.and("dcId", DcSearch.entity().getDcId(), SearchCriteria.Op.EQ); + DcSearch.done(); + + DetailSearch = createSearchBuilder(); + DetailSearch.and("dcId", DetailSearch.entity().getDcId(), SearchCriteria.Op.EQ); + DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ); + DetailSearch.done(); + } + + @Override + public DcDetailVO findDetail(long dcId, String name) { + SearchCriteria sc = DetailSearch.create(); + sc.setParameters("dcId", dcId); + sc.setParameters("name", name); + + return findOneIncludingRemovedBy(sc); + } + + @Override + public Map findDetails(long dcId) { + SearchCriteria sc = DcSearch.create(); + sc.setParameters("dcId", dcId); + + List results = search(sc, null); + Map details = new HashMap(results.size()); + for (DcDetailVO result : results) { + details.put(result.getName(), result.getValue()); + } + return details; + } + + @Override + public void deleteDetails(long dcId) { + SearchCriteria sc = DcSearch.create(); + sc.setParameters("dcId", dcId); + + List results = search(sc, null); + for (DcDetailVO result : results) { + remove(result.getId()); + } + } + + @Override + public void persist(long dcId, Map details) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + SearchCriteria sc = DcSearch.create(); + sc.setParameters("dcId", dcId); + expunge(sc); + + for (Map.Entry detail : details.entrySet()) { + DcDetailVO vo = new DcDetailVO(dcId, detail.getKey(), detail.getValue()); + persist(vo); + } + txn.commit(); + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDao.java new file mode 100644 index 00000000000..af1b1536e26 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDao.java @@ -0,0 +1,37 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; + + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +public interface EngineClusterDao extends GenericDao, StateDao { + List listByPodId(long podId); + EngineClusterVO findBy(String name, long podId); + List listByHyTypeWithoutGuid(String hyType); + List listByZoneId(long zoneId); + + List getAvailableHypervisorInZone(Long zoneId); + List listByDcHyType(long dcId, String hyType); + Map> getPodClusterIdMap(List clusterIds); + List listDisabledClusters(long zoneId, Long podId); + List listClustersWithDisabledPods(long zoneId); +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDaoImpl.java new file mode 100644 index 00000000000..1f0bd4d84af --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineClusterDaoImpl.java @@ -0,0 +1,288 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Grouping; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Func; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.UpdateBuilder; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component(value="EngineClusterDao") +@Local(value=EngineClusterDao.class) +public class EngineClusterDaoImpl extends GenericDaoBase implements EngineClusterDao { + private static final Logger s_logger = Logger.getLogger(EngineClusterDaoImpl.class); + + protected final SearchBuilder PodSearch; + protected final SearchBuilder HyTypeWithoutGuidSearch; + protected final SearchBuilder AvailHyperSearch; + protected final SearchBuilder ZoneSearch; + protected final SearchBuilder ZoneHyTypeSearch; + protected SearchBuilder StateChangeSearch; + protected SearchBuilder UUIDSearch; + + private static final String GET_POD_CLUSTER_MAP_PREFIX = "SELECT pod_id, id FROM cloud.cluster WHERE cluster.id IN( "; + private static final String GET_POD_CLUSTER_MAP_SUFFIX = " )"; + + @Inject protected EngineHostPodDao _hostPodDao; + + protected EngineClusterDaoImpl() { + super(); + + HyTypeWithoutGuidSearch = createSearchBuilder(); + HyTypeWithoutGuidSearch.and("hypervisorType", HyTypeWithoutGuidSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); + HyTypeWithoutGuidSearch.and("guid", HyTypeWithoutGuidSearch.entity().getGuid(), SearchCriteria.Op.NULL); + HyTypeWithoutGuidSearch.done(); + + ZoneHyTypeSearch = createSearchBuilder(); + ZoneHyTypeSearch.and("hypervisorType", ZoneHyTypeSearch.entity().getHypervisorType(), SearchCriteria.Op.EQ); + ZoneHyTypeSearch.and("dataCenterId", ZoneHyTypeSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + ZoneHyTypeSearch.done(); + + PodSearch = createSearchBuilder(); + PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ); + PodSearch.and("name", PodSearch.entity().getName(), SearchCriteria.Op.EQ); + PodSearch.done(); + + ZoneSearch = createSearchBuilder(); + ZoneSearch.and("dataCenterId", ZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + ZoneSearch.groupBy(ZoneSearch.entity().getHypervisorType()); + ZoneSearch.done(); + + AvailHyperSearch = createSearchBuilder(); + AvailHyperSearch.and("zoneId", AvailHyperSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + AvailHyperSearch.select(null, Func.DISTINCT, AvailHyperSearch.entity().getHypervisorType()); + AvailHyperSearch.done(); + + UUIDSearch = createSearchBuilder(); + UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ); + UUIDSearch.done(); + + StateChangeSearch = createSearchBuilder(); + StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); + StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); + StateChangeSearch.done(); + } + + @Override + public List listByZoneId(long zoneId) { + SearchCriteria sc = ZoneSearch.create(); + sc.setParameters("dataCenterId", zoneId); + return listBy(sc); + } + + @Override + public List listByPodId(long podId) { + SearchCriteria sc = PodSearch.create(); + sc.setParameters("pod", podId); + + return listBy(sc); + } + + @Override + public EngineClusterVO findBy(String name, long podId) { + SearchCriteria sc = PodSearch.create(); + sc.setParameters("pod", podId); + sc.setParameters("name", name); + + return findOneBy(sc); + } + + @Override + public List listByHyTypeWithoutGuid(String hyType) { + SearchCriteria sc = HyTypeWithoutGuidSearch.create(); + sc.setParameters("hypervisorType", hyType); + + return listBy(sc); + } + + @Override + public List listByDcHyType(long dcId, String hyType) { + SearchCriteria sc = ZoneHyTypeSearch.create(); + sc.setParameters("dataCenterId", dcId); + sc.setParameters("hypervisorType", hyType); + return listBy(sc); + } + + @Override + public List getAvailableHypervisorInZone(Long zoneId) { + SearchCriteria sc = AvailHyperSearch.create(); + if (zoneId != null) { + sc.setParameters("zoneId", zoneId); + } + List clusters = listBy(sc); + List hypers = new ArrayList(4); + for (EngineClusterVO cluster : clusters) { + hypers.add(cluster.getHypervisorType()); + } + + return hypers; + } + + @Override + public Map> getPodClusterIdMap(List clusterIds){ + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + Map> result = new HashMap>(); + + try { + StringBuilder sql = new StringBuilder(GET_POD_CLUSTER_MAP_PREFIX); + if (clusterIds.size() > 0) { + for (Long clusterId : clusterIds) { + sql.append(clusterId).append(","); + } + sql.delete(sql.length()-1, sql.length()); + sql.append(GET_POD_CLUSTER_MAP_SUFFIX); + } + + pstmt = txn.prepareAutoCloseStatement(sql.toString()); + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + Long podId = rs.getLong(1); + Long clusterIdInPod = rs.getLong(2); + if(result.containsKey(podId)){ + List clusterList = result.get(podId); + clusterList.add(clusterIdInPod); + result.put(podId, clusterList); + }else{ + List clusterList = new ArrayList(); + clusterList.add(clusterIdInPod); + result.put(podId, clusterList); + } + } + return result; + } catch (SQLException e) { + throw new CloudRuntimeException("DB Exception on: " + GET_POD_CLUSTER_MAP_PREFIX, e); + } catch (Throwable e) { + throw new CloudRuntimeException("Caught: " + GET_POD_CLUSTER_MAP_PREFIX, e); + } + } + + @Override + public List listDisabledClusters(long zoneId, Long podId) { + GenericSearchBuilder clusterIdSearch = createSearchBuilder(Long.class); + clusterIdSearch.selectField(clusterIdSearch.entity().getId()); + clusterIdSearch.and("dataCenterId", clusterIdSearch.entity().getDataCenterId(), Op.EQ); + if(podId != null){ + clusterIdSearch.and("podId", clusterIdSearch.entity().getPodId(), Op.EQ); + } + clusterIdSearch.and("allocationState", clusterIdSearch.entity().getAllocationState(), Op.EQ); + clusterIdSearch.done(); + + + SearchCriteria sc = clusterIdSearch.create(); + sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId); + if (podId != null) { + sc.addAnd("podId", SearchCriteria.Op.EQ, podId); + } + sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled); + return customSearch(sc, null); + } + + @Override + public List listClustersWithDisabledPods(long zoneId) { + + GenericSearchBuilder disabledPodIdSearch = _hostPodDao.createSearchBuilder(Long.class); + disabledPodIdSearch.selectField(disabledPodIdSearch.entity().getId()); + disabledPodIdSearch.and("dataCenterId", disabledPodIdSearch.entity().getDataCenterId(), Op.EQ); + disabledPodIdSearch.and("allocationState", disabledPodIdSearch.entity().getAllocationState(), Op.EQ); + + GenericSearchBuilder clusterIdSearch = createSearchBuilder(Long.class); + clusterIdSearch.selectField(clusterIdSearch.entity().getId()); + clusterIdSearch.join("disabledPodIdSearch", disabledPodIdSearch, clusterIdSearch.entity().getPodId(), disabledPodIdSearch.entity().getId(), JoinBuilder.JoinType.INNER); + clusterIdSearch.done(); + + + SearchCriteria sc = clusterIdSearch.create(); + sc.setJoinParameters("disabledPodIdSearch", "dataCenterId", zoneId); + sc.setJoinParameters("disabledPodIdSearch", "allocationState", Grouping.AllocationState.Disabled); + + return customSearch(sc, null); + } + + @Override + public boolean remove(Long id) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + EngineClusterVO cluster = createForUpdate(); + cluster.setName(null); + cluster.setGuid(null); + + update(id, cluster); + + boolean result = super.remove(id); + txn.commit(); + return result; + } + + @Override + public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity clusterEntity, Object data) { + + EngineClusterVO vo = findById(clusterEntity.getId()); + + Date oldUpdatedTime = vo.getLastUpdated(); + + SearchCriteria sc = StateChangeSearch.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "lastUpdated", new Date()); + + int rows = update(vo, sc); + + if (rows == 0 && s_logger.isDebugEnabled()) { + EngineClusterVO dbCluster = findByIdIncludingRemoved(vo.getId()); + if (dbCluster != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbCluster.getId()).append("; state=").append(dbCluster.getState()).append(";updatedTime=") + .append(dbCluster.getLastUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update dataCenter: id=" + vo.getId() + ", as there is no such dataCenter exists in the database anymore"); + } + } + return rows > 0; + + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDao.java new file mode 100644 index 00000000000..83060cfee2f --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDao.java @@ -0,0 +1,54 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.List; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; + + +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + + +public interface EngineDataCenterDao extends GenericDao, StateDao { + EngineDataCenterVO findByName(String name); + + /** + * @param id data center id + * @return a pair of mac address strings. The first one is private and second is public. + */ + String[] getNextAvailableMacAddressPair(long id); + String[] getNextAvailableMacAddressPair(long id, long mask); + List findZonesByDomainId(Long domainId); + + List listPublicZones(String keyword); + + List findChildZones(Object[] ids, String keyword); + + void loadDetails(EngineDataCenterVO zone); + void saveDetails(EngineDataCenterVO zone); + + List listDisabledZones(); + List listEnabledZones(); + EngineDataCenterVO findByToken(String zoneToken); + EngineDataCenterVO findByTokenOrIdOrName(String tokenIdOrName); + + + + List findZonesByDomainId(Long domainId, String keyword); + + List findByKeyword(String keyword); + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDaoImpl.java new file mode 100644 index 00000000000..f99bc6c0c09 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineDataCenterDaoImpl.java @@ -0,0 +1,327 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Random; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import javax.persistence.TableGenerator; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.org.Grouping; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SequenceFetcher; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.UpdateBuilder; +import com.cloud.utils.net.NetUtils; + +/** + * @config + * {@table + * || Param Name | Description | Values | Default || + * || mac.address.prefix | prefix to attach to all public and private mac addresses | number | 06 || + * } + **/ +@Component(value="EngineDataCenterDao") +@Local(value={EngineDataCenterDao.class}) +public class EngineDataCenterDaoImpl extends GenericDaoBase implements EngineDataCenterDao { + private static final Logger s_logger = Logger.getLogger(EngineDataCenterDaoImpl.class); + + protected SearchBuilder NameSearch; + protected SearchBuilder ListZonesByDomainIdSearch; + protected SearchBuilder PublicZonesSearch; + protected SearchBuilder ChildZonesSearch; + protected SearchBuilder DisabledZonesSearch; + protected SearchBuilder TokenSearch; + protected SearchBuilder StateChangeSearch; + protected SearchBuilder UUIDSearch; + + protected long _prefix; + protected Random _rand = new Random(System.currentTimeMillis()); + protected TableGenerator _tgMacAddress; + + @Inject protected DcDetailsDao _detailsDao; + + + @Override + public EngineDataCenterVO findByName(String name) { + SearchCriteria sc = NameSearch.create(); + sc.setParameters("name", name); + return findOneBy(sc); + } + + + @Override + public EngineDataCenterVO findByToken(String zoneToken){ + SearchCriteria sc = TokenSearch.create(); + sc.setParameters("zoneToken", zoneToken); + return findOneBy(sc); + } + + @Override + public List findZonesByDomainId(Long domainId){ + SearchCriteria sc = ListZonesByDomainIdSearch.create(); + sc.setParameters("domainId", domainId); + return listBy(sc); + } + + @Override + public List findZonesByDomainId(Long domainId, String keyword){ + SearchCriteria sc = ListZonesByDomainIdSearch.create(); + sc.setParameters("domainId", domainId); + if (keyword != null) { + SearchCriteria ssc = createSearchCriteria(); + ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + sc.addAnd("name", SearchCriteria.Op.SC, ssc); + } + return listBy(sc); + } + + @Override + public List findChildZones(Object[] ids, String keyword){ + SearchCriteria sc = ChildZonesSearch.create(); + sc.setParameters("domainid", ids); + if (keyword != null) { + SearchCriteria ssc = createSearchCriteria(); + ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + sc.addAnd("name", SearchCriteria.Op.SC, ssc); + } + return listBy(sc); + } + + @Override + public List listPublicZones(String keyword){ + SearchCriteria sc = PublicZonesSearch.create(); + if (keyword != null) { + SearchCriteria ssc = createSearchCriteria(); + ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + sc.addAnd("name", SearchCriteria.Op.SC, ssc); + } + //sc.setParameters("domainId", domainId); + return listBy(sc); + } + + @Override + public List findByKeyword(String keyword){ + SearchCriteria ssc = createSearchCriteria(); + ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%"); + return listBy(ssc); + } + + + @Override + public String[] getNextAvailableMacAddressPair(long id) { + return getNextAvailableMacAddressPair(id, 0); + } + + @Override + public String[] getNextAvailableMacAddressPair(long id, long mask) { + SequenceFetcher fetch = SequenceFetcher.getInstance(); + + long seq = fetch.getNextSequence(Long.class, _tgMacAddress, id); + seq = seq | _prefix | ((id & 0x7f) << 32); + seq |= mask; + seq |= ((_rand.nextInt(Short.MAX_VALUE) << 16) & 0x00000000ffff0000l); + String[] pair = new String[2]; + pair[0] = NetUtils.long2Mac(seq); + pair[1] = NetUtils.long2Mac(seq | 0x1l << 39); + return pair; + } + + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + if (!super.configure(name, params)) { + return false; + } + + String value = (String)params.get("mac.address.prefix"); + _prefix = (long)NumbersUtil.parseInt(value, 06) << 40; + + return true; + } + + protected EngineDataCenterDaoImpl() { + super(); + NameSearch = createSearchBuilder(); + NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ); + NameSearch.done(); + + ListZonesByDomainIdSearch = createSearchBuilder(); + ListZonesByDomainIdSearch.and("domainId", ListZonesByDomainIdSearch.entity().getDomainId(), SearchCriteria.Op.EQ); + ListZonesByDomainIdSearch.done(); + + PublicZonesSearch = createSearchBuilder(); + PublicZonesSearch.and("domainId", PublicZonesSearch.entity().getDomainId(), SearchCriteria.Op.NULL); + PublicZonesSearch.done(); + + ChildZonesSearch = createSearchBuilder(); + ChildZonesSearch.and("domainid", ChildZonesSearch.entity().getDomainId(), SearchCriteria.Op.IN); + ChildZonesSearch.done(); + + DisabledZonesSearch = createSearchBuilder(); + DisabledZonesSearch.and("allocationState", DisabledZonesSearch.entity().getAllocationState(), SearchCriteria.Op.EQ); + DisabledZonesSearch.done(); + + TokenSearch = createSearchBuilder(); + TokenSearch.and("zoneToken", TokenSearch.entity().getZoneToken(), SearchCriteria.Op.EQ); + TokenSearch.done(); + + StateChangeSearch = createSearchBuilder(); + StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); + StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); + StateChangeSearch.done(); + + UUIDSearch = createSearchBuilder(); + UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ); + UUIDSearch.done(); + + + _tgMacAddress = _tgs.get("macAddress"); + assert _tgMacAddress != null : "Couldn't get mac address table generator"; + } + + @Override @DB + public boolean update(Long zoneId, EngineDataCenterVO zone) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + boolean persisted = super.update(zoneId, zone); + if (!persisted) { + return persisted; + } + saveDetails(zone); + txn.commit(); + return persisted; + } + + @Override + public void loadDetails(EngineDataCenterVO zone) { + Map details =_detailsDao.findDetails(zone.getId()); + zone.setDetails(details); + } + + @Override + public void saveDetails(EngineDataCenterVO zone) { + Map details = zone.getDetails(); + if (details == null) { + return; + } + _detailsDao.persist(zone.getId(), details); + } + + @Override + public List listDisabledZones(){ + SearchCriteria sc = DisabledZonesSearch.create(); + sc.setParameters("allocationState", Grouping.AllocationState.Disabled); + + List dcs = listBy(sc); + + return dcs; + } + + @Override + public List listEnabledZones(){ + SearchCriteria sc = DisabledZonesSearch.create(); + sc.setParameters("allocationState", Grouping.AllocationState.Enabled); + + List dcs = listBy(sc); + + return dcs; + } + + @Override + public EngineDataCenterVO findByTokenOrIdOrName(String tokenOrIdOrName) { + EngineDataCenterVO result = findByToken(tokenOrIdOrName); + if (result == null) { + result = findByName(tokenOrIdOrName); + if (result == null) { + try { + Long dcId = Long.parseLong(tokenOrIdOrName); + return findById(dcId); + } catch (NumberFormatException nfe) { + + } + } + } + return result; + } + + @Override + public boolean remove(Long id) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + EngineDataCenterVO zone = createForUpdate(); + zone.setName(null); + + update(id, zone); + + boolean result = super.remove(id); + txn.commit(); + return result; + } + + + @Override + public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity zoneEntity, Object data) { + + EngineDataCenterVO vo = findById(zoneEntity.getId()); + + Date oldUpdatedTime = vo.getLastUpdated(); + + SearchCriteria sc = StateChangeSearch.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "lastUpdated", new Date()); + + int rows = update(vo, sc); + + if (rows == 0 && s_logger.isDebugEnabled()) { + EngineDataCenterVO dbDC = findByIdIncludingRemoved(vo.getId()); + if (dbDC != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbDC.getId()).append("; state=").append(dbDC.getState()).append(";updatedTime=") + .append(dbDC.getLastUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update dataCenter: id=" + vo.getId() + ", as there is no such dataCenter exists in the database anymore"); + } + } + return rows > 0; + + } + + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.java new file mode 100644 index 00000000000..a27ed505289 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDao.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.engine.datacenter.entity.api.db.dao; + +import java.util.Date; +import java.util.List; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; + +import com.cloud.host.Host; +import com.cloud.host.Host.Type; +import com.cloud.host.Status; +import com.cloud.info.RunningHostCountInfo; +import com.cloud.resource.ResourceState; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +/** + * Data Access Object for server + * + */ +public interface EngineHostDao extends GenericDao, StateDao { + long countBy(long clusterId, ResourceState... states); + + /** + * Mark all hosts associated with a certain management server + * as disconnected. + * + * @param msId management server id. + */ + void markHostsAsDisconnected(long msId, long lastPing); + + List findLostHosts(long timeout); + + List findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId); + + List getRunningHostCounts(Date cutTime); + + long getNextSequence(long hostId); + + void loadDetails(EngineHostVO host); + + void saveDetails(EngineHostVO host); + + void loadHostTags(EngineHostVO host); + + List listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag); + + long countRoutingHostsByDataCenter(long dcId); + + List findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId); + + boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo); + + EngineHostVO findByGuid(String guid); + + EngineHostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type); + List findHypervisorHostInCluster(long clusterId); + + + /** + * @param type + * @param clusterId + * @param podId + * @param dcId + * @param haTag TODO + * @return + */ + List listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag); +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java new file mode 100644 index 00000000000..3c34023c01c --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostDaoImpl.java @@ -0,0 +1,809 @@ +// 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.engine.datacenter.entity.api.db.dao; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.TimeZone; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.persistence.TableGenerator; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.host.Host; +import com.cloud.host.Host.Type; +import com.cloud.host.HostTagVO; +import com.cloud.host.Status; +import com.cloud.info.RunningHostCountInfo; +import com.cloud.org.Managed; +import com.cloud.resource.ResourceState; +import com.cloud.utils.DateUtil; +import com.cloud.utils.db.Attribute; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.JoinBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Func; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.UpdateBuilder; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component(value="EngineHostDao") +@Local(value = { EngineHostDao.class }) +@DB(txn = false) +@TableGenerator(name = "host_req_sq", table = "op_host", pkColumnName = "id", valueColumnName = "sequence", allocationSize = 1) +public class EngineHostDaoImpl extends GenericDaoBase implements EngineHostDao { + private static final Logger s_logger = Logger.getLogger(EngineHostDaoImpl.class); + private static final Logger status_logger = Logger.getLogger(Status.class); + private static final Logger state_logger = Logger.getLogger(ResourceState.class); + + protected final SearchBuilder TypePodDcStatusSearch; + + protected final SearchBuilder IdStatusSearch; + protected final SearchBuilder TypeDcSearch; + protected final SearchBuilder TypeDcStatusSearch; + protected final SearchBuilder TypeClusterStatusSearch; + protected final SearchBuilder MsStatusSearch; + protected final SearchBuilder DcPrivateIpAddressSearch; + protected final SearchBuilder DcStorageIpAddressSearch; + + protected final SearchBuilder GuidSearch; + protected final SearchBuilder DcSearch; + protected final SearchBuilder PodSearch; + protected final SearchBuilder TypeSearch; + protected final SearchBuilder StatusSearch; + protected final SearchBuilder ResourceStateSearch; + protected final SearchBuilder NameLikeSearch; + protected final SearchBuilder NameSearch; + protected final SearchBuilder SequenceSearch; + protected final SearchBuilder DirectlyConnectedSearch; + protected final SearchBuilder UnmanagedDirectConnectSearch; + protected final SearchBuilder UnmanagedApplianceSearch; + protected final SearchBuilder MaintenanceCountSearch; + protected final SearchBuilder ClusterStatusSearch; + protected final SearchBuilder TypeNameZoneSearch; + protected final SearchBuilder AvailHypevisorInZone; + + protected final SearchBuilder DirectConnectSearch; + protected final SearchBuilder ManagedDirectConnectSearch; + protected final SearchBuilder ManagedRoutingServersSearch; + protected final SearchBuilder SecondaryStorageVMSearch; + protected SearchBuilder StateChangeSearch; + + protected SearchBuilder UUIDSearch; + + protected final GenericSearchBuilder HostsInStatusSearch; + protected final GenericSearchBuilder CountRoutingByDc; + protected final SearchBuilder RoutingSearch; + + protected final Attribute _statusAttr; + protected final Attribute _resourceStateAttr; + protected final Attribute _msIdAttr; + protected final Attribute _pingTimeAttr; + + @Inject protected HostDetailsDao _detailsDao; + @Inject protected HostTagsDao _hostTagsDao; + @Inject protected EngineClusterDao _clusterDao; + + + public EngineHostDaoImpl() { + + MaintenanceCountSearch = createSearchBuilder(); + MaintenanceCountSearch.and("cluster", MaintenanceCountSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + MaintenanceCountSearch.and("resourceState", MaintenanceCountSearch.entity().getResourceState(), SearchCriteria.Op.IN); + MaintenanceCountSearch.done(); + + TypePodDcStatusSearch = createSearchBuilder(); + EngineHostVO entity = TypePodDcStatusSearch.entity(); + TypePodDcStatusSearch.and("type", entity.getType(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ); + TypePodDcStatusSearch.done(); + + MsStatusSearch = createSearchBuilder(); + MsStatusSearch.and("ms", MsStatusSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); + MsStatusSearch.and("type", MsStatusSearch.entity().getType(), SearchCriteria.Op.EQ); + MsStatusSearch.and("resourceState", MsStatusSearch.entity().getResourceState(), SearchCriteria.Op.NIN); + MsStatusSearch.done(); + + TypeDcSearch = createSearchBuilder(); + TypeDcSearch.and("type", TypeDcSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeDcSearch.and("dc", TypeDcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + TypeDcSearch.done(); + + SecondaryStorageVMSearch = createSearchBuilder(); + SecondaryStorageVMSearch.and("type", SecondaryStorageVMSearch.entity().getType(), SearchCriteria.Op.EQ); + SecondaryStorageVMSearch.and("dc", SecondaryStorageVMSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + SecondaryStorageVMSearch.and("status", SecondaryStorageVMSearch.entity().getStatus(), SearchCriteria.Op.EQ); + SecondaryStorageVMSearch.done(); + + TypeDcStatusSearch = createSearchBuilder(); + TypeDcStatusSearch.and("type", TypeDcStatusSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeDcStatusSearch.and("dc", TypeDcStatusSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + TypeDcStatusSearch.and("status", TypeDcStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ); + TypeDcStatusSearch.and("resourceState", TypeDcStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ); + TypeDcStatusSearch.done(); + + TypeClusterStatusSearch = createSearchBuilder(); + TypeClusterStatusSearch.and("type", TypeClusterStatusSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeClusterStatusSearch.and("cluster", TypeClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + TypeClusterStatusSearch.and("status", TypeClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ); + TypeClusterStatusSearch.and("resourceState", TypeClusterStatusSearch.entity().getResourceState(), SearchCriteria.Op.EQ); + TypeClusterStatusSearch.done(); + + IdStatusSearch = createSearchBuilder(); + IdStatusSearch.and("id", IdStatusSearch.entity().getId(), SearchCriteria.Op.EQ); + IdStatusSearch.and("states", IdStatusSearch.entity().getStatus(), SearchCriteria.Op.IN); + IdStatusSearch.done(); + + DcPrivateIpAddressSearch = createSearchBuilder(); + DcPrivateIpAddressSearch.and("privateIpAddress", DcPrivateIpAddressSearch.entity().getPrivateIpAddress(), SearchCriteria.Op.EQ); + DcPrivateIpAddressSearch.and("dc", DcPrivateIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DcPrivateIpAddressSearch.done(); + + DcStorageIpAddressSearch = createSearchBuilder(); + DcStorageIpAddressSearch.and("storageIpAddress", DcStorageIpAddressSearch.entity().getStorageIpAddress(), SearchCriteria.Op.EQ); + DcStorageIpAddressSearch.and("dc", DcStorageIpAddressSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DcStorageIpAddressSearch.done(); + + GuidSearch = createSearchBuilder(); + GuidSearch.and("guid", GuidSearch.entity().getGuid(), SearchCriteria.Op.EQ); + GuidSearch.done(); + + DcSearch = createSearchBuilder(); + DcSearch.and("dc", DcSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DcSearch.done(); + + ClusterStatusSearch = createSearchBuilder(); + ClusterStatusSearch.and("cluster", ClusterStatusSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + ClusterStatusSearch.and("status", ClusterStatusSearch.entity().getStatus(), SearchCriteria.Op.EQ); + ClusterStatusSearch.done(); + + TypeNameZoneSearch = createSearchBuilder(); + TypeNameZoneSearch.and("name", TypeNameZoneSearch.entity().getName(), SearchCriteria.Op.EQ); + TypeNameZoneSearch.and("type", TypeNameZoneSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeNameZoneSearch.and("zoneId", TypeNameZoneSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + TypeNameZoneSearch.done(); + + PodSearch = createSearchBuilder(); + PodSearch.and("pod", PodSearch.entity().getPodId(), SearchCriteria.Op.EQ); + PodSearch.done(); + + TypeSearch = createSearchBuilder(); + TypeSearch.and("type", TypeSearch.entity().getType(), SearchCriteria.Op.EQ); + TypeSearch.done(); + + StatusSearch = createSearchBuilder(); + StatusSearch.and("status", StatusSearch.entity().getStatus(), SearchCriteria.Op.IN); + StatusSearch.done(); + + ResourceStateSearch = createSearchBuilder(); + ResourceStateSearch.and("resourceState", ResourceStateSearch.entity().getResourceState(), SearchCriteria.Op.IN); + ResourceStateSearch.done(); + + NameLikeSearch = createSearchBuilder(); + NameLikeSearch.and("name", NameLikeSearch.entity().getName(), SearchCriteria.Op.LIKE); + NameLikeSearch.done(); + + NameSearch = createSearchBuilder(); + NameSearch.and("name", NameSearch.entity().getName(), SearchCriteria.Op.EQ); + NameSearch.done(); + + SequenceSearch = createSearchBuilder(); + SequenceSearch.and("id", SequenceSearch.entity().getId(), SearchCriteria.Op.EQ); + // SequenceSearch.addRetrieve("sequence", SequenceSearch.entity().getSequence()); + SequenceSearch.done(); + + DirectlyConnectedSearch = createSearchBuilder(); + DirectlyConnectedSearch.and("resource", DirectlyConnectedSearch.entity().getResource(), SearchCriteria.Op.NNULL); + DirectlyConnectedSearch.and("ms", DirectlyConnectedSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); + DirectlyConnectedSearch.and("statuses", DirectlyConnectedSearch.entity().getStatus(), SearchCriteria.Op.EQ); + DirectlyConnectedSearch.and("resourceState", DirectlyConnectedSearch.entity().getResourceState(), SearchCriteria.Op.NOTIN); + DirectlyConnectedSearch.done(); + + UnmanagedDirectConnectSearch = createSearchBuilder(); + UnmanagedDirectConnectSearch.and("resource", UnmanagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL); + UnmanagedDirectConnectSearch.and("server", UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); + UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ); + UnmanagedDirectConnectSearch.and("resourceStates", UnmanagedDirectConnectSearch.entity().getResourceState(), SearchCriteria.Op.NIN); + /* + * UnmanagedDirectConnectSearch.op(SearchCriteria.Op.OR, "managementServerId", + * UnmanagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); + * UnmanagedDirectConnectSearch.and("lastPinged", UnmanagedDirectConnectSearch.entity().getLastPinged(), + * SearchCriteria.Op.LTEQ); UnmanagedDirectConnectSearch.cp(); UnmanagedDirectConnectSearch.cp(); + */ + + DirectConnectSearch = createSearchBuilder(); + DirectConnectSearch.and("resource", DirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL); + DirectConnectSearch.and("id", DirectConnectSearch.entity().getId(), SearchCriteria.Op.EQ); + DirectConnectSearch.and().op("nullserver", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); + DirectConnectSearch.or("server", DirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.EQ); + DirectConnectSearch.cp(); + DirectConnectSearch.done(); + + UnmanagedApplianceSearch = createSearchBuilder(); + UnmanagedApplianceSearch.and("resource", UnmanagedApplianceSearch.entity().getResource(), SearchCriteria.Op.NNULL); + UnmanagedApplianceSearch.and("server", UnmanagedApplianceSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); + UnmanagedApplianceSearch.and("types", UnmanagedApplianceSearch.entity().getType(), SearchCriteria.Op.IN); + UnmanagedApplianceSearch.and("lastPinged", UnmanagedApplianceSearch.entity().getLastPinged(), SearchCriteria.Op.LTEQ); + UnmanagedApplianceSearch.done(); + + AvailHypevisorInZone = createSearchBuilder(); + AvailHypevisorInZone.and("zoneId", AvailHypevisorInZone.entity().getDataCenterId(), SearchCriteria.Op.EQ); + AvailHypevisorInZone.and("hostId", AvailHypevisorInZone.entity().getId(), SearchCriteria.Op.NEQ); + AvailHypevisorInZone.and("type", AvailHypevisorInZone.entity().getType(), SearchCriteria.Op.EQ); + AvailHypevisorInZone.groupBy(AvailHypevisorInZone.entity().getHypervisorType()); + AvailHypevisorInZone.done(); + + HostsInStatusSearch = createSearchBuilder(Long.class); + HostsInStatusSearch.selectField(HostsInStatusSearch.entity().getId()); + HostsInStatusSearch.and("dc", HostsInStatusSearch.entity().getDataCenterId(), Op.EQ); + HostsInStatusSearch.and("pod", HostsInStatusSearch.entity().getPodId(), Op.EQ); + HostsInStatusSearch.and("cluster", HostsInStatusSearch.entity().getClusterId(), Op.EQ); + HostsInStatusSearch.and("type", HostsInStatusSearch.entity().getType(), Op.EQ); + HostsInStatusSearch.and("statuses", HostsInStatusSearch.entity().getStatus(), Op.IN); + HostsInStatusSearch.done(); + + CountRoutingByDc = createSearchBuilder(Long.class); + CountRoutingByDc.select(null, Func.COUNT, null); + CountRoutingByDc.and("dc", CountRoutingByDc.entity().getDataCenterId(), SearchCriteria.Op.EQ); + CountRoutingByDc.and("type", CountRoutingByDc.entity().getType(), SearchCriteria.Op.EQ); + CountRoutingByDc.and("status", CountRoutingByDc.entity().getStatus(), SearchCriteria.Op.EQ); + + CountRoutingByDc.done(); + + ManagedDirectConnectSearch = createSearchBuilder(); + ManagedDirectConnectSearch.and("resource", ManagedDirectConnectSearch.entity().getResource(), SearchCriteria.Op.NNULL); + ManagedDirectConnectSearch.and("server", ManagedDirectConnectSearch.entity().getManagementServerId(), SearchCriteria.Op.NULL); + ManagedDirectConnectSearch.done(); + + ManagedRoutingServersSearch = createSearchBuilder(); + ManagedRoutingServersSearch.and("server", ManagedRoutingServersSearch.entity().getManagementServerId(), SearchCriteria.Op.NNULL); + ManagedRoutingServersSearch.and("type", ManagedRoutingServersSearch.entity().getType(), SearchCriteria.Op.EQ); + ManagedRoutingServersSearch.done(); + + RoutingSearch = createSearchBuilder(); + RoutingSearch.and("type", RoutingSearch.entity().getType(), SearchCriteria.Op.EQ); + RoutingSearch.done(); + + _statusAttr = _allAttributes.get("status"); + _msIdAttr = _allAttributes.get("managementServerId"); + _pingTimeAttr = _allAttributes.get("lastPinged"); + _resourceStateAttr = _allAttributes.get("resourceState"); + + assert (_statusAttr != null && _msIdAttr != null && _pingTimeAttr != null) : "Couldn't find one of these attributes"; + + UUIDSearch = createSearchBuilder(); + UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ); + UUIDSearch.done(); + + StateChangeSearch = createSearchBuilder(); + StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); + StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); + StateChangeSearch.done(); + } + + @Override + public long countBy(long clusterId, ResourceState... states) { + SearchCriteria sc = MaintenanceCountSearch.create(); + + sc.setParameters("resourceState", (Object[]) states); + sc.setParameters("cluster", clusterId); + + List hosts = listBy(sc); + return hosts.size(); + } + + + @Override + public EngineHostVO findByGuid(String guid) { + SearchCriteria sc = GuidSearch.create("guid", guid); + return findOneBy(sc); + } + + @Override @DB + public List findAndUpdateDirectAgentToLoad(long lastPingSecondsAfter, Long limit, long managementServerId) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + SearchCriteria sc = UnmanagedDirectConnectSearch.create(); + sc.setParameters("lastPinged", lastPingSecondsAfter); + //sc.setParameters("resourceStates", ResourceState.ErrorInMaintenance, ResourceState.Maintenance, ResourceState.PrepareForMaintenance, ResourceState.Disabled); + sc.setJoinParameters("ClusterManagedSearch", "managed", Managed.ManagedState.Managed); + List hosts = lockRows(sc, new Filter(EngineHostVO.class, "clusterId", true, 0L, limit), true); + + for (EngineHostVO host : hosts) { + host.setManagementServerId(managementServerId); + update(host.getId(), host); + } + + txn.commit(); + + return hosts; + } + + @Override @DB + public List findAndUpdateApplianceToLoad(long lastPingSecondsAfter, long managementServerId) { + Transaction txn = Transaction.currentTxn(); + + txn.start(); + SearchCriteria sc = UnmanagedApplianceSearch.create(); + sc.setParameters("lastPinged", lastPingSecondsAfter); + sc.setParameters("types", Type.ExternalDhcp, Type.ExternalFirewall, Type.ExternalLoadBalancer, Type.PxeServer, Type.TrafficMonitor, Type.L2Networking); + List hosts = lockRows(sc, null, true); + + for (EngineHostVO host : hosts) { + host.setManagementServerId(managementServerId); + update(host.getId(), host); + } + + txn.commit(); + + return hosts; + } + + @Override + public void markHostsAsDisconnected(long msId, long lastPing) { + SearchCriteria sc = MsStatusSearch.create(); + sc.setParameters("ms", msId); + + EngineHostVO host = createForUpdate(); + host.setLastPinged(lastPing); + host.setDisconnectedOn(new Date()); + UpdateBuilder ub = getUpdateBuilder(host); + ub.set(host, "status", Status.Disconnected); + + update(ub, sc, null); + + sc = MsStatusSearch.create(); + sc.setParameters("ms", msId); + + host = createForUpdate(); + host.setManagementServerId(null); + host.setLastPinged((System.currentTimeMillis() >> 10) - (10 * 60)); + host.setDisconnectedOn(new Date()); + ub = getUpdateBuilder(host); + update(ub, sc, null); + } + + @Override + public List listByHostTag(Host.Type type, Long clusterId, Long podId, long dcId, String hostTag) { + + SearchBuilder hostTagSearch = _hostTagsDao.createSearchBuilder(); + HostTagVO tagEntity = hostTagSearch.entity(); + hostTagSearch.and("tag", tagEntity.getTag(), SearchCriteria.Op.EQ); + + SearchBuilder hostSearch = createSearchBuilder(); + EngineHostVO entity = hostSearch.entity(); + hostSearch.and("type", entity.getType(), SearchCriteria.Op.EQ); + hostSearch.and("pod", entity.getPodId(), SearchCriteria.Op.EQ); + hostSearch.and("dc", entity.getDataCenterId(), SearchCriteria.Op.EQ); + hostSearch.and("cluster", entity.getClusterId(), SearchCriteria.Op.EQ); + hostSearch.and("status", entity.getStatus(), SearchCriteria.Op.EQ); + hostSearch.and("resourceState", entity.getResourceState(), SearchCriteria.Op.EQ); + hostSearch.join("hostTagSearch", hostTagSearch, entity.getId(), tagEntity.getHostId(), JoinBuilder.JoinType.INNER); + + SearchCriteria sc = hostSearch.create(); + sc.setJoinParameters("hostTagSearch", "tag", hostTag); + sc.setParameters("type", type.toString()); + if (podId != null) { + sc.setParameters("pod", podId); + } + if (clusterId != null) { + sc.setParameters("cluster", clusterId); + } + sc.setParameters("dc", dcId); + sc.setParameters("status", Status.Up.toString()); + sc.setParameters("resourceState", ResourceState.Enabled.toString()); + + return listBy(sc); + } + + + @Override + public List listAllUpAndEnabledNonHAHosts(Type type, Long clusterId, Long podId, long dcId, String haTag) { + SearchBuilder hostTagSearch = null; + if (haTag != null && !haTag.isEmpty()) { + hostTagSearch = _hostTagsDao.createSearchBuilder(); + hostTagSearch.and().op("tag", hostTagSearch.entity().getTag(), SearchCriteria.Op.NEQ); + hostTagSearch.or("tagNull", hostTagSearch.entity().getTag(), SearchCriteria.Op.NULL); + hostTagSearch.cp(); + } + + SearchBuilder hostSearch = createSearchBuilder(); + + hostSearch.and("type", hostSearch.entity().getType(), SearchCriteria.Op.EQ); + hostSearch.and("clusterId", hostSearch.entity().getClusterId(), SearchCriteria.Op.EQ); + hostSearch.and("podId", hostSearch.entity().getPodId(), SearchCriteria.Op.EQ); + hostSearch.and("zoneId", hostSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + hostSearch.and("status", hostSearch.entity().getStatus(), SearchCriteria.Op.EQ); + hostSearch.and("resourceState", hostSearch.entity().getResourceState(), SearchCriteria.Op.EQ); + + if (haTag != null && !haTag.isEmpty()) { + hostSearch.join("hostTagSearch", hostTagSearch, hostSearch.entity().getId(), hostTagSearch.entity().getHostId(), JoinBuilder.JoinType.LEFTOUTER); + } + + SearchCriteria sc = hostSearch.create(); + + if (haTag != null && !haTag.isEmpty()) { + sc.setJoinParameters("hostTagSearch", "tag", haTag); + } + + if (type != null) { + sc.setParameters("type", type); + } + + if (clusterId != null) { + sc.setParameters("clusterId", clusterId); + } + + if (podId != null) { + sc.setParameters("podId", podId); + } + + sc.setParameters("zoneId", dcId); + sc.setParameters("status", Status.Up); + sc.setParameters("resourceState", ResourceState.Enabled); + + return listBy(sc); + } + + @Override + public void loadDetails(EngineHostVO host) { + Map details = _detailsDao.findDetails(host.getId()); + host.setDetails(details); + } + + @Override + public void loadHostTags(EngineHostVO host) { + List hostTags = _hostTagsDao.gethostTags(host.getId()); + host.setHostTags(hostTags); + } + + @DB + @Override + public List findLostHosts(long timeout) { + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + List result = new ArrayList(); + ResultSet rs = null; + try { + String sql = "select h.id from host h left join cluster c on h.cluster_id=c.id where h.mgmt_server_id is not null and h.last_ping < ? and h.status in ('Up', 'Updating', 'Disconnected', 'Connecting') and h.type not in ('ExternalFirewall', 'ExternalLoadBalancer', 'TrafficMonitor', 'SecondaryStorage', 'LocalSecondaryStorage', 'L2Networking') and (h.cluster_id is null or c.managed_state = 'Managed') ;" ; + pstmt = txn.prepareStatement(sql); + pstmt.setLong(1, timeout); + rs = pstmt.executeQuery(); + while (rs.next()) { + long id = rs.getLong(1); //ID column + result.add(findById(id)); + } + } catch (Exception e) { + s_logger.warn("Exception: ", e); + } finally { + try { + if (rs != null) { + rs.close(); + } + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + return result; + } + + @Override + public void saveDetails(EngineHostVO host) { + Map details = host.getDetails(); + if (details == null) { + return; + } + _detailsDao.persist(host.getId(), details); + } + + protected void saveHostTags(EngineHostVO host) { + List hostTags = host.getHostTags(); + if (hostTags == null || (hostTags != null && hostTags.isEmpty())) { + return; + } + _hostTagsDao.persist(host.getId(), hostTags); + } + + @Override + @DB + public EngineHostVO persist(EngineHostVO host) { + final String InsertSequenceSql = "INSERT INTO op_host(id) VALUES(?)"; + + Transaction txn = Transaction.currentTxn(); + txn.start(); + + EngineHostVO dbHost = super.persist(host); + + try { + PreparedStatement pstmt = txn.prepareAutoCloseStatement(InsertSequenceSql); + pstmt.setLong(1, dbHost.getId()); + pstmt.executeUpdate(); + } catch (SQLException e) { + throw new CloudRuntimeException("Unable to persist the sequence number for this host"); + } + + saveDetails(host); + loadDetails(dbHost); + saveHostTags(host); + loadHostTags(dbHost); + + txn.commit(); + + return dbHost; + } + + @Override + @DB + public boolean update(Long hostId, EngineHostVO host) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + + boolean persisted = super.update(hostId, host); + if (!persisted) { + return persisted; + } + + saveDetails(host); + saveHostTags(host); + + txn.commit(); + + return persisted; + } + + @Override + @DB + public List getRunningHostCounts(Date cutTime) { + String sql = "select * from (" + "select h.data_center_id, h.type, count(*) as count from host as h INNER JOIN mshost as m ON h.mgmt_server_id=m.msid " + + "where h.status='Up' and h.type='SecondaryStorage' and m.last_update > ? " + "group by h.data_center_id, h.type " + "UNION ALL " + + "select h.data_center_id, h.type, count(*) as count from host as h INNER JOIN mshost as m ON h.mgmt_server_id=m.msid " + + "where h.status='Up' and h.type='Routing' and m.last_update > ? " + "group by h.data_center_id, h.type) as t " + "ORDER by t.data_center_id, t.type"; + + ArrayList l = new ArrayList(); + + Transaction txn = Transaction.currentTxn(); + ; + PreparedStatement pstmt = null; + try { + pstmt = txn.prepareAutoCloseStatement(sql); + String gmtCutTime = DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), cutTime); + pstmt.setString(1, gmtCutTime); + pstmt.setString(2, gmtCutTime); + + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + RunningHostCountInfo info = new RunningHostCountInfo(); + info.setDcId(rs.getLong(1)); + info.setHostType(rs.getString(2)); + info.setCount(rs.getInt(3)); + + l.add(info); + } + } catch (SQLException e) { + } catch (Throwable e) { + } + return l; + } + + @Override + public long getNextSequence(long hostId) { + if (s_logger.isTraceEnabled()) { + s_logger.trace("getNextSequence(), hostId: " + hostId); + } + + TableGenerator tg = _tgs.get("host_req_sq"); + assert tg != null : "how can this be wrong!"; + + return s_seqFetcher.getNextSequence(Long.class, tg, hostId); + } + + /*TODO: this is used by mycloud, check if it needs resource state Enabled */ + @Override + public long countRoutingHostsByDataCenter(long dcId) { + SearchCriteria sc = CountRoutingByDc.create(); + sc.setParameters("dc", dcId); + sc.setParameters("type", Host.Type.Routing); + sc.setParameters("status", Status.Up.toString()); + return customSearch(sc, null).get(0); + } + + + @Override + public boolean updateState(State currentState, DataCenterResourceEntity.State.Event event, State nextState, DataCenterResourceEntity hostEntity, Object data) { + EngineHostVO vo = findById(hostEntity.getId()); + Date oldUpdatedTime = vo.getLastUpdated(); + + SearchCriteria sc = StateChangeSearch.create(); + sc.setParameters("id", hostEntity.getId()); + sc.setParameters("state", currentState); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "lastUpdated", new Date()); + + int rows = update(vo, sc); + + if (rows == 0 && s_logger.isDebugEnabled()) { + EngineHostVO dbHost = findByIdIncludingRemoved(vo.getId()); + if (dbHost != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbHost.getId()).append("; state=").append(dbHost.getState()).append(";updatedTime=") + .append(dbHost.getLastUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update dataCenter: id=" + vo.getId() + ", as there is no such dataCenter exists in the database anymore"); + } + } + return rows > 0; + } + + @Override + public boolean updateResourceState(ResourceState oldState, ResourceState.Event event, ResourceState newState, Host vo) { + EngineHostVO host = (EngineHostVO)vo; + SearchBuilder sb = createSearchBuilder(); + sb.and("resource_state", sb.entity().getResourceState(), SearchCriteria.Op.EQ); + sb.and("id", sb.entity().getId(), SearchCriteria.Op.EQ); + sb.done(); + + SearchCriteria sc = sb.create(); + + sc.setParameters("resource_state", oldState); + sc.setParameters("id", host.getId()); + + UpdateBuilder ub = getUpdateBuilder(host); + ub.set(host, _resourceStateAttr, newState); + int result = update(ub, sc, null); + assert result <= 1 : "How can this update " + result + " rows? "; + + if (state_logger.isDebugEnabled() && result == 0) { + EngineHostVO ho = findById(host.getId()); + assert ho != null : "How how how? : " + host.getId(); + + StringBuilder str = new StringBuilder("Unable to update resource state: ["); + str.append("m = " + host.getId()); + str.append("; name = " + host.getName()); + str.append("; old state = " + oldState); + str.append("; event = " + event); + str.append("; new state = " + newState + "]"); + state_logger.debug(str.toString()); + } else { + StringBuilder msg = new StringBuilder("Resource state update: ["); + msg.append("id = " + host.getId()); + msg.append("; name = " + host.getName()); + msg.append("; old state = " + oldState); + msg.append("; event = " + event); + msg.append("; new state = " + newState + "]"); + state_logger.debug(msg.toString()); + } + + return result > 0; + } + + @Override + public EngineHostVO findByTypeNameAndZoneId(long zoneId, String name, Host.Type type) { + SearchCriteria sc = TypeNameZoneSearch.create(); + sc.setParameters("type", type); + sc.setParameters("name", name); + sc.setParameters("zoneId", zoneId); + return findOneBy(sc); + } + + @Override + public List findHypervisorHostInCluster(long clusterId) { + SearchCriteria sc = TypeClusterStatusSearch.create(); + sc.setParameters("type", Host.Type.Routing); + sc.setParameters("cluster", clusterId); + sc.setParameters("status", Status.Up); + sc.setParameters("resourceState", ResourceState.Enabled); + + return listBy(sc); + } + + @Override + public List lockRows( + SearchCriteria sc, + Filter filter, boolean exclusive) { + // TODO Auto-generated method stub + return null; + } + + @Override + public org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO lockOneRandomRow( + SearchCriteria sc, + boolean exclusive) { + // TODO Auto-generated method stub + return null; + } + + + @Override + public List search( + SearchCriteria sc, + Filter filter) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List search( + SearchCriteria sc, + Filter filter, boolean enable_query_cache) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List searchIncludingRemoved( + SearchCriteria sc, + Filter filter, Boolean lock, boolean cache) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List searchIncludingRemoved( + SearchCriteria sc, + Filter filter, Boolean lock, boolean cache, + boolean enable_query_cache) { + // TODO Auto-generated method stub + return null; + } + + + @Override + public int remove( + SearchCriteria sc) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int expunge(SearchCriteria sc) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public EngineHostVO findOneBy(SearchCriteria sc) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java new file mode 100644 index 00000000000..48e77739085 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDao.java @@ -0,0 +1,33 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.HashMap; +import java.util.List; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; + + +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +public interface EngineHostPodDao extends GenericDao, StateDao { + public List listByDataCenterId(long id); + + public EngineHostPodVO findByName(String name, long dcId); + + public HashMap> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip); + + public List listDisabledPods(long zoneId); +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java new file mode 100644 index 00000000000..c5b4bd28de4 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/EngineHostPodDaoImpl.java @@ -0,0 +1,184 @@ +// Copyright 2012 Citrix Systems, Inc. Licensed under the +// Apache License, Version 2.0 (the "License"); you may not use this +// file except in compliance with the License. Citrix Systems, Inc. +// reserves all rights not expressly granted by the License. +// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.List; + +import javax.ejb.Local; + +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State.Event; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + + +import com.cloud.org.Grouping; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.UpdateBuilder; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.Transaction; + +@Component(value="EngineHostPodDao") +@Local(value={EngineHostPodDao.class}) +public class EngineHostPodDaoImpl extends GenericDaoBase implements EngineHostPodDao { + private static final Logger s_logger = Logger.getLogger(EngineHostPodDaoImpl.class); + + protected SearchBuilder DataCenterAndNameSearch; + protected SearchBuilder DataCenterIdSearch; + protected SearchBuilder UUIDSearch; + protected SearchBuilder StateChangeSearch; + + protected EngineHostPodDaoImpl() { + DataCenterAndNameSearch = createSearchBuilder(); + DataCenterAndNameSearch.and("dc", DataCenterAndNameSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DataCenterAndNameSearch.and("name", DataCenterAndNameSearch.entity().getName(), SearchCriteria.Op.EQ); + DataCenterAndNameSearch.done(); + + DataCenterIdSearch = createSearchBuilder(); + DataCenterIdSearch.and("dcId", DataCenterIdSearch.entity().getDataCenterId(), SearchCriteria.Op.EQ); + DataCenterIdSearch.done(); + + + UUIDSearch = createSearchBuilder(); + UUIDSearch.and("uuid", UUIDSearch.entity().getUuid(), SearchCriteria.Op.EQ); + UUIDSearch.done(); + + StateChangeSearch = createSearchBuilder(); + StateChangeSearch.and("id", StateChangeSearch.entity().getId(), SearchCriteria.Op.EQ); + StateChangeSearch.and("state", StateChangeSearch.entity().getState(), SearchCriteria.Op.EQ); + StateChangeSearch.done(); + + } + + @Override + public List listByDataCenterId(long id) { + SearchCriteria sc = DataCenterIdSearch.create(); + sc.setParameters("dcId", id); + + return listBy(sc); + } + + @Override + public EngineHostPodVO findByName(String name, long dcId) { + SearchCriteria sc = DataCenterAndNameSearch.create(); + sc.setParameters("dc", dcId); + sc.setParameters("name", name); + + return findOneBy(sc); + } + + @Override + public HashMap> getCurrentPodCidrSubnets(long zoneId, long podIdToSkip) { + HashMap> currentPodCidrSubnets = new HashMap>(); + + String selectSql = "SELECT id, cidr_address, cidr_size FROM host_pod_ref WHERE data_center_id=" + zoneId +" and removed IS NULL"; + Transaction txn = Transaction.currentTxn(); + try { + PreparedStatement stmt = txn.prepareAutoCloseStatement(selectSql); + ResultSet rs = stmt.executeQuery(); + while (rs.next()) { + Long podId = rs.getLong("id"); + if (podId.longValue() == podIdToSkip) { + continue; + } + String cidrAddress = rs.getString("cidr_address"); + long cidrSize = rs.getLong("cidr_size"); + List cidrPair = new ArrayList(); + cidrPair.add(0, cidrAddress); + cidrPair.add(1, new Long(cidrSize)); + currentPodCidrSubnets.put(podId, cidrPair); + } + } catch (SQLException ex) { + s_logger.warn("DB exception " + ex.getMessage(), ex); + return null; + } + + return currentPodCidrSubnets; + } + + @Override + public boolean remove(Long id) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + EngineHostPodVO pod = createForUpdate(); + pod.setName(null); + + update(id, pod); + + boolean result = super.remove(id); + txn.commit(); + return result; + } + + @Override + public List listDisabledPods(long zoneId) { + GenericSearchBuilder podIdSearch = createSearchBuilder(Long.class); + podIdSearch.selectField(podIdSearch.entity().getId()); + podIdSearch.and("dataCenterId", podIdSearch.entity().getDataCenterId(), Op.EQ); + podIdSearch.and("allocationState", podIdSearch.entity().getAllocationState(), Op.EQ); + podIdSearch.done(); + + + SearchCriteria sc = podIdSearch.create(); + sc.addAnd("dataCenterId", SearchCriteria.Op.EQ, zoneId); + sc.addAnd("allocationState", SearchCriteria.Op.EQ, Grouping.AllocationState.Disabled); + return customSearch(sc, null); + } + + + @Override + public boolean updateState(State currentState, Event event, State nextState, DataCenterResourceEntity podEntity, Object data) { + + EngineHostPodVO vo = findById(podEntity.getId()); + + Date oldUpdatedTime = vo.getLastUpdated(); + + SearchCriteria sc = StateChangeSearch.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "lastUpdated", new Date()); + + int rows = update((EngineHostPodVO) vo, sc); + + if (rows == 0 && s_logger.isDebugEnabled()) { + EngineHostPodVO dbDC = findByIdIncludingRemoved(vo.getId()); + if (dbDC != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbDC.getId()).append("; state=").append(dbDC.getState()).append(";updatedTime=") + .append(dbDC.getLastUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatedTime=").append(vo.getLastUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update dataCenter: id=" + vo.getId() + ", as there is no such dataCenter exists in the database anymore"); + } + } + return rows > 0; + + } + + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDao.java new file mode 100644 index 00000000000..d6455038f8e --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDao.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 org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.Map; + +import com.cloud.host.DetailVO; +import com.cloud.utils.db.GenericDao; + +public interface HostDetailsDao extends GenericDao { + Map findDetails(long hostId); + + void persist(long hostId, Map details); + + DetailVO findDetail(long hostId, String name); + + void deleteDetails(long hostId); +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDaoImpl.java new file mode 100644 index 00000000000..02f8c2c546c --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostDetailsDaoImpl.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 org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.host.DetailVO; +import com.cloud.utils.crypt.DBEncryptionUtil; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component(value="EngineHostDetailsDao") +@Local(value=HostDetailsDao.class) +public class HostDetailsDaoImpl extends GenericDaoBase implements HostDetailsDao { + protected final SearchBuilder HostSearch; + protected final SearchBuilder DetailSearch; + + public HostDetailsDaoImpl() { + HostSearch = createSearchBuilder(); + HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ); + HostSearch.done(); + + DetailSearch = createSearchBuilder(); + DetailSearch.and("hostId", DetailSearch.entity().getHostId(), SearchCriteria.Op.EQ); + DetailSearch.and("name", DetailSearch.entity().getName(), SearchCriteria.Op.EQ); + DetailSearch.done(); + } + + @Override + public DetailVO findDetail(long hostId, String name) { + SearchCriteria sc = DetailSearch.create(); + sc.setParameters("hostId", hostId); + sc.setParameters("name", name); + + DetailVO detail = findOneIncludingRemovedBy(sc); + if("password".equals(name) && detail != null){ + detail.setValue(DBEncryptionUtil.decrypt(detail.getValue())); + } + return detail; + } + + @Override + public Map findDetails(long hostId) { + SearchCriteria sc = HostSearch.create(); + sc.setParameters("hostId", hostId); + + List results = search(sc, null); + Map details = new HashMap(results.size()); + for (DetailVO result : results) { + if("password".equals(result.getName())){ + details.put(result.getName(), DBEncryptionUtil.decrypt(result.getValue())); + } else { + details.put(result.getName(), result.getValue()); + } + } + return details; + } + + @Override + public void deleteDetails(long hostId) { + SearchCriteria sc = HostSearch.create(); + sc.setParameters("hostId", hostId); + + List results = search(sc, null); + for (DetailVO result : results) { + remove(result.getId()); + } + } + + @Override + public void persist(long hostId, Map details) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + SearchCriteria sc = HostSearch.create(); + sc.setParameters("hostId", hostId); + expunge(sc); + + for (Map.Entry detail : details.entrySet()) { + String value = detail.getValue(); + if("password".equals(detail.getKey())){ + value = DBEncryptionUtil.encrypt(value); + } + DetailVO vo = new DetailVO(hostId, detail.getKey(), value); + persist(vo); + } + txn.commit(); + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDao.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDao.java new file mode 100644 index 00000000000..09503d80127 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDao.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.engine.datacenter.entity.api.db.dao; + +import java.util.List; +import com.cloud.host.HostTagVO; +import com.cloud.utils.db.GenericDao; + +public interface HostTagsDao extends GenericDao { + + void persist(long hostId, List hostTags); + + List gethostTags(long hostId); + +} + diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDaoImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDaoImpl.java new file mode 100644 index 00000000000..a70b7d1b234 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/datacenter/entity/api/db/dao/HostTagsDaoImpl.java @@ -0,0 +1,75 @@ +// 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.engine.datacenter.entity.api.db.dao; + +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.host.HostTagVO; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.Transaction; + +@Component(value="EngineHostTagsDao") +@Local(value=HostTagsDao.class) +public class HostTagsDaoImpl extends GenericDaoBase implements HostTagsDao { + protected final SearchBuilder HostSearch; + + protected HostTagsDaoImpl() { + HostSearch = createSearchBuilder(); + HostSearch.and("hostId", HostSearch.entity().getHostId(), SearchCriteria.Op.EQ); + HostSearch.done(); + } + + @Override + public List gethostTags(long hostId) { + SearchCriteria sc = HostSearch.create(); + sc.setParameters("hostId", hostId); + + List results = search(sc, null); + List hostTags = new ArrayList(results.size()); + for (HostTagVO result : results) { + hostTags.add(result.getTag()); + } + + return hostTags; + } + + @Override + public void persist(long hostId, List hostTags) { + Transaction txn = Transaction.currentTxn(); + + txn.start(); + SearchCriteria sc = HostSearch.create(); + sc.setParameters("hostId", hostId); + expunge(sc); + + for (String tag : hostTags) { + tag = tag.trim(); + if(tag.length() > 0) { + HostTagVO vo = new HostTagVO(hostId, tag); + persist(vo); + } + } + txn.commit(); + } +} diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java new file mode 100644 index 00000000000..83e78b45fd0 --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/engine/service/api/ProvisioningServiceImpl.java @@ -0,0 +1,170 @@ +/* + * 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.engine.service.api; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; +import javax.ws.rs.Path; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceManager; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntityImpl; +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntityImpl; +import org.springframework.stereotype.Component; +import org.springframework.stereotype.Service; + +import com.cloud.host.Host; +import com.cloud.host.Status; +import com.cloud.storage.StoragePool; + + +@Component +@Service("provisioningService") +@Path("/provisioning") +public class ProvisioningServiceImpl implements ProvisioningService { + + @Inject + DataCenterResourceManager manager; + + @Override + public StorageEntity registerStorage(String name, List tags, Map details) { + // TODO Auto-generated method stub + return null; + } + + @Override + public ZoneEntity registerZone(String zoneUuid, String name, String owner, List tags, Map details) { + ZoneEntityImpl zoneEntity = new ZoneEntityImpl(zoneUuid, manager); + zoneEntity.setName(name); + zoneEntity.setOwner(owner); + zoneEntity.setDetails(details); + zoneEntity.persist(); + return zoneEntity; + } + + @Override + public PodEntity registerPod(String podUuid, String name, String owner, String zoneUuid, List tags, Map details) { + PodEntityImpl podEntity = new PodEntityImpl(podUuid, manager); + podEntity.setOwner(owner); + podEntity.setName(name); + podEntity.persist(); + return podEntity; + } + + @Override + public ClusterEntity registerCluster(String clusterUuid, String name, String owner, List tags, Map details) { + ClusterEntityImpl clusterEntity = new ClusterEntityImpl(clusterUuid, manager); + clusterEntity.setOwner(owner); + clusterEntity.setName(name); + clusterEntity.persist(); + return clusterEntity; + } + + @Override + public HostEntity registerHost(String hostUuid, String name, String owner, List tags, Map details) { + HostEntityImpl hostEntity = new HostEntityImpl(hostUuid, manager); + hostEntity.setOwner(owner); + hostEntity.setName(name); + hostEntity.setDetails(details); + + hostEntity.persist(); + return hostEntity; + } + + @Override + public void deregisterStorage(String uuid) { + // TODO Auto-generated method stub + + } + + @Override + public void deregisterZone(String uuid) { + ZoneEntityImpl zoneEntity = new ZoneEntityImpl(uuid, manager); + zoneEntity.disable(); + } + + @Override + public void deregisterPod(String uuid) { + PodEntityImpl podEntity = new PodEntityImpl(uuid, manager); + podEntity.disable(); + } + + @Override + public void deregisterCluster(String uuid) { + ClusterEntityImpl clusterEntity = new ClusterEntityImpl(uuid, manager); + clusterEntity.disable(); + + } + + @Override + public void deregisterHost(String uuid) { + HostEntityImpl hostEntity = new HostEntityImpl(uuid, manager); + hostEntity.disable(); + } + + @Override + public void changeState(String type, String entity, Status state) { + // TODO Auto-generated method stub + + } + + @Override + public List listHosts() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List listPods() { + List pods = new ArrayList(); + //pods.add(new PodEntityImpl("pod-uuid-1", "pod1")); + //pods.add(new PodEntityImpl("pod-uuid-2", "pod2")); + return null; + } + + @Override + public List listZones() { + List zones = new ArrayList(); + //zones.add(new ZoneEntityImpl("zone-uuid-1")); + //zones.add(new ZoneEntityImpl("zone-uuid-2")); + return zones; + } + + @Override + public List listStorage() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ZoneEntity getZone(String uuid) { + ZoneEntityImpl impl = new ZoneEntityImpl(uuid, manager); + return impl; + } + +} diff --git a/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java new file mode 100755 index 00000000000..ea9a30b969a --- /dev/null +++ b/engine/orchestration/src/org/apache/cloudstack/platform/orchestration/CloudOrchestrator.java @@ -0,0 +1,292 @@ +/* + * 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.platform.orchestration; + +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.engine.cloud.entity.api.NetworkEntity; +import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityFactory; +import org.apache.cloudstack.engine.cloud.entity.api.VirtualMachineEntityImpl; +import org.apache.cloudstack.engine.cloud.entity.api.VMEntityManager; +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.apache.cloudstack.engine.service.api.OrchestrationService; +import org.springframework.stereotype.Component; + +import com.cloud.deploy.DeploymentPlan; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.hypervisor.Hypervisor.HypervisorType; + +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.service.ServiceOfferingVO; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.storage.DiskOfferingVO; +import com.cloud.storage.dao.DiskOfferingDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.user.dao.AccountDao; +import com.cloud.utils.Pair; +import com.cloud.utils.component.ComponentContext; +import com.cloud.vm.NicProfile; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.dao.VMInstanceDao; + + +@Component +public class CloudOrchestrator implements OrchestrationService { + + @Inject + private VMEntityManager vmEntityManager; + + @Inject + private VirtualMachineManager _itMgr; + + @Inject + protected VMTemplateDao _templateDao = null; + + @Inject + protected VMInstanceDao _vmDao; + + @Inject + protected UserVmDao _userVmDao = null; + + @Inject + protected ServiceOfferingDao _serviceOfferingDao; + + @Inject + protected DiskOfferingDao _diskOfferingDao = null; + + @Inject + protected VirtualMachineEntityFactory _vmEntityFactory; + + @Inject + protected NetworkDao _networkDao; + + @Inject + protected AccountDao _accountDao = null; + + + public VirtualMachineEntity createFromScratch(String uuid, String iso, String os, String hypervisor, String hostName, int cpu, int speed, long memory, List networks, List computeTags, + Map details, String owner) { + // TODO Auto-generated method stub + return null; + } + + public String reserve(String vm, String planner, Long until) throws InsufficientCapacityException { + // TODO Auto-generated method stub + return null; + } + + public String deploy(String reservationId) { + // TODO Auto-generated method stub + return null; + } + + public void joinNetwork(String network1, String network2) { + // TODO Auto-generated method stub + + } + + public void createNetwork() { + // TODO Auto-generated method stub + + } + + public void destroyNetwork() { + // TODO Auto-generated method stub + + } + + @Override + public VolumeEntity createVolume() { + // TODO Auto-generated method stub + return null; + } + + @Override + public TemplateEntity registerTemplate(String name, URL path, String os, Hypervisor hypervisor) { + return null; + } + + @Override + public void destroyNetwork(String networkUuid) { + // TODO Auto-generated method stub + + } + + @Override + public void destroyVolume(String volumeEntity) { + // TODO Auto-generated method stub + + } + + @Override + public VirtualMachineEntity createVirtualMachine( + String id, + String owner, + String templateId, + String hostName, + String displayName, + String hypervisor, + int cpu, + int speed, + long memory, + Long diskSize, + List computeTags, + List rootDiskTags, + Map networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException { + + // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager); + + List> networkIpMap = new ArrayList>(); + for (String uuid : networkNicMap.keySet()) { + NetworkVO network = _networkDao.findByUuid(uuid); + if(network != null){ + networkIpMap.add(new Pair(network, networkNicMap.get(uuid))); + } + } + + VirtualMachineEntityImpl vmEntity = null; + try { + //vmEntity = _vmEntityFactory.getObject(); + vmEntity = VirtualMachineEntityImpl.class.newInstance(); + vmEntity = ComponentContext.inject(vmEntity); + } catch (Exception e) { + // add error handling here + } + vmEntity.init(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, new ArrayList(networkNicMap.keySet())); + + + HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor); + + //load vm instance and offerings and call virtualMachineManagerImpl + VMInstanceVO vm = _vmDao.findByUuid(id); + + // If the template represents an ISO, a disk offering must be passed in, and will be used to create the root disk + // Else, a disk offering is optional, and if present will be used to create the data disk + + Pair rootDiskOffering = new Pair(null, null); + List> dataDiskOfferings = new ArrayList>(); + + ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId()); + rootDiskOffering.first(offering); + + if(vm.getDiskOfferingId() != null){ + DiskOfferingVO diskOffering = _diskOfferingDao.findById(vm.getDiskOfferingId()); + if (diskOffering == null) { + throw new InvalidParameterValueException("Unable to find disk offering " + vm.getDiskOfferingId()); + } + Long size = null; + if (diskOffering.getDiskSize() == 0) { + size = diskSize; + if (size == null) { + throw new InvalidParameterValueException( + "Disk offering " + diskOffering + + " requires size parameter."); + } + } + dataDiskOfferings.add(new Pair(diskOffering, size)); + } + + + + if (_itMgr.allocate(_userVmDao.findById(vm.getId(), true), _templateDao.findById(new Long(templateId)), offering, rootDiskOffering, dataDiskOfferings, networkIpMap, null, plan, hypervisorType, _accountDao.findById(new Long(owner))) == null) { + return null; + } + + return vmEntity; + } + + @Override + public VirtualMachineEntity createVirtualMachineFromScratch(String id, String owner, String isoId, String hostName, String displayName, String hypervisor, String os, int cpu, int speed, long memory,Long diskSize, + List computeTags, List rootDiskTags, Map networkNicMap, DeploymentPlan plan) throws InsufficientCapacityException { + + // VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, networks, vmEntityManager); + VirtualMachineEntityImpl vmEntity = null; + try { + vmEntity = _vmEntityFactory.getObject(); + } catch (Exception e) { + // add error handling here + } + vmEntity.init(id, owner, hostName, displayName, cpu, speed, memory, computeTags, rootDiskTags, new ArrayList(networkNicMap.keySet())); + + //load vm instance and offerings and call virtualMachineManagerImpl + VMInstanceVO vm = _vmDao.findByUuid(id); + + + Pair rootDiskOffering = new Pair(null, null); + ServiceOfferingVO offering = _serviceOfferingDao.findById(vm.getServiceOfferingId()); + rootDiskOffering.first(offering); + + List> dataDiskOfferings = new ArrayList>(); + Long diskOfferingId = vm.getDiskOfferingId(); + if (diskOfferingId == null) { + throw new InvalidParameterValueException( + "Installing from ISO requires a disk offering to be specified for the root disk."); + } + DiskOfferingVO diskOffering = _diskOfferingDao.findById(diskOfferingId); + if (diskOffering == null) { + throw new InvalidParameterValueException("Unable to find disk offering " + diskOfferingId); + } + Long size = null; + if (diskOffering.getDiskSize() == 0) { + size = diskSize; + if (size == null) { + throw new InvalidParameterValueException("Disk offering " + + diskOffering + " requires size parameter."); + } + } + rootDiskOffering.first(diskOffering); + rootDiskOffering.second(size); + + + HypervisorType hypervisorType = HypervisorType.valueOf(hypervisor); + + if (_itMgr.allocate(vm, _templateDao.findById(new Long(isoId)), offering, rootDiskOffering, dataDiskOfferings, null, null, plan, hypervisorType, null) == null) { + return null; + } + + return vmEntity; + } + + @Override + public NetworkEntity createNetwork(String id, String name, String domainName, String cidr, String gateway) { + // TODO Auto-generated method stub + return null; + } + + @Override + public VirtualMachineEntity getVirtualMachine(String id) { + VirtualMachineEntityImpl vmEntity = new VirtualMachineEntityImpl(id, vmEntityManager); + return vmEntity; + } + +} diff --git a/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ChildTestConfiguration.java b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ChildTestConfiguration.java new file mode 100644 index 00000000000..3b1721f37fb --- /dev/null +++ b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ChildTestConfiguration.java @@ -0,0 +1,51 @@ +// 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.engine.provisioning.test; + + +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; + + + + +public class ChildTestConfiguration { + + @Bean + public EngineDataCenterDao dataCenterDao() { + return Mockito.mock(EngineDataCenterDao.class); + } + + @Bean + public EngineHostPodDao hostPodDao() { + return Mockito.mock(EngineHostPodDao.class); + } + + @Bean + public EngineClusterDao clusterDao() { + return Mockito.mock(EngineClusterDao.class); + } + + @Bean + public EngineHostDao hostDao() { + return Mockito.mock(EngineHostDao.class); + } +} diff --git a/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java new file mode 100644 index 00000000000..a3ef2768287 --- /dev/null +++ b/engine/orchestration/test/org/apache/cloudstack/engine/provisioning/test/ProvisioningTest.java @@ -0,0 +1,137 @@ +// 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.engine.provisioning.test; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.datacenter.entity.api.ClusterEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity.State; +import org.apache.cloudstack.engine.datacenter.entity.api.HostEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.PodEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.ZoneEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineClusterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineDataCenterDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostDao; +import org.apache.cloudstack.engine.datacenter.entity.api.db.dao.EngineHostPodDao; +import org.apache.cloudstack.engine.service.api.ProvisioningService; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineClusterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineDataCenterVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostPodVO; +import org.apache.cloudstack.engine.datacenter.entity.api.db.EngineHostVO; + +import com.cloud.dc.DataCenter.NetworkType; + +import junit.framework.TestCase; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/resource/provisioningContext.xml") +public class ProvisioningTest extends TestCase { + + @Inject + ProvisioningService service; + + @Inject + EngineDataCenterDao dcDao; + + @Inject + EngineHostPodDao _podDao; + + @Inject + EngineClusterDao _clusterDao; + + @Inject + EngineHostDao _hostDao; + + @Before + public void setUp() { + EngineDataCenterVO dc = new EngineDataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", + null, null, NetworkType.Basic, null, null, true, true, null, null); + Mockito.when(dcDao.findByUuid(Mockito.anyString())).thenReturn(dc); + Mockito.when(dcDao.persist((EngineDataCenterVO) Mockito.anyObject())).thenReturn(dc); + + EngineHostPodVO pod = new EngineHostPodVO("lab", 123, "10.0.0.1", "10.0.0.1", 24, "test"); + Mockito.when(_podDao.findByUuid(Mockito.anyString())).thenReturn(pod); + Mockito.when(_podDao.persist((EngineHostPodVO) Mockito.anyObject())).thenReturn(pod); + + EngineClusterVO cluster = new EngineClusterVO(); + Mockito.when(_clusterDao.findByUuid(Mockito.anyString())).thenReturn(cluster); + Mockito.when(_clusterDao.persist((EngineClusterVO) Mockito.anyObject())).thenReturn(cluster); + + EngineHostVO host = new EngineHostVO("68765876598"); + Mockito.when(_hostDao.findByUuid(Mockito.anyString())).thenReturn(host); + Mockito.when(_hostDao.persist((EngineHostVO) Mockito.anyObject())).thenReturn(host); + + } + + private void registerAndEnableZone() { + ZoneEntity zone = service.registerZone("47547648", "lab","owner", null, new HashMap()); + State state = zone.getState(); + System.out.println("state:"+state); + boolean result = zone.enable(); + System.out.println("result:"+result); + + } + + private void registerAndEnablePod() { + PodEntity pod = service.registerPod("47547648", "lab","owner", "8709874074", null, new HashMap()); + State state = pod.getState(); + System.out.println("state:"+state); + boolean result = pod.enable(); + System.out.println("result:"+result); + } + + private void registerAndEnableCluster() { + ClusterEntity cluster = service.registerCluster("1265476542", "lab","owner", null, new HashMap()); + State state = cluster.getState(); + System.out.println("state:"+state); + boolean result = cluster.enable(); + System.out.println("result:"+result); + } + + private void registerAndEnableHost() { + HostEntity host = service.registerHost("1265476542", "lab","owner", null, new HashMap()); + State state = host.getState(); + System.out.println("state:"+state); + boolean result = host.enable(); + System.out.println("result:"+result); + } + + @Test + public void testProvisioning() { + registerAndEnableZone(); + registerAndEnablePod(); + registerAndEnableCluster(); + registerAndEnableHost(); + } + + +} diff --git a/engine/orchestration/test/resource/provisioningContext.xml b/engine/orchestration/test/resource/provisioningContext.xml new file mode 100644 index 00000000000..6ed0ab5d472 --- /dev/null +++ b/engine/orchestration/test/resource/provisioningContext.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.java new file mode 100755 index 00000000000..97dfb2bbfe6 --- /dev/null +++ b/engine/planning/src/org/apache/cloudstack/platform/planning/Concierge.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 org.apache.cloudstack.platform.planning; + +import org.apache.cloudstack.framework.ipc.Ipc; + +public interface Concierge { + @Ipc(topic="cs.concierge.reserve") + String reserve(String vm, String planner, Long until); + + @Ipc(topic="cs.concierge.cancel") + String cancel(String reservationId); + + @Ipc(topic="cs.concierge.claim") + String claim(String reservationId); + + @Ipc(topic="cs.concierge.reserveAnother") + String reserveAnother(String reservationId); + +} diff --git a/engine/pom.xml b/engine/pom.xml new file mode 100644 index 00000000000..1a3d896d50d --- /dev/null +++ b/engine/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + cloud-engine + Apache CloudStack Cloud Engine + pom + + org.apache.cloudstack + cloudstack + 4.2.0-SNAPSHOT + ../pom.xml + + + install + src + test + + + api + compute + orchestration + storage + storage/volume + storage/image + storage/imagemotion + storage/backup + storage/snapshot + storage/integration-test + components-api + schema + network + service + + diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml new file mode 100644 index 00000000000..da40d9cc4a3 --- /dev/null +++ b/engine/schema/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + cloud-engine-schema + Apache CloudStack Cloud Engine Schema Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + + install + src + test + + diff --git a/engine/service/pom.xml b/engine/service/pom.xml new file mode 100644 index 00000000000..47c0edcefc0 --- /dev/null +++ b/engine/service/pom.xml @@ -0,0 +1,119 @@ + + + 4.0.0 + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + + cloud-engine-service + war + Apache CloudStack Cloud Engine Service + http://www.cloudstack.org + + + junit + junit + 3.8.1 + test + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + org.apache.cloudstack + cloud-engine-schema + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + org.apache.cloudstack + cloud-engine-orchestration + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + org.apache.cloudstack + cloud-engine-network + ${project.version} + + + org.apache.cloudstack + cloud-engine-compute + ${project.version} + + + org.apache.cxf + cxf-bundle-jaxrs + 2.7.0 + + + org.eclipse.jetty + jetty-server + + + + + org.springframework + spring-context + 3.1.2.RELEASE + + + org.springframework + spring-web + 3.1.2.RELEASE + + + + engine + + + org.mortbay.jetty + jetty-maven-plugin + 8.1.7.v20120910 + + 10 + + /engine + + + + 1736 + 60000 + + + + + + + diff --git a/engine/service/src/main/webapp/WEB-INF/beans.xml b/engine/service/src/main/webapp/WEB-INF/beans.xml new file mode 100644 index 00000000000..e5bcb88951d --- /dev/null +++ b/engine/service/src/main/webapp/WEB-INF/beans.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.cloudstack.framework + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/service/src/main/webapp/WEB-INF/log4j.xml b/engine/service/src/main/webapp/WEB-INF/log4j.xml new file mode 100644 index 00000000000..df46461f972 --- /dev/null +++ b/engine/service/src/main/webapp/WEB-INF/log4j.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/engine/service/src/main/webapp/WEB-INF/web.xml b/engine/service/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..6b8648a5b33 --- /dev/null +++ b/engine/service/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,52 @@ + + + + + + contextConfigLocation + WEB-INF/beans.xml + + + + org.springframework.web.context.ContextLoaderListener + + + + org.springframework.web.util.Log4jConfigListener + + + CXFServlet + CXF Servlet + + org.apache.cxf.transport.servlet.CXFServlet + + 1 + + + CXFServlet + /rest/* + + diff --git a/engine/service/src/main/webapp/index.jsp b/engine/service/src/main/webapp/index.jsp new file mode 100644 index 00000000000..6b26cc21c4d --- /dev/null +++ b/engine/service/src/main/webapp/index.jsp @@ -0,0 +1,23 @@ + + + +

Hello World!

+ + diff --git a/engine/storage/backup/pom.xml b/engine/storage/backup/pom.xml new file mode 100644 index 00000000000..019e09c7204 --- /dev/null +++ b/engine/storage/backup/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + cloud-engine-storage-backup + Apache CloudStack Engine Storage Backup Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + test + + diff --git a/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupMotionService.java b/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupMotionService.java new file mode 100644 index 00000000000..cb49027f3bf --- /dev/null +++ b/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupMotionService.java @@ -0,0 +1,23 @@ +/* + * 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.storage.backup; + +public interface BackupMotionService { + boolean copySnapshot(String snapshotUri, String destSnapshotUri); +} diff --git a/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupService.java b/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupService.java new file mode 100644 index 00000000000..67924d2ce73 --- /dev/null +++ b/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupService.java @@ -0,0 +1,26 @@ +/* + * 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.storage.backup; + +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; + +public interface BackupService { + public boolean backupSnapshot(SnapshotInfo snapshot, long backupStoreId); + public SnapshotOnBackupStoreInfo getSnapshot(long snapshotId); +} diff --git a/engine/storage/image/pom.xml b/engine/storage/image/pom.xml new file mode 100644 index 00000000000..c4cf14ca9b5 --- /dev/null +++ b/engine/storage/image/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + cloud-engine-storage-image + Apache CloudStack Engine Storage Image Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + test + + diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java new file mode 100644 index 00000000000..616e4789a27 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java @@ -0,0 +1,93 @@ +/* + * 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.storage.image; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.image.store.TemplateObject; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.storage.VMTemplateStoragePoolVO; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplatePoolDao; + +@Component +public class ImageDataFactoryImpl implements ImageDataFactory { + private static final Logger s_logger = Logger + .getLogger(ImageDataFactoryImpl.class); + @Inject + VMTemplateDao imageDataDao; + @Inject + ObjectInDataStoreManager objMap; + @Inject + DataStoreManager storeMgr; + @Inject + VMTemplatePoolDao templatePoolDao; + @Override + public TemplateInfo getTemplate(long templateId, DataStore store) { + VMTemplateVO templ = imageDataDao.findById(templateId); + if (store == null) { + TemplateObject tmpl = TemplateObject.getTemplate(templ, null); + return tmpl; + } + boolean found = false; + if (store.getRole() == DataStoreRole.Primary) { + VMTemplateStoragePoolVO templatePoolVO = templatePoolDao.findByPoolTemplate(store.getId(), templateId); + if (templatePoolVO != null) { + found = true; + } + } else { + DataObjectInStore obj = objMap.findObject(templ.getUuid(), DataObjectType.TEMPLATE, store.getUuid(), store.getRole()); + if (obj != null) { + found = true; + } + } + + if (!found) { + s_logger.debug("template " + templateId + " is not in store:" + store.getId() + ", type:" + store.getRole()); + } + + TemplateObject tmpl = TemplateObject.getTemplate(templ, store); + return tmpl; + } + @Override + public TemplateInfo getTemplate(long templateId) { + VMTemplateVO templ = imageDataDao.findById(templateId); + if (templ.getImageDataStoreId() == null) { + return this.getTemplate(templateId, null); + } + DataStore store = this.storeMgr.getDataStore(templ.getImageDataStoreId(), DataStoreRole.Image); + return this.getTemplate(templateId, store); + } + @Override + public TemplateInfo getTemplate(DataObject obj, DataStore store) { + return this.getTemplate(obj.getId(), store); + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageOrchestrator.java new file mode 100644 index 00000000000..e4141f3fa00 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageOrchestrator.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 org.apache.cloudstack.storage.image; + +public interface ImageOrchestrator { + void registerTemplate(long templateId); + + void registerSnapshot(long snapshotId); + + void registerVolume(long volumeId); + + void registerIso(long isoId); +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java new file mode 100644 index 00000000000..5898b1b0794 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java @@ -0,0 +1,156 @@ +/* + * 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.storage.image; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageService; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.datastore.DataObjectManager; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.image.store.TemplateObject; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.utils.fsm.NoTransitionException; + +@Component +public class ImageServiceImpl implements ImageService { + private static final Logger s_logger = Logger.getLogger(ImageServiceImpl.class); + @Inject + ObjectInDataStoreManager objectInDataStoreMgr; + @Inject + DataObjectManager dataObjectMgr; + + class CreateTemplateContext extends AsyncRpcConext { + final TemplateInfo srcTemplate; + final DataStore store; + final AsyncCallFuture future; + final DataObject templateOnStore; + + public CreateTemplateContext(AsyncCompletionCallback callback, TemplateInfo srcTemplate, + AsyncCallFuture future, + DataStore store, + DataObject templateOnStore + ) { + super(callback); + this.srcTemplate = srcTemplate; + this.future = future; + this.store = store; + this.templateOnStore = templateOnStore; + } + } + + @Override + public AsyncCallFuture createTemplateAsync( + TemplateInfo template, DataStore store) { + TemplateObject to = (TemplateObject) template; + AsyncCallFuture future = new AsyncCallFuture(); + try { + to.stateTransit(TemplateEvent.CreateRequested); + } catch (NoTransitionException e) { + s_logger.debug("Failed to transit state:", e); + CommandResult result = new CommandResult(); + result.setResult(e.toString()); + future.complete(result); + return future; + } + + DataObject templateOnStore = store.create(template); + templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.CreateOnlyRequested); + + CreateTemplateContext context = new CreateTemplateContext(null, + template, + future, + store, + templateOnStore + ); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createTemplateCallback(null, null)) + .setContext(context); + store.getDriver().createAsync(templateOnStore, caller); + return future; + } + + protected Void createTemplateCallback(AsyncCallbackDispatcher callback, + CreateTemplateContext context) { + TemplateObject template = (TemplateObject)context.srcTemplate; + AsyncCallFuture future = context.future; + CommandResult result = new CommandResult(); + DataObject templateOnStore = context.templateOnStore; + CreateCmdResult callbackResult = callback.getResult(); + if (callbackResult.isFailed()) { + try { + templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); + template.stateTransit(TemplateEvent.OperationFailed); + } catch (NoTransitionException e) { + s_logger.debug("Failed to update template state", e); + } + result.setResult(callbackResult.getResult()); + future.complete(result); + return null; + } + + try { + templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed); + template.stateTransit(TemplateEvent.OperationSucceeded); + } catch (NoTransitionException e) { + s_logger.debug("Failed to transit state", e); + result.setResult(e.toString()); + future.complete(result); + return null; + } + + future.complete(result); + return null; + } + + @Override + public AsyncCallFuture deleteTemplateAsync( + TemplateInfo template) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AsyncCallFuture createTemplateFromSnapshotAsync( + SnapshotInfo snapshot, TemplateInfo template, DataStore store) { + // TODO Auto-generated method stub + return null; + } + + @Override + public AsyncCallFuture createTemplateFromVolumeAsync( + VolumeInfo volume, TemplateInfo template, DataStore store) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java new file mode 100644 index 00000000000..af572d49a5e --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/downloader/ImageDownloader.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.downloader; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; + +public interface ImageDownloader { + public void downloadImage(TemplateInfo template); +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java new file mode 100644 index 00000000000..97ea6c48c79 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/AncientImageDataStoreDriverImpl.java @@ -0,0 +1,250 @@ +/* + * 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.storage.image.driver; + +import java.util.List; +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.DeleteSnapshotBackupCommand; +import com.cloud.agent.api.storage.DeleteVolumeCommand; +import com.cloud.agent.api.to.S3TO; +import com.cloud.agent.api.to.SwiftTO; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.storage.RegisterVolumePayload; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.VMTemplateStorageResourceAssoc; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VMTemplateZoneVO; +import com.cloud.storage.VolumeHostVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplateHostDao; +import com.cloud.storage.dao.VMTemplateZoneDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.dao.VolumeHostDao; +import com.cloud.storage.download.DownloadMonitor; +import com.cloud.storage.s3.S3Manager; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.storage.swift.SwiftManager; +import com.cloud.utils.exception.CloudRuntimeException; + +public class AncientImageDataStoreDriverImpl implements ImageDataStoreDriver { + private static final Logger s_logger = Logger + .getLogger(AncientImageDataStoreDriverImpl.class); + @Inject + VMTemplateZoneDao templateZoneDao; + @Inject + VMTemplateDao templateDao; + @Inject DownloadMonitor _downloadMonitor; + @Inject + VMTemplateHostDao _vmTemplateHostDao; + @Inject VolumeDao volumeDao; + @Inject VolumeHostDao volumeHostDao; + @Inject HostDao hostDao; + @Inject SnapshotDao snapshotDao; + @Inject AgentManager agentMgr; + @Inject SnapshotManager snapshotMgr; + @Inject + private SwiftManager _swiftMgr; + @Inject + private S3Manager _s3Mgr; + @Override + public String grantAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Set listObjects(DataStore store) { + // TODO Auto-generated method stub + return null; + } + + class CreateContext extends AsyncRpcConext { + final DataObject data; + public CreateContext(AsyncCompletionCallback callback, DataObject data) { + super(callback); + this.data = data; + } + } + + @Override + public void createAsync(DataObject data, + AsyncCompletionCallback callback) { + if (data.getType() == DataObjectType.TEMPLATE) { + List templateZones = this.templateZoneDao.listByTemplateId(data.getId()); + for (VMTemplateZoneVO templateZone : templateZones) { + VMTemplateVO template = this.templateDao.findById(data.getId()); + _downloadMonitor.downloadTemplateToStorage(template, templateZone.getZoneId()); + } + } else if (data.getType() == DataObjectType.VOLUME) { + VolumeVO vol = this.volumeDao.findById(data.getId()); + VolumeInfo volInfo = (VolumeInfo)data; + RegisterVolumePayload payload = (RegisterVolumePayload)volInfo.getpayload(); + _downloadMonitor.downloadVolumeToStorage(vol, vol.getDataCenterId(), payload.getUrl(), + payload.getChecksum(), ImageFormat.valueOf(payload.getFormat().toUpperCase())); + } + + CreateCmdResult result = new CreateCmdResult(null, null); + callback.complete(result); + } + + private void deleteVolume(DataObject data, AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + VolumeVO vol = volumeDao.findById(data.getId()); + if (s_logger.isDebugEnabled()) { + s_logger.debug("Expunging " + vol); + } + + // Find out if the volume is present on secondary storage + VolumeHostVO volumeHost = volumeHostDao.findByVolumeId(vol.getId()); + if (volumeHost != null) { + if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOADED) { + HostVO ssHost = hostDao.findById(volumeHost.getHostId()); + DeleteVolumeCommand dtCommand = new DeleteVolumeCommand( + ssHost.getStorageUrl(), volumeHost.getInstallPath()); + Answer answer = agentMgr.sendToSecStorage(ssHost, dtCommand); + if (answer == null || !answer.getResult()) { + s_logger.debug("Failed to delete " + + volumeHost + + " due to " + + ((answer == null) ? "answer is null" : answer + .getDetails())); + return; + } + } else if (volumeHost.getDownloadState() == VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS) { + s_logger.debug("Volume: " + vol.getName() + + " is currently being uploaded; cant' delete it."); + throw new CloudRuntimeException( + "Please specify a volume that is not currently being uploaded."); + } + volumeHostDao.remove(volumeHost.getId()); + volumeDao.remove(vol.getId()); + CommandResult result = new CommandResult(); + callback.complete(result); + return; + } + } + + private void deleteTemplate(DataObject data, AsyncCompletionCallback callback) { + + } + + private void deleteSnapshot(DataObject data, AsyncCompletionCallback callback) { + Long snapshotId = data.getId(); + SnapshotVO snapshot = this.snapshotDao.findByIdIncludingRemoved(snapshotId); + CommandResult result = new CommandResult(); + if (snapshot == null) { + s_logger.debug("Destroying snapshot " + snapshotId + " backup failed due to unable to find snapshot "); + result.setResult("Unable to find snapshot: " + snapshotId); + callback.complete(result); + return; + } + + try { + String secondaryStoragePoolUrl = this.snapshotMgr.getSecondaryStorageURL(snapshot); + Long dcId = snapshot.getDataCenterId(); + Long accountId = snapshot.getAccountId(); + Long volumeId = snapshot.getVolumeId(); + + String backupOfSnapshot = snapshot.getBackupSnapshotId(); + if (backupOfSnapshot == null) { + callback.complete(result); + return; + } + SwiftTO swift = _swiftMgr.getSwiftTO(snapshot.getSwiftId()); + S3TO s3 = _s3Mgr.getS3TO(); + + DeleteSnapshotBackupCommand cmd = new DeleteSnapshotBackupCommand( + swift, s3, secondaryStoragePoolUrl, dcId, accountId, volumeId, + backupOfSnapshot, false); + Answer answer = agentMgr.sendToSSVM(dcId, cmd); + + if ((answer != null) && answer.getResult()) { + snapshot.setBackupSnapshotId(null); + snapshotDao.update(snapshotId, snapshot); + } else if (answer != null) { + result.setResult(answer.getDetails()); + } + } catch (Exception e) { + s_logger.debug("failed to delete snapshot: " + snapshotId + ": " + e.toString()); + result.setResult(e.toString()); + } + callback.complete(result); + } + + @Override + public void deleteAsync(DataObject data, + AsyncCompletionCallback callback) { + if (data.getType() == DataObjectType.VOLUME) { + deleteVolume(data, callback); + } else if (data.getType() == DataObjectType.TEMPLATE) { + deleteTemplate(data, callback); + } else if (data.getType() == DataObjectType.SNAPSHOT) { + deleteSnapshot(data, callback); + } + } + + @Override + public void copyAsync(DataObject srcdata, DataObject destData, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public boolean canCopy(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void resize(DataObject data, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/DefaultImageDataStoreDriverImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/DefaultImageDataStoreDriverImpl.java new file mode 100644 index 00000000000..3d46c73cde2 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/driver/DefaultImageDataStoreDriverImpl.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.storage.image.driver; + +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.command.CreateObjectAnswer; +import org.apache.cloudstack.storage.command.CreateObjectCommand; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; + +import com.cloud.storage.dao.VMTemplateDao; + +//http-read-only based image store +public class DefaultImageDataStoreDriverImpl implements ImageDataStoreDriver { + @Inject + EndPointSelector selector; + @Inject + VMTemplateDao imageDataDao; + public DefaultImageDataStoreDriverImpl() { + } + + @Override + public String grantAccess(DataObject data, EndPoint ep) { + return data.getUri(); + } + + @Override + public boolean revokeAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return true; + } + + @Override + public Set listObjects(DataStore store) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void createAsync(DataObject data, + AsyncCompletionCallback callback) { + //for default http data store, can create http based template/iso + CreateCmdResult result = new CreateCmdResult("", null); + if (!data.getUri().startsWith("http")) { + result.setResult("can't register an image which is not a http link"); + callback.complete(result); + return; + } + + if (data.getSize() == null && data.getType() == DataObjectType.TEMPLATE) { + //the template size is unknown during registration, need to find out the size of template + EndPoint ep = selector.select(data); + if (ep == null) { + result.setResult("can't find storage client for:" + data.getId() + "," + data.getType()); + callback.complete(result); + return; + } + CreateObjectCommand createCmd = new CreateObjectCommand(data.getUri()); + CreateObjectAnswer answer = (CreateObjectAnswer)ep.sendMessage(createCmd); + if (answer.getResult()) { + //update imagestorevo + + result = new CreateCmdResult(answer.getPath(), answer.getSize()); + } else { + result.setResult(answer.getDetails()); + } + + } + + callback.complete(result); + } + + @Override + public void deleteAsync(DataObject data, + AsyncCompletionCallback callback) { + CommandResult result = new CommandResult(); + callback.complete(result); + } + + @Override + public boolean canCopy(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void copyAsync(DataObject srcdata, DataObject destData, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(DataObject data, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManager.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManager.java new file mode 100644 index 00000000000..e1fd46b76df --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManager.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.manager; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState; + +import com.cloud.storage.VMTemplateVO; +import com.cloud.utils.fsm.StateMachine2; + +public interface ImageDataManager { + StateMachine2 getStateMachine(); + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManagerImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManagerImpl.java new file mode 100644 index 00000000000..83e98878158 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataManagerImpl.java @@ -0,0 +1,50 @@ +/* + * 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.storage.image.manager; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateState; +import org.springframework.stereotype.Component; + +import com.cloud.storage.VMTemplateVO; +import com.cloud.utils.fsm.StateMachine2; + +@Component +public class ImageDataManagerImpl implements ImageDataManager { + private final StateMachine2 + stateMachine = new StateMachine2(); + + public ImageDataManagerImpl() { + stateMachine.addTransition(TemplateState.Allocated, TemplateEvent.CreateRequested, TemplateState.Creating); + stateMachine.addTransition(TemplateState.Creating, TemplateEvent.CreateRequested, TemplateState.Creating); + stateMachine.addTransition(TemplateState.Creating, TemplateEvent.OperationSucceeded, TemplateState.Ready); + stateMachine.addTransition(TemplateState.Creating, TemplateEvent.OperationFailed, TemplateState.Allocated); + stateMachine.addTransition(TemplateState.Creating, TemplateEvent.DestroyRequested, TemplateState.Destroying); + stateMachine.addTransition(TemplateState.Ready, TemplateEvent.DestroyRequested, TemplateState.Destroying); + stateMachine.addTransition(TemplateState.Allocated, TemplateEvent.DestroyRequested, TemplateState.Destroying); + stateMachine.addTransition(TemplateState.Destroying, TemplateEvent.DestroyRequested, TemplateState.Destroying); + stateMachine.addTransition(TemplateState.Destroying, TemplateEvent.OperationFailed, TemplateState.Destroying); + stateMachine.addTransition(TemplateState.Destroying, TemplateEvent.OperationSucceeded, TemplateState.Destroyed); + } + + @Override + public StateMachine2 getStateMachine() { + return stateMachine; + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java new file mode 100644 index 00000000000..2771f78e381 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/manager/ImageDataStoreManagerImpl.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.manager; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.provider.ImageDataStoreProvider; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; +import org.apache.cloudstack.storage.image.datastore.ImageDataStore; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreManager; +import org.apache.cloudstack.storage.image.db.ImageDataStoreDao; +import org.apache.cloudstack.storage.image.db.ImageDataStoreVO; +import org.apache.cloudstack.storage.image.store.DefaultImageDataStoreImpl; +import org.springframework.stereotype.Component; + +import com.cloud.storage.dao.VMTemplateDao; + +@Component +public class ImageDataStoreManagerImpl implements ImageDataStoreManager { + @Inject + ImageDataStoreDao dataStoreDao; + @Inject + VMTemplateDao imageDataDao; + @Inject + DataStoreProviderManager providerManager; + Map driverMaps; + + @PostConstruct + public void config() { + driverMaps = new HashMap(); + } + + @Override + public ImageDataStore getImageDataStore(long dataStoreId) { + ImageDataStoreVO dataStore = dataStoreDao.findById(dataStoreId); + long providerId = dataStore.getProvider(); + ImageDataStoreProvider provider = (ImageDataStoreProvider)providerManager.getDataStoreProviderById(providerId); + ImageDataStore imgStore = DefaultImageDataStoreImpl.getDataStore(dataStore, + driverMaps.get(provider.getUuid()), provider + ); + // TODO Auto-generated method stub + return imgStore; + } + + @Override + public boolean registerDriver(String uuid, ImageDataStoreDriver driver) { + if (driverMaps.containsKey(uuid)) { + return false; + } + driverMaps.put(uuid, driver); + return true; + } + + @Override + public ImageDataStore getImageDataStore(String uuid) { + ImageDataStoreVO dataStore = dataStoreDao.findByUuid(uuid); + return getImageDataStore(dataStore.getId()); + } + + @Override + public List getList() { + List stores = dataStoreDao.listAll(); + List imageStores = new ArrayList(); + for (ImageDataStoreVO store : stores) { + imageStores.add(getImageDataStore(store.getId())); + } + return imageStores; + } + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/AncientImageDataStoreProvider.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/AncientImageDataStoreProvider.java new file mode 100644 index 00000000000..b2ee9ab853d --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/AncientImageDataStoreProvider.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.storage.image.store; + +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.storage.datastore.provider.ImageDataStoreProvider; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreHelper; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreManager; +import org.apache.cloudstack.storage.image.driver.AncientImageDataStoreDriverImpl; +import org.apache.cloudstack.storage.image.store.lifecycle.DefaultImageDataStoreLifeCycle; +import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle; +import org.springframework.stereotype.Component; + +import com.cloud.utils.component.ComponentContext; + +@Component +public class AncientImageDataStoreProvider implements ImageDataStoreProvider { + + private final String name = "ancient image data store"; + protected ImageDataStoreLifeCycle lifeCycle; + protected ImageDataStoreDriver driver; + @Inject + ImageDataStoreManager storeMgr; + @Inject + ImageDataStoreHelper helper; + long id; + String uuid; + @Override + public DataStoreLifeCycle getLifeCycle() { + return lifeCycle; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getUuid() { + return this.uuid; + } + + @Override + public long getId() { + return this.id; + } + + @Override + public boolean configure(Map params) { + lifeCycle = ComponentContext.inject(DefaultImageDataStoreLifeCycle.class); + driver = ComponentContext.inject(AncientImageDataStoreDriverImpl.class); + uuid = (String)params.get("uuid"); + id = (Long)params.get("id"); + storeMgr.registerDriver(uuid, driver); + + Map infos = new HashMap(); + String dataStoreName = UUID.nameUUIDFromBytes(this.name.getBytes()).toString(); + infos.put("name", dataStoreName); + infos.put("uuid", dataStoreName); + infos.put("protocol", "http"); + infos.put("scope", ScopeType.GLOBAL); + infos.put("provider", this.getId()); + DataStoreLifeCycle lifeCycle = this.getLifeCycle(); + lifeCycle.initialize(infos); + return true; + } + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreImpl.java new file mode 100644 index 00000000000..d159f741584 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreImpl.java @@ -0,0 +1,145 @@ +/* + * 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.storage.image.store; + +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.Scope; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.datastore.provider.ImageDataStoreProvider; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; +import org.apache.cloudstack.storage.image.datastore.ImageDataStore; +import org.apache.cloudstack.storage.image.db.ImageDataStoreVO; + +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.storage.encoding.EncodingType; + + +public class DefaultImageDataStoreImpl implements ImageDataStore { + @Inject + VMTemplateDao imageDao; + @Inject + private ObjectInDataStoreManager objectInStoreMgr; + protected ImageDataStoreDriver driver; + protected ImageDataStoreVO imageDataStoreVO; + protected ImageDataStoreProvider provider; + boolean needDownloadToCacheStorage = false; + + protected DefaultImageDataStoreImpl() { + + } + + protected void configure(ImageDataStoreVO dataStoreVO, ImageDataStoreDriver imageDataStoreDriver, + ImageDataStoreProvider provider) { + this.driver = imageDataStoreDriver; + this.imageDataStoreVO = dataStoreVO; + this.provider = provider; + } + + public static ImageDataStore getDataStore(ImageDataStoreVO dataStoreVO, ImageDataStoreDriver imageDataStoreDriver, + ImageDataStoreProvider provider) { + DefaultImageDataStoreImpl instance = (DefaultImageDataStoreImpl)ComponentContext.inject(DefaultImageDataStoreImpl.class); + instance.configure(dataStoreVO, imageDataStoreDriver, provider); + return instance; + } + + @Override + public Set listTemplates() { + // TODO Auto-generated method stub + return null; + } + + @Override + public DataStoreDriver getDriver() { + // TODO Auto-generated method stub + return this.driver; + } + + @Override + public DataStoreRole getRole() { + // TODO Auto-generated method stub + return DataStoreRole.Image; + } + @Override + public long getId() { + // TODO Auto-generated method stub + return this.imageDataStoreVO.getId(); + } + + @Override + public String getUri() { + return this.imageDataStoreVO.getProtocol() + "://" + "?" + EncodingType.ROLE + "=" + this.getRole(); + } + + @Override + public Scope getScope() { + return new ZoneScope(imageDataStoreVO.getDcId()); + } + + @Override + public TemplateInfo getTemplate(long templateId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public VolumeInfo getVolume(long volumeId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public SnapshotInfo getSnapshot(long snapshotId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean exists(DataObject object) { + return (objectInStoreMgr.findObject(object, + this) != null) ? true : false; + } + + @Override + public String getUuid() { + return this.imageDataStoreVO.getUuid(); + } + + @Override + public DataObject create(DataObject obj) { + DataObject object = objectInStoreMgr.create(obj, this); + return object; + } + + @Override + public boolean delete(DataObject obj) { + // TODO Auto-generated method stub + return false; + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreProvider.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreProvider.java new file mode 100644 index 00000000000..efbb999bdcf --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/DefaultImageDataStoreProvider.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.store; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; +import org.apache.cloudstack.storage.datastore.provider.ImageDataStoreProvider; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreManager; +import org.apache.cloudstack.storage.image.driver.DefaultImageDataStoreDriverImpl; +import org.apache.cloudstack.storage.image.store.lifecycle.DefaultImageDataStoreLifeCycle; +import org.apache.cloudstack.storage.image.store.lifecycle.ImageDataStoreLifeCycle; + +import com.cloud.utils.component.ComponentContext; + +public class DefaultImageDataStoreProvider implements ImageDataStoreProvider { + private final String name = "default image data store"; + protected ImageDataStoreLifeCycle lifeCycle; + protected ImageDataStoreDriver driver; + @Inject + ImageDataStoreManager storeMgr; + long id; + String uuid; + @Override + public DataStoreLifeCycle getLifeCycle() { + return lifeCycle; + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getUuid() { + return this.uuid; + } + + @Override + public long getId() { + return this.id; + } + + @Override + public boolean configure(Map params) { + lifeCycle = ComponentContext.inject(DefaultImageDataStoreLifeCycle.class); + driver = ComponentContext.inject(DefaultImageDataStoreDriverImpl.class); + uuid = (String)params.get("uuid"); + id = (Long)params.get("id"); + storeMgr.registerDriver(uuid, driver); + return true; + } + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java new file mode 100644 index 00000000000..85bc0c118a0 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/TemplateObject.java @@ -0,0 +1,183 @@ +/* + * 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.storage.image.store; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateEvent; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.image.manager.ImageDataManager; +import org.apache.log4j.Logger; + +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplatePoolDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.storage.encoding.EncodingType; + +public class TemplateObject implements TemplateInfo { + private static final Logger s_logger = Logger + .getLogger(TemplateObject.class); + private VMTemplateVO imageVO; + private DataStore dataStore; + @Inject + ImageDataManager imageMgr; + @Inject + VMTemplateDao imageDao; + @Inject + ObjectInDataStoreManager ojbectInStoreMgr; + @Inject VMTemplatePoolDao templatePoolDao; + + protected TemplateObject() { + } + + protected void configure(VMTemplateVO template, DataStore dataStore) { + this.imageVO = template; + this.dataStore = dataStore; + } + + public static TemplateObject getTemplate(VMTemplateVO vo, DataStore store) { + TemplateObject to = ComponentContext.inject(TemplateObject.class); + to.configure(vo, store); + return to; + } + + public void setImageStoreId(long id) { + this.imageVO.setImageDataStoreId(id); + } + + public void setSize(Long size) { + this.imageVO.setSize(size); + } + + public VMTemplateVO getImage() { + return this.imageVO; + } + + @Override + public DataStore getDataStore() { + return this.dataStore; + } + + @Override + public long getId() { + return this.imageVO.getId(); + } + + @Override + public String getUuid() { + return this.imageVO.getUuid(); + } + + @Override + public String getUri() { + VMTemplateVO image = imageDao.findById(this.imageVO.getId()); + if (this.dataStore == null) { + return image.getUrl(); + } else { + DataObjectInStore obj = ojbectInStoreMgr.findObject(this, this.dataStore); + StringBuilder builder = new StringBuilder(); + if (obj.getState() == ObjectInDataStoreStateMachine.State.Ready + || obj.getState() == ObjectInDataStoreStateMachine.State.Copying) { + + builder.append(this.dataStore.getUri()); + builder.append("&" + EncodingType.OBJTYPE + "=" + DataObjectType.TEMPLATE); + builder.append("&" + EncodingType.PATH + "=" + obj.getInstallPath()); + builder.append("&" + EncodingType.SIZE + "=" + image.getSize()); + return builder.toString(); + } else { + builder.append(this.dataStore.getUri()); + builder.append("&" + EncodingType.OBJTYPE + "=" + DataObjectType.TEMPLATE); + builder.append("&" + EncodingType.SIZE + "=" + image.getSize()); + builder.append("&" + EncodingType.PATH + "=" + image.getUrl()); + return builder.toString(); + } + } + } + + @Override + public Long getSize() { + if (this.dataStore == null) { + return this.imageVO.getSize(); + } + + /* + +// If the template that was passed into this allocator is not installed in the storage pool, + // add 3 * (template size on secondary storage) to the running total + VMTemplateHostVO templateHostVO = _storageMgr.findVmTemplateHost(templateForVmCreation.getId(), null); + + if (templateHostVO == null) { + VMTemplateSwiftVO templateSwiftVO = _swiftMgr.findByTmpltId(templateForVmCreation.getId()); + if (templateSwiftVO != null) { + long templateSize = templateSwiftVO.getPhysicalSize(); + if (templateSize == 0) { + templateSize = templateSwiftVO.getSize(); + } + totalAllocatedSize += (templateSize + _extraBytesPerVolume); + } + } else { + long templateSize = templateHostVO.getPhysicalSize(); + if ( templateSize == 0 ){ + templateSize = templateHostVO.getSize(); + } + totalAllocatedSize += (templateSize + _extraBytesPerVolume); + } + + */ + VMTemplateVO image = imageDao.findById(this.imageVO.getId()); + return image.getSize(); + } + + @Override + public DataObjectType getType() { + return DataObjectType.TEMPLATE; + } + + @Override + public DiskFormat getFormat() { + return DiskFormat.valueOf(this.imageVO.getFormat().toString()); + } + + public boolean stateTransit(TemplateEvent e) throws NoTransitionException { + boolean result= imageMgr.getStateMachine().transitTo(this.imageVO, e, null, + imageDao); + this.imageVO = imageDao.findById(this.imageVO.getId()); + return result; + } + + @Override + public void processEvent(Event event) { + try { + ojbectInStoreMgr.update(this, event); + } catch (NoTransitionException e) { + s_logger.debug("failed to update state", e); + throw new CloudRuntimeException("Failed to update state" + e.toString()); + } + } +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/DefaultImageDataStoreLifeCycle.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/DefaultImageDataStoreLifeCycle.java new file mode 100644 index 00000000000..17aabca3921 --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/DefaultImageDataStoreLifeCycle.java @@ -0,0 +1,112 @@ +// 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.storage.image.store.lifecycle; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreHelper; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreManager; +import org.apache.cloudstack.storage.image.db.ImageDataStoreDao; +import org.apache.cloudstack.storage.image.db.ImageDataStoreVO; + +import com.cloud.agent.api.StoragePoolInfo; + +public class DefaultImageDataStoreLifeCycle implements ImageDataStoreLifeCycle { + @Inject + protected ImageDataStoreDao imageStoreDao; + @Inject + ImageDataStoreHelper imageStoreHelper; + @Inject + ImageDataStoreManager imageStoreMgr; + public DefaultImageDataStoreLifeCycle() { + } + + + @Override + public DataStore initialize(Map dsInfos) { + ImageDataStoreVO ids = imageStoreHelper.createImageDataStore(dsInfos); + return imageStoreMgr.getImageDataStore(ids.getId()); + } + + + @Override + public boolean attachCluster(DataStore store, ClusterScope scope) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean attachHost(DataStore store, HostScope scope, + StoragePoolInfo existingInfo) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean attachZone(DataStore dataStore, ZoneScope scope) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean dettach() { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean unmanaged() { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean maintain(long storeId) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean cancelMaintain(long storeId) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public boolean deleteDataStore(long storeId) { + // TODO Auto-generated method stub + return false; + } + + + + + +} diff --git a/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/ImageDataStoreLifeCycle.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/ImageDataStoreLifeCycle.java new file mode 100644 index 00000000000..a36823959df --- /dev/null +++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/store/lifecycle/ImageDataStoreLifeCycle.java @@ -0,0 +1,24 @@ +/* + * 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.storage.image.store.lifecycle; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; + +public interface ImageDataStoreLifeCycle extends DataStoreLifeCycle { +} diff --git a/engine/storage/imagemotion/pom.xml b/engine/storage/imagemotion/pom.xml new file mode 100644 index 00000000000..9a7f3e017a2 --- /dev/null +++ b/engine/storage/imagemotion/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + cloud-engine-storage-imagemotion + Apache CloudStack Engine Storage Image Motion Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + org.apache.cloudstack + cloud-engine-storage-volume + ${project.version} + runtime + + + org.apache.cloudstack + cloud-engine-storage-image + ${project.version} + runtime + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + test + + diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java new file mode 100644 index 00000000000..c49a521a3ca --- /dev/null +++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/DefaultImageMotionStrategy.java @@ -0,0 +1,140 @@ +/* + * 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.storage.image.motion; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.command.CopyCmd; +import org.apache.cloudstack.storage.command.CopyCmdAnswer; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo; + +import com.cloud.agent.api.Answer; + +//At least one of datastore is coming from image store or image cache store + +public class DefaultImageMotionStrategy implements ImageMotionStrategy { + @Inject + EndPointSelector selector; + private class CreateTemplateContext extends AsyncRpcConext { + private final TemplateOnPrimaryDataStoreInfo template; + public CreateTemplateContext(AsyncCompletionCallback callback, TemplateOnPrimaryDataStoreInfo template) { + super(callback); + this.template = template; + } + + public TemplateOnPrimaryDataStoreInfo getTemplate() { + return this.template; + } + + } +/* + @Override + public void copyTemplateAsync(String destUri, String srcUri, EndPoint ep, AsyncCompletionCallback callback) { + + CopyCmd copyCommand = new CopyCmd(destUri, srcUri); + CreateTemplateContext context = new CreateTemplateContext(callback, null); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyTemplateCallBack(null, null)) + .setContext(context); + + ep.sendMessageAsync(copyCommand, caller); + } + + public Object copyTemplateCallBack(AsyncCallbackDispatcher callback, CreateTemplateContext context) { + AsyncCompletionCallback parentCall = context.getParentCallback(); + CopyTemplateToPrimaryStorageAnswer answer = (CopyTemplateToPrimaryStorageAnswer)callback.getResult(); + CommandResult result = new CommandResult(); + + if (!answer.getResult()) { + result.setSucess(answer.getResult()); + result.setResult(answer.getDetails()); + } else { + TemplateOnPrimaryDataStoreInfo templateStore = context.getTemplate(); + templateStore.setPath(answer.getPath()); + result.setSucess(true); + } + + parentCall.complete(result); + return null; + }*/ + + @Override + public boolean canHandle(DataObject srcData, DataObject destData) { + /* + DataStore destStore = destData.getDataStore(); + DataStore srcStore = srcData.getDataStore(); + if (destStore.getRole() == DataStoreRole.Image || destStore.getRole() == DataStoreRole.ImageCache + || srcStore.getRole() == DataStoreRole.Image + || srcStore.getRole() == DataStoreRole.ImageCache) { + return true; + }*/ + return false; + } + + @Override + public Void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback) { + DataStore destStore = destData.getDataStore(); + DataStore srcStore = srcData.getDataStore(); + EndPoint ep = selector.select(srcData, destData); + CopyCommandResult result = new CopyCommandResult("", null); + if (ep == null) { + result.setResult("can't find end point"); + callback.complete(result); + return null; + } + + String srcUri = srcStore.getDriver().grantAccess(srcData, ep); + String destUri = destStore.getDriver().grantAccess(destData, ep); + CopyCmd cmd = new CopyCmd(srcUri, destUri); + + CreateTemplateContext context = new CreateTemplateContext(callback, null); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyAsyncCallback(null, null)) + .setContext(context); + + ep.sendMessageAsync(cmd, caller); + return null; + } + + protected Void copyAsyncCallback(AsyncCallbackDispatcher callback, CreateTemplateContext context) { + AsyncCompletionCallback parentCall = context.getParentCallback(); + Answer answer = (Answer)callback.getResult(); + if (!answer.getResult()) { + CopyCommandResult result = new CopyCommandResult("", null); + result.setResult(answer.getDetails()); + parentCall.complete(result); + } else { + CopyCmdAnswer ans = (CopyCmdAnswer)answer; + CopyCommandResult result = new CopyCommandResult(ans.getPath(), null); + parentCall.complete(result); + } + return null; + + } + +} diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java new file mode 100644 index 00000000000..93ba4a5ad64 --- /dev/null +++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionServiceImpl.java @@ -0,0 +1,70 @@ +/* + * 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.storage.image.motion; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageService; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + + +public class ImageMotionServiceImpl implements ImageMotionService { + @Inject + List motionStrategies; + @Inject + VolumeService volumeService; + @Inject + ImageService imageService; + + @Override + public boolean copyIso(String isoUri, String destIsoUri) { + // TODO Auto-generated method stub + return false; + } + + + + @Override + public void copyTemplateAsync(TemplateInfo destTemplate, TemplateInfo srcTemplate, AsyncCompletionCallback callback) { + /* ImageMotionStrategy ims = null; + for (ImageMotionStrategy strategy : motionStrategies) { + if (strategy.canHandle(srcTemplate)) { + ims = strategy; + break; + } + } + + if (ims == null) { + throw new CloudRuntimeException("Can't find proper image motion strategy"); + } + + EndPoint ep = ims.getEndPoint(destTemplate, srcTemplate); + String srcUri = srcTemplate.getDataStore().grantAccess(srcTemplate, ep); + String destUri = destTemplate.getDataStore().grantAccess(destTemplate, ep); + + ims.copyTemplateAsync(destUri, srcUri, ep, callback);*/ + } + + +} diff --git a/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java new file mode 100644 index 00000000000..7a476367d37 --- /dev/null +++ b/engine/storage/imagemotion/src/org/apache/cloudstack/storage/image/motion/ImageMotionStrategy.java @@ -0,0 +1,24 @@ +/* + * 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.storage.image.motion; + +import org.apache.cloudstack.storage.motion.DataMotionStrategy; + +public interface ImageMotionStrategy extends DataMotionStrategy { +} diff --git a/engine/storage/integration-test/pom.xml b/engine/storage/integration-test/pom.xml new file mode 100644 index 00000000000..368a4e301ab --- /dev/null +++ b/engine/storage/integration-test/pom.xml @@ -0,0 +1,124 @@ + + + 4.0.0 + cloud-engine-storage-integration-test + Apache CloudStack Engine Storage integration test Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + test + + + org.apache.cloudstack + cloud-engine-storage-volume + ${project.version} + test + + + org.apache.cloudstack + cloud-engine-storage-snapshot + ${project.version} + test + + + org.apache.cloudstack + cloud-engine-storage-image + ${project.version} + test + + + org.apache.cloudstack + cloud-engine-storage-imagemotion + ${project.version} + test + + + org.apache.cloudstack + cloud-plugin-hypervisor-xen + ${project.version} + test + + + org.apache.httpcomponents + httpclient + 4.2.2 + compile + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + org.testng + testng + 6.1.1 + test + + + + + install + ${project.basedir}/test + + + ${project.basedir}/test/resource + + + + + maven-compiler-plugin + + + + testCompile + + + + + + maven-surefire-plugin + + true + + + + integration-test + + test + + + + + + + diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AllTests.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AllTests.java new file mode 100644 index 00000000000..dde4484db54 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AllTests.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 org.apache.cloudstack.storage.test; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; +import org.junit.runners.Suite.SuiteClasses; + +@RunWith(Suite.class) +@SuiteClasses({ volumeServiceTest.class }) +public class AllTests { + +} diff --git a/api/src/org/apache/cloudstack/api/PlugService.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTest.java similarity index 77% rename from api/src/org/apache/cloudstack/api/PlugService.java rename to engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTest.java index 00032e3abdd..bde5804e624 100644 --- a/api/src/org/apache/cloudstack/api/PlugService.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTest.java @@ -14,18 +14,17 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package org.apache.cloudstack.api; +package org.apache.cloudstack.storage.test; -import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.ElementType.TYPE; 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) +@Target({TYPE, METHOD}) @Retention(RUNTIME) -public @interface PlugService { - Class pluggableService() default PluggableService.class; +public @interface AopTest { + } diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTestAdvice.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTestAdvice.java new file mode 100644 index 00000000000..63669c453d7 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/AopTestAdvice.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 org.apache.cloudstack.storage.test; + +import org.aspectj.lang.ProceedingJoinPoint; + +import com.cloud.utils.db.Transaction; + +public class AopTestAdvice { + public Object AopTestMethod(ProceedingJoinPoint call) throws Throwable { + Transaction txn = Transaction.open(call.getSignature().getName()); + Object ret = null; + try { + ret = call.proceed(); + } finally { + txn.close(); + } + return ret; + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java new file mode 100644 index 00000000000..2ad52159afc --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java @@ -0,0 +1,212 @@ +// 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.storage.test; + +import java.io.IOException; + +import org.apache.cloudstack.acl.APIChecker; +import org.apache.cloudstack.engine.service.api.OrchestrationService; +import org.apache.cloudstack.storage.HostEndpointRpcServer; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.cloudstack.storage.test.ChildTestConfiguration.Library; +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.ComponentScan.Filter; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.FilterType; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.core.type.filter.TypeFilter; + +import com.cloud.agent.AgentManager; +import com.cloud.alert.AlertManager; +import com.cloud.cluster.ClusteredAgentRebalanceService; +import com.cloud.cluster.agentlb.dao.HostTransferMapDao; +import com.cloud.cluster.agentlb.dao.HostTransferMapDaoImpl; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.configuration.dao.ConfigurationDaoImpl; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.ClusterDaoImpl; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.DataCenterDaoImpl; +import com.cloud.dc.dao.DataCenterIpAddressDaoImpl; +import com.cloud.dc.dao.DataCenterLinkLocalIpAddressDaoImpl; +import com.cloud.dc.dao.DataCenterVnetDaoImpl; +import com.cloud.dc.dao.DcDetailsDaoImpl; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.dc.dao.HostPodDaoImpl; +import com.cloud.dc.dao.PodVlanDaoImpl; +import com.cloud.domain.dao.DomainDao; +import com.cloud.domain.dao.DomainDaoImpl; +import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDetailsDao; +import com.cloud.host.dao.HostDetailsDaoImpl; +import com.cloud.host.dao.HostTagsDao; +import com.cloud.host.dao.HostTagsDaoImpl; +import com.cloud.server.auth.UserAuthenticator; +import com.cloud.storage.dao.StoragePoolHostDao; +import com.cloud.storage.dao.StoragePoolHostDaoImpl; +import com.cloud.storage.dao.VMTemplateDaoImpl; +import com.cloud.storage.dao.VMTemplateDetailsDao; +import com.cloud.storage.dao.VMTemplateDetailsDaoImpl; +import com.cloud.storage.dao.VMTemplateHostDaoImpl; +import com.cloud.storage.dao.VMTemplatePoolDaoImpl; +import com.cloud.storage.dao.VMTemplateZoneDao; +import com.cloud.storage.dao.VMTemplateZoneDaoImpl; +import com.cloud.storage.dao.VolumeDaoImpl; +import com.cloud.storage.dao.VolumeHostDaoImpl; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.tags.dao.ResourceTagsDaoImpl; +import com.cloud.utils.component.SpringComponentScanUtils; +import com.cloud.vm.dao.NicDaoImpl; +import com.cloud.vm.dao.VMInstanceDaoImpl; +@Configuration +@ComponentScan(basePackageClasses={ + NicDaoImpl.class, + VMInstanceDaoImpl.class, + VMTemplateHostDaoImpl.class, + VolumeHostDaoImpl.class, + VolumeDaoImpl.class, + VMTemplatePoolDaoImpl.class, + ResourceTagsDaoImpl.class, + VMTemplateDaoImpl.class, + MockStorageMotionStrategy.class +}, +includeFilters={@Filter(value=Library.class, type=FilterType.CUSTOM)}, +useDefaultFilters=false +) +public class ChildTestConfiguration extends TestConfiguration { + + @Override + @Bean + public HostDao hostDao() { + HostDao dao = super.hostDao(); + HostDao nDao = Mockito.spy(dao); + return nDao; + } + + @Bean + public EndPointSelector selector() { + return Mockito.mock(EndPointSelector.class); + } + @Bean + public DataCenterDao dcDao() { + return new DataCenterDaoImpl(); + } + @Bean + public HostDetailsDao hostDetailsDao() { + return new HostDetailsDaoImpl(); + } + + @Bean + public HostTagsDao hostTagsDao() { + return new HostTagsDaoImpl(); + } + + @Bean ClusterDao clusterDao() { + return new ClusterDaoImpl(); + } + + @Bean HostTransferMapDao hostTransferDao() { + return new HostTransferMapDaoImpl(); + } + @Bean DataCenterIpAddressDaoImpl dataCenterIpAddressDaoImpl() { + return new DataCenterIpAddressDaoImpl(); + } + @Bean DataCenterLinkLocalIpAddressDaoImpl dataCenterLinkLocalIpAddressDaoImpl() { + return new DataCenterLinkLocalIpAddressDaoImpl(); + } + @Bean DataCenterVnetDaoImpl dataCenterVnetDaoImpl() { + return new DataCenterVnetDaoImpl(); + } + @Bean PodVlanDaoImpl podVlanDaoImpl() { + return new PodVlanDaoImpl(); + } + @Bean DcDetailsDaoImpl dcDetailsDaoImpl() { + return new DcDetailsDaoImpl(); + } + @Bean HostPodDao hostPodDao() { + return new HostPodDaoImpl(); + } + @Bean StoragePoolHostDao storagePoolHostDao() { + return new StoragePoolHostDaoImpl(); + } + @Bean VMTemplateZoneDao templateZoneDao() { + return new VMTemplateZoneDaoImpl(); + } + @Bean VMTemplateDetailsDao templateDetailsDao() { + return new VMTemplateDetailsDaoImpl(); + } + @Bean ConfigurationDao configDao() { + return new ConfigurationDaoImpl(); + } + @Bean + public AgentManager agentMgr() { + return new DirectAgentManagerSimpleImpl(); + } + @Bean DomainDao domainDao() { + return new DomainDaoImpl(); + } + + @Bean + public HostEndpointRpcServer rpcServer() { + return new MockHostEndpointRpcServerDirectCallResource(); + } + @Bean + public ClusteredAgentRebalanceService _rebalanceService() { + return Mockito.mock(ClusteredAgentRebalanceService.class); + } + @Bean + public UserAuthenticator authenticator() { + return Mockito.mock(UserAuthenticator.class); + } + @Bean + public OrchestrationService orchSrvc() { + return Mockito.mock(OrchestrationService.class); + } + @Bean + public APIChecker apiChecker() { + return Mockito.mock(APIChecker.class); + } + + @Bean + public SnapshotManager snapshotMgr() { + return Mockito.mock(SnapshotManager.class); + } + + @Bean + public AlertManager alertMgr() { + return Mockito.mock(AlertManager.class); + } + + public static class Library implements TypeFilter { + + @Override + public boolean match(MetadataReader mdr, MetadataReaderFactory arg1) throws IOException { + mdr.getClassMetadata().getClassName(); + ComponentScan cs = ChildTestConfiguration.class.getAnnotation(ComponentScan.class); + return SpringComponentScanUtils.includedInBasePackageClasses(mdr.getClassMetadata().getClassName(), cs); + } + + } +/* @Override + @Bean + public PrimaryDataStoreDao primaryDataStoreDao() { + return Mockito.mock(PrimaryDataStoreDaoImpl.class); + }*/ +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/CloudStackTestNGBase.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/CloudStackTestNGBase.java new file mode 100644 index 00000000000..dc7223c9e84 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/CloudStackTestNGBase.java @@ -0,0 +1,104 @@ +// 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.storage.test; + +import java.lang.reflect.Method; + +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; + +public class CloudStackTestNGBase extends AbstractTestNGSpringContextTests { + private String hostGateway; + private String hostCidr; + private String hostIp; + private String hostGuid; + private String templateUrl; + private String localStorageUuid; + private String primaryStorageUrl; + private Transaction txn; + + protected void injectMockito() { + + } + + @BeforeMethod(alwaysRun = true) + protected void injectDB(Method testMethod) throws Exception { + txn = Transaction.open(testMethod.getName()); + } + + @Test + protected void injectMockitoTest() { + injectMockito(); + } + + @AfterMethod(alwaysRun = true) + protected void closeDB(Method testMethod) throws Exception { + if (txn != null) { + txn.close(); + } + } + + @BeforeMethod(alwaysRun = true) + @Parameters({"devcloud-host-uuid", "devcloud-host-gateway", "devcloud-host-cidr", + "devcloud-host-ip", "template-url", "devcloud-local-storage-uuid", + "primary-storage-want-to-add"}) + protected void setup(String hostuuid, String gateway, String cidr, + String hostIp, String templateUrl, String localStorageUuid, + String primaryStorage) { + this.hostGuid = hostuuid; + this.hostGateway = gateway; + this.hostCidr = cidr; + this.hostIp = hostIp; + this.templateUrl = templateUrl; + this.localStorageUuid = localStorageUuid; + this.primaryStorageUrl = primaryStorage; + } + + protected String getHostGuid() { + return this.hostGuid; + } + + protected String getHostGateway() { + return this.hostGateway; + } + + protected String getHostCidr() { + return this.hostCidr; + } + + protected String getHostIp() { + return this.hostIp; + } + + protected String getTemplateUrl() { + return this.templateUrl; + } + + protected String getLocalStorageUuid() { + return this.localStorageUuid; + } + + protected String getPrimaryStorageUrl() { + return this.primaryStorageUrl; + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java new file mode 100644 index 00000000000..81db645938c --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentManagerSimpleImpl.java @@ -0,0 +1,243 @@ +/* + * 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.storage.test; + +import java.util.HashMap; +import java.util.Map; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.Listener; +import com.cloud.agent.StartupCommandProcessor; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.SetupCommand; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.manager.AgentAttache; +import com.cloud.agent.manager.Commands; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.ConnectionException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.host.HostEnvironment; +import com.cloud.host.HostVO; +import com.cloud.host.Status.Event; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.xen.resource.XcpOssResource; +import com.cloud.resource.ServerResource; +import com.cloud.utils.component.ManagerBase; + +public class DirectAgentManagerSimpleImpl extends ManagerBase implements AgentManager { + private static final Logger logger = Logger.getLogger(DirectAgentManagerSimpleImpl.class); + private Map hostResourcesMap = new HashMap(); + @Inject + HostDao hostDao; + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean start() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean stop() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Answer easySend(Long hostId, Command cmd) { + // TODO Auto-generated method stub + return null; + } + + protected void loadResource(Long hostId) { + HostVO host = hostDao.findById(hostId); + Map params = new HashMap(); + params.put("guid", host.getGuid()); + params.put("ipaddress", host.getPrivateIpAddress()); + params.put("username", "root"); + params.put("password", "password"); + params.put("zone", String.valueOf(host.getDataCenterId())); + params.put("pod", String.valueOf(host.getPodId())); + + ServerResource resource = null; + if (host.getHypervisorType() == HypervisorType.XenServer) { + resource = new XcpOssResource(); + } + + try { + resource.configure(host.getName(), params); + hostResourcesMap.put(hostId, resource); + } catch (ConfigurationException e) { + logger.debug("Failed to load resource:" + e.toString()); + } + HostEnvironment env = new HostEnvironment(); + SetupCommand cmd = new SetupCommand(env); + cmd.setNeedSetup(true); + + resource.executeRequest(cmd); + } + + @Override + public synchronized Answer send(Long hostId, Command cmd) throws AgentUnavailableException, OperationTimedoutException { + ServerResource resource = hostResourcesMap.get(hostId); + if (resource == null) { + loadResource(hostId); + resource = hostResourcesMap.get(hostId); + } + + if (resource == null) { + return null; + } + + Answer answer = resource.executeRequest(cmd); + return answer; + } + + @Override + public Answer[] send(Long hostId, Commands cmds) throws AgentUnavailableException, OperationTimedoutException { + // TODO Auto-generated method stub + return null; + } + + @Override + public Answer[] send(Long hostId, Commands cmds, int timeout) throws AgentUnavailableException, OperationTimedoutException { + // TODO Auto-generated method stub + return null; + } + + @Override + public long send(Long hostId, Commands cmds, Listener listener) throws AgentUnavailableException { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int registerForHostEvents(Listener listener, boolean connections, boolean commands, boolean priority) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int registerForInitialConnects(StartupCommandProcessor creator, boolean priority) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public void unregisterForHostEvents(int id) { + // TODO Auto-generated method stub + + } + + @Override + public boolean executeUserRequest(long hostId, Event event) throws AgentUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public Answer sendTo(Long dcId, HypervisorType type, Command cmd) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void sendToSecStorage(HostVO ssHost, Command cmd, Listener listener) throws AgentUnavailableException { + // TODO Auto-generated method stub + + } + + @Override + public Answer sendToSecStorage(HostVO ssHost, Command cmd) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean tapLoadingAgents(Long hostId, TapAgentsAction action) { + // TODO Auto-generated method stub + return false; + } + + @Override + public AgentAttache handleDirectConnectAgent(HostVO host, StartupCommand[] cmds, ServerResource resource, boolean forRebalance) throws ConnectionException { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean agentStatusTransitTo(HostVO host, Event e, long msId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public AgentAttache findAttache(long hostId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void disconnectWithoutInvestigation(long hostId, Event event) { + // TODO Auto-generated method stub + + } + + @Override + public void pullAgentToMaintenance(long hostId) { + // TODO Auto-generated method stub + + } + + @Override + public void pullAgentOutMaintenance(long hostId) { + // TODO Auto-generated method stub + + } + + @Override + public boolean reconnect(long hostId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Answer sendToSSVM(Long dcId, Command cmd) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.java new file mode 100644 index 00000000000..2d6b94fdfaf --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/DirectAgentTest.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.storage.test; + +import java.util.UUID; + +import javax.inject.Inject; + +import org.apache.cloudstack.storage.to.ImageDataStoreTO; +import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; +import org.apache.cloudstack.storage.to.PrimaryDataStoreTO; +import org.apache.cloudstack.storage.to.TemplateTO; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.testng.annotations.Test; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.ReadyCommand; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster.ClusterType; +import com.cloud.org.Managed.ManagedState; +import com.cloud.resource.ResourceState; + +@ContextConfiguration(locations="classpath:/storageContext.xml") +public class DirectAgentTest extends CloudStackTestNGBase { + @Inject + AgentManager agentMgr; + @Inject + HostDao hostDao; + @Inject + HostPodDao podDao; + @Inject + ClusterDao clusterDao; + @Inject + DataCenterDao dcDao; + private long dcId; + private long clusterId; + private long hostId; + + @Test(priority = -1) + public void setUp() { + HostVO host = hostDao.findByGuid(this.getHostGuid()); + if (host != null) { + hostId = host.getId(); + dcId = host.getDataCenterId(); + clusterId = host.getClusterId(); + return; + } + //create data center + DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", + null, null, NetworkType.Basic, null, null, true, true, null, null); + dc = dcDao.persist(dc); + dcId = dc.getId(); + //create pod + + HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), this.getHostGateway(), this.getHostCidr(), 8, "test"); + pod = podDao.persist(pod); + //create xen cluster + ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster"); + cluster.setHypervisorType(HypervisorType.XenServer.toString()); + cluster.setClusterType(ClusterType.CloudManaged); + cluster.setManagedState(ManagedState.Managed); + cluster = clusterDao.persist(cluster); + clusterId = cluster.getId(); + //create xen host + + host = new HostVO(this.getHostGuid()); + host.setName("devcloud xen host"); + host.setType(Host.Type.Routing); + host.setHypervisorType(HypervisorType.XenServer); + host.setPrivateIpAddress(this.getHostIp()); + host.setDataCenterId(dc.getId()); + host.setVersion("6.0.1"); + host.setAvailable(true); + host.setSetup(true); + host.setLastPinged(0); + host.setResourceState(ResourceState.Enabled); + host.setClusterId(cluster.getId()); + + host = hostDao.persist(host); + hostId = host.getId(); + } + + @Test + public void testInitResource() { + ReadyCommand cmd = new ReadyCommand(dcId); + try { + agentMgr.send(hostId, cmd); + } catch (AgentUnavailableException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OperationTimedoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void testDownloadTemplate() { + ImageOnPrimayDataStoreTO image = Mockito.mock(ImageOnPrimayDataStoreTO.class); + PrimaryDataStoreTO primaryStore = Mockito.mock(PrimaryDataStoreTO.class); + Mockito.when(primaryStore.getUuid()).thenReturn(this.getLocalStorageUuid()); + Mockito.when(image.getPrimaryDataStore()).thenReturn(primaryStore); + + ImageDataStoreTO imageStore = Mockito.mock(ImageDataStoreTO.class); + Mockito.when(imageStore.getType()).thenReturn("http"); + + TemplateTO template = Mockito.mock(TemplateTO.class); + Mockito.when(template.getPath()).thenReturn(this.getTemplateUrl()); + Mockito.when(template.getImageDataStore()).thenReturn(imageStore); + + Mockito.when(image.getTemplate()).thenReturn(template); + //CopyTemplateToPrimaryStorageCmd cmd = new CopyTemplateToPrimaryStorageCmd(image); + Command cmd = null; + try { + agentMgr.send(hostId, cmd); + } catch (AgentUnavailableException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OperationTimedoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHostEndpointRpcServerDirectCallResource.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHostEndpointRpcServerDirectCallResource.java new file mode 100644 index 00000000000..4ec2436b06d --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHostEndpointRpcServerDirectCallResource.java @@ -0,0 +1,70 @@ +/* + * 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.storage.test; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import javax.inject.Inject; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.HostEndpointRpcServer; +import org.apache.cloudstack.storage.HypervisorHostEndPoint; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.utils.component.ComponentContext; + + +public class MockHostEndpointRpcServerDirectCallResource implements HostEndpointRpcServer { + private static final Logger s_logger = Logger.getLogger(MockHostEndpointRpcServerDirectCallResource.class); + private ScheduledExecutorService executor; + @Inject + AgentManager agentMgr; + public MockHostEndpointRpcServerDirectCallResource() { + executor = Executors.newScheduledThreadPool(10); + } + + public void sendCommandAsync(HypervisorHostEndPoint host, final Command command, final AsyncCompletionCallback callback) { + // new MockRpcCallBack(host.getHostId(), command, callback); + MockRpcCallBack run = ComponentContext.inject(MockRpcCallBack.class); + run.setCallback(callback); + run.setCmd(command); + run.setHostId(host.getId()); + executor.schedule(run, 10, TimeUnit.SECONDS); + } + + @Override + public Answer sendCommand(HypervisorHostEndPoint host, Command command) { + Answer answer; + try { + answer = agentMgr.send(host.getId(), command); + return answer; + } catch (AgentUnavailableException e) { + return null; + } catch (OperationTimedoutException e) { + return null; + } + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHypervsiorHostEndPointRpcServer.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHypervsiorHostEndPointRpcServer.java new file mode 100644 index 00000000000..d6985768d91 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockHypervsiorHostEndPointRpcServer.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.storage.test; + +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.HostEndpointRpcServer; +import org.apache.cloudstack.storage.HypervisorHostEndPoint; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class MockHypervsiorHostEndPointRpcServer implements HostEndpointRpcServer { + private ScheduledExecutorService executor; + public MockHypervsiorHostEndPointRpcServer() { + executor = Executors.newScheduledThreadPool(10); + } + + protected class MockRpcCallBack implements Runnable { + private final Command cmd; + private final AsyncCompletionCallback callback; + public MockRpcCallBack(Command cmd, final AsyncCompletionCallback callback) { + this.cmd = cmd; + this.callback = callback; + } + @Override + public void run() { + try { + Answer answer = new Answer(cmd, false, "unknown command"); + /*if (cmd instanceof CopyTemplateToPrimaryStorageCmd) { + answer = new CopyTemplateToPrimaryStorageAnswer(cmd, UUID.randomUUID().toString()); + } else if (cmd instanceof CreateVolumeFromBaseImageCommand) { + answer = new CreateVolumeAnswer(cmd, UUID.randomUUID().toString()); + }*/ + + callback.complete(answer); + } catch (Exception e) { + e.printStackTrace(); + } + } + + } + + public void sendCommandAsync(HypervisorHostEndPoint host, final Command command, final AsyncCompletionCallback callback) { + executor.schedule(new MockRpcCallBack(command, callback), 10, TimeUnit.SECONDS); + } + + @Override + public Answer sendCommand(HypervisorHostEndPoint host, Command command) { + // TODO Auto-generated method stub + return null; + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockRpcCallBack.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockRpcCallBack.java new file mode 100644 index 00000000000..e0ffb48281a --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockRpcCallBack.java @@ -0,0 +1,60 @@ +// 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.storage.test; + +import javax.inject.Inject; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.utils.db.DB; + +public class MockRpcCallBack implements Runnable { + private static final Logger s_logger = Logger.getLogger(MockRpcCallBack.class); + @Inject + AgentManager agentMgr; + private Command cmd; + private long hostId; + private AsyncCompletionCallback callback; + + public void setCmd(Command cmd) { + this.cmd = cmd; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + public void setCallback(AsyncCompletionCallback callback) { + this.callback = callback; + } + + @Override + @DB + public void run() { + try { + Answer answer = agentMgr.send(hostId, cmd); + callback.complete(answer); + } catch (Throwable e) { + s_logger.debug("send command failed:", e); + } + } + +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.java new file mode 100644 index 00000000000..b619ee9240f --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/MockStorageMotionStrategy.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 org.apache.cloudstack.storage.test; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.motion.DataMotionStrategy; + +public class MockStorageMotionStrategy implements DataMotionStrategy { + + @Override + public boolean canHandle(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return true; + } + + @Override + public Void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback) { + CopyCommandResult result = new CopyCommandResult("something", null); + callback.complete(result); + return null; + } + +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java new file mode 100644 index 00000000000..2ac6dac4c16 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageFactoryBean.java @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.storage.test; + + +import org.mockito.Mockito; +import org.springframework.beans.factory.FactoryBean; + +/** + * A {@link FactoryBean} for creating mocked beans based on Mockito so that they + * can be {@link @Autowired} into Spring test configurations. + * + * @author Mattias Severson, Jayway + * + * @see FactoryBean + * @see org.mockito.Mockito + */ +public class StorageFactoryBean implements FactoryBean { + + private Class classToBeMocked; + + /** + * Creates a Mockito mock instance of the provided class. + * @param classToBeMocked The class to be mocked. + */ + public StorageFactoryBean(Class classToBeMocked) { + this.classToBeMocked = classToBeMocked; + } + + @Override + public T getObject() throws Exception { + return Mockito.mock(classToBeMocked); + } + + @Override + public Class getObjectType() { + return classToBeMocked; + } + + @Override + public boolean isSingleton() { + return true; + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.java new file mode 100644 index 00000000000..0ee7fe0a431 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/StorageTest.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 org.apache.cloudstack.storage.test; + +import static org.junit.Assert.*; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:resource/storageContext.xml") +public class StorageTest { + + @Test + public void test() { + fail("Not yet implemented"); + } + +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.java new file mode 100644 index 00000000000..d3280c0e38d --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestConfiguration.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.storage.test; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDaoImpl; + +@Configuration +public class TestConfiguration { + @Bean + public HostDao hostDao() { + return new HostDaoImpl(); + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.java new file mode 100644 index 00000000000..8b10f7e3224 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestHttp.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.storage.test; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.channels.FileChannel; + +import junit.framework.Assert; + +import org.apache.commons.httpclient.HttpException; +import org.apache.cxf.helpers.IOUtils; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpHead; +import org.apache.http.impl.client.DefaultHttpClient; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.testng.annotations.Parameters; + +@ContextConfiguration(locations="classpath:/storageContext.xml") +public class TestHttp extends AbstractTestNGSpringContextTests { + @Test + @Parameters("template-url") + public void testHttpclient(String templateUrl) { + HttpHead method = new HttpHead(templateUrl); + DefaultHttpClient client = new DefaultHttpClient(); + + OutputStream output = null; + long length = 0; + try { + HttpResponse response = client.execute(method); + length = Long.parseLong(response.getFirstHeader("Content-Length").getValue()); + System.out.println(response.getFirstHeader("Content-Length").getValue()); + File localFile = new File("/tmp/test"); + if (!localFile.exists()) { + localFile.createNewFile(); + } + + HttpGet getMethod = new HttpGet(templateUrl); + response = client.execute(getMethod); + HttpEntity entity = response.getEntity(); + + output = new BufferedOutputStream(new FileOutputStream(localFile)); + entity.writeTo(output); + } catch (HttpException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } finally { + try { + if (output != null) + output.close(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + File f = new File("/tmp/test"); + Assert.assertEquals(f.length(), length); + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNG.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNG.java new file mode 100644 index 00000000000..b3ecd3c22cb --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNG.java @@ -0,0 +1,35 @@ +// 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.storage.test; + +import junit.framework.Assert; + +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.testng.AbstractTestNGSpringContextTests; +import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests; +import org.testng.annotations.Parameters; +import org.testng.annotations.Test; + +import com.cloud.utils.db.DB; +@ContextConfiguration(locations="classpath:/storageContext.xml") +public class TestNG extends AbstractTestNGSpringContextTests { + @Test + @DB + public void test1() { + Assert.assertEquals("", "192.168.56.2"); + } +} diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNGAop.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNGAop.java new file mode 100644 index 00000000000..130ecd21980 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/TestNGAop.java @@ -0,0 +1,53 @@ +// 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.storage.test; + +import java.lang.reflect.Method; +import java.util.List; + +import org.testng.IMethodInstance; +import org.testng.IMethodInterceptor; +import org.testng.ITestContext; +import org.testng.ITestNGMethod; +import org.testng.internal.ConstructorOrMethod; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; + +public class TestNGAop implements IMethodInterceptor { + + @Override + public List intercept(List methods, + ITestContext context) { + for (IMethodInstance methodIns : methods) { + ITestNGMethod method = methodIns.getMethod(); + ConstructorOrMethod meth = method.getConstructorOrMethod(); + Method m = meth.getMethod(); + if (m != null) { + DB db = m.getAnnotation(DB.class); + if (db != null) { + Transaction txn = Transaction.open(m.getName()); + } + } + } + + + // TODO Auto-generated method stub + return methods; + } + +} diff --git a/server/src/com/cloud/network/guru/GuruUtils.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java similarity index 91% rename from server/src/com/cloud/network/guru/GuruUtils.java rename to engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java index 4f287ffdbc0..d0709d5be0f 100644 --- a/server/src/com/cloud/network/guru/GuruUtils.java +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/XenEndpoint.java @@ -14,9 +14,8 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.network.guru; +package org.apache.cloudstack.storage.test; -public final class GuruUtils { - +public class XenEndpoint { } diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java new file mode 100644 index 00000000000..d8d187c0ce5 --- /dev/null +++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/volumeServiceTest.java @@ -0,0 +1,471 @@ +/* + * 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.storage.test; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ExecutionException; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageService; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult; +import org.apache.cloudstack.engine.subsystem.api.storage.type.RootDisk; +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.storage.HypervisorHostEndPoint; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.cloudstack.storage.volume.db.VolumeDao2; +import org.apache.cloudstack.storage.volume.db.VolumeVO; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.testng.Assert; +import org.testng.annotations.Test; + +import com.cloud.agent.AgentManager; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster.ClusterType; +import com.cloud.org.Managed.ManagedState; +import com.cloud.resource.ResourceState; +import com.cloud.storage.Storage; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.Storage.TemplateType; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.utils.component.ComponentContext; + +@ContextConfiguration(locations={"classpath:/storageContext.xml"}) +public class volumeServiceTest extends CloudStackTestNGBase { + //@Inject + //ImageDataStoreProviderManager imageProviderMgr; + @Inject + ImageService imageService; + @Inject + VolumeService volumeService; + @Inject + VMTemplateDao imageDataDao; + @Inject + VolumeDao2 volumeDao; + @Inject + HostDao hostDao; + @Inject + HostPodDao podDao; + @Inject + ClusterDao clusterDao; + @Inject + DataCenterDao dcDao; + @Inject + PrimaryDataStoreDao primaryStoreDao; + @Inject + DataStoreProviderManager dataStoreProviderMgr; + @Inject + AgentManager agentMgr; + @Inject + EndPointSelector selector; + @Inject + ImageDataFactory imageDataFactory; + @Inject + VolumeDataFactory volumeFactory; + Long dcId; + Long clusterId; + Long podId; + HostVO host; + String primaryName = "my primary data store"; + DataStore primaryStore; + + @Test(priority = -1) + public void setUp() { + ComponentContext.initComponentsLifeCycle(); + /* try { + dataStoreProviderMgr.configure(null, new HashMap()); + } catch (ConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }*/ + host = hostDao.findByGuid(this.getHostGuid()); + if (host != null) { + dcId = host.getDataCenterId(); + clusterId = host.getClusterId(); + podId = host.getPodId(); + return; + } + //create data center + DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", + null, null, NetworkType.Basic, null, null, true, true, null, null); + dc = dcDao.persist(dc); + dcId = dc.getId(); + //create pod + + HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), this.getHostGateway(), this.getHostCidr(), 8, "test"); + pod = podDao.persist(pod); + podId = pod.getId(); + //create xen cluster + ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster"); + cluster.setHypervisorType(HypervisorType.XenServer.toString()); + cluster.setClusterType(ClusterType.CloudManaged); + cluster.setManagedState(ManagedState.Managed); + cluster = clusterDao.persist(cluster); + clusterId = cluster.getId(); + //create xen host + + host = new HostVO(this.getHostGuid()); + host.setName("devcloud xen host"); + host.setType(Host.Type.Routing); + host.setPrivateIpAddress(this.getHostIp()); + host.setDataCenterId(dc.getId()); + host.setVersion("6.0.1"); + host.setAvailable(true); + host.setSetup(true); + host.setPodId(podId); + host.setLastPinged(0); + host.setResourceState(ResourceState.Enabled); + host.setHypervisorType(HypervisorType.XenServer); + host.setClusterId(cluster.getId()); + + host = hostDao.persist(host); + + //primaryStore = createPrimaryDataStore(); + + //CreateVolumeAnswer createVolumeFromImageAnswer = new CreateVolumeAnswer(UUID.randomUUID().toString()); + + /*try { + Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer); + } catch (AgentUnavailableException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OperationTimedoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }*/ + + + //Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore); + } + + @Override + protected void injectMockito() { + if (host == null) { + return; + } + List results = new ArrayList(); + results.add(host); + Mockito.when(hostDao.listAll()).thenReturn(results); + Mockito.when(hostDao.findById(Mockito.anyLong())).thenReturn(host); + Mockito.when(hostDao.findHypervisorHostInCluster(Mockito.anyLong())).thenReturn(results); + List eps = new ArrayList(); + eps.add(HypervisorHostEndPoint.getHypervisorHostEndPoint(host.getId(), + host.getPrivateIpAddress())); + Mockito.when(selector.selectAll(Mockito.any(DataStore.class))).thenReturn(eps); + Mockito.when(selector.select(Mockito.any(DataObject.class))).thenReturn(eps.get(0)); + Mockito.when(selector.select(Mockito.any(DataObject.class), Mockito.any(DataObject.class))).thenReturn(eps.get(0)); + } + + private VMTemplateVO createImageData() { + VMTemplateVO image = new VMTemplateVO(); + image.setTemplateType(TemplateType.USER); + image.setUrl(this.getTemplateUrl()); + image.setUniqueName(UUID.randomUUID().toString()); + image.setName(UUID.randomUUID().toString()); + image.setPublicTemplate(true); + image.setFeatured(true); + image.setRequiresHvm(true); + image.setBits(64); + image.setFormat(Storage.ImageFormat.VHD); + image.setEnablePassword(true); + image.setEnableSshKey(true); + image.setGuestOSId(1); + image.setBootable(true); + image.setPrepopulate(true); + image.setCrossZones(true); + image.setExtractable(true); + + //image.setImageDataStoreId(storeId); + image = imageDataDao.persist(image); + + return image; + } + + private TemplateInfo createTemplate() { + try { + DataStore store = createImageStore(); + VMTemplateVO image = createImageData(); + TemplateInfo template = imageDataFactory.getTemplate(image.getId(), store); + AsyncCallFuture future = imageService.createTemplateAsync(template, store); + future.get(); + template = imageDataFactory.getTemplate(image.getId(), store); + /*imageProviderMgr.configure("image Provider", new HashMap()); + VMTemplateVO image = createImageData(); + ImageDataStoreProvider defaultProvider = imageProviderMgr.getProvider("DefaultProvider"); + ImageDataStoreLifeCycle lifeCycle = defaultProvider.getLifeCycle(); + ImageDataStore store = lifeCycle.registerDataStore("defaultHttpStore", new HashMap()); + imageService.registerTemplate(image.getId(), store.getImageDataStoreId()); + TemplateEntity te = imageService.getTemplateEntity(image.getId()); + return te;*/ + return template; + } catch (Exception e) { + Assert.fail("failed", e); + return null; + } + } + + //@Test + public void createTemplateTest() { + createTemplate(); + } + + @Test + public void testCreatePrimaryStorage() { + DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("default primary data store provider"); + Map params = new HashMap(); + URI uri = null; + try { + uri = new URI(this.getPrimaryStorageUrl()); + } catch (URISyntaxException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + params.put("url", this.getPrimaryStorageUrl()); + params.put("server", uri.getHost()); + params.put("path", uri.getPath()); + params.put("protocol", StoragePoolType.NetworkFilesystem); + params.put("dcId", dcId.toString()); + params.put("clusterId", clusterId.toString()); + params.put("name", this.primaryName); + params.put("port", "1"); + params.put("roles", DataStoreRole.Primary.toString()); + params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); + params.put("providerId", String.valueOf(provider.getId())); + + DataStoreLifeCycle lifeCycle = provider.getLifeCycle(); + this.primaryStore = lifeCycle.initialize(params); + ClusterScope scope = new ClusterScope(clusterId, podId, dcId); + lifeCycle.attachCluster(this.primaryStore, scope); + } + + private DataStore createImageStore() { + DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("default image data store"); + Map params = new HashMap(); + String name = UUID.randomUUID().toString(); + params.put("name", name); + params.put("uuid", name); + params.put("protocol", "http"); + params.put("scope", ScopeType.GLOBAL.toString()); + params.put("provider", Long.toString(provider.getId())); + DataStoreLifeCycle lifeCycle = provider.getLifeCycle(); + DataStore store = lifeCycle.initialize(params); + return store; + } + //@Test + public void testcreateImageStore() { + createImageStore(); + } + + + public DataStore createPrimaryDataStore() { + try { + DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider("default primary data store provider"); + Map params = new HashMap(); + URI uri = new URI(this.getPrimaryStorageUrl()); + params.put("url", this.getPrimaryStorageUrl()); + params.put("server", uri.getHost()); + params.put("path", uri.getPath()); + params.put("protocol", Storage.StoragePoolType.NetworkFilesystem); + params.put("dcId", dcId.toString()); + params.put("clusterId", clusterId.toString()); + params.put("name", this.primaryName); + params.put("port", "1"); + params.put("roles", DataStoreRole.Primary.toString()); + params.put("uuid", UUID.nameUUIDFromBytes(this.getPrimaryStorageUrl().getBytes()).toString()); + params.put("providerId", String.valueOf(provider.getId())); + + DataStoreLifeCycle lifeCycle = provider.getLifeCycle(); + DataStore store = lifeCycle.initialize(params); + ClusterScope scope = new ClusterScope(clusterId, podId, dcId); + lifeCycle.attachCluster(store, scope); + + /* + PrimaryDataStoreProvider provider = primaryDataStoreProviderMgr.getDataStoreProvider("default primary data store provider"); + primaryDataStoreProviderMgr.configure("primary data store mgr", new HashMap()); + + List ds = primaryStoreDao.findPoolByName(this.primaryName); + if (ds.size() >= 1) { + PrimaryDataStoreVO store = ds.get(0); + if (store.getRemoved() == null) { + return provider.getDataStore(store.getId()); + } + } + + + Map params = new HashMap(); + params.put("url", this.getPrimaryStorageUrl()); + params.put("dcId", dcId.toString()); + params.put("clusterId", clusterId.toString()); + params.put("name", this.primaryName); + PrimaryDataStoreInfo primaryDataStoreInfo = provider.registerDataStore(params); + PrimaryDataStoreLifeCycle lc = primaryDataStoreInfo.getLifeCycle(); + ClusterScope scope = new ClusterScope(clusterId, podId, dcId); + lc.attachCluster(scope); + return primaryDataStoreInfo; + */ + return store; + } catch (Exception e) { + return null; + } + } + + private VolumeVO createVolume(Long templateId, long dataStoreId) { + VolumeVO volume = new VolumeVO(1000, new RootDisk().toString(), UUID.randomUUID().toString(), templateId); + volume.setPoolId(dataStoreId); + volume = volumeDao.persist(volume); + return volume; + } + + @Test(priority=2) + public void createVolumeFromTemplate() { + DataStore primaryStore = this.primaryStore; + TemplateInfo te = createTemplate(); + VolumeVO volume = createVolume(te.getId(), primaryStore.getId()); + VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore); + //ve.createVolumeFromTemplate(primaryStore.getId(), new VHD(), te); + AsyncCallFuture future = volumeService.createVolumeFromTemplateAsync(vol, primaryStore.getId(), te); + try { + future.get(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + //@Test(priority=3) + public void createDataDisk() { + DataStore primaryStore = this.primaryStore; + VolumeVO volume = createVolume(null, primaryStore.getId()); + VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore); + AsyncCallFuture future = volumeService.createVolumeAsync(vol, primaryStore); + try { + future.get(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + //@Test(priority=3) + public void createAndDeleteDataDisk() { + DataStore primaryStore = this.primaryStore; + VolumeVO volume = createVolume(null, primaryStore.getId()); + VolumeInfo vol = volumeFactory.getVolume(volume.getId(), primaryStore); + AsyncCallFuture future = volumeService.createVolumeAsync(vol, primaryStore); + try { + future.get(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + //delete the volume + vol = volumeFactory.getVolume(volume.getId(), primaryStore); + future = volumeService.expungeVolumeAsync(vol); + try { + future.get(); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + //@Test(priority=3) + public void tearDown() { + List ds = primaryStoreDao.findPoolByName(this.primaryName); + for (int i = 0; i < ds.size(); i++) { + StoragePoolVO store = ds.get(i); + store.setUuid(null); + primaryStoreDao.remove(ds.get(i).getId()); + primaryStoreDao.expunge(ds.get(i).getId()); + } + } + + //@Test + //@Test + public void test1() { + /*System.out.println(VolumeTypeHelper.getType("Root")); + System.out.println(VolumeDiskTypeHelper.getDiskType("vmdk")); + System.out.println(ImageFormatHelper.getFormat("ova")); + AssertJUnit.assertFalse(new VMDK().equals(new VHD())); + VMDK vmdk = new VMDK(); + AssertJUnit.assertTrue(vmdk.equals(vmdk)); + VMDK newvmdk = new VMDK(); + AssertJUnit.assertTrue(vmdk.equals(newvmdk)); + + ImageFormat ova = new OVA(); + ImageFormat iso = new ISO(); + AssertJUnit.assertTrue(ova.equals(new OVA())); + AssertJUnit.assertFalse(ova.equals(iso)); + AssertJUnit.assertTrue(ImageFormatHelper.getFormat("test").equals(new Unknown())); + + VolumeDiskType qcow2 = new QCOW2(); + ImageFormat qcow2format = new org.apache.cloudstack.storage.image.format.QCOW2(); + AssertJUnit.assertFalse(qcow2.equals(qcow2format)); +*/ + } + +} diff --git a/engine/storage/integration-test/test/resource/component.xml b/engine/storage/integration-test/test/resource/component.xml new file mode 100644 index 00000000000..0368ad41425 --- /dev/null +++ b/engine/storage/integration-test/test/resource/component.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/integration-test/test/resource/storageContext.xml b/engine/storage/integration-test/test/resource/storageContext.xml new file mode 100644 index 00000000000..4f55e243bac --- /dev/null +++ b/engine/storage/integration-test/test/resource/storageContext.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.cloudstack.framework + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/integration-test/test/resource/testng.xml b/engine/storage/integration-test/test/resource/testng.xml new file mode 100644 index 00000000000..db32c247d1b --- /dev/null +++ b/engine/storage/integration-test/test/resource/testng.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/pom.xml b/engine/storage/pom.xml new file mode 100644 index 00000000000..270fe47c743 --- /dev/null +++ b/engine/storage/pom.xml @@ -0,0 +1,74 @@ + + + 4.0.0 + cloud-engine-storage + Apache CloudStack Engine Storage Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-api + ${project.version} + + + org.apache.cloudstack + cloud-core + ${project.version} + + + org.apache.cloudstack + cloud-server + ${project.version} + + + org.apache.cloudstack + cloud-engine-components-api + ${project.version} + + + org.apache.cloudstack + cloud-framework-ipc + ${project.version} + + + org.apache.cloudstack + cloud-engine-api + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + + diff --git a/engine/storage/snapshot/pom.xml b/engine/storage/snapshot/pom.xml new file mode 100644 index 00000000000..211cdac574e --- /dev/null +++ b/engine/storage/snapshot/pom.xml @@ -0,0 +1,54 @@ + + + 4.0.0 + cloud-engine-storage-snapshot + Apache CloudStack Engine Storage Snapshot Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + ${project.basedir}/test + + + ${project.basedir}/test/resource + + + + diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.java new file mode 100644 index 00000000000..fa7772a979d --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactoryImpl.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.storage.snapshot; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.springframework.stereotype.Component; + +import com.cloud.storage.Snapshot; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class SnapshotDataFactoryImpl implements SnapshotDataFactory { + @Inject + SnapshotDao snapshotDao; + @Inject + ObjectInDataStoreManager objMap; + @Inject + DataStoreManager storeMgr; + @Inject + VolumeDataFactory volumeFactory; + @Override + public SnapshotInfo getSnapshot(long snapshotId, DataStore store) { + SnapshotVO snapshot = snapshotDao.findByIdIncludingRemoved(snapshotId); + DataObjectInStore obj = objMap.findObject(snapshot.getUuid(), DataObjectType.SNAPSHOT, store.getUuid(), store.getRole()); + if (obj == null) { + return null; + } + SnapshotObject so = SnapshotObject.getSnapshotObject(snapshot, store); + return so; + } + @Override + public SnapshotInfo getSnapshot(long snapshotId) { + SnapshotVO snapshot = snapshotDao.findByIdIncludingRemoved(snapshotId); + SnapshotObject so = null; + if (snapshot.getState() == Snapshot.State.BackedUp) { + DataStore store = objMap.findStore(snapshot.getUuid(), DataObjectType.SNAPSHOT, DataStoreRole.Image); + so = SnapshotObject.getSnapshotObject(snapshot, store); + } else { + VolumeInfo volume = this.volumeFactory.getVolume(snapshot.getVolumeId()); + so = SnapshotObject.getSnapshotObject(snapshot, volume.getDataStore()); + } + return so; + } + + @Override + public SnapshotInfo getSnapshot(DataObject obj, DataStore store) { + SnapshotVO snapshot = snapshotDao.findByIdIncludingRemoved(obj.getId()); + if (snapshot == null) { + throw new CloudRuntimeException("Can't find snapshot: " + obj.getId()); + } + SnapshotObject so = SnapshotObject.getSnapshotObject(snapshot, store); + return so; + } +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java new file mode 100644 index 00000000000..a82be6de01d --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java @@ -0,0 +1,223 @@ +/* + * 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.storage.snapshot; + +import java.util.Date; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.log4j.Logger; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Snapshot; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; + +public class SnapshotObject implements SnapshotInfo { + private static final Logger s_logger = Logger.getLogger(SnapshotObject.class); + private SnapshotVO snapshot; + private DataStore store; + @Inject + protected SnapshotDao snapshotDao; + @Inject + protected VolumeDao volumeDao; + @Inject protected VolumeDataFactory volFactory; + @Inject protected SnapshotStateMachineManager stateMachineMgr; + @Inject + ObjectInDataStoreManager ojbectInStoreMgr; + protected SnapshotObject() { + + } + + protected void configure(SnapshotVO snapshot, DataStore store) { + this.snapshot = snapshot; + this.store = store; + } + + public static SnapshotObject getSnapshotObject(SnapshotVO snapshot, DataStore store) { + SnapshotObject snapObj = ComponentContext.inject(SnapshotObject.class); + snapObj.configure(snapshot, store); + return snapObj; + } + + public DataStore getStore() { + return this.store; + } + + @Override + public SnapshotInfo getParent() { + // TODO Auto-generated method stub + return null; + } + + @Override + public SnapshotInfo getChild() { + // TODO Auto-generated method stub + return null; + } + + @Override + public VolumeInfo getBaseVolume() { + return volFactory.getVolume(this.snapshot.getVolumeId()); + } + + @Override + public long getId() { + return this.snapshot.getId(); + } + + @Override + public String getUri() { + return this.snapshot.getUuid(); + } + + @Override + public DataStore getDataStore() { + return this.store; + } + + @Override + public Long getSize() { + return this.getSize(); + } + + @Override + public DataObjectType getType() { + return DataObjectType.SNAPSHOT; + } + + @Override + public DiskFormat getFormat() { + return null; + } + + @Override + public String getUuid() { + return this.snapshot.getUuid(); + } + + @Override + public void processEvent( + ObjectInDataStoreStateMachine.Event event) { + try { + ojbectInStoreMgr.update(this, event); + } catch (Exception e) { + s_logger.debug("Failed to update state:" + e.toString()); + throw new CloudRuntimeException("Failed to update state: " + e.toString()); + } + } + + @Override + public long getAccountId() { + return this.snapshot.getAccountId(); + } + + @Override + public long getVolumeId() { + return this.snapshot.getVolumeId(); + } + + @Override + public String getPath() { + return this.snapshot.getPath(); + } + + public void setPath(String path) { + this.snapshot.setPath(path); + } + + @Override + public String getName() { + return this.snapshot.getName(); + } + + @Override + public Date getCreated() { + return this.snapshot.getCreated(); + } + + @Override + public Type getRecurringType() { + return this.snapshot.getRecurringType(); + } + + @Override + public State getState() { + return this.snapshot.getState(); + } + + @Override + public HypervisorType getHypervisorType() { + return this.snapshot.getHypervisorType(); + } + + @Override + public boolean isRecursive() { + return this.snapshot.isRecursive(); + } + + @Override + public short getsnapshotType() { + return this.snapshot.getsnapshotType(); + } + + @Override + public long getDomainId() { + return this.snapshot.getDomainId(); + } + + public void setPrevSnapshotId(Long id) { + this.snapshot.setPrevSnapshotId(id); + } + + @Override + public Long getDataCenterId() { + return this.snapshot.getDataCenterId(); + } + + public void processEvent(Snapshot.Event event) + throws NoTransitionException { + stateMachineMgr.processEvent(this.snapshot, event); + } + + @Override + public Long getPrevSnapshotId() { + return this.snapshot.getPrevSnapshotId(); + } + + public void setBackupSnapshotId(String id) { + this.snapshot.setBackupSnapshotId(id); + } + + public String getBackupSnapshotId() { + return this.snapshot.getBackupSnapshotId(); + } +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java new file mode 100644 index 00000000000..1b64fd0cae3 --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java @@ -0,0 +1,56 @@ +// 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.storage.snapshot; + +import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.springframework.stereotype.Component; + +@Component +public class SnapshotServiceImpl implements SnapshotService { + + public SnapshotServiceImpl() { + + } + + @Override + public SnapshotEntity getSnapshotEntity(long snapshotId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean takeSnapshot(SnapshotInfo snapshot) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean revertSnapshot(SnapshotInfo snapshot) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deleteSnapshot(SnapshotInfo snapshot) { + // TODO Auto-generated method stub + return false; + } + + + +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java new file mode 100644 index 00000000000..c6057704cd8 --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManager.java @@ -0,0 +1,26 @@ +// 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.storage.snapshot; + +import com.cloud.storage.Snapshot.Event; +import com.cloud.storage.SnapshotVO; +import com.cloud.utils.fsm.NoTransitionException; + +public interface SnapshotStateMachineManager { + public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException; +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.java new file mode 100644 index 00000000000..aa1cf684d7a --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotStateMachineManagerImpl.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 org.apache.cloudstack.storage.snapshot; + +import javax.inject.Inject; + +import org.springframework.stereotype.Component; + +import com.cloud.storage.Snapshot; +import com.cloud.storage.Snapshot.Event; +import com.cloud.storage.Snapshot.State; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.listener.SnapshotStateListener; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.fsm.StateMachine2; + +@Component +public class SnapshotStateMachineManagerImpl implements +SnapshotStateMachineManager { + private StateMachine2 stateMachine = new StateMachine2(); + @Inject + protected SnapshotDao snapshotDao; + public SnapshotStateMachineManagerImpl() { + stateMachine.addTransition(Snapshot.State.Allocated, Event.CreateRequested, Snapshot.State.Creating); + stateMachine.addTransition(Snapshot.State.Creating, Event.OperationSucceeded, Snapshot.State.CreatedOnPrimary); + stateMachine.addTransition(Snapshot.State.Creating, Event.OperationNotPerformed, Snapshot.State.BackedUp); + stateMachine.addTransition(Snapshot.State.Creating, Event.OperationFailed, Snapshot.State.Error); + stateMachine.addTransition(Snapshot.State.CreatedOnPrimary, Event.BackupToSecondary, Snapshot.State.BackingUp); + stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationSucceeded, Snapshot.State.BackedUp); + stateMachine.addTransition(Snapshot.State.BackingUp, Event.OperationFailed, Snapshot.State.CreatedOnPrimary); + + stateMachine.registerListener(new SnapshotStateListener()); + } + + public void processEvent(SnapshotVO snapshot, Event event) throws NoTransitionException { + stateMachine.transitTo(snapshot, event, null, snapshotDao); + } +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2.java new file mode 100644 index 00000000000..d531ede0aba --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.snapshot.db; + +import com.cloud.utils.db.GenericDao; + +public interface SnapshotDao2 extends GenericDao { + +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2Impl.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2Impl.java new file mode 100644 index 00000000000..74cec5e76e5 --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotDao2Impl.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 org.apache.cloudstack.storage.snapshot.db; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; + +@Component +public class SnapshotDao2Impl extends GenericDaoBase implements SnapshotDao2 { + +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java new file mode 100644 index 00000000000..b05b803623f --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/db/SnapshotVO.java @@ -0,0 +1,296 @@ +// 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.storage.snapshot.db; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Snapshot.State; +import com.cloud.storage.Snapshot.Type; +import com.cloud.utils.db.GenericDao; +import com.google.gson.annotations.Expose; + +@Entity +@Table(name="snapshots") +public class SnapshotVO { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private final long id = -1; + + @Column(name="data_center_id") + long dataCenterId; + + @Column(name="account_id") + long accountId; + + @Column(name="domain_id") + long domainId; + + @Column(name="volume_id") + Long volumeId; + + @Column(name="disk_offering_id") + Long diskOfferingId; + + @Expose + @Column(name="path") + String path; + + @Expose + @Column(name="name") + String name; + + @Expose + @Column(name="status", updatable = true, nullable=false) + @Enumerated(value=EnumType.STRING) + private State status; + + @Column(name="snapshot_type") + short snapshotType; + + @Column(name="type_description") + String typeDescription; + + @Column(name="size") + long size; + + @Column(name=GenericDao.CREATED_COLUMN) + Date created; + + @Column(name=GenericDao.REMOVED_COLUMN) + Date removed; + + @Column(name="backup_snap_id") + String backupSnapshotId; + + @Column(name="swift_id") + Long swiftId; + + @Column(name="s3_id") + Long s3Id; + + @Column(name="sechost_id") + Long secHostId; + + @Column(name="prev_snap_id") + long prevSnapshotId; + + @Column(name="hypervisor_type") + @Enumerated(value=EnumType.STRING) + HypervisorType hypervisorType; + + @Expose + @Column(name="version") + String version; + + @Column(name="uuid") + String uuid; + + public SnapshotVO() { + this.uuid = UUID.randomUUID().toString(); + } + + public SnapshotVO(long dcId, long accountId, long domainId, Long volumeId, Long diskOfferingId, String path, String name, short snapshotType, String typeDescription, long size, HypervisorType hypervisorType ) { + this.dataCenterId = dcId; + this.accountId = accountId; + this.domainId = domainId; + this.volumeId = volumeId; + this.diskOfferingId = diskOfferingId; + this.path = path; + this.name = name; + this.snapshotType = snapshotType; + this.typeDescription = typeDescription; + this.size = size; + this.status = State.Creating; + this.prevSnapshotId = 0; + this.hypervisorType = hypervisorType; + this.version = "2.2"; + this.uuid = UUID.randomUUID().toString(); + } + + public long getId() { + return id; + } + + public long getDataCenterId() { + return dataCenterId; + } + + + public long getAccountId() { + return accountId; + } + + + public long getDomainId() { + return domainId; + } + + public long getVolumeId() { + return volumeId; + } + + public long getDiskOfferingId() { + return diskOfferingId; + } + + public void setVolumeId(Long volumeId) { + this.volumeId = volumeId; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getName() { + return name; + } + + public short getsnapshotType() { + return snapshotType; + } + + public Type getType() { + if (snapshotType < 0 || snapshotType >= Type.values().length) { + return null; + } + return Type.values()[snapshotType]; + } + + public Long getSwiftId() { + return swiftId; + } + + public void setSwiftId(Long swiftId) { + this.swiftId = swiftId; + } + + public Long getSecHostId() { + return secHostId; + } + + public void setSecHostId(Long secHostId) { + this.secHostId = secHostId; + } + + public HypervisorType getHypervisorType() { + return hypervisorType; + } + + public void setSnapshotType(short snapshotType) { + this.snapshotType = snapshotType; + } + + public boolean isRecursive(){ + if ( snapshotType >= Type.HOURLY.ordinal() && snapshotType <= Type.MONTHLY.ordinal() ) { + return true; + } + return false; + } + + public long getSize() { + return size; + } + + public String getTypeDescription() { + return typeDescription; + } + public void setTypeDescription(String typeDescription) { + this.typeDescription = typeDescription; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public Date getCreated() { + return created; + } + + public Date getRemoved() { + return removed; + } + + public State getStatus() { + return status; + } + + public void setStatus(State status) { + this.status = status; + } + + public String getBackupSnapshotId(){ + return backupSnapshotId; + } + + public long getPrevSnapshotId(){ + return prevSnapshotId; + } + + public void setBackupSnapshotId(String backUpSnapshotId){ + this.backupSnapshotId = backUpSnapshotId; + } + + public void setPrevSnapshotId(long prevSnapshotId){ + this.prevSnapshotId = prevSnapshotId; + } + + public static Type getSnapshotType(String snapshotType) { + for ( Type type : Type.values()) { + if ( type.equals(snapshotType)) { + return type; + } + } + return null; + } + + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public Long getS3Id() { + return s3Id; + } + + public void setS3Id(Long s3Id) { + this.s3Id = s3Id; + } + +} diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java new file mode 100644 index 00000000000..5cbe2243faa --- /dev/null +++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/strategy/AncientSnasphotStrategy.java @@ -0,0 +1,608 @@ +// 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.storage.snapshot.strategy; + +import java.util.List; +import java.util.concurrent.ExecutionException; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.motion.DataMotionService; +import org.apache.cloudstack.storage.snapshot.SnapshotObject; +import org.apache.cloudstack.storage.snapshot.SnapshotStateMachineManager; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.BackupSnapshotAnswer; +import com.cloud.agent.api.DeleteSnapshotBackupCommand; +import com.cloud.agent.api.to.S3TO; +import com.cloud.agent.api.to.SwiftTO; +import com.cloud.configuration.Resource.ResourceType; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.event.EventTypes; +import com.cloud.event.UsageEventUtils; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.host.HostVO; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.resource.ResourceManager; +import com.cloud.storage.Snapshot; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.StoragePool; +import com.cloud.storage.VolumeManager; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.StoragePoolDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.s3.S3Manager; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.storage.swift.SwiftManager; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.snapshot.VMSnapshot; +import com.cloud.vm.snapshot.VMSnapshotVO; +import com.cloud.vm.snapshot.dao.VMSnapshotDao; + +@Component +public class AncientSnasphotStrategy implements SnapshotStrategy { + private static final Logger s_logger = Logger.getLogger(AncientSnasphotStrategy.class); + @Inject + protected VolumeDao _volsDao; + @Inject + protected UserVmDao _vmDao; + @Inject + protected StoragePoolDao _storagePoolDao; + @Inject + protected ClusterDao _clusterDao; + @Inject + protected SnapshotDao snapshotDao; + @Inject + private ResourceManager _resourceMgr; + @Inject + protected SnapshotDao _snapshotDao; + @Inject + protected SnapshotManager snapshotMgr; + @Inject + protected VolumeManager volumeMgr; + @Inject + private ConfigurationDao _configDao; + @Inject + protected SnapshotStateMachineManager stateMachineManager; + @Inject + private VolumeDao volumeDao; + @Inject + SnapshotDataFactory snapshotfactory; + @Inject + DataStoreManager dataStoreMgr; + @Inject + DataMotionService motionSrv; + @Inject + ObjectInDataStoreManager objInStoreMgr; + @Inject + VMSnapshotDao _vmSnapshotDao; + + + @Override + public boolean canHandle(SnapshotInfo snapshot) { + return true; + } + + static private class CreateSnapshotContext extends AsyncRpcConext { + final VolumeInfo volume; + final SnapshotInfo snapshot; + final AsyncCallFuture future; + public CreateSnapshotContext(AsyncCompletionCallback callback, VolumeInfo volume, + SnapshotInfo snapshot, + AsyncCallFuture future) { + super(callback); + this.volume = volume; + this.snapshot = snapshot; + this.future = future; + } + } + + static private class DeleteSnapshotContext extends AsyncRpcConext { + final SnapshotInfo snapshot; + final AsyncCallFuture future; + public DeleteSnapshotContext(AsyncCompletionCallback callback, SnapshotInfo snapshot, + AsyncCallFuture future) { + super(callback); + this.snapshot = snapshot; + this.future = future; + } + + } + + static private class CopySnapshotContext extends AsyncRpcConext { + final SnapshotInfo srcSnapshot; + final SnapshotInfo destSnapshot; + final AsyncCallFuture future; + public CopySnapshotContext(AsyncCompletionCallback callback, + SnapshotInfo srcSnapshot, + SnapshotInfo destSnapshot, + AsyncCallFuture future) { + super(callback); + this.srcSnapshot = srcSnapshot; + this.destSnapshot = destSnapshot; + this.future = future; + } + + } + + protected Void createSnapshotAsyncCallback(AsyncCallbackDispatcher callback, + CreateSnapshotContext context) { + CreateCmdResult result = callback.getResult(); + SnapshotObject snapshot = (SnapshotObject)context.snapshot; + VolumeInfo volume = context.volume; + AsyncCallFuture future = context.future; + SnapshotResult snapResult = new SnapshotResult(snapshot); + if (result.isFailed()) { + s_logger.debug("create snapshot " + context.snapshot.getName() + " failed: " + result.getResult()); + try { + snapshot.processEvent(Snapshot.Event.OperationFailed); + } catch (NoTransitionException nte) { + s_logger.debug("Failed to update snapshot state due to " + nte.getMessage()); + } + + + snapResult.setResult(result.getResult()); + future.complete(snapResult); + return null; + } + + try { + SnapshotVO preSnapshotVO = this.snapshotMgr.getParentSnapshot(volume, snapshot); + String preSnapshotPath = null; + if (preSnapshotVO != null) { + preSnapshotPath = preSnapshotVO.getPath(); + } + SnapshotVO snapshotVO = this.snapshotDao.findById(snapshot.getId()); + // The snapshot was successfully created + if (preSnapshotPath != null && preSnapshotPath.equals(result.getPath())) { + // empty snapshot + s_logger.debug("CreateSnapshot: this is empty snapshot "); + + snapshotVO.setPath(preSnapshotPath); + snapshotVO.setBackupSnapshotId(preSnapshotVO.getBackupSnapshotId()); + snapshotVO.setSwiftId(preSnapshotVO.getSwiftId()); + snapshotVO.setPrevSnapshotId(preSnapshotVO.getId()); + snapshotVO.setSecHostId(preSnapshotVO.getSecHostId()); + snapshot.processEvent(Snapshot.Event.OperationNotPerformed); + } else { + long preSnapshotId = 0; + + if (preSnapshotVO != null && preSnapshotVO.getBackupSnapshotId() != null) { + preSnapshotId = preSnapshotVO.getId(); + int _deltaSnapshotMax = NumbersUtil.parseInt(_configDao.getValue("snapshot.delta.max"), SnapshotManager.DELTAMAX); + int deltaSnap = _deltaSnapshotMax; + + int i; + for (i = 1; i < deltaSnap; i++) { + String prevBackupUuid = preSnapshotVO.getBackupSnapshotId(); + // previous snapshot doesn't have backup, create a full snapshot + if (prevBackupUuid == null) { + preSnapshotId = 0; + break; + } + long preSSId = preSnapshotVO.getPrevSnapshotId(); + if (preSSId == 0) { + break; + } + preSnapshotVO = _snapshotDao.findByIdIncludingRemoved(preSSId); + } + if (i >= deltaSnap) { + preSnapshotId = 0; + } + } + + //If the volume is moved around, backup a full snapshot to secondary storage + if (volume.getLastPoolId() != null && !volume.getLastPoolId().equals(volume.getPoolId())) { + preSnapshotId = 0; + //TODO: fix this hack + VolumeVO volumeVO = this.volumeDao.findById(volume.getId()); + volumeVO.setLastPoolId(volume.getPoolId()); + this.volumeDao.update(volume.getId(), volumeVO); + } + + snapshot.setPath(result.getPath()); + snapshot.setPrevSnapshotId(preSnapshotId); + + snapshot.processEvent(Snapshot.Event.OperationSucceeded); + snapResult = new SnapshotResult(this.snapshotfactory.getSnapshot(snapshot.getId())); + } + } catch (Exception e) { + s_logger.debug("Failed to create snapshot: ", e); + snapResult.setResult(e.toString()); + try { + snapshot.processEvent(Snapshot.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("Failed to change snapshot state: " + e1.toString()); + } + } + + future.complete(snapResult); + return null; + } + + class SnapshotResult extends CommandResult { + SnapshotInfo snashot; + public SnapshotResult(SnapshotInfo snapshot) { + this.snashot = snapshot; + } + } + + protected SnapshotInfo createSnapshotOnPrimary(VolumeInfo volume, Long snapshotId) { + SnapshotObject snapshot = (SnapshotObject)this.snapshotfactory.getSnapshot(snapshotId); + if (snapshot == null) { + throw new CloudRuntimeException("Can not find snapshot " + snapshotId); + } + + try { + snapshot.processEvent(Snapshot.Event.CreateRequested); + } catch (NoTransitionException nte) { + s_logger.debug("Failed to update snapshot state due to " + nte.getMessage()); + throw new CloudRuntimeException("Failed to update snapshot state due to " + nte.getMessage()); + } + + AsyncCallFuture future = new AsyncCallFuture(); + try { + CreateSnapshotContext context = new CreateSnapshotContext( + null, volume, snapshot, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().createSnapshotAsyncCallback(null, null)) + .setContext(context); + PrimaryDataStoreDriver primaryStore = (PrimaryDataStoreDriver)volume.getDataStore().getDriver(); + primaryStore.takeSnapshot(snapshot, caller); + } catch (Exception e) { + s_logger.debug("Failed to take snapshot: " + snapshot.getId(), e); + try { + snapshot.processEvent(Snapshot.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("Failed to change state for event: OperationFailed" , e); + } + throw new CloudRuntimeException("Failed to take snapshot" + snapshot.getId()); + } + + SnapshotResult result; + + try { + result = future.get(); + if (result.isFailed()) { + s_logger.debug("Failed to create snapshot:" + result.getResult()); + throw new CloudRuntimeException(result.getResult()); + } + return result.snashot; + } catch (InterruptedException e) { + s_logger.debug("Failed to create snapshot", e); + throw new CloudRuntimeException("Failed to create snapshot", e); + } catch (ExecutionException e) { + s_logger.debug("Failed to create snapshot", e); + throw new CloudRuntimeException("Failed to create snapshot", e); + } + + } + + private boolean hostSupportSnapsthot(HostVO host) { + if (host.getHypervisorType() != HypervisorType.KVM) { + return true; + } + // Determine host capabilities + String caps = host.getCapabilities(); + + if (caps != null) { + String[] tokens = caps.split(","); + for (String token : tokens) { + if (token.contains("snapshot")) { + return true; + } + } + } + return false; + } + + protected boolean supportedByHypervisor(VolumeInfo volume) { + if (volume.getHypervisorType().equals(HypervisorType.KVM)) { + StoragePool storagePool = (StoragePool)volume.getDataStore(); + ClusterVO cluster = _clusterDao.findById(storagePool.getClusterId()); + List hosts = _resourceMgr.listAllHostsInCluster(cluster.getId()); + if (hosts != null && !hosts.isEmpty()) { + HostVO host = hosts.get(0); + if (!hostSupportSnapsthot(host)) { + throw new CloudRuntimeException("KVM Snapshot is not supported on cluster: " + host.getId()); + } + } + } + + // if volume is attached to a vm in destroyed or expunging state; disallow + if (volume.getInstanceId() != null) { + UserVmVO userVm = _vmDao.findById(volume.getInstanceId()); + if (userVm != null) { + if (userVm.getState().equals(State.Destroyed) || userVm.getState().equals(State.Expunging)) { + throw new CloudRuntimeException("Creating snapshot failed due to volume:" + volume.getId() + " is associated with vm:" + userVm.getInstanceName() + " is in " + + userVm.getState().toString() + " state"); + } + + if(userVm.getHypervisorType() == HypervisorType.VMware || userVm.getHypervisorType() == HypervisorType.KVM) { + List activeSnapshots = _snapshotDao.listByInstanceId(volume.getInstanceId(), Snapshot.State.Creating, Snapshot.State.CreatedOnPrimary, Snapshot.State.BackingUp); + if(activeSnapshots.size() > 1) + throw new CloudRuntimeException("There is other active snapshot tasks on the instance to which the volume is attached, please try again later"); + } + + List activeVMSnapshots = _vmSnapshotDao.listByInstanceId(userVm.getId(), + VMSnapshot.State.Creating, VMSnapshot.State.Reverting, VMSnapshot.State.Expunging); + if (activeVMSnapshots.size() > 0) { + throw new CloudRuntimeException( + "There is other active vm snapshot tasks on the instance to which the volume is attached, please try again later"); + } + } + } + + return true; + } + + @Override + public SnapshotInfo takeSnapshot(VolumeInfo volume, Long snapshotId) { + + supportedByHypervisor(volume); + + SnapshotInfo snapshot = createSnapshotOnPrimary(volume, snapshotId); + return snapshot; + } + + @Override + public SnapshotInfo backupSnapshot(SnapshotInfo snapshot) { + SnapshotObject snapObj = (SnapshotObject)snapshot; + AsyncCallFuture future = new AsyncCallFuture(); + SnapshotResult result = new SnapshotResult(snapshot); + try { + + snapObj.processEvent(Snapshot.Event.BackupToSecondary); + + ZoneScope scope = new ZoneScope(snapshot.getDataCenterId()); + List stores = this.dataStoreMgr.getImageStores(scope); + if (stores.size() != 1) { + throw new CloudRuntimeException("find out more than one image stores"); + } + + DataStore imageStore = stores.get(0); + SnapshotInfo snapshotOnImageStore = (SnapshotInfo)imageStore.create(snapshot); + + snapshotOnImageStore.processEvent(Event.CreateOnlyRequested); + CopySnapshotContext context = new CopySnapshotContext(null, snapshot, + snapshotOnImageStore, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().copySnapshotAsyncCallback(null, null)) + .setContext(context); + this.motionSrv.copyAsync(snapshot, snapshotOnImageStore, caller); + } catch (Exception e) { + s_logger.debug("Failed to copy snapshot", e); + result.setResult("Failed to copy snapshot:" +e.toString()); + try { + snapObj.processEvent(Snapshot.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("Failed to change state: " + e1.toString()); + } + future.complete(result); + } + + try { + SnapshotResult res = future.get(); + SnapshotInfo destSnapshot = res.snashot; + return destSnapshot; + } catch (InterruptedException e) { + s_logger.debug("failed copy snapshot", e); + throw new CloudRuntimeException("Failed to copy snapshot" , e); + } catch (ExecutionException e) { + s_logger.debug("Failed to copy snapshot", e); + throw new CloudRuntimeException("Failed to copy snapshot" , e); + } + + } + + protected Void copySnapshotAsyncCallback(AsyncCallbackDispatcher callback, + CopySnapshotContext context) { + CopyCommandResult result = callback.getResult(); + SnapshotInfo destSnapshot = context.destSnapshot; + SnapshotObject srcSnapshot = (SnapshotObject)context.srcSnapshot; + AsyncCallFuture future = context.future; + SnapshotResult snapResult = new SnapshotResult(destSnapshot); + if (result.isFailed()) { + snapResult.setResult(result.getResult()); + future.complete(snapResult); + return null; + } + + try { + BackupSnapshotAnswer answer = (BackupSnapshotAnswer)result.getAnswer(); + + DataObjectInStore dataInStore = objInStoreMgr.findObject(destSnapshot, destSnapshot.getDataStore()); + dataInStore.setInstallPath(answer.getBackupSnapshotName()); + objInStoreMgr.update(destSnapshot, Event.OperationSuccessed); + + srcSnapshot.processEvent(Snapshot.Event.OperationSucceeded); + snapResult = new SnapshotResult(this.snapshotfactory.getSnapshot(destSnapshot.getId())); + future.complete(snapResult); + } catch (Exception e) { + s_logger.debug("Failed to update snapshot state", e); + snapResult.setResult(e.toString()); + future.complete(snapResult); + } + return null; + } + + @DB + protected boolean destroySnapshotBackUp(SnapshotVO snapshot) { + DataStore store = objInStoreMgr.findStore(snapshot.getUuid(), DataObjectType.SNAPSHOT, DataStoreRole.Image); + if (store == null) { + s_logger.debug("Can't find snapshot" + snapshot.getId() + " backed up into image store"); + return false; + } + + try { + SnapshotInfo snapshotInfo = this.snapshotfactory.getSnapshot(snapshot.getId(), store); + snapshotInfo.processEvent(ObjectInDataStoreStateMachine.Event.DestroyRequested); + + AsyncCallFuture future = new AsyncCallFuture(); + DeleteSnapshotContext context = new DeleteSnapshotContext(null, + snapshotInfo, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().deleteSnapshotCallback(null, null)) + .setContext(context); + + store.getDriver().deleteAsync(snapshotInfo, caller); + + SnapshotResult result = future.get(); + if (result.isFailed()) { + s_logger.debug("Failed to delete snapsoht: " + result.getResult()); + } + return result.isSuccess(); + } catch (Exception e) { + s_logger.debug("Failed to delete snapshot", e); + return false; + } + } + + protected Void deleteSnapshotCallback(AsyncCallbackDispatcher callback, + DeleteSnapshotContext context) { + CommandResult result = callback.getResult(); + AsyncCallFuture future = context.future; + SnapshotInfo snapshot = context.snapshot; + if (result.isFailed()) { + s_logger.debug("delete snapshot failed" + result.getResult()); + snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed); + SnapshotResult res = new SnapshotResult(context.snapshot); + future.complete(res); + return null; + } + snapshot.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed); + SnapshotResult res = new SnapshotResult(context.snapshot); + future.complete(res); + return null; + } + + @Override + public boolean deleteSnapshot(SnapshotInfo snapInfo) { + Long snapshotId = snapInfo.getId(); + SnapshotObject snapshot = (SnapshotObject)snapInfo; + + if (!Snapshot.State.BackedUp.equals(snapshot.getState())) { + throw new InvalidParameterValueException("Can't delete snapshotshot " + snapshotId + " due to it is not in BackedUp Status"); + } + + if (s_logger.isDebugEnabled()) { + s_logger.debug("Calling deleteSnapshot for snapshotId: " + snapshotId); + } + SnapshotVO lastSnapshot = null; + if (snapshot.getBackupSnapshotId() != null) { + List snaps = _snapshotDao.listByBackupUuid(snapshot.getVolumeId(), snapshot.getBackupSnapshotId()); + if (snaps != null && snaps.size() > 1) { + snapshot.setBackupSnapshotId(null); + SnapshotVO snapshotVO = this._snapshotDao.findById(snapshotId); + _snapshotDao.update(snapshot.getId(), snapshotVO); + } + } + + _snapshotDao.remove(snapshotId); + + long lastId = snapshotId; + boolean destroy = false; + while (true) { + lastSnapshot = _snapshotDao.findNextSnapshot(lastId); + if (lastSnapshot == null) { + // if all snapshots after this snapshot in this chain are removed, remove those snapshots. + destroy = true; + break; + } + if (lastSnapshot.getRemoved() == null) { + // if there is one child not removed, then can not remove back up snapshot. + break; + } + lastId = lastSnapshot.getId(); + } + if (destroy) { + lastSnapshot = _snapshotDao.findByIdIncludingRemoved(lastId); + while (lastSnapshot.getRemoved() != null) { + String BackupSnapshotId = lastSnapshot.getBackupSnapshotId(); + if (BackupSnapshotId != null) { + List snaps = _snapshotDao.listByBackupUuid(lastSnapshot.getVolumeId(), BackupSnapshotId); + if (snaps != null && snaps.size() > 1) { + lastSnapshot.setBackupSnapshotId(null); + _snapshotDao.update(lastSnapshot.getId(), lastSnapshot); + } else { + if (destroySnapshotBackUp(lastSnapshot)) { + + } else { + s_logger.debug("Destroying snapshot backup failed " + lastSnapshot); + break; + } + } + } + lastId = lastSnapshot.getPrevSnapshotId(); + if (lastId == 0) { + break; + } + lastSnapshot = _snapshotDao.findByIdIncludingRemoved(lastId); + } + } + return true; + + } + + @Override + public boolean revertSnapshot(SnapshotInfo snapshot) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/snapshot/test/resource/SnapshotManagerTestContext.xml b/engine/storage/snapshot/test/resource/SnapshotManagerTestContext.xml new file mode 100644 index 00000000000..d99c2e2dbac --- /dev/null +++ b/engine/storage/snapshot/test/resource/SnapshotManagerTestContext.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java b/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java new file mode 100644 index 00000000000..e722ab55c70 --- /dev/null +++ b/engine/storage/snapshot/test/src/SnapshotDataFactoryTest.java @@ -0,0 +1,50 @@ +/* + * 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 src; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.cloud.utils.component.ComponentContext; + +import junit.framework.TestCase; + +//@RunWith(SpringJUnit4ClassRunner.class) +//@ContextConfiguration(locations = "classpath:/SnapshotManagerTestContext.xml") +public class SnapshotDataFactoryTest extends TestCase { + //@Inject SnapshotDataFactory snapshotFactory; + + @Before + public void setup() throws Exception { + //ComponentContext.initComponentsLifeCycle(); + + } + + @Test + public void testGestSnapshot() { + //snapshotFactory.getSnapshot(snapshotId); + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/BaseType.java b/engine/storage/src/org/apache/cloudstack/storage/BaseType.java new file mode 100644 index 00000000000..a5b45e17f03 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/BaseType.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 org.apache.cloudstack.storage; + +public abstract class BaseType { + public boolean equals(Object that) { + if (this == that) { + return true; + } + if (that instanceof String) { + if (this.toString().equalsIgnoreCase((String) that)) { + return true; + } + } else if (that instanceof BaseType) { + BaseType th = (BaseType) that; + if (this.toString().equalsIgnoreCase(th.toString())) { + return true; + } + } else { + return false; + } + return false; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/EndPoint.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java b/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.java new file mode 100644 index 00000000000..a316223b24d --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/HostEndpointRpcServer.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 org.apache.cloudstack.storage; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public interface HostEndpointRpcServer { + void sendCommandAsync(HypervisorHostEndPoint ep, final Command command, final AsyncCompletionCallback callback); + Answer sendCommand(HypervisorHostEndPoint ep, final Command command); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java new file mode 100644 index 00000000000..6c49b1a0e9e --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/HypervisorHostEndPoint.java @@ -0,0 +1,75 @@ +/* + * 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.storage; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.utils.component.ComponentContext; + +public class HypervisorHostEndPoint implements EndPoint { + private static final Logger s_logger = Logger.getLogger(HypervisorHostEndPoint.class); + private long hostId; + private String hostAddress; + @Inject + AgentManager agentMgr; + @Inject + HostEndpointRpcServer rpcServer; + + protected HypervisorHostEndPoint() { + + } + + private void configure(long hostId, String hostAddress) { + this.hostId = hostId; + this.hostAddress = hostAddress; + } + + public static HypervisorHostEndPoint getHypervisorHostEndPoint(long hostId, String hostAddress) { + HypervisorHostEndPoint ep = ComponentContext.inject(HypervisorHostEndPoint.class); + ep.configure(hostId, hostAddress); + return ep; + } + + public String getHostAddr() { + return this.hostAddress; + } + + public long getId() { + return this.hostId; + } + + @Override + public Answer sendMessage(Command cmd) { + return rpcServer.sendCommand(this, cmd); + } + + @Override + public void sendMessageAsync(Command cmd, AsyncCompletionCallback callback) { + rpcServer.sendCommandAsync(this, cmd, callback); + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/HypervsiorHostEndPointRpcServer.java b/engine/storage/src/org/apache/cloudstack/storage/HypervsiorHostEndPointRpcServer.java new file mode 100644 index 00000000000..b709991ee57 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/HypervsiorHostEndPointRpcServer.java @@ -0,0 +1,119 @@ +/* + * 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.storage; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.framework.rpc.RpcCallbackListener; +import org.apache.cloudstack.framework.rpc.RpcException; +import org.apache.cloudstack.framework.rpc.RpcProvider; +import org.apache.cloudstack.framework.rpc.RpcServiceDispatcher; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class HypervsiorHostEndPointRpcServer implements HostEndpointRpcServer { + private static final Logger s_logger = Logger.getLogger(HypervsiorHostEndPointRpcServer.class); + + @Inject + private RpcProvider _rpcProvider; + + public HypervsiorHostEndPointRpcServer() { + } + + public HypervsiorHostEndPointRpcServer(RpcProvider rpcProvider) { + _rpcProvider = rpcProvider; + _rpcProvider.registerRpcServiceEndpoint(RpcServiceDispatcher.getDispatcher(this)); + } + + @PostConstruct + public void Initialize() { + _rpcProvider.registerRpcServiceEndpoint(RpcServiceDispatcher.getDispatcher(this)); + } + + @Override + public void sendCommandAsync(HypervisorHostEndPoint host, final Command command, final AsyncCompletionCallback callback) { + _rpcProvider.newCall(host.getHostAddr()).addCallbackListener(new RpcCallbackListener() { + @Override + public void onSuccess(Answer result) { + callback.complete(result); + } + + @Override + public void onFailure(RpcException e) { + Answer answer = new Answer(command, false, e.toString()); + callback.complete(answer); + } + }).apply(); + } + + private class SendCommandContext extends AsyncRpcConext { + private T answer; + + public SendCommandContext(AsyncCompletionCallback callback) { + super(callback); + } + + public void setAnswer(T answer) { + this.answer = answer; + } + + public T getAnswer() { + return this.answer; + } + + } + + @Override + public Answer sendCommand(HypervisorHostEndPoint host, Command command) { + SendCommandContext context = new SendCommandContext(null); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().sendCommandCallback(null, null)) + .setContext(context); + + this.sendCommandAsync(host, command, caller); + + synchronized (context) { + try { + context.wait(); + } catch (InterruptedException e) { + s_logger.debug(e.toString()); + throw new CloudRuntimeException("wait on context is interrupted", e); + } + } + + return context.getAnswer(); + } + + protected Object sendCommandCallback(AsyncCallbackDispatcher callback, SendCommandContext context) { + context.setAnswer((Answer)callback.getResult()); + synchronized(context) { + context.notify(); + } + return null; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java new file mode 100644 index 00000000000..5f5ce2f4a92 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/backup/SnapshotOnBackupStoreInfo.java @@ -0,0 +1,24 @@ +// 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.storage.backup; + +import org.apache.cloudstack.storage.backup.datastore.BackupStoreInfo; + +public interface SnapshotOnBackupStoreInfo { + public String getName(); + public BackupStoreInfo getBackupStore(); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java new file mode 100644 index 00000000000..ca1454af570 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/backup/datastore/BackupStoreInfo.java @@ -0,0 +1,24 @@ +// 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.storage.backup.datastore; + +import org.apache.cloudstack.storage.backup.SnapshotOnBackupStoreInfo; + +public interface BackupStoreInfo { + public SnapshotOnBackupStoreInfo getSnapshot(long snapshotId); + public boolean deleteSnapshot(SnapshotOnBackupStoreInfo snapshot); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreAnswer.java b/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreAnswer.java new file mode 100644 index 00000000000..cd15030084d --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreAnswer.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.command; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class AttachPrimaryDataStoreAnswer extends Answer { + private String uuid; + private long capacity; + private long avail; + public AttachPrimaryDataStoreAnswer(Command cmd) { + super(cmd); + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getUuid() { + return this.uuid; + } + + public void setCapacity(long capacity) { + this.capacity = capacity; + } + + public long getCapacity() { + return this.capacity; + } + + public void setAvailable(long avail) { + this.avail = avail; + } + + public long getAvailable() { + return this.avail; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java b/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java new file mode 100644 index 00000000000..8aaca94aee0 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/AttachPrimaryDataStoreCmd.java @@ -0,0 +1,38 @@ +/* + * 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.storage.command; + +import com.cloud.agent.api.Command; + +public class AttachPrimaryDataStoreCmd extends Command implements StorageSubSystemCommand { + private final String dataStore; + public AttachPrimaryDataStoreCmd(String uri) { + this.dataStore = uri; + } + + public String getDataStore() { + return this.dataStore; + } + + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmd.java b/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmd.java new file mode 100644 index 00000000000..10478ef24c7 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmd.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 org.apache.cloudstack.storage.command; + +import com.cloud.agent.api.Command; + +public class CopyCmd extends Command implements StorageSubSystemCommand { + private String srcUri; + private String destUri; + + public CopyCmd(String srcUri, String destUri) { + super(); + this.srcUri = srcUri; + this.destUri = destUri; + } + + public String getDestUri() { + return this.destUri; + } + + public String getSrcUri() { + return this.srcUri; + } + + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmdAnswer.java b/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmdAnswer.java new file mode 100644 index 00000000000..53e082e6950 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CopyCmdAnswer.java @@ -0,0 +1,33 @@ +// 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.storage.command; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class CopyCmdAnswer extends Answer { + private final String path; + + public CopyCmdAnswer(Command cmd, String path) { + super(cmd); + this.path = path; + } + + public String getPath() { + return this.path; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CopyTemplateToPrimaryStorageAnswer.java b/engine/storage/src/org/apache/cloudstack/storage/command/CopyTemplateToPrimaryStorageAnswer.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CopyTemplateToPrimaryStorageAnswer.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectAnswer.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectAnswer.java new file mode 100644 index 00000000000..43540de2bd3 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectAnswer.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.storage.command; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; + +public class CreateObjectAnswer extends Answer { + private String path; + private Long size; + protected CreateObjectAnswer() { + super(); + } + + public CreateObjectAnswer(Command cmd, String path, Long size) { + super(cmd); + this.path = path; + this.size = size; + } + + public CreateObjectAnswer(Command cmd, boolean status, String result) { + super(cmd, status, result); + } + + public String getPath() { + return this.path; + } + + public Long getSize() { + return this.size; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectCommand.java new file mode 100644 index 00000000000..86d3bd42410 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateObjectCommand.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 org.apache.cloudstack.storage.command; + +import com.cloud.agent.api.Command; + +public class CreateObjectCommand extends Command implements StorageSubSystemCommand { + protected String objectUri; + + public CreateObjectCommand(String objectUri) { + super(); + this.objectUri = objectUri; + } + + protected CreateObjectCommand() { + super(); + } + + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } + + public String getObjectUri() { + return this.objectUri; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.java new file mode 100644 index 00000000000..0e50950843e --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreatePrimaryDataStoreCmd.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 org.apache.cloudstack.storage.command; + +import com.cloud.agent.api.Command; + +public class CreatePrimaryDataStoreCmd extends Command implements StorageSubSystemCommand { + private final String dataStore; + public CreatePrimaryDataStoreCmd(String uri) { + this.dataStore = uri; + } + + public String getDataStore() { + return this.dataStore; + } + + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.java new file mode 100644 index 00000000000..f4be0676b9b --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/CreateVolumeFromBaseImageCommand.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.storage.command; + +import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; +import org.apache.cloudstack.storage.to.VolumeTO; + +import com.cloud.agent.api.Command; + +public class CreateVolumeFromBaseImageCommand extends Command implements StorageSubSystemCommand { + private final VolumeTO volume; + private final ImageOnPrimayDataStoreTO image; + + public CreateVolumeFromBaseImageCommand(VolumeTO volume, String image) { + this.volume = volume; + this.image = null; + } + + public VolumeTO getVolume() { + return this.volume; + } + + public ImageOnPrimayDataStoreTO getImage() { + return this.image; + } + + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.java new file mode 100644 index 00000000000..5d948d19356 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/DeleteCommand.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.storage.command; + +import org.apache.cloudstack.storage.to.VolumeTO; + +import com.cloud.agent.api.Command; + +public class DeleteCommand extends Command implements StorageSubSystemCommand { + private String uri; + public DeleteCommand(String uri) { + this.uri = uri; + } + + protected DeleteCommand() { + + } + @Override + public boolean executeInSequence() { + // TODO Auto-generated method stub + return false; + } + + public String getUri() { + return this.uri; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java b/engine/storage/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java new file mode 100644 index 00000000000..d14161ae4c5 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/command/StorageSubSystemCommand.java @@ -0,0 +1,23 @@ +/* + * 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.storage.command; + +public interface StorageSubSystemCommand { + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.java new file mode 100644 index 00000000000..20bf0545dc9 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManager.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 org.apache.cloudstack.storage.datastore; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public interface DataObjectManager { + public void createAsync(DataObject data, DataStore store, AsyncCompletionCallback callback, boolean noCopy); + /* + * Only create internal state, without actually send down create command. + * It's up to device driver decides whether to create object before copying + */ + public DataObject createInternalStateOnly(DataObject data, DataStore store); + public void update(DataObject data, String path, Long size); + public void copyAsync(DataObject srcData, DataObject destData, AsyncCompletionCallback callback); + public void deleteAsync(DataObject data, AsyncCompletionCallback callback); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManagerImpl.java new file mode 100644 index 00000000000..218f9013a17 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataObjectManagerImpl.java @@ -0,0 +1,372 @@ +/* + * 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.storage.datastore; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.motion.DataMotionService; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; + +@Component +public class DataObjectManagerImpl implements DataObjectManager { + private static final Logger s_logger = Logger + .getLogger(DataObjectManagerImpl.class); + @Inject + ObjectInDataStoreManager objectInDataStoreMgr; + @Inject + DataMotionService motionSrv; + protected long waitingTime = 1800; // half an hour + protected long waitingRetries = 10; + + protected DataObject waitingForCreated(DataObject dataObj, + DataStore dataStore) { + long retries = this.waitingRetries; + DataObjectInStore obj = null; + do { + try { + Thread.sleep(waitingTime); + } catch (InterruptedException e) { + s_logger.debug("sleep interrupted", e); + throw new CloudRuntimeException("sleep interrupted", e); + } + + obj = objectInDataStoreMgr.findObject(dataObj, + dataStore); + if (obj == null) { + s_logger.debug("can't find object in db, maybe it's cleaned up already, exit waiting"); + break; + } + if (obj.getState() == ObjectInDataStoreStateMachine.State.Ready) { + break; + } + retries--; + } while (retries > 0); + + if (obj == null || retries <= 0) { + s_logger.debug("waiting too long for template downloading, marked it as failed"); + throw new CloudRuntimeException( + "waiting too long for template downloading, marked it as failed"); + } + return objectInDataStoreMgr.get(dataObj, dataStore); + } + class CreateContext extends AsyncRpcConext { + final DataObject objInStrore; + + public CreateContext(AsyncCompletionCallback callback, + DataObject objInStore) { + super(callback); + this.objInStrore = objInStore; + } + + } + + @Override + public void createAsync(DataObject data, DataStore store, + AsyncCompletionCallback callback, boolean noCopy) { + DataObjectInStore obj = objectInDataStoreMgr.findObject( + data, store); + DataObject objInStore = null; + boolean freshNewTemplate = false; + if (obj == null) { + try { + objInStore = objectInDataStoreMgr.create( + data, store); + freshNewTemplate = true; + } catch (Throwable e) { + obj = objectInDataStoreMgr.findObject(data, + store); + if (obj == null) { + CreateCmdResult result = new CreateCmdResult( + null, null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return; + } + } + } + + if (!freshNewTemplate + && obj.getState() != ObjectInDataStoreStateMachine.State.Ready) { + try { + objInStore = waitingForCreated( + data, store); + } catch (Exception e) { + CreateCmdResult result = new CreateCmdResult(null, null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return; + } + + CreateCmdResult result = new CreateCmdResult( + null, null); + callback.complete(result); + return; + } + + try { + ObjectInDataStoreStateMachine.Event event = null; + if (noCopy) { + event = ObjectInDataStoreStateMachine.Event.CreateOnlyRequested; + } else { + event = ObjectInDataStoreStateMachine.Event.CreateRequested; + } + objectInDataStoreMgr.update(objInStore, + event); + } catch (NoTransitionException e) { + try { + objectInDataStoreMgr.update(objInStore, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("state transation failed", e1); + } + CreateCmdResult result = new CreateCmdResult(null, null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return; + } + + CreateContext context = new CreateContext( + callback, objInStore); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().createAsynCallback(null, null)) + .setContext(context); + + store.getDriver().createAsync(objInStore, caller); + return; + } + + protected Void createAsynCallback(AsyncCallbackDispatcher callback, + CreateContext context) { + CreateCmdResult result = callback.getResult(); + DataObject objInStrore = context.objInStrore; + CreateCmdResult upResult = new CreateCmdResult( + null, null); + if (result.isFailed()) { + upResult.setResult(result.getResult()); + context.getParentCallback().complete(upResult); + return null; + } + + try { + objectInDataStoreMgr.update(objInStrore, + ObjectInDataStoreStateMachine.Event.OperationSuccessed); + } catch (NoTransitionException e) { + try { + objectInDataStoreMgr.update(objInStrore, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("failed to change state", e1); + } + + upResult.setResult(e.toString()); + context.getParentCallback().complete(upResult); + return null; + } + + context.getParentCallback().complete(result); + return null; + } + + class CopyContext extends AsyncRpcConext { + DataObject destObj; + DataObject srcObj; + + public CopyContext(AsyncCompletionCallback callback, + DataObject srcObj, + DataObject destObj) { + super(callback); + this.srcObj = srcObj; + this.destObj = destObj; + } + } + + @Override + public void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback) { + try { + objectInDataStoreMgr.update(destData, + ObjectInDataStoreStateMachine.Event.CopyingRequested); + } catch (NoTransitionException e) { + s_logger.debug("failed to change state", e); + try { + objectInDataStoreMgr.update(destData, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + + } + CreateCmdResult res = new CreateCmdResult(null, null); + res.setResult("Failed to change state: " + e.toString()); + callback.complete(res); + } + + CopyContext anotherCall = new CopyContext( + callback, srcData, destData); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback(caller.getTarget().copyCallback(null, null)) + .setContext(anotherCall); + + motionSrv.copyAsync(srcData, destData, caller); + } + + protected Void copyCallback( + AsyncCallbackDispatcher callback, + CopyContext context) { + CopyCommandResult result = callback.getResult(); + DataObject destObj = context.destObj; + + if (result.isFailed()) { + try { + objectInDataStoreMgr.update(destObj, Event.OperationFailed); + } catch (NoTransitionException e) { + s_logger.debug("Failed to update copying state", e); + } + CreateCmdResult res = new CreateCmdResult( + null, null); + res.setResult(result.getResult()); + context.getParentCallback().complete(res); + } + + try { + objectInDataStoreMgr.update(destObj, + ObjectInDataStoreStateMachine.Event.OperationSuccessed); + } catch (NoTransitionException e) { + s_logger.debug("Failed to update copying state: ", e); + try { + objectInDataStoreMgr.update(destObj, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + } + CreateCmdResult res = new CreateCmdResult( + null, null); + res.setResult("Failed to update copying state: " + e.toString()); + context.getParentCallback().complete(res); + } + CreateCmdResult res = new CreateCmdResult( + result.getPath(), null); + context.getParentCallback().complete(res); + return null; + } + + + class DeleteContext extends AsyncRpcConext { + private final DataObject obj; + public DeleteContext(AsyncCompletionCallback callback, DataObject obj) { + super(callback); + this.obj = obj; + } + + } + @Override + public void deleteAsync(DataObject data, + AsyncCompletionCallback callback) { + try { + objectInDataStoreMgr.update(data, Event.DestroyRequested); + } catch (NoTransitionException e) { + s_logger.debug("destroy failed", e); + CreateCmdResult res = new CreateCmdResult( + null, null); + callback.complete(res); + } + + DeleteContext context = new DeleteContext( + callback, data); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().deleteAsynCallback(null, null)) + .setContext(context); + + data.getDataStore().getDriver().deleteAsync(data, caller); + return; + } + + protected Void deleteAsynCallback(AsyncCallbackDispatcher callback, + DeleteContext context) { + DataObject destObj = context.obj; + + CommandResult res = callback.getResult(); + if (res.isFailed()) { + try { + objectInDataStoreMgr.update(destObj, Event.OperationFailed); + } catch (NoTransitionException e) { + s_logger.debug("delete failed", e); + } + + } else { + try { + objectInDataStoreMgr.update(destObj, Event.OperationSuccessed); + } catch (NoTransitionException e) { + s_logger.debug("delete failed", e); + } + } + + context.getParentCallback().complete(res); + return null; + } + + @Override + public DataObject createInternalStateOnly(DataObject data, DataStore store) { + DataObjectInStore obj = objectInDataStoreMgr.findObject( + data, store); + DataObject objInStore = null; + if (obj == null) { + objInStore = objectInDataStoreMgr.create( + data, store); + } + try { + ObjectInDataStoreStateMachine.Event event = null; + event = ObjectInDataStoreStateMachine.Event.CreateRequested; + objectInDataStoreMgr.update(objInStore, + event); + + objectInDataStoreMgr.update(objInStore, ObjectInDataStoreStateMachine.Event.OperationSuccessed); + } catch (NoTransitionException e) { + s_logger.debug("Failed to update state", e); + throw new CloudRuntimeException("Failed to update state", e); + } + + return objInStore; + } + + @Override + public void update(DataObject data, String path, Long size) { + throw new CloudRuntimeException("not implemented"); + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStore.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStore.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStore.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java new file mode 100644 index 00000000000..a2fd08d1e8f --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.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 org.apache.cloudstack.storage.datastore; + +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.Scope; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreManager; +import org.springframework.stereotype.Component; + +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class DataStoreManagerImpl implements DataStoreManager { + @Inject + PrimaryDataStoreProviderManager primaryStorMgr; + @Inject + ImageDataStoreManager imageDataStoreMgr; + + @Override + public DataStore getDataStore(long storeId, DataStoreRole role) { + if (role == DataStoreRole.Primary) { + return primaryStorMgr.getPrimaryDataStore(storeId); + } else if (role == DataStoreRole.Image) { + return imageDataStoreMgr.getImageDataStore(storeId); + } + throw new CloudRuntimeException("un recognized type" + role); + } + @Override + public DataStore registerDataStore(Map params, + String providerUuid) { + return null; + } + @Override + public DataStore getDataStore(String uuid, DataStoreRole role) { + if (role == DataStoreRole.Primary) { + return primaryStorMgr.getPrimaryDataStore(uuid); + } else if (role == DataStoreRole.Image) { + return imageDataStoreMgr.getImageDataStore(uuid); + } + throw new CloudRuntimeException("un recognized type" + role); + } + @Override + public List getImageStores(Scope scope) { + return imageDataStoreMgr.getList(); + } + @Override + public DataStore getPrimaryDataStore(long storeId) { + return primaryStorMgr.getPrimaryDataStore(storeId); + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManager.java new file mode 100644 index 00000000000..d170f5c707a --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManager.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 org.apache.cloudstack.storage.datastore; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; + +import com.cloud.utils.fsm.NoTransitionException; + +public interface ObjectInDataStoreManager { + public DataObject create(DataObject template, DataStore dataStore); + public DataObject get(DataObject dataObj, DataStore store); + public boolean update(DataObject vo, Event event) throws NoTransitionException; + DataObjectInStore findObject(String uuid, DataObjectType type, + String dataStoreUuid, DataStoreRole role); + DataObjectInStore findObject(DataObject obj, DataStore store); + DataStore findStore(String objUuid, DataObjectType type, DataStoreRole role); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java new file mode 100644 index 00000000000..87ba1d216c5 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java @@ -0,0 +1,215 @@ +// 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.storage.datastore; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.storage.db.ObjectInDataStoreDao; +import org.apache.cloudstack.storage.db.ObjectInDataStoreVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.storage.VMTemplateStoragePoolVO; +import com.cloud.storage.dao.VMTemplateHostDao; +import com.cloud.storage.dao.VMTemplatePoolDao; +import com.cloud.storage.dao.VolumeHostDao; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.fsm.StateMachine2; + +@Component +public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager { + private static final Logger s_logger = Logger + .getLogger(ObjectInDataStoreManagerImpl.class); + @Inject + ImageDataFactory imageFactory; + @Inject + DataStoreManager storeMgr; + @Inject + VolumeDataFactory volumeFactory; + @Inject + ObjectInDataStoreDao objectDataStoreDao; + @Inject + VolumeHostDao volumeHostDao; + @Inject + VMTemplateHostDao templateHostDao; + @Inject + VMTemplatePoolDao templatePoolDao; + @Inject + SnapshotDataFactory snapshotFactory; + protected StateMachine2 stateMachines; + + public ObjectInDataStoreManagerImpl() { + stateMachines = new StateMachine2(); + stateMachines.addTransition(State.Allocated, Event.CreateRequested, + State.Creating); + stateMachines.addTransition(State.Creating, Event.OperationSuccessed, + State.Created); + stateMachines.addTransition(State.Creating, Event.OperationFailed, + State.Failed); + stateMachines.addTransition(State.Failed, Event.CreateRequested, + State.Creating); + stateMachines.addTransition(State.Ready, Event.DestroyRequested, + State.Destroying); + stateMachines.addTransition(State.Destroying, Event.OperationSuccessed, + State.Destroyed); + stateMachines.addTransition(State.Destroying, Event.OperationFailed, + State.Destroying); + stateMachines.addTransition(State.Destroying, Event.DestroyRequested, + State.Destroying); + stateMachines.addTransition(State.Created, Event.CopyingRequested, + State.Copying); + stateMachines.addTransition(State.Copying, Event.OperationFailed, + State.Created); + stateMachines.addTransition(State.Copying, Event.OperationSuccessed, + State.Ready); + stateMachines.addTransition(State.Allocated, Event.CreateOnlyRequested, + State.Creating2); + stateMachines.addTransition(State.Creating2, Event.OperationFailed, + State.Allocated); + stateMachines.addTransition(State.Creating2, Event.OperationSuccessed, + State.Ready); + } + + @Override + public DataObject create(DataObject obj, DataStore dataStore) { + if (obj.getType() == DataObjectType.TEMPLATE && dataStore.getRole() == DataStoreRole.Primary) { + VMTemplateStoragePoolVO vo = new VMTemplateStoragePoolVO(dataStore.getId(), obj.getId()); + vo = templatePoolDao.persist(vo); + } else { + ObjectInDataStoreVO vo = new ObjectInDataStoreVO(); + vo.setDataStoreRole(dataStore.getRole()); + vo.setDataStoreUuid(dataStore.getUuid()); + vo.setObjectType(obj.getType()); + vo.setObjectUuid(obj.getUuid()); + vo = objectDataStoreDao.persist(vo); + } + + if (obj.getType() == DataObjectType.TEMPLATE) { + return imageFactory.getTemplate(obj, dataStore); + } else if (obj.getType() == DataObjectType.VOLUME) { + return volumeFactory.getVolume(obj, dataStore); + } else if (obj.getType() == DataObjectType.SNAPSHOT) { + return snapshotFactory.getSnapshot(obj, dataStore); + } + throw new CloudRuntimeException("unknown type"); + } + + @Override + public boolean update(DataObject data, Event event) + throws NoTransitionException { + DataObjectInStore obj = this.findObject(data, data.getDataStore()); + if (obj == null) { + throw new CloudRuntimeException( + "can't find mapping in ObjectInDataStore table for: " + + data); + } + + if (data.getType() == DataObjectType.TEMPLATE && data.getDataStore().getRole() == DataStoreRole.Primary) { + try { + this.stateMachines.transitTo(obj, event, null, + templatePoolDao); + } catch (NoTransitionException e) { + if (event == Event.CreateOnlyRequested || event == Event.OperationSuccessed) { + s_logger.debug("allow muliple create requests"); + } else { + throw e; + } + } + } else { + this.stateMachines.transitTo(obj, event, null, objectDataStoreDao); + } + return true; + } + + @Override + public DataObject get(DataObject dataObj, DataStore store) { + if (dataObj.getType() == DataObjectType.TEMPLATE) { + return imageFactory.getTemplate(dataObj, store); + } else if (dataObj.getType() == DataObjectType.VOLUME) { + return volumeFactory.getVolume(dataObj, store); + } + throw new CloudRuntimeException("unknown type"); + } + + @Override + public DataObjectInStore findObject(DataObject obj, DataStore store) { + DataObjectInStore vo = null; + SearchCriteriaService sc = SearchCriteria2.create(ObjectInDataStoreVO.class); + + if (store.getRole() == DataStoreRole.Image) { + sc.addAnd(sc.getEntity().getDataStoreUuid(), Op.EQ, store.getUuid()); + sc.addAnd(sc.getEntity().getDataStoreRole(), Op.EQ, store.getRole()); + sc.addAnd(sc.getEntity().getObjectUuid(), Op.EQ, obj.getUuid()); + sc.addAnd(sc.getEntity().getObjectType(), Op.EQ, obj.getType()); + vo = sc.find(); + } else if (obj.getType() == DataObjectType.TEMPLATE && store.getRole() == DataStoreRole.Primary) { + vo = templatePoolDao.findByPoolTemplate(store.getId(), obj.getId()); + } else { + s_logger.debug("unknown type: " + obj.getType() + " " + store.getRole()); + throw new CloudRuntimeException("unknown type"); + } + return vo; + } + + @Override + public DataObjectInStore findObject(String uuid, DataObjectType type, + String dataStoreUuid, DataStoreRole role) { + DataObjectInStore vo = null; + SearchCriteriaService sc = SearchCriteria2.create(ObjectInDataStoreVO.class); + + if (role == DataStoreRole.Image) { + sc.addAnd(sc.getEntity().getDataStoreUuid(), Op.EQ, dataStoreUuid); + sc.addAnd(sc.getEntity().getDataStoreRole(), Op.EQ, role); + sc.addAnd(sc.getEntity().getObjectUuid(), Op.EQ, uuid); + sc.addAnd(sc.getEntity().getObjectType(), Op.EQ, type); + vo = sc.find(); + } + return vo; + } + + @Override + public DataStore findStore(String objUuid, DataObjectType type, DataStoreRole role) { + DataStore store = null; + if (role == DataStoreRole.Image) { + SearchCriteriaService sc = SearchCriteria2.create(ObjectInDataStoreVO.class); + sc.addAnd(sc.getEntity().getDataStoreRole(), Op.EQ, role); + sc.addAnd(sc.getEntity().getObjectUuid(), Op.EQ, objUuid); + sc.addAnd(sc.getEntity().getObjectType(), Op.EQ, type); + ObjectInDataStoreVO vo = sc.find(); + if (vo != null) { + store = this.storeMgr.getDataStore(vo.getDataStoreUuid(), vo.getDataStoreRole()); + } + } + return store; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.java new file mode 100644 index 00000000000..fdaaace49d7 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStore.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.storage.datastore; + +import java.util.List; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; + +public interface PrimaryDataStore extends DataStore, PrimaryDataStoreInfo { + VolumeInfo getVolume(long id); + + List getVolumes(); + + boolean exists(DataObject data); + + TemplateInfo getTemplate(long templateId); + + SnapshotInfo getSnapshot(long snapshotId); + + + DiskFormat getDefaultDiskType(); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java new file mode 100644 index 00000000000..e70f803ee81 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreEntityImpl.java @@ -0,0 +1,257 @@ +/* + * 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.storage.datastore; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; + +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolStatus; + +public class PrimaryDataStoreEntityImpl implements StorageEntity { + private PrimaryDataStoreInfo dataStore; + + public PrimaryDataStoreEntityImpl(PrimaryDataStoreInfo dataStore) { + this.dataStore = dataStore; + } + + @Override + public boolean enable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean disable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deactivate() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean reactivate() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getUuid() { + return this.dataStore.getUuid(); + } + + @Override + public long getId() { + return this.dataStore.getId(); + } + + @Override + public String getCurrentState() { + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getLastUpdatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getOwner() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getDetails() { + // TODO Auto-generated method stub + return null; + } + + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public State getState() { + //return this.dataStore.getManagedState(); + return null; + } + + @Override + public String getName() { + return this.dataStore.getName(); + } + + @Override + public StoragePoolType getPoolType() { + return null; + } + + @Override + public Date getCreated() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getUpdateTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getDataCenterId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getCapacityBytes() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getAvailableBytes() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Long getClusterId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getHostAddress() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getUserInfo() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isShared() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isLocal() { + // TODO Auto-generated method stub + return false; + } + + @Override + public StoragePoolStatus getStatus() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getPort() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public Long getPodId() { + // TODO Auto-generated method stub + return null; + } + + + public String getStorageType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void persist() { + // TODO Auto-generated method stub + + } + + @Override + public Long getStorageProviderId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isInMaintenance() { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.java new file mode 100644 index 00000000000..d1c26e1a272 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/PrimaryDataStoreProviderManager.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.storage.datastore; + +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; + + +public interface PrimaryDataStoreProviderManager { + public PrimaryDataStore getPrimaryDataStore(long dataStoreId); + public PrimaryDataStore getPrimaryDataStore(String uuid); + + boolean registerDriver(String uuid, PrimaryDataStoreDriver driver); + boolean registerHostListener(String uuid, HypervisorHostListener listener); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/TemplateInDataStore.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/protocol/DataStoreProtocol.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/protocol/DataStoreProtocol.java new file mode 100644 index 00000000000..b0a7d50c57d --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/protocol/DataStoreProtocol.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 org.apache.cloudstack.storage.datastore.protocol; + +public enum DataStoreProtocol { + NFS("nfs"), + ISCSI("iscsi"); + + private String name; + DataStoreProtocol(String name) { + this.name = name; + } + + @Override + public String toString() { + return this.name; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManagerImpl.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManagerImpl.java new file mode 100644 index 00000000000..96d2da357f5 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManagerImpl.java @@ -0,0 +1,118 @@ +/* + * 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.storage.datastore.provider; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.db.DataStoreProviderDao; +import org.apache.cloudstack.storage.datastore.db.DataStoreProviderVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.utils.component.ManagerBase; + +@Component +public class DataStoreProviderManagerImpl extends ManagerBase implements DataStoreProviderManager { + private static final Logger s_logger = Logger + .getLogger(DataStoreProviderManagerImpl.class); + @Inject + List providers; + @Inject + DataStoreProviderDao providerDao; + protected Map providerMap = new HashMap(); + @Override + public DataStoreProvider getDataStoreProviderByUuid(String uuid) { + return providerMap.get(uuid); + } + + @Override + public DataStoreProvider getDataStoreProvider(String name) { + DataStoreProviderVO dspv = providerDao.findByName(name); + return providerMap.get(dspv.getUuid()); + } + + @Override + public List getDataStoreProviders() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + Map copyParams = new HashMap(params); + + //TODO: hold global lock + List providerVos = providerDao.listAll(); + for (DataStoreProvider provider : providers) { + boolean existingProvider = false; + DataStoreProviderVO providerVO = null; + for (DataStoreProviderVO prov : providerVos) { + if (prov.getName().equalsIgnoreCase(provider.getName())) { + existingProvider = true; + providerVO = prov; + break; + } + } + String uuid = null; + if (!existingProvider) { + uuid = UUID.nameUUIDFromBytes(provider.getName().getBytes()).toString(); + providerVO = new DataStoreProviderVO(); + providerVO.setName(provider.getName()); + providerVO.setUuid(uuid); + providerVO = providerDao.persist(providerVO); + } else { + uuid = providerVO.getUuid(); + } + copyParams.put("uuid", uuid); + copyParams.put("id", providerVO.getId()); + providerMap.put(uuid, provider); + try { + boolean registrationResult = provider.configure(copyParams); + if (!registrationResult) { + providerMap.remove(uuid); + } + } catch(Exception e) { + s_logger.debug("configure provider failed", e); + providerMap.remove(uuid); + } + } + + return true; + } + + @Override + public DataStoreProvider getDataStoreProviderById(long id) { + DataStoreProviderVO provider = providerDao.findById(id); + return providerMap.get(provider.getUuid()); + } + + @Override + public DataStoreProvider getDefaultPrimaryDataStoreProvider() { + return this.getDataStoreProvider("ancient primary data store provider"); + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/ImageDataStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/ImageDataStoreProvider.java new file mode 100644 index 00000000000..d44a40e971f --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/ImageDataStoreProvider.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.datastore.provider; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; + +public interface ImageDataStoreProvider extends DataStoreProvider { + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java new file mode 100644 index 00000000000..fdf5958f1ab --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProvider.java @@ -0,0 +1,23 @@ +// 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.storage.datastore.provider; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; + + +public interface PrimaryDataStoreProvider extends DataStoreProvider { +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDao.java new file mode 100644 index 00000000000..fb7dec0fa41 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDao.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 org.apache.cloudstack.storage.db; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +public interface ObjectInDataStoreDao extends GenericDao, StateDao { + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDaoImpl.java new file mode 100644 index 00000000000..50dc984d49b --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreDaoImpl.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.storage.db; +import java.util.Date; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.UpdateBuilder; + +@Component +public class ObjectInDataStoreDaoImpl extends GenericDaoBase implements ObjectInDataStoreDao { + private static final Logger s_logger = Logger.getLogger(ObjectInDataStoreDaoImpl.class); + private SearchBuilder updateStateSearch; + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + updateStateSearch = this.createSearchBuilder(); + updateStateSearch.and("id", updateStateSearch.entity().getId(), Op.EQ); + updateStateSearch.and("state", updateStateSearch.entity().getState(), Op.EQ); + updateStateSearch.and("updatedCount", updateStateSearch.entity().getUpdatedCount(), Op.EQ); + updateStateSearch.done(); + return true; + } + @Override + public boolean updateState(State currentState, Event event, + State nextState, DataObjectInStore dataObj, Object data) { + ObjectInDataStoreVO vo = (ObjectInDataStoreVO)dataObj; + Long oldUpdated = vo.getUpdatedCount(); + Date oldUpdatedTime = vo.getUpdated(); + + + SearchCriteria sc = updateStateSearch.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + sc.setParameters("updatedCount", vo.getUpdatedCount()); + + vo.incrUpdatedCount(); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "updated", new Date()); + + int rows = update((ObjectInDataStoreVO) vo, sc); + if (rows == 0 && s_logger.isDebugEnabled()) { + ObjectInDataStoreVO dbVol = findByIdIncludingRemoved(vo.getId()); + if (dbVol != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbVol.getId()).append("; state=").append(dbVol.getState()).append("; updatecount=").append(dbVol.getUpdatedCount()).append(";updatedTime=") + .append(dbVol.getUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount()) + .append("; updatedTime=").append(vo.getUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatecount=").append(oldUpdated) + .append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update objectIndatastore: id=" + vo.getId() + ", as there is no such object exists in the database anymore"); + } + } + return rows > 0; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreVO.java new file mode 100644 index 00000000000..0fbcbb1f956 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/db/ObjectInDataStoreVO.java @@ -0,0 +1,192 @@ +// 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.storage.db; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + +import com.cloud.storage.Storage; +import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.fsm.StateObject; + +@Entity +@Table(name = "object_datastore_ref") +public class ObjectInDataStoreVO implements StateObject, DataObjectInStore { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + long id; + + @Column(name = "datastore_uuid") + private String dataStoreUuid; + + @Column(name = "datastore_role") + @Enumerated(EnumType.STRING) + private DataStoreRole dataStoreRole; + + @Column(name = "object_uuid") + String objectUuid; + + @Column(name = "object_type") + @Enumerated(EnumType.STRING) + DataObjectType objectType; + + @Column(name = GenericDaoBase.CREATED_COLUMN) + Date created = null; + + @Column(name = "last_updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date lastUpdated = null; + + @Column(name = "download_pct") + int downloadPercent; + + @Column(name = "download_state") + @Enumerated(EnumType.STRING) + Status downloadState; + + @Column(name = "local_path") + String localDownloadPath; + + @Column (name="url") + private String downloadUrl; + + @Column(name="format") + private Storage.ImageFormat format; + + @Column(name="checksum") + private String checksum; + + @Column(name = "error_str") + String errorString; + + @Column(name = "job_id") + String jobId; + + @Column(name = "install_path") + String installPath; + + @Column(name = "size") + Long size; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + ObjectInDataStoreStateMachine.State state; + + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + public ObjectInDataStoreVO() { + this.state = ObjectInDataStoreStateMachine.State.Allocated; + } + + public long getId() { + return this.id; + } + + public String getDataStoreUuid() { + return this.dataStoreUuid; + } + + public void setDataStoreUuid(String uuid) { + this.dataStoreUuid = uuid; + } + + public DataStoreRole getDataStoreRole() { + return this.dataStoreRole; + } + + public void setDataStoreRole(DataStoreRole role) { + this.dataStoreRole = role; + } + + public String getObjectUuid() { + return this.objectUuid; + } + + public void setObjectUuid(String uuid) { + this.objectUuid = uuid; + } + + public DataObjectType getObjectType() { + return this.objectType; + } + + public void setObjectType(DataObjectType type) { + this.objectType = type; + } + + @Override + public ObjectInDataStoreStateMachine.State getState() { + return this.state; + } + + public void setInstallPath(String path) { + this.installPath = path; + } + + public String getInstallPath() { + return this.installPath; + } + + public void setSize(Long size) { + this.size = size; + } + + public Long getSize() { + return this.size; + } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public Date getUpdated() { + return updated; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java new file mode 100644 index 00000000000..c385abe9624 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/DefaultEndPointSelector.java @@ -0,0 +1,200 @@ +/* + * 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.storage.endpoint; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.Scope; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.HypervisorHostEndPoint; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.host.HostVO; +import com.cloud.host.Status; +import com.cloud.host.dao.HostDao; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class DefaultEndPointSelector implements EndPointSelector { + private static final Logger s_logger = Logger + .getLogger(DefaultEndPointSelector.class); + @Inject + HostDao hostDao; + private String findOneHostInaScope = "select id from host where " + + " status == 'Up' and hypervisor_type != 'VMware' and type in ('Routing', 'SecondaryStorageVM') "; + private String findOneHostOnPrimaryStorage = "select id from host where" + + "status == 'Up' and type == 'Routing' "; + + protected boolean moveBetweenPrimaryImage(DataStore srcStore, + DataStore destStore) { + DataStoreRole srcRole = srcStore.getRole(); + DataStoreRole destRole = destStore.getRole(); + if ((srcRole == DataStoreRole.Primary && destRole.isImageStore()) + || (srcRole.isImageStore() && destRole == DataStoreRole.Primary)) { + return true; + } else { + return false; + } + } + + @DB + protected EndPoint findEndPointInScope(Scope scope, String sqlBase) { + StringBuilder sbuilder = new StringBuilder(); + sbuilder.append(sqlBase); + + if (scope.getScopeType() == ScopeType.HOST) { + sbuilder.append(" and id = "); + sbuilder.append(scope.getScopeId()); + } else if (scope.getScopeType() == ScopeType.CLUSTER) { + sbuilder.append(" and cluster_id = "); + sbuilder.append(scope.getScopeId()); + } else if (scope.getScopeType() == ScopeType.ZONE) { + sbuilder.append(" and data_center_id = "); + sbuilder.append(scope.getScopeId()); + } +//TODO: order by rand() is slow if there are lot of hosts + sbuilder.append(" ORDER by rand() limit 1"); + String sql = sbuilder.toString(); + PreparedStatement pstmt = null; + ResultSet rs = null; + HostVO host = null; + Transaction txn = Transaction.currentTxn(); + + try { + pstmt = txn.prepareStatement(sql); + rs = pstmt.executeQuery(); + while (rs.next()) { + long id = rs.getLong(1); + host = hostDao.findById(id); + } + } catch (SQLException e) { + s_logger.warn("can't find endpoint", e); + } finally { + try { + if (rs != null) { + rs.close(); + } + if (pstmt != null) { + pstmt.close(); + } + } catch (SQLException e) { + } + } + + if (host == null) { + return null; + } + + return HypervisorHostEndPoint.getHypervisorHostEndPoint(host.getId(), + host.getPrivateIpAddress()); + } + + protected EndPoint findEndPointForImageMove(DataStore srcStore, + DataStore destStore) { + // find any xen/kvm host in the scope + Scope srcScope = srcStore.getScope(); + Scope destScope = destStore.getScope(); + Scope selectedScope = null; + // assumption, at least one of scope should be zone, find the least + // scope + if (srcScope.getScopeType() != ScopeType.ZONE) { + selectedScope = srcScope; + } else if (destScope.getScopeType() != ScopeType.ZONE) { + selectedScope = destScope; + } else { + // if both are zone scope + selectedScope = srcScope; + } + return findEndPointInScope(selectedScope, findOneHostInaScope); + } + + @Override + public EndPoint select(DataObject srcData, DataObject destData) { + DataStore srcStore = srcData.getDataStore(); + DataStore destStore = destData.getDataStore(); + if (srcData.getFormat() == DiskFormat.VMDK + || destData.getFormat() == DiskFormat.VMDK) { + // If any of data is for vmware, data moving should go to ssvm + + } else if (moveBetweenPrimaryImage(srcStore, destStore)) { + return findEndPointForImageMove(srcStore, destStore); + } + // TODO Auto-generated method stub + return null; + } + + protected EndPoint findEndpointForPrimaryStorage(DataStore store) { + return findEndPointInScope(store.getScope(), findOneHostOnPrimaryStorage); + } + + @Override + public EndPoint select(DataObject object) { + DataStore store = object.getDataStore(); + if (store.getRole() == DataStoreRole.Primary) { + return findEndpointForPrimaryStorage(store); + } else if (store.getRole() == DataStoreRole.Image) { + //in case there is no ssvm, directly send down command hypervisor host + //TODO: add code to handle in case ssvm is there + return findEndpointForPrimaryStorage(store); + }else { + throw new CloudRuntimeException("not implemented yet"); + } + + } + + @Override + public List selectAll(DataStore store) { + List endPoints = new ArrayList(); + if (store.getScope().getScopeType() == ScopeType.HOST) { + HostVO host = hostDao.findById(store.getScope().getScopeId()); + endPoints.add(HypervisorHostEndPoint.getHypervisorHostEndPoint(host.getId(), + host.getPrivateIpAddress())); + } else if (store.getScope().getScopeType() == ScopeType.CLUSTER) { + SearchCriteriaService sc = SearchCriteria2.create(HostVO.class); + sc.addAnd(sc.getEntity().getClusterId(), Op.EQ, store.getScope().getScopeId()); + sc.addAnd(sc.getEntity().getStatus(), Op.EQ, Status.Up); + List hosts = sc.find(); + for (HostVO host : hosts) { + endPoints.add(HypervisorHostEndPoint.getHypervisorHostEndPoint(host.getId(), + host.getPrivateIpAddress())); + } + + } else { + throw new CloudRuntimeException("shouldn't use it for other scope"); + } + return endPoints; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/endpoint/EndPointSelector.java b/engine/storage/src/org/apache/cloudstack/storage/endpoint/EndPointSelector.java new file mode 100644 index 00000000000..6910eb6a401 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/endpoint/EndPointSelector.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 org.apache.cloudstack.storage.endpoint; + +import java.util.List; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; + +public interface EndPointSelector { + public EndPoint select(DataObject srcData, DataObject destData); + + /** + * @param object + * @return + */ + EndPoint select(DataObject object); + /** + * @param store + * @return + */ + List selectAll(DataStore store); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageDataStoreDriver.java b/engine/storage/src/org/apache/cloudstack/storage/image/ImageDataStoreDriver.java new file mode 100644 index 00000000000..d352d972182 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/ImageDataStoreDriver.java @@ -0,0 +1,24 @@ +/* + * 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.storage.image; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; + +public interface ImageDataStoreDriver extends DataStoreDriver { +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java new file mode 100644 index 00000000000..4d162bbdd09 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEntityImpl.java @@ -0,0 +1,279 @@ +/* + * 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.storage.image; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.cloud.entity.api.TemplateEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Storage.TemplateType; + +public class TemplateEntityImpl implements TemplateEntity { + protected TemplateInfo templateInfo; + + public TemplateEntityImpl(TemplateInfo templateInfo) { + this.templateInfo = templateInfo; + } + + public ImageDataStoreInfo getImageDataStore() { + return (ImageDataStoreInfo)templateInfo.getDataStore(); + } + + public long getImageDataStoreId() { + return getImageDataStore().getImageDataStoreId(); + } + + public TemplateInfo getTemplateInfo() { + return this.templateInfo; + } + + @Override + public String getUuid() { + return this.templateInfo.getUuid(); + } + + @Override + public long getId() { + return this.templateInfo.getId(); + } + + public String getExternalId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getLastUpdatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getOwner() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Map getDetails() { + // TODO Auto-generated method stub + return null; + } + + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isFeatured() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isPublicTemplate() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isExtractable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ImageFormat getFormat() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isRequiresHvm() { + // TODO Auto-generated method stub + return false; + } + + @Override + public String getDisplayText() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean getEnablePassword() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getEnableSshKey() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isCrossZones() { + // TODO Auto-generated method stub + return false; + } + + @Override + public Date getCreated() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getGuestOSId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public boolean isBootable() { + // TODO Auto-generated method stub + return false; + } + + @Override + public TemplateType getTemplateType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public HypervisorType getHypervisorType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public int getBits() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getUniqueName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getUrl() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getChecksum() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Long getSourceTemplateId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getTemplateTag() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getAccountId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getDomainId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getPhysicalSize() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getVirtualSize() { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStore.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStore.java new file mode 100644 index 00000000000..ed2274e3d40 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStore.java @@ -0,0 +1,35 @@ +/* + * 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.storage.image.datastore; + +import java.util.Set; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; + +public interface ImageDataStore extends DataStore { + TemplateInfo getTemplate(long templateId); + VolumeInfo getVolume(long volumeId); + SnapshotInfo getSnapshot(long snapshotId); + boolean exists(DataObject object); + Set listTemplates(); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreHelper.java new file mode 100644 index 00000000000..ba267af6984 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreHelper.java @@ -0,0 +1,60 @@ +/* + * 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.storage.image.datastore; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.storage.image.db.ImageDataStoreDao; +import org.apache.cloudstack.storage.image.db.ImageDataStoreVO; +import org.springframework.stereotype.Component; + +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class ImageDataStoreHelper { + @Inject + ImageDataStoreDao imageStoreDao; + public ImageDataStoreVO createImageDataStore(Map params) { + ImageDataStoreVO store = imageStoreDao.findByUuid((String)params.get("uuid")); + if (store != null) { + return store; + } + store = new ImageDataStoreVO(); + store.setName((String)params.get("name")); + store.setProtocol((String)params.get("protocol")); + store.setProvider((Long)params.get("provider")); + store.setScope((ScopeType)params.get("scope")); + store.setUuid((String)params.get("uuid")); + store = imageStoreDao.persist(store); + return store; + } + + public boolean deleteImageDataStore(long id) { + ImageDataStoreVO store = imageStoreDao.findById(id); + if (store == null) { + throw new CloudRuntimeException("can't find image store:" + id); + } + + imageStoreDao.remove(id); + return true; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java new file mode 100644 index 00000000000..b6b9a2a55d7 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreInfo.java @@ -0,0 +1,26 @@ +/* + * 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.storage.image.datastore; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; + +public interface ImageDataStoreInfo extends DataStore { + public long getImageDataStoreId(); + public String getType(); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreManager.java b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreManager.java new file mode 100644 index 00000000000..b6d84cdcef2 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/datastore/ImageDataStoreManager.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.storage.image.datastore; + +import java.util.List; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.storage.image.ImageDataStoreDriver; + +public interface ImageDataStoreManager { + ImageDataStore getImageDataStore(long dataStoreId); + ImageDataStore getImageDataStore(String uuid); + List getList(); + boolean registerDriver(String uuid, ImageDataStoreDriver driver); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java new file mode 100644 index 00000000000..3f3e9ca95fb --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDaoStoreDaoImpl.java @@ -0,0 +1,38 @@ +/* + * 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.storage.image.db; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.SearchCriteria.Op; + +@Component +public class ImageDaoStoreDaoImpl extends GenericDaoBase implements ImageDataStoreDao { + + @Override + public ImageDataStoreVO findByName(String name) { + SearchCriteriaService sc = SearchCriteria2.create(ImageDataStoreVO.class); + sc.addAnd(sc.getEntity().getName(), Op.EQ, name); + return sc.find(); + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java new file mode 100644 index 00000000000..d7358be9140 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreDao.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.db; + +import com.cloud.utils.db.GenericDao; + +public interface ImageDataStoreDao extends GenericDao { + public ImageDataStoreVO findByName(String name); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java new file mode 100644 index 00000000000..1b13b7ae4e2 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDao.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.db; + +import com.cloud.utils.db.GenericDao; + +public interface ImageDataStoreProviderDao extends GenericDao { + public ImageDataStoreProviderVO findByName(String name); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.java new file mode 100644 index 00000000000..0e19dbec1b7 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderDaoImpl.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 org.apache.cloudstack.storage.image.db; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.SearchCriteria.Op; + +@Component +public class ImageDataStoreProviderDaoImpl extends GenericDaoBase implements ImageDataStoreProviderDao { + + public ImageDataStoreProviderDaoImpl() { + } + + @Override + public ImageDataStoreProviderVO findByName(String name) { + SearchCriteriaService service = SearchCriteria2.create(ImageDataStoreProviderVO.class); + service.addAnd(service.getEntity().getName(), Op.EQ, name); + return service.find(); + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.java new file mode 100644 index 00000000000..5cc5b8ddcef --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreProviderVO.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.storage.image.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +@Entity +@Table(name = "image_data_store_provider") +public class ImageDataStoreProviderVO { + @Id + @TableGenerator(name = "image_data_store_provider_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_provider_seq", allocationSize = 1) + @Column(name = "id", nullable = false) + private long id; + + @Column(name = "name", nullable = false) + private String name; + + public long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.java new file mode 100644 index 00000000000..c7b8e2d1228 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/db/ImageDataStoreVO.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 org.apache.cloudstack.storage.image.db; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; + +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; + +@Entity +@Table(name = "image_data_store") +public class ImageDataStoreVO { + @Id + @TableGenerator(name = "image_data_store_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "image_data_store_seq", allocationSize = 1) + @Column(name = "id", nullable = false) + private long id; + + @Column(name = "name", nullable = false) + private String name; + + @Column(name = "uuid", nullable = false) + private String uuid; + + @Column(name = "protocol", nullable = false) + private String protocol; + + @Column(name = "image_provider_id", nullable = false) + private long provider; + + @Column(name = "data_center_id") + private long dcId; + + @Column(name = "scope") + @Enumerated(value = EnumType.STRING) + private ScopeType scope; + + + public long getId() { + return this.id; + } + + public String getName() { + return this.name; + } + + public long getProvider() { + return this.provider; + } + + public void setName(String name) { + this.name = name; + } + + public void setProvider(long provider) { + this.provider = provider; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public String getProtocol() { + return this.protocol; + } + + public void setDcId(long dcId) { + this.dcId = dcId; + } + + public long getDcId() { + return this.dcId; + } + + public ScopeType getScope() { + return this.scope; + } + + public void setScope(ScopeType scope) { + this.scope = scope; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getUuid() { + return this.uuid; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/BAREMETAL.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/BAREMETAL.java new file mode 100644 index 00000000000..72e683be132 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/BAREMETAL.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class BAREMETAL extends BaseType implements ImageFormat { + private final String type = "BAREMETAL"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/ISO.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/ISO.java new file mode 100644 index 00000000000..2f01a276187 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/ISO.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class ISO extends BaseType implements ImageFormat { + private final String type = "ISO"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormat.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormat.java new file mode 100644 index 00000000000..f02694a7195 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormat.java @@ -0,0 +1,23 @@ +/* + * 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.storage.image.format; + +public interface ImageFormat { + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.java new file mode 100644 index 00000000000..9523d24c14e --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/ImageFormatHelper.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 org.apache.cloudstack.storage.image.format; + +import java.util.List; + +import javax.inject.Inject; + +import org.springframework.stereotype.Component; + +@Component +public class ImageFormatHelper { + private static List formats; + private static final ImageFormat defaultFormat = new Unknown(); + + @Inject + public void setFormats(List formats) { + ImageFormatHelper.formats = formats; + } + + public static ImageFormat getFormat(String format) { + for (ImageFormat fm : formats) { + if (fm.equals(format)) { + return fm; + } + } + return ImageFormatHelper.defaultFormat; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.java new file mode 100644 index 00000000000..77a355a0c86 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/OVA.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class OVA extends BaseType implements ImageFormat { + private final String type = "OVA"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.java new file mode 100644 index 00000000000..d51052b8998 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/QCOW2.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component("imageformat_qcow2") +public class QCOW2 extends BaseType implements ImageFormat { + private final String type = "QCOW2"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.java new file mode 100644 index 00000000000..992654e085b --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/Unknown.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class Unknown extends BaseType implements ImageFormat { + private final String type = "Unknown"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java b/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.java new file mode 100644 index 00000000000..89cd424311e --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/format/VHD.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 org.apache.cloudstack.storage.image.format; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component("image_format_vhd") +public class VHD extends BaseType implements ImageFormat { + private final String type = "VHD"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java new file mode 100644 index 00000000000..908d6d52c20 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/image/motion/ImageMotionService.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.image.motion; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.db.ObjectInDataStoreVO; +import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo; + +public interface ImageMotionService { + void copyTemplateAsync(TemplateInfo destTemplate, TemplateInfo srcTemplate, AsyncCompletionCallback callback); + boolean copyIso(String isoUri, String destIsoUri); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java new file mode 100644 index 00000000000..c067a1b651c --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java @@ -0,0 +1,725 @@ +/* + * 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.storage.motion; + +import java.util.Date; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.BackupSnapshotAnswer; +import com.cloud.agent.api.BackupSnapshotCommand; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; +import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; +import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; +import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; +import com.cloud.agent.api.UpgradeSnapshotCommand; +import com.cloud.agent.api.storage.CopyVolumeAnswer; +import com.cloud.agent.api.storage.CopyVolumeCommand; +import com.cloud.agent.api.storage.CreateAnswer; +import com.cloud.agent.api.storage.CreateCommand; +import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; +import com.cloud.agent.api.to.S3TO; +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.agent.api.to.SwiftTO; +import com.cloud.configuration.Config; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.exception.StorageUnavailableException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.storage.DiskOfferingVO; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.StorageManager; +import com.cloud.storage.StoragePool; +import com.cloud.storage.VMTemplateHostVO; +import com.cloud.storage.VMTemplateStoragePoolVO; +import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VolumeHostVO; +import com.cloud.storage.VolumeManager; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.DiskOfferingDao; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VMTemplateHostDao; +import com.cloud.storage.dao.VMTemplatePoolDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.dao.VolumeHostDao; +import com.cloud.storage.s3.S3Manager; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.storage.swift.SwiftManager; +import com.cloud.template.TemplateManager; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.DiskProfile; + +@Component +public class AncientDataMotionStrategy implements DataMotionStrategy { + private static final Logger s_logger = Logger + .getLogger(AncientDataMotionStrategy.class); + @Inject + TemplateManager templateMgr; + @Inject + VolumeHostDao volumeHostDao; + @Inject + HostDao hostDao; + @Inject + ConfigurationDao configDao; + @Inject + StorageManager storagMgr; + @Inject + VolumeDao volDao; + @Inject + VMTemplateDao templateDao; + @Inject + SnapshotManager snapshotMgr; + @Inject + SnapshotDao snapshotDao; + @Inject + PrimaryDataStoreDao primaryDataStoreDao; + @Inject + DataStoreManager dataStoreMgr; + @Inject + VMTemplateHostDao templateHostDao; + @Inject DiskOfferingDao diskOfferingDao; + @Inject VMTemplatePoolDao templatePoolDao; + @Inject + VolumeManager volumeMgr; + @Inject + private SwiftManager _swiftMgr; + @Inject + private S3Manager _s3Mgr; + + @Override + public boolean canHandle(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return true; + } + + @DB + protected Answer copyVolumeFromImage(DataObject srcData, DataObject destData) { + String value = configDao.getValue(Config.RecreateSystemVmEnabled.key()); + int _copyvolumewait = NumbersUtil.parseInt(value, + Integer.parseInt(Config.CopyVolumeWait.getDefaultValue())); + + VolumeHostVO volumeHostVO = volumeHostDao.findByVolumeId(srcData + .getId()); + HostVO secStorage = hostDao.findById(volumeHostVO.getHostId()); + String secondaryStorageURL = secStorage.getStorageUrl(); + String[] volumePath = volumeHostVO.getInstallPath().split("/"); + String volumeUUID = volumePath[volumePath.length - 1].split("\\.")[0]; + StoragePool destPool = (StoragePool) destData.getDataStore(); + CopyVolumeCommand cvCmd = new CopyVolumeCommand(srcData.getId(), + volumeUUID, destPool, secondaryStorageURL, false, + _copyvolumewait); + CopyVolumeAnswer cvAnswer = null; + String errMsg = null; + try { + cvAnswer = (CopyVolumeAnswer) this.storagMgr.sendToPool(destPool, + cvCmd); + } catch (StorageUnavailableException e1) { + s_logger.debug("Failed to copy volume " + srcData.getId() + " to " + + destData.getId(), e1); + errMsg = e1.toString(); + } + + if (cvAnswer == null || !cvAnswer.getResult()) { + errMsg = cvAnswer.getDetails(); + } + + VolumeVO vol = this.volDao.findById(destData.getId()); + Transaction txn = Transaction.currentTxn(); + txn.start(); + vol.setPath(cvAnswer.getVolumePath()); + vol.setFolder(destPool.getPath()); + vol.setPodId(destPool.getPodId()); + vol.setPoolId(destPool.getId()); + vol.setPodId(destPool.getPodId()); + + this.volDao.update(vol.getId(), vol); + volumeHostDao.remove(volumeHostVO.getId()); + txn.commit(); + return cvAnswer; + } + + private Answer copyTemplate(DataObject srcData, DataObject destData) { + VMTemplateVO template = this.templateDao.findById(srcData.getId()); + templateMgr.prepareTemplateForCreate(template, + (StoragePool) destData.getDataStore()); + return null; + } + + protected Answer copyFromSnapshot(DataObject snapObj, DataObject volObj) { + SnapshotVO snapshot = this.snapshotDao.findById(snapObj.getId()); + StoragePool pool = (StoragePool) volObj.getDataStore(); + String vdiUUID = null; + Long snapshotId = snapshot.getId(); + Long volumeId = snapshot.getVolumeId(); + Long dcId = snapshot.getDataCenterId(); + String secondaryStoragePoolUrl = this.snapshotMgr + .getSecondaryStorageURL(snapshot); + long accountId = snapshot.getAccountId(); + + String backedUpSnapshotUuid = snapshot.getBackupSnapshotId(); + snapshot = snapshotDao.findById(snapshotId); + if (snapshot.getVersion().trim().equals("2.1")) { + VolumeVO volume = this.volDao.findByIdIncludingRemoved(volumeId); + if (volume == null) { + throw new CloudRuntimeException("failed to upgrade snapshot " + + snapshotId + " due to unable to find orignal volume:" + + volumeId + ", try it later "); + } + if (volume.getTemplateId() == null) { + snapshotDao.updateSnapshotVersion(volumeId, "2.1", "2.2"); + } else { + VMTemplateVO template = templateDao + .findByIdIncludingRemoved(volume.getTemplateId()); + if (template == null) { + throw new CloudRuntimeException( + "failed to upgrade snapshot " + + snapshotId + + " due to unalbe to find orignal template :" + + volume.getTemplateId() + + ", try it later "); + } + Long templateId = template.getId(); + Long tmpltAccountId = template.getAccountId(); + if (!snapshotDao.lockInLockTable(snapshotId.toString(), 10)) { + throw new CloudRuntimeException( + "failed to upgrade snapshot " + + snapshotId + + " due to this snapshot is being used, try it later "); + } + UpgradeSnapshotCommand cmd = new UpgradeSnapshotCommand(null, + secondaryStoragePoolUrl, dcId, accountId, volumeId, + templateId, tmpltAccountId, null, + snapshot.getBackupSnapshotId(), snapshot.getName(), + "2.1"); + Answer answer = null; + try { + answer = this.storagMgr.sendToPool(pool, cmd); + } catch (StorageUnavailableException e) { + } finally { + snapshotDao.unlockFromLockTable(snapshotId.toString()); + } + if ((answer != null) && answer.getResult()) { + snapshotDao.updateSnapshotVersion(volumeId, "2.1", "2.2"); + } else { + throw new CloudRuntimeException("Unable to upgrade snapshot from 2.1 to 2.2 for " + + snapshot.getId()); + } + } + } + String basicErrMsg = "Failed to create volume from " + + snapshot.getName() + " on pool " + pool; + + try { + if (snapshot.getSwiftId() != null && snapshot.getSwiftId() != 0) { + snapshotMgr.downloadSnapshotsFromSwift(snapshot); + } else if (snapshot.getS3Id() != null && snapshot.getS3Id() != 0) { + snapshotMgr.downloadSnapshotsFromS3(snapshot); + } + String value = configDao + .getValue(Config.CreateVolumeFromSnapshotWait.toString()); + int _createVolumeFromSnapshotWait = NumbersUtil.parseInt(value, + Integer.parseInt(Config.CreateVolumeFromSnapshotWait + .getDefaultValue())); + CreateVolumeFromSnapshotCommand createVolumeFromSnapshotCommand = new CreateVolumeFromSnapshotCommand( + pool, secondaryStoragePoolUrl, dcId, accountId, volumeId, + backedUpSnapshotUuid, snapshot.getName(), + _createVolumeFromSnapshotWait); + CreateVolumeFromSnapshotAnswer answer; + if (!snapshotDao.lockInLockTable(snapshotId.toString(), 10)) { + throw new CloudRuntimeException("failed to create volume from " + + snapshotId + + " due to this snapshot is being used, try it later "); + } + answer = (CreateVolumeFromSnapshotAnswer) this.storagMgr + .sendToPool(pool, createVolumeFromSnapshotCommand); + if (answer != null && answer.getResult()) { + vdiUUID = answer.getVdi(); + VolumeVO vol = this.volDao.findById(volObj.getId()); + vol.setPath(vdiUUID); + this.volDao.update(vol.getId(), vol); + return null; + } else { + s_logger.error(basicErrMsg + " due to " + + ((answer == null) ? "null" : answer.getDetails())); + throw new CloudRuntimeException(basicErrMsg); + } + } catch (StorageUnavailableException e) { + s_logger.error(basicErrMsg, e); + throw new CloudRuntimeException(basicErrMsg); + } finally { + if (snapshot.getSwiftId() != null) { + snapshotMgr.deleteSnapshotsDirForVolume( + secondaryStoragePoolUrl, dcId, accountId, volumeId); + } + } + } + + protected Answer cloneVolume(DataObject template, DataObject volume) { + VolumeInfo volInfo = (VolumeInfo)volume; + DiskOfferingVO offering = diskOfferingDao.findById(volInfo.getDiskOfferingId()); + VMTemplateStoragePoolVO tmpltStoredOn = templatePoolDao.findByPoolTemplate(template.getDataStore().getId(), template.getId()); + + DiskProfile diskProfile = new DiskProfile(volInfo, offering, + null); + CreateCommand cmd = new CreateCommand(diskProfile, + tmpltStoredOn.getLocalDownloadPath(), + new StorageFilerTO((StoragePool)template.getDataStore())); + Answer answer = null; + StoragePool pool = (StoragePool)volume.getDataStore(); + String errMsg = null; + try { + answer = storagMgr.sendToPool(pool, null, cmd); + } catch (StorageUnavailableException e) { + s_logger.debug("Failed to send to storage pool", e); + throw new CloudRuntimeException("Failed to send to storage pool", e); + } + + if (answer.getResult()) { + VolumeVO vol = this.volDao.findById(volume.getId()); + CreateAnswer createAnswer = (CreateAnswer) answer; + vol.setFolder(pool.getPath()); + vol.setPath(createAnswer.getVolume().getPath()); + vol.setSize(createAnswer.getVolume().getSize()); + vol.setPoolType(pool.getPoolType()); + vol.setPoolId(pool.getId()); + vol.setPodId(pool.getPodId()); + this.volDao.update(vol.getId(), vol); + + } else { + if (tmpltStoredOn != null + && (answer instanceof CreateAnswer) + && ((CreateAnswer) answer) + .templateReloadRequested()) { + if (!templateMgr + .resetTemplateDownloadStateOnPool(tmpltStoredOn + .getId())) { + + } + } + errMsg = answer.getDetails(); + } + + return answer; + } + + protected Answer copyVolumeBetweenPools(DataObject srcData, DataObject destData) { + VolumeInfo volume = (VolumeInfo)srcData; + VolumeInfo destVolume = (VolumeInfo)destData; + String secondaryStorageURL = this.templateMgr.getSecondaryStorageURL(volume + .getDataCenterId()); + StoragePool srcPool = (StoragePool)this.dataStoreMgr.getDataStore(volume + .getPoolId(), DataStoreRole.Primary); + + StoragePool destPool = (StoragePool)this.dataStoreMgr.getDataStore(destVolume.getPoolId(), DataStoreRole.Primary); + + String value = this.configDao.getValue(Config.CopyVolumeWait.toString()); + int _copyvolumewait = NumbersUtil.parseInt(value, + Integer.parseInt(Config.CopyVolumeWait.getDefaultValue())); + CopyVolumeCommand cvCmd = new CopyVolumeCommand(volume.getId(), + volume.getPath(), srcPool, secondaryStorageURL, true, + _copyvolumewait); + CopyVolumeAnswer cvAnswer; + try { + cvAnswer = (CopyVolumeAnswer) this.storagMgr.sendToPool(srcPool, cvCmd); + } catch (StorageUnavailableException e1) { + throw new CloudRuntimeException( + "Failed to copy the volume from the source primary storage pool to secondary storage.", + e1); + } + + if (cvAnswer == null || !cvAnswer.getResult()) { + throw new CloudRuntimeException( + "Failed to copy the volume from the source primary storage pool to secondary storage."); + } + + String secondaryStorageVolumePath = cvAnswer.getVolumePath(); + + cvCmd = new CopyVolumeCommand(volume.getId(), + secondaryStorageVolumePath, destPool, + secondaryStorageURL, false, _copyvolumewait); + try { + cvAnswer = (CopyVolumeAnswer) this.storagMgr.sendToPool(destPool, cvCmd); + } catch (StorageUnavailableException e1) { + throw new CloudRuntimeException( + "Failed to copy the volume from secondary storage to the destination primary storage pool."); + } + + if (cvAnswer == null || !cvAnswer.getResult()) { + throw new CloudRuntimeException( + "Failed to copy the volume from secondary storage to the destination primary storage pool."); + } + + VolumeVO destVol = this.volDao.findById(destVolume.getId()); + destVol.setPath(cvAnswer.getVolumePath()); + this.volDao.update(destVol.getId(), destVol); + return cvAnswer; + } + + @Override + public Void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback) { + Answer answer = null; + String errMsg = null; + try { + if (destData.getType() == DataObjectType.VOLUME + && srcData.getType() == DataObjectType.VOLUME && srcData.getDataStore().getRole() == DataStoreRole.Image) { + answer = copyVolumeFromImage(srcData, destData); + } else if (destData.getType() == DataObjectType.TEMPLATE + && srcData.getType() == DataObjectType.TEMPLATE) { + answer = copyTemplate(srcData, destData); + } else if (srcData.getType() == DataObjectType.SNAPSHOT + && destData.getType() == DataObjectType.VOLUME) { + answer = copyFromSnapshot(srcData, destData); + } else if (srcData.getType() == DataObjectType.SNAPSHOT + && destData.getType() == DataObjectType.TEMPLATE) { + answer = createTemplateFromSnashot(srcData, destData); + } else if (srcData.getType() == DataObjectType.VOLUME + && destData.getType() == DataObjectType.TEMPLATE) { + answer = createTemplateFromVolume(srcData, destData); + } else if (srcData.getType() == DataObjectType.TEMPLATE + && destData.getType() == DataObjectType.VOLUME) { + answer = cloneVolume(srcData, destData); + } else if (destData.getType() == DataObjectType.VOLUME + && srcData.getType() == DataObjectType.VOLUME && srcData.getDataStore().getRole() == DataStoreRole.Primary) { + answer = copyVolumeBetweenPools(srcData, destData); + } else if (srcData.getType() == DataObjectType.SNAPSHOT && + destData.getType() == DataObjectType.SNAPSHOT) { + answer = copySnapshot(srcData, destData); + } + } catch (Exception e) { + s_logger.debug("copy failed", e); + errMsg = e.toString(); + } + CopyCommandResult result = new CopyCommandResult(null, answer); + result.setResult(errMsg); + callback.complete(result); + + return null; + } + + @DB + protected Answer createTemplateFromSnashot(DataObject srcData, + DataObject destData) { + long snapshotId = srcData.getId(); + SnapshotVO snapshot = snapshotDao.findById(snapshotId); + if (snapshot == null) { + throw new CloudRuntimeException("Unable to find Snapshot for Id " + + srcData.getId()); + } + Long zoneId = snapshot.getDataCenterId(); + HostVO secondaryStorageHost = this.templateMgr + .getSecondaryStorageHost(zoneId); + String secondaryStorageURL = snapshotMgr + .getSecondaryStorageURL(snapshot); + VMTemplateVO template = this.templateDao.findById(destData.getId()); + String name = template.getName(); + String backupSnapshotUUID = snapshot.getBackupSnapshotId(); + if (backupSnapshotUUID == null) { + throw new CloudRuntimeException( + "Unable to create private template from snapshot " + + snapshotId + + " due to there is no backupSnapshotUUID for this snapshot"); + } + + Long dcId = snapshot.getDataCenterId(); + Long accountId = snapshot.getAccountId(); + Long volumeId = snapshot.getVolumeId(); + + String origTemplateInstallPath = null; + List pools = this.storagMgr + .ListByDataCenterHypervisor(zoneId, + snapshot.getHypervisorType()); + if (pools == null || pools.size() == 0) { + throw new CloudRuntimeException( + "Unable to find storage pools in zone " + zoneId); + } + StoragePoolVO poolvo = pools.get(0); + StoragePool pool = (StoragePool) this.dataStoreMgr.getDataStore( + poolvo.getId(), DataStoreRole.Primary); + if (snapshot.getVersion() != null + && snapshot.getVersion().equalsIgnoreCase("2.1")) { + VolumeVO volume = this.volDao.findByIdIncludingRemoved(volumeId); + if (volume == null) { + throw new CloudRuntimeException("failed to upgrade snapshot " + + snapshotId + " due to unable to find orignal volume:" + + volumeId + ", try it later "); + } + if (volume.getTemplateId() == null) { + snapshotDao.updateSnapshotVersion(volumeId, "2.1", "2.2"); + } else { + template = templateDao.findByIdIncludingRemoved(volume + .getTemplateId()); + if (template == null) { + throw new CloudRuntimeException( + "failed to upgrade snapshot " + + snapshotId + + " due to unalbe to find orignal template :" + + volume.getTemplateId() + + ", try it later "); + } + Long origTemplateId = template.getId(); + Long origTmpltAccountId = template.getAccountId(); + if (!this.volDao.lockInLockTable(volumeId.toString(), 10)) { + throw new CloudRuntimeException( + "failed to upgrade snapshot " + snapshotId + + " due to volume:" + volumeId + + " is being used, try it later "); + } + UpgradeSnapshotCommand cmd = new UpgradeSnapshotCommand(null, + secondaryStorageURL, dcId, accountId, volumeId, + origTemplateId, origTmpltAccountId, null, + snapshot.getBackupSnapshotId(), snapshot.getName(), + "2.1"); + if (!this.volDao.lockInLockTable(volumeId.toString(), 10)) { + throw new CloudRuntimeException( + "Creating template failed due to volume:" + + volumeId + + " is being used, try it later "); + } + Answer answer = null; + try { + answer = this.storagMgr.sendToPool(pool, cmd); + cmd = null; + } catch (StorageUnavailableException e) { + } finally { + this.volDao.unlockFromLockTable(volumeId.toString()); + } + if ((answer != null) && answer.getResult()) { + snapshotDao.updateSnapshotVersion(volumeId, "2.1", "2.2"); + } else { + throw new CloudRuntimeException( + "Unable to upgrade snapshot"); + } + } + } + if (snapshot.getSwiftId() != null && snapshot.getSwiftId() != 0) { + snapshotMgr.downloadSnapshotsFromSwift(snapshot); + } + String value = configDao + .getValue(Config.CreatePrivateTemplateFromSnapshotWait + .toString()); + int _createprivatetemplatefromsnapshotwait = NumbersUtil.parseInt( + value, Integer + .parseInt(Config.CreatePrivateTemplateFromSnapshotWait + .getDefaultValue())); + + CreatePrivateTemplateFromSnapshotCommand cmd = new CreatePrivateTemplateFromSnapshotCommand( + pool, secondaryStorageURL, dcId, accountId, + snapshot.getVolumeId(), backupSnapshotUUID, snapshot.getName(), + origTemplateInstallPath, template.getId(), name, + _createprivatetemplatefromsnapshotwait); + + return sendCommand(cmd, pool, template.getId(), dcId, + secondaryStorageHost.getId()); + } + + @DB + protected Answer sendCommand(Command cmd, StoragePool pool, + long templateId, long zoneId, long hostId) { + + CreatePrivateTemplateAnswer answer = null; + try { + answer = (CreatePrivateTemplateAnswer) this.storagMgr.sendToPool( + pool, cmd); + } catch (StorageUnavailableException e) { + throw new CloudRuntimeException( + "Failed to execute CreatePrivateTemplateFromSnapshotCommand", + e); + } + + if (answer == null || !answer.getResult()) { + return answer; + } + + VMTemplateVO privateTemplate = templateDao.findById(templateId); + String answerUniqueName = answer.getUniqueName(); + if (answerUniqueName != null) { + privateTemplate.setUniqueName(answerUniqueName); + } + ImageFormat format = answer.getImageFormat(); + if (format != null) { + privateTemplate.setFormat(format); + } else { + // This never occurs. + // Specify RAW format makes it unusable for snapshots. + privateTemplate.setFormat(ImageFormat.RAW); + } + + String checkSum = this.templateMgr + .getChecksum(hostId, answer.getPath()); + + Transaction txn = Transaction.currentTxn(); + + txn.start(); + + privateTemplate.setChecksum(checkSum); + templateDao.update(privateTemplate.getId(), privateTemplate); + + // add template zone ref for this template + templateDao.addTemplateToZone(privateTemplate, zoneId); + VMTemplateHostVO templateHostVO = new VMTemplateHostVO(hostId, + privateTemplate.getId()); + templateHostVO.setDownloadPercent(100); + templateHostVO.setDownloadState(Status.DOWNLOADED); + templateHostVO.setInstallPath(answer.getPath()); + templateHostVO.setLastUpdated(new Date()); + templateHostVO.setSize(answer.getVirtualSize()); + templateHostVO.setPhysicalSize(answer.getphysicalSize()); + templateHostDao.persist(templateHostVO); + txn.close(); + return answer; + } + + private Answer createTemplateFromVolume(DataObject srcObj, + DataObject destObj) { + long volumeId = srcObj.getId(); + VolumeVO volume = this.volDao.findById(volumeId); + if (volume == null) { + throw new CloudRuntimeException("Unable to find volume for Id " + + volumeId); + } + long accountId = volume.getAccountId(); + + String vmName = this.volumeMgr.getVmNameOnVolume(volume); + Long zoneId = volume.getDataCenterId(); + HostVO secondaryStorageHost = this.templateMgr + .getSecondaryStorageHost(zoneId); + if (secondaryStorageHost == null) { + throw new CloudRuntimeException( + "Can not find the secondary storage for zoneId " + zoneId); + } + String secondaryStorageURL = secondaryStorageHost.getStorageUrl(); + VMTemplateVO template = this.templateDao.findById(destObj.getId()); + StoragePool pool = (StoragePool) this.dataStoreMgr.getDataStore( + volume.getPoolId(), DataStoreRole.Primary); + String value = configDao + .getValue(Config.CreatePrivateTemplateFromVolumeWait.toString()); + int _createprivatetemplatefromvolumewait = NumbersUtil.parseInt(value, + Integer.parseInt(Config.CreatePrivateTemplateFromVolumeWait + .getDefaultValue())); + + CreatePrivateTemplateFromVolumeCommand cmd = new CreatePrivateTemplateFromVolumeCommand( + pool, secondaryStorageURL, destObj.getId(), accountId, + template.getName(), template.getUniqueName(), volume.getPath(), + vmName, _createprivatetemplatefromvolumewait); + + return sendCommand(cmd, pool, template.getId(), zoneId, + secondaryStorageHost.getId()); + } + + private HostVO getSecHost(long volumeId, long dcId) { + Long id = snapshotDao.getSecHostId(volumeId); + if ( id != null) { + return hostDao.findById(id); + } + return this.templateMgr.getSecondaryStorageHost(dcId); + } + + protected Answer copySnapshot(DataObject srcObject, DataObject destObject) { + SnapshotInfo srcSnapshot = (SnapshotInfo)srcObject; + VolumeInfo baseVolume = srcSnapshot.getBaseVolume(); + Long dcId = baseVolume.getDataCenterId(); + Long accountId = baseVolume.getAccountId(); + + HostVO secHost = getSecHost(baseVolume.getId(), baseVolume.getDataCenterId()); + + String secondaryStoragePoolUrl = secHost.getStorageUrl(); + String snapshotUuid = srcSnapshot.getPath(); + // In order to verify that the snapshot is not empty, + // we check if the parent of the snapshot is not the same as the parent of the previous snapshot. + // We pass the uuid of the previous snapshot to the plugin to verify this. + SnapshotVO prevSnapshot = null; + String prevSnapshotUuid = null; + String prevBackupUuid = null; + + + SwiftTO swift = _swiftMgr.getSwiftTO(); + S3TO s3 = _s3Mgr.getS3TO(); + + long prevSnapshotId = srcSnapshot.getPrevSnapshotId(); + if (prevSnapshotId > 0) { + prevSnapshot = snapshotDao.findByIdIncludingRemoved(prevSnapshotId); + if ( prevSnapshot.getBackupSnapshotId() != null && swift == null) { + if (prevSnapshot.getVersion() != null && prevSnapshot.getVersion().equals("2.2")) { + prevBackupUuid = prevSnapshot.getBackupSnapshotId(); + prevSnapshotUuid = prevSnapshot.getPath(); + } + } else if ((prevSnapshot.getSwiftId() != null && swift != null) + || (prevSnapshot.getS3Id() != null && s3 != null)) { + prevBackupUuid = prevSnapshot.getBackupSnapshotId(); + prevSnapshotUuid = prevSnapshot.getPath(); + } + } + boolean isVolumeInactive = this.volumeMgr.volumeInactive(baseVolume); + String vmName = this.volumeMgr.getVmNameOnVolume(baseVolume); + StoragePool srcPool = (StoragePool)dataStoreMgr.getPrimaryDataStore(baseVolume.getPoolId()); + String value = configDao.getValue(Config.BackupSnapshotWait.toString()); + int _backupsnapshotwait = NumbersUtil.parseInt(value, Integer.parseInt(Config.BackupSnapshotWait.getDefaultValue())); + BackupSnapshotCommand backupSnapshotCommand = new BackupSnapshotCommand(secondaryStoragePoolUrl, dcId, accountId, baseVolume.getId(), srcSnapshot.getId(), baseVolume.getPath(), srcPool, snapshotUuid, + srcSnapshot.getName(), prevSnapshotUuid, prevBackupUuid, isVolumeInactive, vmName, _backupsnapshotwait); + + if ( swift != null ) { + backupSnapshotCommand.setSwift(swift); + } else if (s3 != null) { + backupSnapshotCommand.setS3(s3); + } + BackupSnapshotAnswer answer = (BackupSnapshotAnswer) this.snapshotMgr.sendToPool(baseVolume, backupSnapshotCommand); + if (answer != null && answer.getResult()) { + SnapshotVO snapshotVO = this.snapshotDao.findById(srcSnapshot.getId()); + if (backupSnapshotCommand.getSwift() != null ) { + snapshotVO.setSwiftId(swift.getId()); + snapshotVO.setBackupSnapshotId(answer.getBackupSnapshotName()); + } else if (backupSnapshotCommand.getS3() != null) { + snapshotVO.setS3Id(s3.getId()); + snapshotVO.setBackupSnapshotId(answer.getBackupSnapshotName()); + } else { + snapshotVO.setSecHostId(secHost.getId()); + snapshotVO.setBackupSnapshotId(answer.getBackupSnapshotName()); + } + if (answer.isFull()) { + snapshotVO.setPrevSnapshotId(0L); + } + this.snapshotDao.update(srcSnapshot.getId(), snapshotVO); + } + return answer; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java new file mode 100644 index 00000000000..3a59b21238b --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionDriver.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.motion; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; + +public interface DataMotionDriver { + public void copy(DataObject srcObj, DataObject destObj); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.java new file mode 100644 index 00000000000..db36f6492e8 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionService.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 org.apache.cloudstack.storage.motion; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public interface DataMotionService { + public void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java new file mode 100644 index 00000000000..343140fb98e --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionServiceImpl.java @@ -0,0 +1,61 @@ +/* + * 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.storage.motion; + +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.springframework.stereotype.Component; + +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class DataMotionServiceImpl implements DataMotionService { + @Inject + List strategies; + + @Override + public void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback) { + + if (srcData.getDataStore().getDriver().canCopy(srcData, destData)) { + srcData.getDataStore().getDriver() + .copyAsync(srcData, destData, callback); + return; + } else if (destData.getDataStore().getDriver() + .canCopy(srcData, destData)) { + destData.getDataStore().getDriver() + .copyAsync(srcData, destData, callback); + return; + } + + for (DataMotionStrategy strategy : strategies) { + if (strategy.canHandle(srcData, destData)) { + strategy.copyAsync(srcData, destData, callback); + return; + } + } + throw new CloudRuntimeException("can't find strategy to move data"); + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java new file mode 100644 index 00000000000..ba40c6dcbce --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/motion/DataMotionStrategy.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.motion; + +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public interface DataMotionStrategy { + public boolean canHandle(DataObject srcData, DataObject destData); + + public Void copyAsync(DataObject srcData, DataObject destData, + AsyncCompletionCallback callback); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java new file mode 100644 index 00000000000..0a91186aaab --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotEntityImpl.java @@ -0,0 +1,192 @@ +// 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.storage.snapshot; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; + +public class SnapshotEntityImpl implements SnapshotEntity { + + @Override + public String getUuid() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getCurrentState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getDesiredState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getLastUpdatedTime() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getOwner() { + // TODO Auto-generated method stub + return null; + } + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public long getAccountId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getVolumeId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String getPath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Date getCreated() { + // TODO Auto-generated method stub + return null; + } + + @Override + public HypervisorType getHypervisorType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean isRecursive() { + // TODO Auto-generated method stub + return false; + } + + @Override + public short getsnapshotType() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public long getDomainId() { + // TODO Auto-generated method stub + return 0; + } + + @Override + public String reserveForBackup(int expiration) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void backup(String reservationToken) { + // TODO Auto-generated method stub + + } + + @Override + public void restore(String vm) { + // TODO Auto-generated method stub + + } + + @Override + public void destroy() { + // TODO Auto-generated method stub + + } + + @Override + public Map getDetails() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public State getState() { + // TODO Auto-generated method stub + return null; + } + + @Override + public Type getRecurringType() { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.java new file mode 100644 index 00000000000..f3e5c4aea50 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotService.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 org.apache.cloudstack.storage.snapshot; + +import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; + +public interface SnapshotService { + public SnapshotEntity getSnapshotEntity(long snapshotId); + public boolean takeSnapshot(SnapshotInfo snapshot); + public boolean revertSnapshot(SnapshotInfo snapshot); + public boolean deleteSnapshot(SnapshotInfo snapshot); +} diff --git a/server/src/com/cloud/baremetal/PxeServerResponse.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java similarity index 63% rename from server/src/com/cloud/baremetal/PxeServerResponse.java rename to engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java index 32fcc7fb5b9..b1de88f0e2a 100644 --- a/server/src/com/cloud/baremetal/PxeServerResponse.java +++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageDataStoreTO.java @@ -14,22 +14,23 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.baremetal; +package org.apache.cloudstack.storage.to; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo; -public class PxeServerResponse extends BaseResponse { - @SerializedName(ApiConstants.ID) @Param(description="the ID of the PXE server") - private String id; - - public String getId() { - return id; +public class ImageDataStoreTO { + private final String type; + private final String uri; + public ImageDataStoreTO(ImageDataStoreInfo dataStore) { + this.type = dataStore.getType(); + this.uri = dataStore.getUri(); } - - public void setId(String id) { - this.id = id; + + public String getType() { + return this.type; + } + + public String getUri() { + return this.uri; } } diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.java new file mode 100644 index 00000000000..18743d70bf2 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/ImageOnPrimayDataStoreTO.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.storage.to; + +import org.apache.cloudstack.storage.volume.TemplateOnPrimaryDataStoreInfo; + +public class ImageOnPrimayDataStoreTO { + private final String pathOnPrimaryDataStore; + private PrimaryDataStoreTO dataStore; + private final TemplateTO template; + public ImageOnPrimayDataStoreTO(TemplateOnPrimaryDataStoreInfo template) { + this.pathOnPrimaryDataStore = template.getPath(); + //this.dataStore = template.getPrimaryDataStore().getDataStoreTO(); + this.template = new TemplateTO(template.getTemplate()); + } + + public String getPathOnPrimaryDataStore() { + return this.pathOnPrimaryDataStore; + } + + public PrimaryDataStoreTO getPrimaryDataStore() { + return this.dataStore; + } + + public TemplateTO getTemplate() { + return this.template; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.java new file mode 100644 index 00000000000..96fb6bb2401 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/NfsPrimaryDataStoreTO.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.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; + +public class NfsPrimaryDataStoreTO extends PrimaryDataStoreTO { + private String server; + private String path; + + public NfsPrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) { + super(dataStore); + } + + public void setServer(String server) { + this.server = server; + } + + public String getServer() { + return this.server; + } + + public void setPath(String path) { + this.path = path; + } + + public String getPath() { + return this.path; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.java new file mode 100644 index 00000000000..aa47e8f4977 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/PrimaryDataStoreTO.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.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; + +public class PrimaryDataStoreTO { + private final String uuid; + private final String name; + private String type; + private final long id; + public PrimaryDataStoreTO(PrimaryDataStoreInfo dataStore) { + this.uuid = dataStore.getUuid(); + this.name = dataStore.getName(); + // this.type = dataStore.getType(); + this.id = dataStore.getId(); + } + + public long getId() { + return this.id; + } + + public String getUuid() { + return this.uuid; + } + + public String getName() { + return this.name; + } + + public String getType() { + return this.type; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java new file mode 100644 index 00000000000..bc55ea8c3ea --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/TemplateTO.java @@ -0,0 +1,51 @@ +// 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.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.image.datastore.ImageDataStoreInfo; + +public class TemplateTO { + private final String path; + private final String uuid; + private DiskFormat diskType; + private final ImageDataStoreTO imageDataStore; + + public TemplateTO(TemplateInfo template) { + this.path = null; + this.uuid = template.getUuid(); + //this.diskType = template.getDiskType(); + this.imageDataStore = new ImageDataStoreTO((ImageDataStoreInfo)template.getDataStore()); + } + + public String getPath() { + return this.path; + } + + public String getUuid() { + return this.uuid; + } + + public DiskFormat getDiskType() { + return this.diskType; + } + + public ImageDataStoreTO getImageDataStore() { + return this.imageDataStore; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.java new file mode 100644 index 00000000000..c65b6525827 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/to/VolumeTO.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.storage.to; + +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; + +public class VolumeTO { + private final String uuid; + private final String path; + private VolumeType volumeType; + private DiskFormat diskType; + private PrimaryDataStoreTO dataStore; + private String name; + private final long size; + public VolumeTO(VolumeInfo volume) { + this.uuid = volume.getUuid(); + this.path = volume.getUri(); + //this.volumeType = volume.getType(); + //this.diskType = volume.getDiskType(); + if (volume.getDataStore() != null) { + this.dataStore = new PrimaryDataStoreTO((PrimaryDataStoreInfo)volume.getDataStore()); + } else { + this.dataStore = null; + } + //this.name = volume.getName(); + this.size = volume.getSize(); + } + + public String getUuid() { + return this.uuid; + } + + public String getPath() { + return this.path; + } + + public VolumeType getVolumeType() { + return this.volumeType; + } + + public DiskFormat getDiskType() { + return this.diskType; + } + + public PrimaryDataStoreTO getDataStore() { + return this.dataStore; + } + + public void setDataStore(PrimaryDataStoreTO dataStore) { + this.dataStore = dataStore; + } + + public String getName() { + return this.name; + } + + public long getSize() { + return this.size; + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.java new file mode 100644 index 00000000000..b8d0857d495 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/TemplateOnPrimaryDataStoreInfo.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 org.apache.cloudstack.storage.volume; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; + +public interface TemplateOnPrimaryDataStoreInfo { + public String getPath(); + + public void setPath(String path); + + public PrimaryDataStore getPrimaryDataStore(); + + public TemplateInfo getTemplate(); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java new file mode 100644 index 00000000000..663584b9dba --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeEvent.java @@ -0,0 +1,23 @@ +/* + * 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.storage.volume; + +public enum VolumeEvent { + CreateRequested, CopyRequested, CopySucceeded, CopyFailed, OperationFailed, OperationSucceeded, OperationRetry, UploadRequested, MigrationRequested, SnapshotRequested, DestroyRequested, ExpungingRequested; +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java b/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.java new file mode 100644 index 00000000000..c6ca90d1641 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/datastore/PrimaryDataStoreHelper.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 org.apache.cloudstack.storage.volume.datastore; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.springframework.stereotype.Component; + +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.utils.exception.CloudRuntimeException; + +@Component +public class PrimaryDataStoreHelper { + @Inject + private PrimaryDataStoreDao dataStoreDao; + public StoragePoolVO createPrimaryDataStore(Map params) { + StoragePoolVO dataStoreVO = dataStoreDao.findPoolByUUID((String)params.get("uuid")); + if (dataStoreVO != null) { + throw new CloudRuntimeException("duplicate uuid: " + params.get("uuid")); + } + + dataStoreVO = new StoragePoolVO(); + dataStoreVO.setStorageProviderId(Long.parseLong((String)params.get("providerId"))); + dataStoreVO.setHostAddress((String)params.get("server")); + dataStoreVO.setPath((String)params.get("path")); + dataStoreVO.setPoolType((StoragePoolType)params.get("protocol")); + dataStoreVO.setPort(Integer.parseInt((String)params.get("port"))); + dataStoreVO.setName((String)params.get("name")); + dataStoreVO.setUuid((String)params.get("uuid")); + dataStoreVO = dataStoreDao.persist(dataStoreVO); + return dataStoreVO; + } + + public boolean deletePrimaryDataStore(long id) { + StoragePoolVO dataStoreVO = dataStoreDao.findById(id); + if (dataStoreVO == null) { + throw new CloudRuntimeException("can't find store: " + id); + } + dataStoreDao.remove(id); + return true; + } + + public void attachCluster(DataStore dataStore) { + //send down AttachPrimaryDataStoreCmd command to all the hosts in the cluster + AttachPrimaryDataStoreCmd cmd = new AttachPrimaryDataStoreCmd(dataStore.getUri()); + /*for (EndPoint ep : dataStore.getEndPoints()) { + ep.sendMessage(cmd); + } */ + } + + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDao.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDao.java new file mode 100644 index 00000000000..63cdb16c596 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDao.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 org.apache.cloudstack.storage.volume.db; + +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +public interface TemplatePrimaryDataStoreDao extends GenericDao, StateDao { + public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolId(long templateId, long poolId); + public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolIdAndReady(long templateId, long poolId); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java new file mode 100644 index 00000000000..ad561502266 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreDaoImpl.java @@ -0,0 +1,96 @@ +/* + * 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.storage.volume.db; + +import java.util.Date; + +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.State; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.UpdateBuilder; + +@Component +public class TemplatePrimaryDataStoreDaoImpl extends GenericDaoBase implements TemplatePrimaryDataStoreDao { + private static final Logger s_logger = Logger.getLogger(TemplatePrimaryDataStoreDaoImpl.class); + protected final SearchBuilder updateSearchBuilder; + public TemplatePrimaryDataStoreDaoImpl() { + updateSearchBuilder = createSearchBuilder(); + updateSearchBuilder.and("id", updateSearchBuilder.entity().getId(), Op.EQ); + updateSearchBuilder.and("state", updateSearchBuilder.entity().getState(), Op.EQ); + updateSearchBuilder.and("updatedCount", updateSearchBuilder.entity().getUpdatedCount(), Op.EQ); + updateSearchBuilder.done(); + } + @Override + public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolId(long templateId, long poolId) { + SearchCriteriaService sc = SearchCriteria2.create(TemplatePrimaryDataStoreVO.class); + sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, templateId); + sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, poolId); + return sc.find(); + } + + @Override + public TemplatePrimaryDataStoreVO findByTemplateIdAndPoolIdAndReady(long templateId, long poolId) { + SearchCriteriaService sc = SearchCriteria2.create(TemplatePrimaryDataStoreVO.class); + sc.addAnd(sc.getEntity().getTemplateId(), Op.EQ, templateId); + sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, poolId); + sc.addAnd(sc.getEntity().getState(), Op.EQ, ObjectInDataStoreStateMachine.State.Ready); + return sc.find(); + } + + @Override + public boolean updateState(State currentState, Event event, State nextState, TemplatePrimaryDataStoreVO vo, Object data) { + Long oldUpdated = vo.getUpdatedCount(); + Date oldUpdatedTime = vo.getLastUpdated(); + + SearchCriteria sc = updateSearchBuilder.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + sc.setParameters("updatedCount", vo.getUpdatedCount()); + + vo.incrUpdatedCount(); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "lastUpdated", new Date()); + + int rows = update((TemplatePrimaryDataStoreVO)vo, sc); + if (rows == 0 && s_logger.isDebugEnabled()) { + TemplatePrimaryDataStoreVO template = findByIdIncludingRemoved(vo.getId()); + if (template != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(template.getId()).append("; state=").append(template.getState()).append("; updatecount=").append(template.getUpdatedCount()).append(";updatedTime=").append(template.getLastUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount()).append("; updatedTime=").append(vo.getLastUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatecount=").append(oldUpdated).append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update template: id=" + vo.getId() + ", as there is no such template exists in the database anymore"); + } + } + return rows > 0; + } + +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java new file mode 100644 index 00000000000..48a9f334a19 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/TemplatePrimaryDataStoreVO.java @@ -0,0 +1,255 @@ +/* + * 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.storage.volume.db; + +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; + +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; + +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.fsm.StateObject; + +@Entity +@Table(name = "template_spool_ref") +public class TemplatePrimaryDataStoreVO implements StateObject { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + long id; + + @Column(name = "pool_id") + private long poolId; + + @Column(name = "template_id") + long templateId; + + @Column(name = GenericDaoBase.CREATED_COLUMN) + Date created = null; + + @Column(name = "last_updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date lastUpdated = null; + + @Column(name = "download_pct") + int downloadPercent; + + @Column(name = "download_state") + @Enumerated(EnumType.STRING) + Status downloadState; + + @Column(name = "local_path") + String localDownloadPath; + + @Column(name = "error_str") + String errorString; + + @Column(name = "job_id") + String jobId; + + @Column(name = "install_path") + String installPath; + + @Column(name = "template_size") + long templateSize; + + @Column(name = "marked_for_gc") + boolean markedForGC; + + @Column(name = "state") + @Enumerated(EnumType.STRING) + ObjectInDataStoreStateMachine.State state; + + @Column(name="update_count", updatable = true, nullable=false) + protected long updatedCount; + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public String getInstallPath() { + return installPath; + } + + public long getTemplateSize() { + return templateSize; + } + + public long getPoolId() { + return poolId; + } + + public void setpoolId(long poolId) { + this.poolId = poolId; + } + + public long getTemplateId() { + return templateId; + } + + public void setTemplateId(long templateId) { + this.templateId = templateId; + } + + public int getDownloadPercent() { + return downloadPercent; + } + + public void setDownloadPercent(int downloadPercent) { + this.downloadPercent = downloadPercent; + } + + public void setDownloadState(Status downloadState) { + this.downloadState = downloadState; + } + + public long getId() { + return id; + } + + public Date getCreated() { + return created; + } + + public Date getLastUpdated() { + return lastUpdated; + } + + public void setLastUpdated(Date date) { + lastUpdated = date; + } + + public void setInstallPath(String installPath) { + this.installPath = installPath; + } + + public Status getDownloadState() { + return downloadState; + } + + public TemplatePrimaryDataStoreVO(long poolId, long templateId) { + super(); + this.poolId = poolId; + this.templateId = templateId; + this.downloadState = Status.NOT_DOWNLOADED; + this.state = ObjectInDataStoreStateMachine.State.Allocated; + this.markedForGC = false; + } + + public TemplatePrimaryDataStoreVO(long poolId, long templateId, Date lastUpdated, int downloadPercent, Status downloadState, String localDownloadPath, String errorString, String jobId, + String installPath, long templateSize) { + super(); + this.poolId = poolId; + this.templateId = templateId; + this.lastUpdated = lastUpdated; + this.downloadPercent = downloadPercent; + this.downloadState = downloadState; + this.localDownloadPath = localDownloadPath; + this.errorString = errorString; + this.jobId = jobId; + this.installPath = installPath; + this.templateSize = templateSize; + } + + protected TemplatePrimaryDataStoreVO() { + + } + + public void setLocalDownloadPath(String localPath) { + this.localDownloadPath = localPath; + } + + public String getLocalDownloadPath() { + return localDownloadPath; + } + + public void setErrorString(String errorString) { + this.errorString = errorString; + } + + public String getErrorString() { + return errorString; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } + + public String getJobId() { + return jobId; + } + + public void setTemplateSize(long templateSize) { + this.templateSize = templateSize; + } + + public boolean getMarkedForGC() { + return markedForGC; + } + + public void setMarkedForGC(boolean markedForGC) { + this.markedForGC = markedForGC; + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof TemplatePrimaryDataStoreVO) { + TemplatePrimaryDataStoreVO other = (TemplatePrimaryDataStoreVO) obj; + return (this.templateId == other.getTemplateId() && this.poolId == other.getPoolId()); + } + return false; + } + + @Override + public int hashCode() { + Long tid = new Long(templateId); + Long hid = new Long(poolId); + return tid.hashCode() + hid.hashCode(); + } + + @Override + public String toString() { + return new StringBuilder("TmplPool[").append(id).append("-").append(templateId).append("-").append("poolId").append("-").append(installPath).append("]").toString(); + } + + @Override + public ObjectInDataStoreStateMachine.State getState() { + return this.state; + } + +} \ No newline at end of file diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2.java new file mode 100644 index 00000000000..b0c8fad3b19 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2.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 org.apache.cloudstack.storage.volume.db; + +import java.util.List; + +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; +import org.apache.cloudstack.storage.volume.VolumeEvent; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Volume; +import com.cloud.utils.Pair; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateDao; + +public interface VolumeDao2 extends GenericDao, StateDao { + + List findDetachedByAccount(long accountId); + + List findByAccount(long accountId); + + Pair getCountAndTotalByPool(long poolId); + + Pair getNonDestroyedCountAndTotalByPool(long poolId); + + List findByInstance(long id); + + List findByInstanceAndType(long id, VolumeType vType); + + List findByInstanceIdDestroyed(long vmId); + + List findByAccountAndPod(long accountId, long podId); + + List findByTemplateAndZone(long templateId, long zoneId); + + void deleteVolumesByInstance(long instanceId); + + void attachVolume(long volumeId, long vmId, long deviceId); + + void detachVolume(long volumeId); + + boolean isAnyVolumeActivelyUsingTemplateOnPool(long templateId, long poolId); + + List findCreatedByInstance(long id); + + List findByPoolId(long poolId); + + List findByInstanceAndDeviceId(long instanceId, long deviceId); + + List findUsableVolumesForInstance(long instanceId); + + Long countAllocatedVolumesForAccount(long accountId); + + HypervisorType getHypervisorType(long volumeId); + + List listVolumesToBeDestroyed(); + + ImageFormat getImageFormat(Long volumeId); + + List findReadyRootVolumesByInstance(long instanceId); + + List listPoolIdsByVolumeCount(long dcId, Long podId, Long clusterId, long accountId); + + VolumeVO allocVolume(long size, VolumeType type, String volName, Long templateId); + + VolumeVO findByVolumeIdAndPoolId(long volumeId, long poolId); +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java new file mode 100644 index 00000000000..1e12498dff6 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeDao2Impl.java @@ -0,0 +1,439 @@ +// 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.storage.volume.db; + +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.ejb.Local; + +import org.apache.cloudstack.engine.subsystem.api.storage.type.RootDisk; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; +import org.apache.cloudstack.storage.volume.VolumeEvent; + +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.server.ResourceTag.TaggedResourceType; +import com.cloud.storage.Storage.ImageFormat; +import com.cloud.storage.Volume; +import com.cloud.tags.dao.ResourceTagsDaoImpl; +import com.cloud.utils.Pair; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Func; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.db.UpdateBuilder; +import com.cloud.utils.exception.CloudRuntimeException; + +@Local(value = VolumeDao2.class) +@Component +public class VolumeDao2Impl extends GenericDaoBase implements VolumeDao2 { + private static final Logger s_logger = Logger.getLogger(VolumeDao2Impl.class); + protected final SearchBuilder DetachedAccountIdSearch; + protected final SearchBuilder TemplateZoneSearch; + protected final GenericSearchBuilder TotalSizeByPoolSearch; + protected final GenericSearchBuilder ActiveTemplateSearch; + protected final SearchBuilder InstanceStatesSearch; + protected final SearchBuilder AllFieldsSearch; + protected GenericSearchBuilder CountByAccount; + //ResourceTagsDaoImpl _tagsDao = ComponentLocator.inject(ResourceTagsDaoImpl.class); + ResourceTagsDaoImpl _tagsDao = null; + protected static final String SELECT_VM_SQL = "SELECT DISTINCT instance_id from volumes v where v.host_id = ? and v.mirror_state = ?"; + protected static final String SELECT_HYPERTYPE_FROM_VOLUME = "SELECT c.hypervisor_type from volumes v, storage_pool s, cluster c where v.pool_id = s.id and s.cluster_id = c.id and v.id = ?"; + + private static final String ORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT = "SELECT pool.id, SUM(IF(vol.state='Ready' AND vol.account_id = ?, 1, 0)) FROM `cloud`.`storage_pool` pool LEFT JOIN `cloud`.`volumes` vol ON pool.id = vol.pool_id WHERE pool.data_center_id = ? " + + " AND pool.pod_id = ? AND pool.cluster_id = ? " + " GROUP BY pool.id ORDER BY 2 ASC "; + + @Override + public List findDetachedByAccount(long accountId) { + SearchCriteria sc = DetachedAccountIdSearch.create(); + sc.setParameters("accountId", accountId); + sc.setParameters("destroyed", Volume.State.Destroy); + return listBy(sc); + } + + @Override + public List findByAccount(long accountId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("accountId", accountId); + sc.setParameters("state", Volume.State.Ready); + return listBy(sc); + } + + @Override + public List findByInstance(long id) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", id); + return listBy(sc); + } + + @Override + public List findByInstanceAndDeviceId(long instanceId, long deviceId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", instanceId); + sc.setParameters("deviceId", deviceId); + return listBy(sc); + } + + @Override + public List findByPoolId(long poolId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("poolId", poolId); + sc.setParameters("notDestroyed", Volume.State.Destroy); + sc.setParameters("vType", new RootDisk().toString()); + return listBy(sc); + } + + @Override + public List findCreatedByInstance(long id) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", id); + sc.setParameters("state", Volume.State.Ready); + return listBy(sc); + } + + @Override + public List findUsableVolumesForInstance(long instanceId) { + SearchCriteria sc = InstanceStatesSearch.create(); + sc.setParameters("instance", instanceId); + sc.setParameters("states", Volume.State.Creating, Volume.State.Ready, Volume.State.Allocated); + + return listBy(sc); + } + + @Override + public List findByInstanceAndType(long id, VolumeType vType) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", id); + sc.setParameters("vType", vType.toString()); + return listBy(sc); + } + + @Override + public List findByInstanceIdDestroyed(long vmId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", vmId); + sc.setParameters("destroyed", Volume.State.Destroy); + return listBy(sc); + } + + @Override + public List findReadyRootVolumesByInstance(long instanceId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", instanceId); + sc.setParameters("state", Volume.State.Ready); + sc.setParameters("vType", new RootDisk().toString()); + return listBy(sc); + } + + @Override + public List findByAccountAndPod(long accountId, long podId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("accountId", accountId); + sc.setParameters("pod", podId); + sc.setParameters("state", Volume.State.Ready); + + return listIncludingRemovedBy(sc); + } + + @Override + public List findByTemplateAndZone(long templateId, long zoneId) { + SearchCriteria sc = TemplateZoneSearch.create(); + sc.setParameters("template", templateId); + sc.setParameters("zone", zoneId); + + return listIncludingRemovedBy(sc); + } + + @Override + public boolean isAnyVolumeActivelyUsingTemplateOnPool(long templateId, long poolId) { + SearchCriteria sc = ActiveTemplateSearch.create(); + sc.setParameters("template", templateId); + sc.setParameters("pool", poolId); + + List results = customSearchIncludingRemoved(sc, null); + assert results.size() > 0 : "How can this return a size of " + results.size(); + + return results.get(0) > 0; + } + + @Override + public void deleteVolumesByInstance(long instanceId) { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("instanceId", instanceId); + expunge(sc); + } + + @Override + public void attachVolume(long volumeId, long vmId, long deviceId) { + VolumeVO volume = createForUpdate(volumeId); + volume.setInstanceId(vmId); + volume.setDeviceId(deviceId); + volume.setUpdated(new Date()); + volume.setAttached(new Date()); + update(volumeId, volume); + } + + @Override + public void detachVolume(long volumeId) { + VolumeVO volume = createForUpdate(volumeId); + volume.setInstanceId(null); + volume.setDeviceId(null); + volume.setUpdated(new Date()); + volume.setAttached(null); + update(volumeId, volume); + } + + @Override + @DB + public HypervisorType getHypervisorType(long volumeId) { + /* lookup from cluster of pool */ + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + + try { + String sql = SELECT_HYPERTYPE_FROM_VOLUME; + pstmt = txn.prepareAutoCloseStatement(sql); + pstmt.setLong(1, volumeId); + ResultSet rs = pstmt.executeQuery(); + if (rs.next()) { + return HypervisorType.getType(rs.getString(1)); + } + return HypervisorType.None; + } catch (SQLException e) { + throw new CloudRuntimeException("DB Exception on: " + SELECT_HYPERTYPE_FROM_VOLUME, e); + } catch (Throwable e) { + throw new CloudRuntimeException("Caught: " + SELECT_HYPERTYPE_FROM_VOLUME, e); + } + } + + @Override + public ImageFormat getImageFormat(Long volumeId) { + HypervisorType type = getHypervisorType(volumeId); + if (type.equals(HypervisorType.KVM)) { + return ImageFormat.QCOW2; + } else if (type.equals(HypervisorType.XenServer)) { + return ImageFormat.VHD; + } else if (type.equals(HypervisorType.VMware)) { + return ImageFormat.OVA; + } else { + s_logger.warn("Do not support hypervisor " + type.toString()); + return null; + } + } + + protected VolumeDao2Impl() { + AllFieldsSearch = createSearchBuilder(); + AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), Op.EQ); + AllFieldsSearch.and("accountId", AllFieldsSearch.entity().getAccountId(), Op.EQ); + AllFieldsSearch.and("pod", AllFieldsSearch.entity().getPodId(), Op.EQ); + AllFieldsSearch.and("instanceId", AllFieldsSearch.entity().getInstanceId(), Op.EQ); + AllFieldsSearch.and("deviceId", AllFieldsSearch.entity().getDeviceId(), Op.EQ); + AllFieldsSearch.and("poolId", AllFieldsSearch.entity().getPoolId(), Op.EQ); + AllFieldsSearch.and("vType", AllFieldsSearch.entity().getVolumeType(), Op.EQ); + AllFieldsSearch.and("id", AllFieldsSearch.entity().getId(), Op.EQ); + AllFieldsSearch.and("destroyed", AllFieldsSearch.entity().getState(), Op.EQ); + AllFieldsSearch.and("notDestroyed", AllFieldsSearch.entity().getState(), Op.NEQ); + AllFieldsSearch.and("updatedCount", AllFieldsSearch.entity().getUpdatedCount(), Op.EQ); + AllFieldsSearch.done(); + + DetachedAccountIdSearch = createSearchBuilder(); + DetachedAccountIdSearch.and("accountId", DetachedAccountIdSearch.entity().getAccountId(), Op.EQ); + DetachedAccountIdSearch.and("destroyed", DetachedAccountIdSearch.entity().getState(), Op.NEQ); + DetachedAccountIdSearch.and("instanceId", DetachedAccountIdSearch.entity().getInstanceId(), Op.NULL); + DetachedAccountIdSearch.done(); + + TemplateZoneSearch = createSearchBuilder(); + TemplateZoneSearch.and("template", TemplateZoneSearch.entity().getTemplateId(), Op.EQ); + TemplateZoneSearch.and("zone", TemplateZoneSearch.entity().getDataCenterId(), Op.EQ); + TemplateZoneSearch.done(); + + TotalSizeByPoolSearch = createSearchBuilder(SumCount.class); + TotalSizeByPoolSearch.select("sum", Func.SUM, TotalSizeByPoolSearch.entity().getSize()); + TotalSizeByPoolSearch.select("count", Func.COUNT, (Object[]) null); + TotalSizeByPoolSearch.and("poolId", TotalSizeByPoolSearch.entity().getPoolId(), Op.EQ); + TotalSizeByPoolSearch.and("removed", TotalSizeByPoolSearch.entity().getRemoved(), Op.NULL); + TotalSizeByPoolSearch.and("state", TotalSizeByPoolSearch.entity().getState(), Op.NEQ); + TotalSizeByPoolSearch.done(); + + ActiveTemplateSearch = createSearchBuilder(Long.class); + ActiveTemplateSearch.and("pool", ActiveTemplateSearch.entity().getPoolId(), Op.EQ); + ActiveTemplateSearch.and("template", ActiveTemplateSearch.entity().getTemplateId(), Op.EQ); + ActiveTemplateSearch.and("removed", ActiveTemplateSearch.entity().getRemoved(), Op.NULL); + ActiveTemplateSearch.select(null, Func.COUNT, null); + ActiveTemplateSearch.done(); + + InstanceStatesSearch = createSearchBuilder(); + InstanceStatesSearch.and("instance", InstanceStatesSearch.entity().getInstanceId(), Op.EQ); + InstanceStatesSearch.and("states", InstanceStatesSearch.entity().getState(), Op.IN); + InstanceStatesSearch.done(); + + CountByAccount = createSearchBuilder(Long.class); + CountByAccount.select(null, Func.COUNT, null); + CountByAccount.and("account", CountByAccount.entity().getAccountId(), SearchCriteria.Op.EQ); + CountByAccount.and("state", CountByAccount.entity().getState(), SearchCriteria.Op.NIN); + CountByAccount.done(); + } + + @Override + @DB(txn = false) + public Pair getCountAndTotalByPool(long poolId) { + SearchCriteria sc = TotalSizeByPoolSearch.create(); + sc.setParameters("poolId", poolId); + List results = customSearch(sc, null); + SumCount sumCount = results.get(0); + return new Pair(sumCount.count, sumCount.sum); + } + + @Override + public Long countAllocatedVolumesForAccount(long accountId) { + SearchCriteria sc = CountByAccount.create(); + sc.setParameters("account", accountId); + sc.setParameters("state", Volume.State.Destroy); + return customSearch(sc, null).get(0); + } + + public static class SumCount { + public long sum; + public long count; + + public SumCount() { + } + } + + @Override + public List listVolumesToBeDestroyed() { + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("state", Volume.State.Destroy); + + return listBy(sc); + } + + @Override + public boolean updateState(Volume.State currentState, Volume.Event event, Volume.State nextState, VolumeVO vo, Object data) { + + Long oldUpdated = vo.getUpdatedCount(); + Date oldUpdatedTime = vo.getUpdated(); + + SearchCriteria sc = AllFieldsSearch.create(); + sc.setParameters("id", vo.getId()); + sc.setParameters("state", currentState); + sc.setParameters("updatedCount", vo.getUpdatedCount()); + + vo.incrUpdatedCount(); + + UpdateBuilder builder = getUpdateBuilder(vo); + builder.set(vo, "state", nextState); + builder.set(vo, "updated", new Date()); + + int rows = update((VolumeVO) vo, sc); + if (rows == 0 && s_logger.isDebugEnabled()) { + VolumeVO dbVol = findByIdIncludingRemoved(vo.getId()); + if (dbVol != null) { + StringBuilder str = new StringBuilder("Unable to update ").append(vo.toString()); + str.append(": DB Data={id=").append(dbVol.getId()).append("; state=").append(dbVol.getState()).append("; updatecount=").append(dbVol.getUpdatedCount()).append(";updatedTime=") + .append(dbVol.getUpdated()); + str.append(": New Data={id=").append(vo.getId()).append("; state=").append(nextState).append("; event=").append(event).append("; updatecount=").append(vo.getUpdatedCount()) + .append("; updatedTime=").append(vo.getUpdated()); + str.append(": stale Data={id=").append(vo.getId()).append("; state=").append(currentState).append("; event=").append(event).append("; updatecount=").append(oldUpdated) + .append("; updatedTime=").append(oldUpdatedTime); + } else { + s_logger.debug("Unable to update volume: id=" + vo.getId() + ", as there is no such volume exists in the database anymore"); + } + } + return rows > 0; + } + + @Override + public List listPoolIdsByVolumeCount(long dcId, Long podId, Long clusterId, long accountId) { + Transaction txn = Transaction.currentTxn(); + PreparedStatement pstmt = null; + List result = new ArrayList(); + try { + String sql = ORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT; + pstmt = txn.prepareAutoCloseStatement(sql); + pstmt.setLong(1, accountId); + pstmt.setLong(2, dcId); + pstmt.setLong(3, podId); + pstmt.setLong(4, clusterId); + + ResultSet rs = pstmt.executeQuery(); + while (rs.next()) { + result.add(rs.getLong(1)); + } + return result; + } catch (SQLException e) { + throw new CloudRuntimeException("DB Exception on: " + ORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT, e); + } catch (Throwable e) { + throw new CloudRuntimeException("Caught: " + ORDER_POOLS_NUMBER_OF_VOLUMES_FOR_ACCOUNT, e); + } + } + + @Override + @DB(txn = false) + public Pair getNonDestroyedCountAndTotalByPool(long poolId) { + SearchCriteria sc = TotalSizeByPoolSearch.create(); + sc.setParameters("poolId", poolId); + sc.setParameters("state", Volume.State.Destroy); + List results = customSearch(sc, null); + SumCount sumCount = results.get(0); + return new Pair(sumCount.count, sumCount.sum); + } + + @Override + @DB + public boolean remove(Long id) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + VolumeVO entry = findById(id); + if (entry != null) { + _tagsDao.removeByIdAndType(id, TaggedResourceType.Volume); + } + boolean result = super.remove(id); + txn.commit(); + return result; + } + + @Override + @DB + public VolumeVO allocVolume(long size, VolumeType type, String volName, Long templateId) { + VolumeVO vol = new VolumeVO(size, type.toString(), volName, templateId); + vol = this.persist(vol); + return vol; + } + + @Override + public VolumeVO findByVolumeIdAndPoolId(long volumeId, long poolId) { + SearchCriteriaService sc = SearchCriteria2.create(VolumeVO.class); + sc.addAnd(sc.getEntity().getId(), Op.EQ, volumeId); + sc.addAnd(sc.getEntity().getPoolId(), Op.EQ, poolId); + return sc.find(); + } +} diff --git a/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java new file mode 100644 index 00000000000..da8234e35f3 --- /dev/null +++ b/engine/storage/src/org/apache/cloudstack/storage/volume/db/VolumeVO.java @@ -0,0 +1,416 @@ +//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.storage.volume.db; + +import java.util.Date; +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.TableGenerator; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; + +import org.apache.cloudstack.api.Identity; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; + +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.Volume; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.fsm.StateObject; + +@Entity +@Table(name = "volumes") +public class VolumeVO implements Identity, StateObject { + @Id + @TableGenerator(name = "volume_sq", table = "sequence", pkColumnName = "name", valueColumnName = "value", pkColumnValue = "volume_seq", allocationSize = 1) + @GeneratedValue(strategy = GenerationType.TABLE) + @Column(name = "id") + long id; + + @Column(name = "name") + String name; + + @Column(name = "pool_id") + Long poolId; + + @Column(name = "last_pool_id") + Long lastPoolId; + + @Column(name = "account_id") + long accountId; + + @Column(name = "domain_id") + long domainId; + + @Column(name = "instance_id") + Long instanceId = null; + + @Column(name = "device_id") + Long deviceId = null; + + @Column(name = "size") + long size; + + @Column(name = "folder") + String folder; + + @Column(name = "path") + String path; + + @Column(name = "pod_id") + Long podId; + + @Column(name = "created") + Date created; + + @Column(name = "attached") + @Temporal(value = TemporalType.TIMESTAMP) + Date attached; + + @Column(name = "data_center_id") + long dataCenterId; + + @Column(name = "host_ip") + String hostip; + + @Column(name = "disk_offering_id") + long diskOfferingId; + + @Column(name = "template_id") + Long templateId; + + @Column(name = "first_snapshot_backup_uuid") + String firstSnapshotBackupUuid; + + @Column(name = "volume_type") + String volumeType = "UNKNOWN"; + + @Column(name = "pool_type") + @Enumerated(EnumType.STRING) + StoragePoolType poolType; + + @Column(name = "disk_type") + DiskFormat diskType; + + @Column(name = GenericDao.REMOVED_COLUMN) + Date removed; + + @Column(name = "updated") + @Temporal(value = TemporalType.TIMESTAMP) + Date updated; + + @Column(name = "update_count", updatable = true, nullable = false) + protected long updatedCount; // This field should be updated everytime the + // state is updated. There's no set method in + // the vo object because it is done with in the + // dao code. + + @Column(name = "recreatable") + boolean recreatable; + + @Column(name = "state") + @Enumerated(value = EnumType.STRING) + private Volume.State state; + + @Column(name = "chain_info") + String chainInfo; + + @Column(name = "uuid") + String uuid; + + // Real Constructor + public VolumeVO(long size, String type, String name, Long templateId) { + this.volumeType = type; + this.size = size; + this.name = name; + this.templateId = templateId; + this.uuid = UUID.randomUUID().toString(); + this.state = Volume.State.Allocated; + } + + // Copy Constructor + public VolumeVO(VolumeVO that) { + this(that.getSize(), that.getVolumeType(), that.getName(), that.getTemplateId()); + this.recreatable = that.isRecreatable(); + this.state = that.getState(); + this.size = that.getSize(); + this.diskOfferingId = that.getDiskOfferingId(); + this.poolId = that.getPoolId(); + this.attached = that.getAttached(); + this.chainInfo = that.getChainInfo(); + this.templateId = that.getTemplateId(); + this.deviceId = that.getDeviceId(); + this.uuid = UUID.randomUUID().toString(); + } + + public long getUpdatedCount() { + return this.updatedCount; + } + + public void incrUpdatedCount() { + this.updatedCount++; + } + + public void decrUpdatedCount() { + this.updatedCount--; + } + + public boolean isRecreatable() { + return recreatable; + } + + public void setRecreatable(boolean recreatable) { + this.recreatable = recreatable; + } + + public long getId() { + return id; + } + + public Long getPodId() { + return podId; + } + + public long getDataCenterId() { + return dataCenterId; + } + + public String getName() { + return name; + } + + public long getAccountId() { + return accountId; + } + + public void setPoolType(StoragePoolType poolType) { + this.poolType = poolType; + } + + public StoragePoolType getPoolType() { + return poolType; + } + + public long getDomainId() { + return domainId; + } + + public String getFolder() { + return folder; + } + + public String getPath() { + return path; + } + + protected VolumeVO() { + } + + public long getSize() { + return size; + } + + public void setSize(long size) { + this.size = size; + } + + public Long getInstanceId() { + return instanceId; + } + + public Long getDeviceId() { + return deviceId; + } + + public void setDeviceId(Long deviceId) { + this.deviceId = deviceId; + } + + public String getVolumeType() { + return volumeType; + } + + public void setName(String name) { + this.name = name; + } + + public void setFolder(String folder) { + this.folder = folder; + } + + public void setAccountId(long accountId) { + this.accountId = accountId; + } + + public void setDomainId(long domainId) { + this.domainId = domainId; + } + + public void setInstanceId(Long instanceId) { + this.instanceId = instanceId; + } + + public void setPath(String path) { + this.path = path; + } + + public String getHostIp() { + return hostip; + } + + public void setHostIp(String hostip) { + this.hostip = hostip; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + public void setDataCenterId(long dataCenterId) { + this.dataCenterId = dataCenterId; + } + + public void setVolumeType(String type) { + volumeType = type; + } + + public Date getCreated() { + return created; + } + + public Date getRemoved() { + return removed; + } + + public void setRemoved(Date removed) { + this.removed = removed; + } + + public long getDiskOfferingId() { + return diskOfferingId; + } + + public void setDiskOfferingId(long diskOfferingId) { + this.diskOfferingId = diskOfferingId; + } + + public Long getTemplateId() { + return templateId; + } + + public void setTemplateId(Long templateId) { + this.templateId = templateId; + } + + public String getFirstSnapshotBackupUuid() { + return firstSnapshotBackupUuid; + } + + public void setFirstSnapshotBackupUuid(String firstSnapshotBackupUuid) { + this.firstSnapshotBackupUuid = firstSnapshotBackupUuid; + } + + public Long getPoolId() { + return poolId; + } + + public void setPoolId(Long poolId) { + this.poolId = poolId; + } + + public Date getUpdated() { + return updated; + } + + @Override + public Volume.State getState() { + return state; + } + + public void setUpdated(Date updated) { + this.updated = updated; + } + + @Override + public String toString() { + return new StringBuilder("Vol[").append(id).append("|vm=").append(instanceId).append("|").append(volumeType).append("]").toString(); + } + + public Date getAttached() { + return this.attached; + } + + public void setAttached(Date attached) { + this.attached = attached; + } + + public String getChainInfo() { + return this.chainInfo; + } + + public void setChainInfo(String chainInfo) { + this.chainInfo = chainInfo; + } + + public Long getLastPoolId() { + return this.lastPoolId; + } + + public void setLastPoolId(Long poolId) { + this.lastPoolId = poolId; + } + + @Override + public int hashCode() { + return NumbersUtil.hash(id); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof VolumeVO) { + return id == ((VolumeVO) obj).id; + } else { + return false; + } + } + + @Override + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public DiskFormat getDiskType() { + return diskType; + } + + public void setDiskType(DiskFormat type) { + diskType = type; + } +} diff --git a/engine/storage/storage.ucls b/engine/storage/storage.ucls new file mode 100644 index 00000000000..23a7b21fe00 --- /dev/null +++ b/engine/storage/storage.ucls @@ -0,0 +1,365 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/volume/pom.xml b/engine/storage/volume/pom.xml new file mode 100644 index 00000000000..19357ab11e4 --- /dev/null +++ b/engine/storage/volume/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + cloud-engine-storage-volume + Apache CloudStack Engine Storage Volume Component + + org.apache.cloudstack + cloud-engine + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + org.mockito + mockito-all + 1.9.5 + + + javax.inject + javax.inject + 1 + + + + install + src + test + + + maven-surefire-plugin + + true + + + + integration-test + + test + + + + + + + diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java new file mode 100644 index 00000000000..f2a999330ad --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/DefaultPrimaryDataStore.java @@ -0,0 +1,332 @@ +// 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.storage.datastore; + +import java.io.File; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.Scope; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.storage.volume.VolumeObject; +import org.apache.log4j.Logger; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StoragePoolStatus; +import com.cloud.storage.VMTemplateStoragePoolVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VMTemplatePoolDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.storage.encoding.EncodingType; + +public class DefaultPrimaryDataStore implements PrimaryDataStore { + private static final Logger s_logger = Logger + .getLogger(DefaultPrimaryDataStore.class); + protected PrimaryDataStoreDriver driver; + protected StoragePoolVO pdsv; + @Inject + protected PrimaryDataStoreDao dataStoreDao; + protected PrimaryDataStoreLifeCycle lifeCycle; + @Inject + private ObjectInDataStoreManager objectInStoreMgr; + @Inject + ImageDataFactory imageDataFactory; + @Inject + SnapshotDataFactory snapshotFactory; + protected DataStoreProvider provider; + @Inject + VMTemplatePoolDao templatePoolDao; + + private VolumeDao volumeDao; + + protected DefaultPrimaryDataStore() { + + } + + public void configure(StoragePoolVO pdsv, + PrimaryDataStoreDriver driver, DataStoreProvider provider) { + this.pdsv = pdsv; + this.driver = driver; + this.provider = provider; + } + + public static DefaultPrimaryDataStore createDataStore( + StoragePoolVO pdsv, PrimaryDataStoreDriver driver, + DataStoreProvider provider) { + DefaultPrimaryDataStore dataStore = (DefaultPrimaryDataStore)ComponentContext.inject(DefaultPrimaryDataStore.class); + dataStore.configure(pdsv, driver, provider); + return dataStore; + } + + @Override + public VolumeInfo getVolume(long id) { + VolumeVO volumeVO = volumeDao.findById(id); + VolumeObject vol = VolumeObject.getVolumeObject(this, volumeVO); + return vol; + } + + @Override + public List getVolumes() { + List volumes = volumeDao.findByPoolId(this.getId()); + List volumeInfos = new ArrayList(); + for (VolumeVO volume : volumes) { + volumeInfos.add(VolumeObject.getVolumeObject(this, volume)); + } + return volumeInfos; + } + + @Override + public DataStoreDriver getDriver() { + return this.driver; + } + + @Override + public DataStoreRole getRole() { + return DataStoreRole.Primary; + } + + @Override + public long getId() { + return this.pdsv.getId(); + } + + @Override + public String getUri() { + String path = this.pdsv.getPath(); + path.replaceFirst("/*", ""); + StringBuilder builder = new StringBuilder(); + builder.append(this.pdsv.getPoolType()); + builder.append("://"); + builder.append(this.pdsv.getHostAddress()); + builder.append(File.separator); + builder.append(this.pdsv.getPath()); + builder.append(File.separator); + builder.append("?" + EncodingType.ROLE + "=" + this.getRole()); + builder.append("&" + EncodingType.STOREUUID + "=" + this.pdsv.getUuid()); + return builder.toString(); + } + + @Override + public Scope getScope() { + StoragePoolVO vo = dataStoreDao.findById(this.pdsv.getId()); + if (vo.getScope() == ScopeType.CLUSTER) { + return new ClusterScope(vo.getClusterId(), vo.getPodId(), + vo.getDataCenterId()); + } else if (vo.getScope() == ScopeType.ZONE) { + return new ZoneScope(vo.getDataCenterId()); + } + return null; + } + + @Override + public boolean isHypervisorSupported(HypervisorType hypervisor) { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean isLocalStorageSupported() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isVolumeDiskTypeSupported(DiskFormat diskType) { + // TODO Auto-generated method stub + return false; + } + + + @Override + public String getUuid() { + return this.pdsv.getUuid(); + } + + @Override + public String getName() { + // TODO Auto-generated method stub + return null; + } + + @Override + public PrimaryDataStoreLifeCycle getLifeCycle() { + return this.lifeCycle; + } + + @Override + public boolean exists(DataObject data) { + return (objectInStoreMgr.findObject(data, data.getDataStore()) != null) ? true : false; + } + + @Override + public TemplateInfo getTemplate(long templateId) { + VMTemplateStoragePoolVO template = templatePoolDao.findByPoolTemplate(this.getId(), templateId); + if (template == null || template.getState() != ObjectInDataStoreStateMachine.State.Ready) { + return null; + } + return imageDataFactory.getTemplate(templateId, this); + } + + @Override + public SnapshotInfo getSnapshot(long snapshotId) { + // TODO Auto-generated method stub + return null; + } + + @Override + public DiskFormat getDefaultDiskType() { + // TODO Auto-generated method stub + return null; + } + + @Override + public DataObject create(DataObject obj) { + //create template on primary storage + if (obj.getType() == DataObjectType.TEMPLATE) { + VMTemplateStoragePoolVO templateStoragePoolRef = templatePoolDao.findByPoolTemplate(this.getId(), obj.getId()); + if (templateStoragePoolRef == null) { + try { + templateStoragePoolRef = new VMTemplateStoragePoolVO(this.getId(), obj.getId()); + templateStoragePoolRef = templatePoolDao.persist(templateStoragePoolRef); + } catch (Throwable t) { + templateStoragePoolRef = templatePoolDao.findByPoolTemplate(this.getId(), obj.getId()); + if (templateStoragePoolRef == null) { + throw new CloudRuntimeException("Failed to create template storage pool entry"); + } + } + } + + } + + return objectInStoreMgr.get(obj, this); + } + + @Override + public boolean delete(DataObject obj) { + // TODO Auto-generated method stub + return false; + } + + @Override + public long getDataCenterId() { + return this.pdsv.getDataCenterId(); + } + + @Override + public String getPath() { + return this.pdsv.getPath(); + } + + @Override + public StoragePoolType getPoolType() { + return this.pdsv.getPoolType(); + } + + @Override + public Date getCreated() { + return this.pdsv.getCreated(); + } + + @Override + public Date getUpdateTime() { + return this.pdsv.getUpdateTime(); + } + + @Override + public long getCapacityBytes() { + return this.pdsv.getCapacityBytes(); + } + + @Override + public long getAvailableBytes() { + return this.pdsv.getAvailableBytes(); + } + + @Override + public Long getClusterId() { + return this.pdsv.getClusterId(); + } + + @Override + public String getHostAddress() { + return this.pdsv.getHostAddress(); + } + + @Override + public String getUserInfo() { + return this.pdsv.getUserInfo(); + } + + @Override + public boolean isShared() { + return this.pdsv.getScope() == ScopeType.HOST ? false : true; + } + + @Override + public boolean isLocal() { + return !this.isShared(); + } + + @Override + public StoragePoolStatus getStatus() { + return this.pdsv.getStatus(); + } + + @Override + public int getPort() { + return this.pdsv.getPort(); + } + + @Override + public Long getPodId() { + return this.pdsv.getPodId(); + } + + @Override + public Long getStorageProviderId() { + return this.pdsv.getStorageProviderId(); + } + + @Override + public boolean isInMaintenance() { + return this.getStatus() == StoragePoolStatus.Maintenance ? true : false; + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/AncientPrimaryDataStoreDriverImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/AncientPrimaryDataStoreDriverImpl.java new file mode 100644 index 00000000000..440cb8c5ea0 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/AncientPrimaryDataStoreDriverImpl.java @@ -0,0 +1,362 @@ +/* + * 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.storage.datastore.driver; + +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.volume.VolumeObject; +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.ManageSnapshotAnswer; +import com.cloud.agent.api.ManageSnapshotCommand; +import com.cloud.agent.api.storage.CreateAnswer; +import com.cloud.agent.api.storage.CreateCommand; +import com.cloud.agent.api.storage.DestroyCommand; +import com.cloud.agent.api.storage.ResizeVolumeAnswer; +import com.cloud.agent.api.storage.ResizeVolumeCommand; +import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.exception.StorageUnavailableException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.storage.DiskOfferingVO; +import com.cloud.storage.ResizeVolumePayload; +import com.cloud.storage.Storage; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.SnapshotVO; +import com.cloud.storage.StorageManager; +import com.cloud.storage.StoragePool; +import com.cloud.storage.VMTemplateHostVO; +import com.cloud.storage.VMTemplateStoragePoolVO; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VolumeManager; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.DiskOfferingDao; +import com.cloud.storage.dao.SnapshotDao; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.template.TemplateManager; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.DiskProfile; +import com.cloud.vm.dao.VMInstanceDao; + +public class AncientPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver { + private static final Logger s_logger = Logger + .getLogger(AncientPrimaryDataStoreDriverImpl.class); + @Inject DiskOfferingDao diskOfferingDao; + @Inject VMTemplateDao templateDao; + @Inject VolumeDao volumeDao; + @Inject TemplateManager templateMgr; + @Inject HostDao hostDao; + @Inject StorageManager storageMgr; + @Inject VolumeManager volumeMgr; + @Inject VMInstanceDao vmDao; + @Inject SnapshotDao snapshotDao; + @Inject PrimaryDataStoreDao primaryStoreDao; + @Inject SnapshotManager snapshotMgr; + @Override + public String grantAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Set listObjects(DataStore store) { + // TODO Auto-generated method stub + return null; + } + + public boolean createVolume( + VolumeInfo volume) throws StorageUnavailableException { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Creating volume: " + volume); + } + + DiskOfferingVO offering = diskOfferingDao.findById(volume.getDiskOfferingId()); + DiskProfile diskProfile = new DiskProfile(volume, offering, + null); + + VMTemplateVO template = null; + if (volume.getTemplateId() != null) { + template = templateDao.findById(volume.getTemplateId()); + } + + StoragePool pool = (StoragePool)volume.getDataStore(); + VolumeVO vol = volumeDao.findById(volume.getId()); + if (pool != null) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Trying to create in " + pool); + } + vol.setPoolId(pool.getId()); + + CreateCommand cmd = null; + VMTemplateStoragePoolVO tmpltStoredOn = null; + + for (int i = 0; i < 2; i++) { + if (template != null + && template.getFormat() != Storage.ImageFormat.ISO) { + if (pool.getPoolType() == StoragePoolType.CLVM) { + // prepareISOForCreate does what we need, which is to + // tell us where the template is + VMTemplateHostVO tmpltHostOn = templateMgr + .prepareISOForCreate(template, pool); + if (tmpltHostOn == null) { + s_logger.debug("cannot find template " + + template.getId() + " " + + template.getName()); + throw new CloudRuntimeException("cannot find template" + + template.getId() + + template.getName()); + } + HostVO secondaryStorageHost = hostDao + .findById(tmpltHostOn.getHostId()); + String tmpltHostUrl = secondaryStorageHost + .getStorageUrl(); + String fullTmpltUrl = tmpltHostUrl + "/" + + tmpltHostOn.getInstallPath(); + cmd = new CreateCommand(diskProfile, fullTmpltUrl, + new StorageFilerTO(pool)); + } else { + tmpltStoredOn = templateMgr.prepareTemplateForCreate( + template, pool); + if (tmpltStoredOn == null) { + s_logger.debug("Cannot use this pool " + pool + + " because we can't propagate template " + + template); + throw new CloudRuntimeException("Cannot use this pool " + pool + + " because we can't propagate template " + + template); + } + cmd = new CreateCommand(diskProfile, + tmpltStoredOn.getLocalDownloadPath(), + new StorageFilerTO(pool)); + } + } else { + if (template != null + && Storage.ImageFormat.ISO == template.getFormat()) { + VMTemplateHostVO tmpltHostOn = templateMgr + .prepareISOForCreate(template, pool); + if (tmpltHostOn == null) { + throw new CloudRuntimeException( + "Did not find ISO in secondry storage in zone " + + pool.getDataCenterId()); + } + } + cmd = new CreateCommand(diskProfile, new StorageFilerTO( + pool)); + } + + Answer answer = storageMgr.sendToPool(pool, null, cmd); + if (answer.getResult()) { + CreateAnswer createAnswer = (CreateAnswer) answer; + vol.setFolder(pool.getPath()); + vol.setPath(createAnswer.getVolume().getPath()); + vol.setSize(createAnswer.getVolume().getSize()); + vol.setPoolType(pool.getPoolType()); + vol.setPoolId(pool.getId()); + vol.setPodId(pool.getPodId()); + this.volumeDao.update(vol.getId(), vol); + return true; + } else { + if (tmpltStoredOn != null + && (answer instanceof CreateAnswer) + && ((CreateAnswer) answer) + .templateReloadRequested()) { + if (!templateMgr + .resetTemplateDownloadStateOnPool(tmpltStoredOn + .getId())) { + break; // break out of template-redeploy retry loop + } + } else { + break; + } + } + } + } + + if (s_logger.isDebugEnabled()) { + s_logger.debug("Unable to create volume " + volume.getId()); + } + return false; + } + + @Override + public void createAsync(DataObject data, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + String errMsg = null; + if (data.getType() == DataObjectType.VOLUME) { + try { + createVolume((VolumeInfo)data); + } catch (StorageUnavailableException e) { + s_logger.debug("failed to create volume", e); + errMsg = e.toString(); + } catch (Exception e) { + s_logger.debug("failed to create volume", e); + errMsg = e.toString(); + } + } + CreateCmdResult result = new CreateCmdResult(null, null); + if (errMsg != null) { + result.setResult(errMsg); + } + + callback.complete(result); + + } + + @Override + public void deleteAsync(DataObject data, + AsyncCompletionCallback callback) { + + String vmName = null; + VolumeVO vol = this.volumeDao.findById(data.getId()); + + + StoragePool pool = (StoragePool)data.getDataStore(); + + DestroyCommand cmd = new DestroyCommand(pool, vol, vmName); + + CommandResult result = new CommandResult(); + try { + Answer answer = this.storageMgr.sendToPool(pool, cmd); + if (answer != null && !answer.getResult()) { + result.setResult(answer.getDetails()); + s_logger.info("Will retry delete of " + vol + " from " + pool.getId()); + } + } catch (StorageUnavailableException e) { + s_logger.error("Storage is unavailable currently. Will retry delete of " + + vol + " from " + pool.getId(), e); + result.setResult(e.toString()); + } catch (Exception ex) { + s_logger.debug("Unable to destoy volume" + vol + " from " + pool.getId(), ex); + result.setResult(ex.toString()); + } + callback.complete(result); + } + + @Override + public void copyAsync(DataObject srcdata, DataObject destData, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public boolean canCopy(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void takeSnapshot(SnapshotInfo snapshot, + AsyncCompletionCallback callback) { + CreateCmdResult result = null; + try { + VolumeInfo volume = snapshot.getBaseVolume(); + String vmName = this.volumeMgr.getVmNameOnVolume(volume); + SnapshotVO preSnapshotVO = this.snapshotMgr.getParentSnapshot(volume, snapshot); + String parentSnapshotPath = null; + if (preSnapshotVO != null) { + parentSnapshotPath = preSnapshotVO.getPath(); + } + StoragePool srcPool = (StoragePool)volume.getDataStore(); + + ManageSnapshotCommand cmd = new ManageSnapshotCommand(snapshot.getId(), volume.getPath(), srcPool, parentSnapshotPath, snapshot.getName(), vmName); + + ManageSnapshotAnswer answer = (ManageSnapshotAnswer) this.snapshotMgr.sendToPool(volume, cmd); + + if ((answer != null) && answer.getResult()) { + result = new CreateCmdResult(answer.getSnapshotPath(), null); + } else { + result = new CreateCmdResult(null, null); + } + } catch (Exception e) { + s_logger.debug("Failed to take snapshot: " + snapshot.getId(), e); + result = new CreateCmdResult(null, null); + result.setResult(e.toString()); + } + callback.complete(result); + } + + @Override + public void revertSnapshot(SnapshotInfo snapshot, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(DataObject data, + AsyncCompletionCallback callback) { + VolumeObject vol = (VolumeObject)data; + StoragePool pool = (StoragePool)data.getDataStore(); + ResizeVolumePayload resizeParameter = (ResizeVolumePayload)vol.getpayload(); + + ResizeVolumeCommand resizeCmd = new ResizeVolumeCommand( + vol.getPath(), new StorageFilerTO(pool), vol.getSize(), + resizeParameter.newSize, resizeParameter.shrinkOk, resizeParameter.instanceName); + CreateCmdResult result = new CreateCmdResult(null, null); + try { + ResizeVolumeAnswer answer = (ResizeVolumeAnswer) this.storageMgr.sendToPool(pool, + resizeParameter.hosts, resizeCmd); + if (answer != null && answer.getResult()) { + long finalSize = answer.getNewSize(); + s_logger.debug("Resize: volume started at size " + vol.getSize() + + " and ended at size " + finalSize); + + vol.setSize(finalSize); + vol.update(); + } else if (answer != null) { + result.setResult(answer.getDetails()); + } else { + s_logger.debug("return a null answer, mark it as failed for unknown reason"); + result.setResult("return a null answer, mark it as failed for unknown reason"); + } + + } catch (Exception e) { + s_logger.debug("sending resize command failed", e); + result.setResult(e.toString()); + } + + callback.complete(result); + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java new file mode 100644 index 00000000000..6d0c2c6862b --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/DefaultPrimaryDataStoreDriverImpl.java @@ -0,0 +1,249 @@ +// 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.storage.datastore.driver; + +import java.net.URISyntaxException; +import java.util.Set; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.command.CreateObjectAnswer; +import org.apache.cloudstack.storage.command.CreateObjectCommand; +import org.apache.cloudstack.storage.command.DeleteCommand; +import org.apache.cloudstack.storage.datastore.DataObjectManager; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.storage.dao.StoragePoolHostDao; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.storage.encoding.DecodedDataObject; +import com.cloud.utils.storage.encoding.Decoder; + + +public class DefaultPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver { + private static final Logger s_logger = Logger.getLogger(DefaultPrimaryDataStoreDriverImpl.class); + @Inject + EndPointSelector selector; + @Inject + StoragePoolHostDao storeHostDao; + @Inject + DataObjectManager dataObjMgr; + public DefaultPrimaryDataStoreDriverImpl() { + + } + + private class CreateVolumeContext extends AsyncRpcConext { + private final DataObject volume; + /** + * @param callback + */ + public CreateVolumeContext(AsyncCompletionCallback callback, DataObject volume) { + super(callback); + this.volume = volume; + } + + public DataObject getVolume() { + return this.volume; + } + + } + + public Void createAsyncCallback(AsyncCallbackDispatcher callback, CreateVolumeContext context) { + CreateCmdResult result = null; + CreateObjectAnswer volAnswer = (CreateObjectAnswer) callback.getResult(); + if (volAnswer.getResult()) { + result = new CreateCmdResult(volAnswer.getPath(), volAnswer.getSize()); + } else { + result = new CreateCmdResult("", null); + result.setResult(volAnswer.getDetails()); + } + + context.getParentCallback().complete(result); + return null; + } + + @Override + public void deleteAsync(DataObject vo, AsyncCompletionCallback callback) { + DeleteCommand cmd = new DeleteCommand(vo.getUri()); + + EndPoint ep = selector.select(vo); + AsyncRpcConext context = new AsyncRpcConext(callback); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().deleteCallback(null, null)) + .setContext(context); + ep.sendMessageAsync(cmd, caller); + } + + public Void deleteCallback(AsyncCallbackDispatcher callback, AsyncRpcConext context) { + CommandResult result = new CommandResult(); + Answer answer = callback.getResult(); + if (!answer.getResult()) { + result.setResult(answer.getDetails()); + } + context.getParentCallback().complete(result); + return null; + } + /* + private class CreateVolumeFromBaseImageContext extends AsyncRpcConext { + private final VolumeObject volume; + + public CreateVolumeFromBaseImageContext(AsyncCompletionCallback callback, VolumeObject volume) { + super(callback); + this.volume = volume; + } + + public VolumeObject getVolume() { + return this.volume; + } + + } + + @Override + public void createVolumeFromBaseImageAsync(VolumeObject volume, TemplateInfo template, AsyncCompletionCallback callback) { + VolumeTO vol = this.dataStore.getVolumeTO(volume); + List endPoints = this.dataStore.getEndPoints(); + EndPoint ep = endPoints.get(0); + String templateUri = template.getDataStore().grantAccess(template, ep); + CreateVolumeFromBaseImageCommand cmd = new CreateVolumeFromBaseImageCommand(vol, templateUri); + + CreateVolumeFromBaseImageContext context = new CreateVolumeFromBaseImageContext(callback, volume); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setContext(context) + .setCallback(caller.getTarget().createVolumeFromBaseImageAsyncCallback(null, null)); + + ep.sendMessageAsync(cmd, caller); + }*/ + /* + public Object createVolumeFromBaseImageAsyncCallback(AsyncCallbackDispatcher callback, CreateVolumeFromBaseImageContext context) { + CreateVolumeAnswer answer = (CreateVolumeAnswer)callback.getResult(); + CommandResult result = new CommandResult(); + if (answer == null || answer.getDetails() != null) { + result.setSucess(false); + if (answer != null) { + result.setResult(answer.getDetails()); + } + } else { + result.setSucess(true); + VolumeObject volume = context.getVolume(); + volume.setPath(answer.getVolumeUuid()); + } + AsyncCompletionCallback parentCall = context.getParentCallback(); + parentCall.complete(result); + return null; + }*/ + + @Override + public void createAsync(DataObject vol, + AsyncCompletionCallback callback) { + EndPoint ep = selector.select(vol); + CreateObjectCommand createCmd = new CreateObjectCommand(vol.getUri()); + + CreateVolumeContext context = new CreateVolumeContext(callback, vol); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setContext(context) + .setCallback(caller.getTarget().createAsyncCallback(null, null)); + + ep.sendMessageAsync(createCmd, caller); + } + + @Override + public String grantAccess(DataObject object, EndPoint ep) { + //StoragePoolHostVO poolHost = storeHostDao.findByPoolHost(object.getDataStore().getId(), ep.getId()); + + String uri = object.getUri(); + try { + DecodedDataObject obj = Decoder.decode(uri); + if (obj.getPath() == null) { + //create an obj + EndPoint newEp = selector.select(object); + CreateObjectCommand createCmd = new CreateObjectCommand(uri); + CreateObjectAnswer answer = (CreateObjectAnswer)ep.sendMessage(createCmd); + if (answer.getResult()) { + dataObjMgr.update(object, answer.getPath(), answer.getSize()); + } else { + s_logger.debug("failed to create object" + answer.getDetails()); + throw new CloudRuntimeException("failed to create object" + answer.getDetails()); + } + } + + return object.getUri(); + } catch (URISyntaxException e) { + throw new CloudRuntimeException("uri parsed error", e); + } + } + + @Override + public boolean revokeAccess(DataObject vol, EndPoint ep) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Set listObjects(DataStore store) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void revertSnapshot(SnapshotInfo snapshot, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + + + @Override + public boolean canCopy(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void copyAsync(DataObject srcdata, DataObject destData, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(DataObject data, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void takeSnapshot(SnapshotInfo snapshot, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/driver/PrimaryDataStoreDriver.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCyclImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCyclImpl.java new file mode 100644 index 00000000000..2167ba19a32 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/AncientPrimaryDataStoreLifeCyclImpl.java @@ -0,0 +1,958 @@ +/* + * 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.storage.datastore.lifecycle; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus; +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.ScopeType; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.CreateStoragePoolCommand; +import com.cloud.agent.api.DeleteStoragePoolCommand; +import com.cloud.agent.api.ModifyStoragePoolCommand; +import com.cloud.agent.api.StoragePoolInfo; +import com.cloud.alert.AlertManager; +import com.cloud.capacity.Capacity; +import com.cloud.capacity.CapacityVO; +import com.cloud.capacity.dao.CapacityDao; +import com.cloud.exception.DiscoveryException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.Status; +import com.cloud.resource.ResourceManager; +import com.cloud.server.ManagementServer; +import com.cloud.storage.OCFS2Manager; +import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.StorageManager; +import com.cloud.storage.StoragePool; +import com.cloud.storage.StoragePoolDiscoverer; +import com.cloud.storage.StoragePoolHostVO; +import com.cloud.storage.StoragePoolStatus; +import com.cloud.storage.StoragePoolWorkVO; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.StoragePoolHostDao; +import com.cloud.storage.dao.StoragePoolWorkDao; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.user.Account; +import com.cloud.user.User; +import com.cloud.user.UserContext; +import com.cloud.user.dao.UserDao; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.UriUtils; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.exception.ExecutionException; +import com.cloud.vm.ConsoleProxyVO; +import com.cloud.vm.DomainRouterVO; +import com.cloud.vm.SecondaryStorageVmVO; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.dao.ConsoleProxyDao; +import com.cloud.vm.dao.DomainRouterDao; +import com.cloud.vm.dao.SecondaryStorageVmDao; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.dao.VMInstanceDao; + +public class AncientPrimaryDataStoreLifeCyclImpl implements + PrimaryDataStoreLifeCycle { + private static final Logger s_logger = Logger + .getLogger(AncientPrimaryDataStoreLifeCyclImpl.class); + @Inject + protected ResourceManager _resourceMgr; + protected List _discoverers; + @Inject + PrimaryDataStoreDao primaryDataStoreDao; + @Inject + protected OCFS2Manager _ocfs2Mgr; + @Inject + DataStoreManager dataStoreMgr; + @Inject + AgentManager agentMgr; + @Inject + StorageManager storageMgr; + @Inject + protected CapacityDao _capacityDao; + + @Inject + VolumeDao volumeDao; + @Inject + VMInstanceDao vmDao; + @Inject + ManagementServer server; + @Inject + protected VirtualMachineManager vmMgr; + @Inject + protected SecondaryStorageVmDao _secStrgDao; + @Inject + UserVmDao userVmDao; + @Inject + protected UserDao _userDao; + @Inject + protected DomainRouterDao _domrDao; + @Inject + protected StoragePoolHostDao _storagePoolHostDao; + @Inject + protected AlertManager _alertMgr; + + + + @Inject + protected ConsoleProxyDao _consoleProxyDao; + + @Inject + protected StoragePoolWorkDao _storagePoolWorkDao; + + @Override + public DataStore initialize(Map dsInfos) { + Long clusterId = (Long) dsInfos.get("clusterId"); + Long podId = (Long) dsInfos.get("podId"); + Long zoneId = (Long) dsInfos.get("zoneId"); + String url = (String) dsInfos.get("url"); + Long providerId = (Long)dsInfos.get("providerId"); + if (clusterId != null && podId == null) { + throw new InvalidParameterValueException( + "Cluster id requires pod id"); + } + + URI uri = null; + try { + uri = new URI(UriUtils.encodeURIComponent(url)); + if (uri.getScheme() == null) { + throw new InvalidParameterValueException("scheme is null " + + url + ", add nfs:// as a prefix"); + } else if (uri.getScheme().equalsIgnoreCase("nfs")) { + String uriHost = uri.getHost(); + String uriPath = uri.getPath(); + if (uriHost == null || uriPath == null + || uriHost.trim().isEmpty() || uriPath.trim().isEmpty()) { + throw new InvalidParameterValueException( + "host or path is null, should be nfs://hostname/path"); + } + } else if (uri.getScheme().equalsIgnoreCase("sharedMountPoint")) { + String uriPath = uri.getPath(); + if (uriPath == null) { + throw new InvalidParameterValueException( + "host or path is null, should be sharedmountpoint://localhost/path"); + } + } else if (uri.getScheme().equalsIgnoreCase("rbd")) { + String uriPath = uri.getPath(); + if (uriPath == null) { + throw new InvalidParameterValueException( + "host or path is null, should be rbd://hostname/pool"); + } + } + } catch (URISyntaxException e) { + throw new InvalidParameterValueException(url + + " is not a valid uri"); + } + + String tags = (String) dsInfos.get("tags"); + Map details = (Map) dsInfos + .get("details"); + if (tags != null) { + String[] tokens = tags.split(","); + + for (String tag : tokens) { + tag = tag.trim(); + if (tag.length() == 0) { + continue; + } + details.put(tag, "true"); + } + } + + String scheme = uri.getScheme(); + String storageHost = uri.getHost(); + String hostPath = uri.getPath(); + Object localStorage = dsInfos.get("localStorage"); + if (localStorage != null) { + hostPath = hostPath.replace("/", ""); + } + String userInfo = uri.getUserInfo(); + int port = uri.getPort(); + StoragePoolVO pool = null; + if (s_logger.isDebugEnabled()) { + s_logger.debug("createPool Params @ scheme - " + scheme + + " storageHost - " + storageHost + " hostPath - " + + hostPath + " port - " + port); + } + if (scheme.equalsIgnoreCase("nfs")) { + if (port == -1) { + port = 2049; + } + pool = new StoragePoolVO(StoragePoolType.NetworkFilesystem, + storageHost, port, hostPath); + if (clusterId == null) { + throw new IllegalArgumentException( + "NFS need to have clusters specified for XenServers"); + } + } else if (scheme.equalsIgnoreCase("file")) { + if (port == -1) { + port = 0; + } + pool = new StoragePoolVO(StoragePoolType.Filesystem, + "localhost", 0, hostPath); + } else if (scheme.equalsIgnoreCase("sharedMountPoint")) { + pool = new StoragePoolVO(StoragePoolType.SharedMountPoint, + storageHost, 0, hostPath); + } else if (scheme.equalsIgnoreCase("clvm")) { + pool = new StoragePoolVO(StoragePoolType.CLVM, storageHost, 0, + hostPath.replaceFirst("/", "")); + } else if (scheme.equalsIgnoreCase("rbd")) { + if (port == -1) { + port = 6789; + } + pool = new StoragePoolVO(StoragePoolType.RBD, storageHost, + port, hostPath.replaceFirst("/", "")); + pool.setUserInfo(userInfo); + } else if (scheme.equalsIgnoreCase("PreSetup")) { + pool = new StoragePoolVO(StoragePoolType.PreSetup, + storageHost, 0, hostPath); + } else if (scheme.equalsIgnoreCase("iscsi")) { + String[] tokens = hostPath.split("/"); + int lun = NumbersUtil.parseInt(tokens[tokens.length - 1], -1); + if (port == -1) { + port = 3260; + } + if (lun != -1) { + if (clusterId == null) { + throw new IllegalArgumentException( + "IscsiLUN need to have clusters specified"); + } + hostPath.replaceFirst("/", ""); + pool = new StoragePoolVO(StoragePoolType.IscsiLUN, + storageHost, port, hostPath); + } else { + for (StoragePoolDiscoverer discoverer : _discoverers) { + Map> pools; + try { + pools = discoverer.find(zoneId, podId, uri, details); + } catch (DiscoveryException e) { + throw new IllegalArgumentException( + "Not enough information for discovery " + uri, + e); + } + if (pools != null) { + Map.Entry> entry = pools + .entrySet().iterator().next(); + pool = entry.getKey(); + details = entry.getValue(); + break; + } + } + } + } else if (scheme.equalsIgnoreCase("iso")) { + if (port == -1) { + port = 2049; + } + pool = new StoragePoolVO(StoragePoolType.ISO, storageHost, + port, hostPath); + } else if (scheme.equalsIgnoreCase("vmfs")) { + pool = new StoragePoolVO(StoragePoolType.VMFS, + "VMFS datastore: " + hostPath, 0, hostPath); + } else if (scheme.equalsIgnoreCase("ocfs2")) { + port = 7777; + pool = new StoragePoolVO(StoragePoolType.OCFS2, "clustered", + port, hostPath); + } else { + StoragePoolType type = Enum.valueOf(StoragePoolType.class, scheme); + + if (type != null) { + pool = new StoragePoolVO(type, storageHost, + 0, hostPath); + } else { + s_logger.warn("Unable to figure out the scheme for URI: " + uri); + throw new IllegalArgumentException( + "Unable to figure out the scheme for URI: " + uri); + } + } + + if (pool == null) { + s_logger.warn("Unable to figure out the scheme for URI: " + uri); + throw new IllegalArgumentException( + "Unable to figure out the scheme for URI: " + uri); + } + + if (localStorage == null) { + List pools = primaryDataStoreDao + .listPoolByHostPath(storageHost, hostPath); + if (!pools.isEmpty() && !scheme.equalsIgnoreCase("sharedmountpoint")) { + Long oldPodId = pools.get(0).getPodId(); + throw new CloudRuntimeException("Storage pool " + uri + + " already in use by another pod (id=" + oldPodId + ")"); + } + } + + long poolId = primaryDataStoreDao.getNextInSequence(Long.class, "id"); + Object existingUuid = dsInfos.get("uuid"); + String uuid = null; + + if (existingUuid != null) { + uuid = (String)existingUuid; + } else if (scheme.equalsIgnoreCase("sharedmountpoint") + || scheme.equalsIgnoreCase("clvm")) { + uuid = UUID.randomUUID().toString(); + } else if (scheme.equalsIgnoreCase("PreSetup")) { + uuid = hostPath.replace("/", ""); + } else { + uuid = UUID.nameUUIDFromBytes( + new String(storageHost + hostPath).getBytes()).toString(); + } + + List spHandles = primaryDataStoreDao + .findIfDuplicatePoolsExistByUUID(uuid); + if ((spHandles != null) && (spHandles.size() > 0)) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Another active pool with the same uuid already exists"); + } + throw new CloudRuntimeException( + "Another active pool with the same uuid already exists"); + } + + String poolName = (String) dsInfos.get("name"); + if (s_logger.isDebugEnabled()) { + s_logger.debug("In createPool Setting poolId - " + poolId + + " uuid - " + uuid + " zoneId - " + zoneId + " podId - " + + podId + " poolName - " + poolName); + } + + pool.setId(poolId); + pool.setUuid(uuid); + pool.setDataCenterId(zoneId); + pool.setPodId(podId); + pool.setName(poolName); + pool.setClusterId(clusterId); + pool.setStorageProviderId(providerId); + pool.setStatus(StoragePoolStatus.Initialized); + pool = primaryDataStoreDao.persist(pool, details); + + return dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary); + } + + protected boolean createStoragePool(long hostId, StoragePool pool) { + s_logger.debug("creating pool " + pool.getName() + " on host " + + hostId); + if (pool.getPoolType() != StoragePoolType.NetworkFilesystem + && pool.getPoolType() != StoragePoolType.Filesystem + && pool.getPoolType() != StoragePoolType.IscsiLUN + && pool.getPoolType() != StoragePoolType.Iscsi + && pool.getPoolType() != StoragePoolType.VMFS + && pool.getPoolType() != StoragePoolType.SharedMountPoint + && pool.getPoolType() != StoragePoolType.PreSetup + && pool.getPoolType() != StoragePoolType.OCFS2 + && pool.getPoolType() != StoragePoolType.RBD + && pool.getPoolType() != StoragePoolType.CLVM) { + s_logger.warn(" Doesn't support storage pool type " + + pool.getPoolType()); + return false; + } + CreateStoragePoolCommand cmd = new CreateStoragePoolCommand(true, pool); + final Answer answer = agentMgr.easySend(hostId, cmd); + if (answer != null && answer.getResult()) { + return true; + } else { + primaryDataStoreDao.expunge(pool.getId()); + String msg = ""; + if (answer != null) { + msg = "Can not create storage pool through host " + hostId + + " due to " + answer.getDetails(); + s_logger.warn(msg); + } else { + msg = "Can not create storage pool through host " + hostId + + " due to CreateStoragePoolCommand returns null"; + s_logger.warn(msg); + } + throw new CloudRuntimeException(msg); + } + } + + @Override + public boolean attachCluster(DataStore store, ClusterScope scope) { + PrimaryDataStoreInfo primarystore = (PrimaryDataStoreInfo) store; + // Check if there is host up in this cluster + List allHosts = _resourceMgr.listAllUpAndEnabledHosts( + Host.Type.Routing, primarystore.getClusterId(), + primarystore.getPodId(), primarystore.getDataCenterId()); + if (allHosts.isEmpty()) { + throw new CloudRuntimeException( + "No host up to associate a storage pool with in cluster " + + primarystore.getClusterId()); + } + + if (primarystore.getPoolType() == StoragePoolType.OCFS2 + && !_ocfs2Mgr.prepareNodes(allHosts, primarystore)) { + s_logger.warn("Can not create storage pool " + primarystore + + " on cluster " + primarystore.getClusterId()); + primaryDataStoreDao.expunge(primarystore.getId()); + return false; + } + + boolean success = false; + for (HostVO h : allHosts) { + success = createStoragePool(h.getId(), primarystore); + if (success) { + break; + } + } + + s_logger.debug("In createPool Adding the pool to each of the hosts"); + List poolHosts = new ArrayList(); + for (HostVO h : allHosts) { + try { + this.storageMgr.connectHostToSharedPool(h.getId(), + primarystore.getId()); + poolHosts.add(h); + } catch (Exception e) { + s_logger.warn("Unable to establish a connection between " + h + + " and " + primarystore, e); + } + } + + if (poolHosts.isEmpty()) { + s_logger.warn("No host can access storage pool " + primarystore + + " on cluster " + primarystore.getClusterId()); + primaryDataStoreDao.expunge(primarystore.getId()); + return false; + } else { + storageMgr.createCapacityEntry(primarystore.getId()); + } + StoragePoolVO pool = this.primaryDataStoreDao.findById(store.getId()); + pool.setScope(ScopeType.CLUSTER); + pool.setStatus(StoragePoolStatus.Up); + this.primaryDataStoreDao.update(pool.getId(), pool); + return true; + } + + @Override + public boolean attachZone(DataStore dataStore, ZoneScope scope) { + StoragePoolVO pool = this.primaryDataStoreDao.findById(dataStore.getId()); + pool.setScope(ScopeType.ZONE); + pool.setStatus(StoragePoolStatus.Up); + this.primaryDataStoreDao.update(pool.getId(), pool); + return true; + } + + @Override + public boolean dettach() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean unmanaged() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean maintain(long storeId) { + Long userId = UserContext.current().getCallerUserId(); + User user = _userDao.findById(userId); + Account account = UserContext.current().getCaller(); + StoragePoolVO pool = this.primaryDataStoreDao.findById(storeId); + try { + StoragePool storagePool = (StoragePool) this.dataStoreMgr + .getDataStore(storeId, DataStoreRole.Primary); + List hosts = _resourceMgr.listHostsInClusterByStatus( + pool.getClusterId(), Status.Up); + if (hosts == null || hosts.size() == 0) { + pool.setStatus(StoragePoolStatus.Maintenance); + primaryDataStoreDao.update(pool.getId(), pool); + return true; + } else { + // set the pool state to prepare for maintenance + pool.setStatus(StoragePoolStatus.PrepareForMaintenance); + primaryDataStoreDao.update(pool.getId(), pool); + } + // remove heartbeat + for (HostVO host : hosts) { + ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand( + false, storagePool); + final Answer answer = agentMgr.easySend(host.getId(), cmd); + if (answer == null || !answer.getResult()) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("ModifyStoragePool false failed due to " + + ((answer == null) ? "answer null" : answer + .getDetails())); + } + } else { + if (s_logger.isDebugEnabled()) { + s_logger.debug("ModifyStoragePool false secceeded"); + } + } + } + // check to see if other ps exist + // if they do, then we can migrate over the system vms to them + // if they dont, then just stop all vms on this one + List upPools = primaryDataStoreDao + .listByStatusInZone(pool.getDataCenterId(), + DataStoreStatus.Up); + boolean restart = true; + if (upPools == null || upPools.size() == 0) { + restart = false; + } + + // 2. Get a list of all the ROOT volumes within this storage pool + List allVolumes = this.volumeDao.findByPoolId(pool + .getId()); + + // 3. Enqueue to the work queue + for (VolumeVO volume : allVolumes) { + VMInstanceVO vmInstance = vmDao + .findById(volume.getInstanceId()); + + if (vmInstance == null) { + continue; + } + + // enqueue sp work + if (vmInstance.getState().equals(State.Running) + || vmInstance.getState().equals(State.Starting) + || vmInstance.getState().equals(State.Stopping)) { + + try { + StoragePoolWorkVO work = new StoragePoolWorkVO( + vmInstance.getId(), pool.getId(), false, false, + server.getId()); + _storagePoolWorkDao.persist(work); + } catch (Exception e) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Work record already exists, re-using by re-setting values"); + } + StoragePoolWorkVO work = _storagePoolWorkDao + .findByPoolIdAndVmId(pool.getId(), + vmInstance.getId()); + work.setStartedAfterMaintenance(false); + work.setStoppedForMaintenance(false); + work.setManagementServerId(server.getId()); + _storagePoolWorkDao.update(work.getId(), work); + } + } + } + + // 4. Process the queue + List pendingWork = _storagePoolWorkDao + .listPendingWorkForPrepareForMaintenanceByPoolId(pool + .getId()); + + for (StoragePoolWorkVO work : pendingWork) { + // shut down the running vms + VMInstanceVO vmInstance = vmDao.findById(work.getVmId()); + + if (vmInstance == null) { + continue; + } + + // if the instance is of type consoleproxy, call the console + // proxy + if (vmInstance.getType().equals( + VirtualMachine.Type.ConsoleProxy)) { + // call the consoleproxymanager + ConsoleProxyVO consoleProxy = _consoleProxyDao + .findById(vmInstance.getId()); + if (!vmMgr.advanceStop(consoleProxy, true, user, account)) { + String errorMsg = "There was an error stopping the console proxy id: " + + vmInstance.getId() + + " ,cannot enable storage maintenance"; + s_logger.warn(errorMsg); + throw new CloudRuntimeException(errorMsg); + } else { + // update work status + work.setStoppedForMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + + if (restart) { + + if (this.vmMgr.advanceStart(consoleProxy, null, user, + account) == null) { + String errorMsg = "There was an error starting the console proxy id: " + + vmInstance.getId() + + " on another storage pool, cannot enable primary storage maintenance"; + s_logger.warn(errorMsg); + } else { + // update work status + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + } + + // if the instance is of type uservm, call the user vm manager + if (vmInstance.getType().equals(VirtualMachine.Type.User)) { + UserVmVO userVm = userVmDao.findById(vmInstance.getId()); + if (!vmMgr.advanceStop(userVm, true, user, account)) { + String errorMsg = "There was an error stopping the user vm id: " + + vmInstance.getId() + + " ,cannot enable storage maintenance"; + s_logger.warn(errorMsg); + throw new CloudRuntimeException(errorMsg); + } else { + // update work status + work.setStoppedForMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + + // if the instance is of type secondary storage vm, call the + // secondary storage vm manager + if (vmInstance.getType().equals( + VirtualMachine.Type.SecondaryStorageVm)) { + SecondaryStorageVmVO secStrgVm = _secStrgDao + .findById(vmInstance.getId()); + if (!vmMgr.advanceStop(secStrgVm, true, user, account)) { + String errorMsg = "There was an error stopping the ssvm id: " + + vmInstance.getId() + + " ,cannot enable storage maintenance"; + s_logger.warn(errorMsg); + throw new CloudRuntimeException(errorMsg); + } else { + // update work status + work.setStoppedForMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + + if (restart) { + if (vmMgr.advanceStart(secStrgVm, null, user, account) == null) { + String errorMsg = "There was an error starting the ssvm id: " + + vmInstance.getId() + + " on another storage pool, cannot enable primary storage maintenance"; + s_logger.warn(errorMsg); + } else { + // update work status + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + } + + // if the instance is of type domain router vm, call the network + // manager + if (vmInstance.getType().equals( + VirtualMachine.Type.DomainRouter)) { + DomainRouterVO domR = _domrDao.findById(vmInstance.getId()); + if (!vmMgr.advanceStop(domR, true, user, account)) { + String errorMsg = "There was an error stopping the domain router id: " + + vmInstance.getId() + + " ,cannot enable primary storage maintenance"; + s_logger.warn(errorMsg); + throw new CloudRuntimeException(errorMsg); + } else { + // update work status + work.setStoppedForMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + + if (restart) { + if (vmMgr.advanceStart(domR, null, user, account) == null) { + String errorMsg = "There was an error starting the domain router id: " + + vmInstance.getId() + + " on another storage pool, cannot enable primary storage maintenance"; + s_logger.warn(errorMsg); + } else { + // update work status + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + } + } + + // 5. Update the status + pool.setStatus(StoragePoolStatus.Maintenance); + this.primaryDataStoreDao.update(pool.getId(), pool); + + return true; + } catch (Exception e) { + s_logger.error( + "Exception in enabling primary storage maintenance:", e); + setPoolStateToError(pool); + throw new CloudRuntimeException(e.getMessage()); + } + } + + private void setPoolStateToError(StoragePoolVO primaryStorage) { + primaryStorage.setStatus(StoragePoolStatus.ErrorInMaintenance); + this.primaryDataStoreDao.update(primaryStorage.getId(), primaryStorage); + } + + @Override + public boolean cancelMaintain(long storageId) { + // Change the storage state back to up + Long userId = UserContext.current().getCallerUserId(); + User user = _userDao.findById(userId); + Account account = UserContext.current().getCaller(); + StoragePoolVO poolVO = this.primaryDataStoreDao + .findById(storageId); + StoragePool pool = (StoragePool) this.dataStoreMgr.getDataStore( + storageId, DataStoreRole.Primary); + poolVO.setStatus(StoragePoolStatus.Up); + primaryDataStoreDao.update(storageId, poolVO); + + List hosts = _resourceMgr.listHostsInClusterByStatus( + pool.getClusterId(), Status.Up); + if (hosts == null || hosts.size() == 0) { + return true; + } + // add heartbeat + for (HostVO host : hosts) { + ModifyStoragePoolCommand msPoolCmd = new ModifyStoragePoolCommand( + true, pool); + final Answer answer = agentMgr.easySend(host.getId(), msPoolCmd); + if (answer == null || !answer.getResult()) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("ModifyStoragePool add failed due to " + + ((answer == null) ? "answer null" : answer + .getDetails())); + } + } else { + if (s_logger.isDebugEnabled()) { + s_logger.debug("ModifyStoragePool add secceeded"); + } + } + } + + // 2. Get a list of pending work for this queue + List pendingWork = _storagePoolWorkDao + .listPendingWorkForCancelMaintenanceByPoolId(poolVO.getId()); + + // 3. work through the queue + for (StoragePoolWorkVO work : pendingWork) { + try { + VMInstanceVO vmInstance = vmDao.findById(work.getVmId()); + + if (vmInstance == null) { + continue; + } + + // if the instance is of type consoleproxy, call the console + // proxy + if (vmInstance.getType().equals( + VirtualMachine.Type.ConsoleProxy)) { + + ConsoleProxyVO consoleProxy = _consoleProxyDao + .findById(vmInstance.getId()); + if (vmMgr.advanceStart(consoleProxy, null, user, account) == null) { + String msg = "There was an error starting the console proxy id: " + + vmInstance.getId() + + " on storage pool, cannot complete primary storage maintenance"; + s_logger.warn(msg); + throw new ExecutionException(msg); + } else { + // update work queue + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + + // if the instance is of type ssvm, call the ssvm manager + if (vmInstance.getType().equals( + VirtualMachine.Type.SecondaryStorageVm)) { + SecondaryStorageVmVO ssVm = _secStrgDao.findById(vmInstance + .getId()); + if (vmMgr.advanceStart(ssVm, null, user, account) == null) { + String msg = "There was an error starting the ssvm id: " + + vmInstance.getId() + + " on storage pool, cannot complete primary storage maintenance"; + s_logger.warn(msg); + throw new ExecutionException(msg); + } else { + // update work queue + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + + // if the instance is of type ssvm, call the ssvm manager + if (vmInstance.getType().equals( + VirtualMachine.Type.DomainRouter)) { + DomainRouterVO domR = _domrDao.findById(vmInstance.getId()); + if (vmMgr.advanceStart(domR, null, user, account) == null) { + String msg = "There was an error starting the domR id: " + + vmInstance.getId() + + " on storage pool, cannot complete primary storage maintenance"; + s_logger.warn(msg); + throw new ExecutionException(msg); + } else { + // update work queue + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + + // if the instance is of type user vm, call the user vm manager + if (vmInstance.getType().equals(VirtualMachine.Type.User)) { + UserVmVO userVm = userVmDao.findById(vmInstance.getId()); + + if (vmMgr.advanceStart(userVm, null, user, account) == null) { + + String msg = "There was an error starting the user vm id: " + + vmInstance.getId() + + " on storage pool, cannot complete primary storage maintenance"; + s_logger.warn(msg); + throw new ExecutionException(msg); + } else { + // update work queue + work.setStartedAfterMaintenance(true); + _storagePoolWorkDao.update(work.getId(), work); + } + } + } catch (Exception e) { + s_logger.debug("Failed start vm", e); + throw new CloudRuntimeException(e.toString()); + } + } + return true; + } + + @DB + @Override + public boolean deleteDataStore(long storeId) { + // for the given pool id, find all records in the storage_pool_host_ref + List hostPoolRecords = this._storagePoolHostDao + .listByPoolId(storeId); + StoragePoolVO poolVO = this.primaryDataStoreDao.findById(storeId); + StoragePool pool = (StoragePool)this.dataStoreMgr.getDataStore(storeId, DataStoreRole.Primary); + boolean deleteFlag = false; + Transaction txn = Transaction.currentTxn(); + try { + // if not records exist, delete the given pool (base case) + if (hostPoolRecords.size() == 0) { + + txn.start(); + poolVO.setUuid(null); + this.primaryDataStoreDao.update(poolVO.getId(), poolVO); + primaryDataStoreDao.remove(poolVO.getId()); + deletePoolStats(poolVO.getId()); + txn.commit(); + + deleteFlag = true; + return true; + } else { + // Remove the SR associated with the Xenserver + for (StoragePoolHostVO host : hostPoolRecords) { + DeleteStoragePoolCommand deleteCmd = new DeleteStoragePoolCommand( + pool); + final Answer answer = agentMgr.easySend(host.getHostId(), + deleteCmd); + + if (answer != null && answer.getResult()) { + deleteFlag = true; + break; + } + } + } + } finally { + if (deleteFlag) { + // now delete the storage_pool_host_ref and storage_pool records + txn.start(); + for (StoragePoolHostVO host : hostPoolRecords) { + _storagePoolHostDao.deleteStoragePoolHostDetails( + host.getHostId(), host.getPoolId()); + } + poolVO.setUuid(null); + this.primaryDataStoreDao.update(poolVO.getId(), poolVO); + primaryDataStoreDao.remove(poolVO.getId()); + deletePoolStats(poolVO.getId()); + // Delete op_host_capacity entries + this._capacityDao.removeBy(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED, + null, null, null, poolVO.getId()); + txn.commit(); + + s_logger.debug("Storage pool id=" + poolVO.getId() + + " is removed successfully"); + return true; + } else { + // alert that the storage cleanup is required + s_logger.warn("Failed to Delete storage pool id: " + poolVO.getId()); + _alertMgr + .sendAlert(AlertManager.ALERT_TYPE_STORAGE_DELETE, + poolVO.getDataCenterId(), poolVO.getPodId(), + "Unable to delete storage pool id= " + poolVO.getId(), + "Delete storage pool command failed. Please check logs."); + } + } + return false; + } + + @DB + private boolean deletePoolStats(Long poolId) { + CapacityVO capacity1 = _capacityDao.findByHostIdType(poolId, + CapacityVO.CAPACITY_TYPE_STORAGE); + CapacityVO capacity2 = _capacityDao.findByHostIdType(poolId, + CapacityVO.CAPACITY_TYPE_STORAGE_ALLOCATED); + Transaction txn = Transaction.currentTxn(); + txn.start(); + if (capacity1 != null) { + _capacityDao.remove(capacity1.getId()); + } + + if (capacity2 != null) { + _capacityDao.remove(capacity2.getId()); + } + + txn.commit(); + return true; + } + + @Override + public boolean attachHost(DataStore store, HostScope scope, StoragePoolInfo existingInfo) { + StoragePoolHostVO poolHost = _storagePoolHostDao.findByPoolHost(store.getId(), scope.getScopeId()); + if (poolHost == null) { + poolHost = new StoragePoolHostVO(store.getId(), scope.getScopeId(), existingInfo.getLocalPath()); + _storagePoolHostDao.persist(poolHost); + } + + StoragePoolVO pool = this.primaryDataStoreDao.findById(store.getId()); + pool.setScope(scope.getScopeType()); + pool.setAvailableBytes(existingInfo.getAvailableBytes()); + pool.setCapacityBytes(existingInfo.getCapacityBytes()); + pool.setStatus(StoragePoolStatus.Up); + this.primaryDataStoreDao.update(pool.getId(), pool); + this.storageMgr.createCapacityEntry(pool, Capacity.CAPACITY_TYPE_LOCAL_STORAGE, pool.getCapacityBytes() - pool.getAvailableBytes()); + + return true; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java new file mode 100644 index 00000000000..5e8727a316a --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/lifecycle/DefaultPrimaryDataStoreLifeCycleImpl.java @@ -0,0 +1,149 @@ +/* + * 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.storage.datastore.lifecycle; + +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ClusterScope; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.HostScope; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope; +import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd; +import org.apache.cloudstack.storage.command.CreatePrimaryDataStoreCmd; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.cloudstack.storage.endpoint.EndPointSelector; +import org.apache.cloudstack.storage.volume.datastore.PrimaryDataStoreHelper; + +import com.cloud.agent.api.StoragePoolInfo; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.StoragePoolStatus; + +public class DefaultPrimaryDataStoreLifeCycleImpl implements PrimaryDataStoreLifeCycle { + @Inject + EndPointSelector selector; + @Inject + PrimaryDataStoreDao dataStoreDao; + @Inject + HostDao hostDao; + @Inject + PrimaryDataStoreHelper primaryStoreHelper; + @Inject + PrimaryDataStoreProviderManager providerMgr; + public DefaultPrimaryDataStoreLifeCycleImpl() { + } + + @Override + public DataStore initialize(Map dsInfos) { + + StoragePoolVO storeVO = primaryStoreHelper.createPrimaryDataStore(dsInfos); + return providerMgr.getPrimaryDataStore(storeVO.getId()); + } + + protected void attachCluster(DataStore store) { + //send down AttachPrimaryDataStoreCmd command to all the hosts in the cluster + List endPoints = selector.selectAll(store); + CreatePrimaryDataStoreCmd createCmd = new CreatePrimaryDataStoreCmd(store.getUri()); + EndPoint ep = endPoints.get(0); + HostVO host = hostDao.findById(ep.getId()); + if (host.getHypervisorType() == HypervisorType.XenServer) { + ep.sendMessage(createCmd); + } + + endPoints.get(0).sendMessage(createCmd); + AttachPrimaryDataStoreCmd cmd = new AttachPrimaryDataStoreCmd(store.getUri()); + for (EndPoint endp : endPoints) { + endp.sendMessage(cmd); + } + } + + @Override + public boolean attachCluster(DataStore dataStore, ClusterScope scope) { + StoragePoolVO dataStoreVO = dataStoreDao.findById(dataStore.getId()); + dataStoreVO.setDataCenterId(scope.getZoneId()); + dataStoreVO.setPodId(scope.getPodId()); + dataStoreVO.setClusterId(scope.getScopeId()); + dataStoreVO.setStatus(StoragePoolStatus.Attaching); + dataStoreVO.setScope(scope.getScopeType()); + dataStoreDao.update(dataStoreVO.getId(), dataStoreVO); + + + attachCluster(dataStore); + + dataStoreVO = dataStoreDao.findById(dataStore.getId()); + dataStoreVO.setStatus(StoragePoolStatus.Up); + dataStoreDao.update(dataStoreVO.getId(), dataStoreVO); + + return true; + } + + @Override + public boolean dettach() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean unmanaged() { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean maintain(long storeId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean cancelMaintain(long storeId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean deleteDataStore(long storeId) { + // TODO Auto-generated method stub + return false; + } + + + + @Override + public boolean attachZone(DataStore dataStore, ZoneScope scope) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean attachHost(DataStore store, HostScope scope, + StoragePoolInfo existingInfo) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreProviderManagerImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreProviderManagerImpl.java new file mode 100644 index 00000000000..e181adabb5b --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/DefaultPrimaryDataStoreProviderManagerImpl.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.storage.datastore.manager; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager; +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.storage.datastore.DefaultPrimaryDataStore; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.db.DataStoreProviderDao; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.springframework.stereotype.Component; + +import com.cloud.storage.StorageManager; + +@Component +public class DefaultPrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProviderManager { + @Inject + DataStoreProviderDao dataStoreProviderDao; + @Inject + DataStoreProviderManager providerManager; + @Inject + PrimaryDataStoreDao dataStoreDao; + Map driverMaps; + @Inject StorageManager storageMgr; + + @PostConstruct + public void config() { + driverMaps = new HashMap(); + } + + @Override + public PrimaryDataStore getPrimaryDataStore(long dataStoreId) { + StoragePoolVO dataStoreVO = dataStoreDao.findById(dataStoreId); + long providerId = dataStoreVO.getStorageProviderId(); + DataStoreProvider provider = providerManager.getDataStoreProviderById(providerId); + DefaultPrimaryDataStore dataStore = DefaultPrimaryDataStore.createDataStore(dataStoreVO, driverMaps.get(provider.getUuid()), provider); + return dataStore; + } + + @Override + public boolean registerDriver(String uuid, PrimaryDataStoreDriver driver) { + if (driverMaps.get(uuid) != null) { + return false; + } + driverMaps.put(uuid, driver); + return true; + } + + @Override + public PrimaryDataStore getPrimaryDataStore(String uuid) { + StoragePoolVO dataStoreVO = dataStoreDao.findByUuid(uuid); + return getPrimaryDataStore(dataStoreVO.getId()); + } + + @Override + public boolean registerHostListener(String uuid, HypervisorHostListener listener) { + return storageMgr.registerHostListener(uuid, listener); + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/data model.ucls b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/data model.ucls new file mode 100644 index 00000000000..8d7a696957d --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/data model.ucls @@ -0,0 +1,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/AncientPrimaryDataStoreProviderImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/AncientPrimaryDataStoreProviderImpl.java new file mode 100644 index 00000000000..e7d65167eac --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/AncientPrimaryDataStoreProviderImpl.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.datastore.provider; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.driver.AncientPrimaryDataStoreDriverImpl; +import org.apache.cloudstack.storage.datastore.lifecycle.AncientPrimaryDataStoreLifeCyclImpl; +import org.springframework.stereotype.Component; + +import com.cloud.utils.component.ComponentContext; + +@Component +public class AncientPrimaryDataStoreProviderImpl implements + PrimaryDataStoreProvider { + + private final String providerName = "ancient primary data store provider"; + protected PrimaryDataStoreDriver driver; + @Inject + PrimaryDataStoreProviderManager storeMgr; + protected DataStoreLifeCycle lifecyle; + protected String uuid; + protected long id; + @Override + public String getName() { + return providerName; + } + + @Override + public DataStoreLifeCycle getLifeCycle() { + return this.lifecyle; + } + + @Override + public boolean configure(Map params) { + lifecyle = ComponentContext.inject(AncientPrimaryDataStoreLifeCyclImpl.class); + driver = ComponentContext.inject(AncientPrimaryDataStoreDriverImpl.class); + uuid = (String)params.get("uuid"); + id = (Long)params.get("id"); + storeMgr.registerDriver(uuid, this.driver); + HypervisorHostListener listener = ComponentContext.inject(DefaultHostListener.class); + storeMgr.registerHostListener(uuid, listener); + return true; + } + + @Override + public String getUuid() { + return this.uuid; + } + + @Override + public long getId() { + return this.id; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.java new file mode 100644 index 00000000000..f2cb1c45c82 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultHostListener.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.storage.datastore.provider; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.ModifyStoragePoolAnswer; +import com.cloud.agent.api.ModifyStoragePoolCommand; +import com.cloud.alert.AlertManager; +import com.cloud.storage.StoragePool; +import com.cloud.storage.StoragePoolHostVO; +import com.cloud.storage.dao.StoragePoolHostDao; +import com.cloud.utils.exception.CloudRuntimeException; + +public class DefaultHostListener implements HypervisorHostListener { + private static final Logger s_logger = Logger + .getLogger(DefaultHostListener.class); + @Inject AgentManager agentMgr; + @Inject DataStoreManager dataStoreMgr; + @Inject AlertManager alertMgr; + @Inject StoragePoolHostDao storagePoolHostDao; + @Inject PrimaryDataStoreDao primaryStoreDao; + @Override + public boolean hostConnect(long hostId, long poolId) { + StoragePool pool = (StoragePool)this.dataStoreMgr.getDataStore(poolId, DataStoreRole.Primary); + ModifyStoragePoolCommand cmd = new ModifyStoragePoolCommand(true, pool); + final Answer answer = agentMgr.easySend(hostId, cmd); + + if (answer == null) { + throw new CloudRuntimeException("Unable to get an answer to the modify storage pool command" + pool.getId()); + } + + if (!answer.getResult()) { + String msg = "Add host failed due to ModifyStoragePoolCommand failed" + answer.getDetails(); + alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, pool.getDataCenterId(), pool.getPodId(), msg, msg); + throw new CloudRuntimeException("Unable establish connection from storage head to storage pool " + pool.getId() + " due to " + answer.getDetails() + pool.getId()); + } + + assert (answer instanceof ModifyStoragePoolAnswer) : "Well, now why won't you actually return the ModifyStoragePoolAnswer when it's ModifyStoragePoolCommand? Pool=" + pool.getId() + "Host=" + hostId; + ModifyStoragePoolAnswer mspAnswer = (ModifyStoragePoolAnswer) answer; + + StoragePoolHostVO poolHost = storagePoolHostDao.findByPoolHost(pool.getId(), hostId); + if (poolHost == null) { + poolHost = new StoragePoolHostVO(pool.getId(), hostId, mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/")); + storagePoolHostDao.persist(poolHost); + } else { + poolHost.setLocalPath(mspAnswer.getPoolInfo().getLocalPath().replaceAll("//", "/")); + } + + StoragePoolVO poolVO = this.primaryStoreDao.findById(poolId); + poolVO.setAvailableBytes(mspAnswer.getPoolInfo().getAvailableBytes()); + poolVO.setCapacityBytes(mspAnswer.getPoolInfo().getCapacityBytes()); + primaryStoreDao.update(pool.getId(), poolVO); + + s_logger.info("Connection established between " + pool + " host + " + hostId); + return true; + } + + @Override + public boolean hostDisconnected(long hostId, long poolId) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java new file mode 100644 index 00000000000..a1402c13b3d --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/DefaultPrimaryDatastoreProviderImpl.java @@ -0,0 +1,75 @@ +// 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.storage.datastore.provider; + +import java.util.Map; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle; +import org.apache.cloudstack.engine.subsystem.api.storage.HypervisorHostListener; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager; +import org.apache.cloudstack.storage.datastore.driver.DefaultPrimaryDataStoreDriverImpl; +import org.apache.cloudstack.storage.datastore.lifecycle.DefaultPrimaryDataStoreLifeCycleImpl; +import org.springframework.stereotype.Component; + +import com.cloud.utils.component.ComponentContext; + +@Component +public class DefaultPrimaryDatastoreProviderImpl implements PrimaryDataStoreProvider { + private final String providerName = "default primary data store provider"; + protected PrimaryDataStoreDriver driver; + @Inject + PrimaryDataStoreProviderManager storeMgr; + + protected DataStoreLifeCycle lifecyle; + protected String uuid; + protected long id; + @Override + public String getName() { + return providerName; + } + + @Override + public DataStoreLifeCycle getLifeCycle() { + return this.lifecyle; + } + + @Override + public boolean configure(Map params) { + lifecyle = ComponentContext.inject(DefaultPrimaryDataStoreLifeCycleImpl.class); + driver = ComponentContext.inject(DefaultPrimaryDataStoreDriverImpl.class); + HypervisorHostListener listener = ComponentContext.inject(DefaultHostListener.class); + uuid = (String)params.get("uuid"); + id = (Long)params.get("id"); + storeMgr.registerDriver(uuid, this.driver); + storeMgr.registerHostListener(uuid, listener); + return true; + } + + @Override + public String getUuid() { + return this.uuid; + } + + @Override + public long getId() { + return this.id; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java new file mode 100644 index 00000000000..b248758bc12 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/provider/PrimaryDataStoreProviderManager.java @@ -0,0 +1,16 @@ +// 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. diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java new file mode 100644 index 00000000000..8f3fe8ca8ca --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/DataStoreType.java @@ -0,0 +1,23 @@ +/* + * 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.storage.datastore.type; + +public interface DataStoreType { + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/ISCSI.java new file mode 100644 index 00000000000..9b80bccd834 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/ISCSI.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 org.apache.cloudstack.storage.datastore.type; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class ISCSI extends BaseType implements DataStoreType { + private final String type = "iscsi"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.java new file mode 100644 index 00000000000..f8801545ce5 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/NetworkFileSystem.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 org.apache.cloudstack.storage.datastore.type; + +import org.apache.cloudstack.storage.BaseType; +import org.springframework.stereotype.Component; + +@Component +public class NetworkFileSystem extends BaseType implements DataStoreType { + private final String type = "nfs"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java new file mode 100644 index 00000000000..addf9019332 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/type/SharedMount.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.datastore.type; + +import org.apache.cloudstack.storage.BaseType; + +public class SharedMount extends BaseType implements DataStoreType { + private final String type = "SharedMountPoint"; + + @Override + public String toString() { + return type; + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategy.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategy.java new file mode 100644 index 00000000000..99b34cbcf18 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategy.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 org.apache.cloudstack.storage.volume; + +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; +import org.apache.cloudstack.storage.volume.VolumeServiceImpl.CreateBaseImageResult; + +public interface TemplateInstallStrategy { + public Void installAsync(TemplateInfo template, PrimaryDataStore store, AsyncCompletionCallback callback); +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategyImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategyImpl.java new file mode 100644 index 00000000000..5f1735c180a --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/TemplateInstallStrategyImpl.java @@ -0,0 +1,289 @@ +/* + * 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.storage.volume; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.ImageDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; +import org.apache.cloudstack.storage.motion.DataMotionService; +import org.apache.cloudstack.storage.volume.VolumeServiceImpl.CreateBaseImageResult; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +@Component +public class TemplateInstallStrategyImpl implements TemplateInstallStrategy { + private static final Logger s_logger = Logger + .getLogger(TemplateInstallStrategyImpl.class); + @Inject + ObjectInDataStoreManager objectInDataStoreMgr; + @Inject + DataMotionService motionSrv; + @Inject + ImageDataFactory imageFactory; + protected long waitingTime = 1800; // half an hour + protected long waitingRetries = 10; +/* + protected TemplateInfo waitingForTemplateDownload(TemplateInfo template, + PrimaryDataStore dataStore) { + long retries = this.waitingRetries; + ObjectInDataStoreVO obj = null; + do { + try { + Thread.sleep(waitingTime); + } catch (InterruptedException e) { + s_logger.debug("sleep interrupted", e); + throw new CloudRuntimeException("sleep interrupted", e); + } + + obj = objectInDataStoreMgr.findObject(template.getId(), + template.getType(), dataStore.getId(), dataStore.getRole()); + if (obj == null) { + s_logger.debug("can't find object in db, maybe it's cleaned up already, exit waiting"); + break; + } + if (obj.getState() == ObjectInDataStoreStateMachine.State.Ready) { + break; + } + retries--; + } while (retries > 0); + + if (obj == null || retries <= 0) { + s_logger.debug("waiting too long for template downloading, marked it as failed"); + throw new CloudRuntimeException( + "waiting too long for template downloading, marked it as failed"); + } + return imageFactory.getTemplate(template.getId(), dataStore); + } + + class InstallContext extends AsyncRpcConext { + final TemplateInfo destTemplate; + final TemplateInfo srcTemplate; + + public InstallContext(AsyncCompletionCallback callback, + TemplateInfo destTemplate, TemplateInfo srcTemplate) { + super(callback); + this.destTemplate = destTemplate; + this.srcTemplate = srcTemplate; + } + + } + + @Override + public Void installAsync(TemplateInfo template, PrimaryDataStore store, + AsyncCompletionCallback callback) { + ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject( + template.getId(), template.getType(), store.getId(), + store.getRole()); + TemplateInfo templateOnPrimaryStoreObj = null; + boolean freshNewTemplate = false; + if (obj == null) { + try { + templateOnPrimaryStoreObj = objectInDataStoreMgr.create( + template, store); + freshNewTemplate = true; + } catch (Throwable e) { + obj = objectInDataStoreMgr.findObject(template.getId(), + template.getType(), store.getId(), store.getRole()); + if (obj == null) { + CreateBaseImageResult result = new CreateBaseImageResult( + null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return null; + } + } + } + + if (!freshNewTemplate + && obj.getState() != ObjectInDataStoreStateMachine.State.Ready) { + try { + templateOnPrimaryStoreObj = waitingForTemplateDownload( + template, store); + } catch (Exception e) { + CreateBaseImageResult result = new CreateBaseImageResult(null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return null; + } + + CreateBaseImageResult result = new CreateBaseImageResult( + templateOnPrimaryStoreObj); + callback.complete(result); + return null; + } + + try { + objectInDataStoreMgr.update(templateOnPrimaryStoreObj, + ObjectInDataStoreStateMachine.Event.CreateRequested); + } catch (NoTransitionException e) { + try { + objectInDataStoreMgr.update(templateOnPrimaryStoreObj, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("state transation failed", e1); + } + CreateBaseImageResult result = new CreateBaseImageResult(null); + result.setSucess(false); + result.setResult(e.toString()); + callback.complete(result); + return null; + } + + InstallContext context = new InstallContext( + callback, templateOnPrimaryStoreObj, template); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback( + caller.getTarget().installTemplateCallback(null, null)) + .setContext(context); + + store.getDriver().createAsync(templateOnPrimaryStoreObj, caller); + return null; + } + + class CopyTemplateContext extends AsyncRpcConext { + TemplateInfo template; + + public CopyTemplateContext(AsyncCompletionCallback callback, + TemplateInfo template) { + super(callback); + this.template = template; + } + } + + protected Void installTemplateCallback( + AsyncCallbackDispatcher callback, + InstallContext context) { + CreateCmdResult result = callback.getResult(); + TemplateInfo templateOnPrimaryStoreObj = context.destTemplate; + CreateBaseImageResult upResult = new CreateBaseImageResult( + templateOnPrimaryStoreObj); + if (result.isFailed()) { + upResult.setResult(result.getResult()); + context.getParentCallback().complete(upResult); + return null; + } + + ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject( + templateOnPrimaryStoreObj.getId(), templateOnPrimaryStoreObj + .getType(), templateOnPrimaryStoreObj.getDataStore() + .getId(), templateOnPrimaryStoreObj.getDataStore() + .getRole()); + + obj.setInstallPath(result.getPath()); + obj.setSize(result.getSize()); + try { + objectInDataStoreMgr.update(obj, + ObjectInDataStoreStateMachine.Event.OperationSuccessed); + } catch (NoTransitionException e) { + try { + objectInDataStoreMgr.update(obj, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + s_logger.debug("failed to change state", e1); + } + + upResult.setResult(e.toString()); + context.getParentCallback().complete(upResult); + return null; + } + + moveTemplate(context.srcTemplate, templateOnPrimaryStoreObj, obj, + context.getParentCallback()); + return null; + } + + protected void moveTemplate(TemplateInfo srcTemplate, + TemplateInfo destTemplate, ObjectInDataStoreVO obj, + AsyncCompletionCallback callback) { + // move template into primary storage + try { + objectInDataStoreMgr.update(destTemplate, + ObjectInDataStoreStateMachine.Event.CopyingRequested); + } catch (NoTransitionException e) { + s_logger.debug("failed to change state", e); + try { + objectInDataStoreMgr.update(destTemplate, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + + } + CreateBaseImageResult res = new CreateBaseImageResult(destTemplate); + res.setResult("Failed to change state: " + e.toString()); + callback.complete(res); + } + + CopyTemplateContext anotherCall = new CopyTemplateContext( + callback, destTemplate); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher + .create(this); + caller.setCallback(caller.getTarget().copyTemplateCallback(null, null)) + .setContext(anotherCall); + + motionSrv.copyAsync(srcTemplate, destTemplate, caller); + } + + protected Void copyTemplateCallback( + AsyncCallbackDispatcher callback, + CopyTemplateContext context) { + CopyCommandResult result = callback.getResult(); + TemplateInfo templateOnPrimaryStoreObj = context.template; + if (result.isFailed()) { + CreateBaseImageResult res = new CreateBaseImageResult( + templateOnPrimaryStoreObj); + res.setResult(result.getResult()); + context.getParentCallback().complete(res); + } + DataObjectInStore obj = objectInDataStoreMgr.findObject( + templateOnPrimaryStoreObj, templateOnPrimaryStoreObj.getDataStore()); + + + CreateBaseImageResult res = new CreateBaseImageResult( + templateOnPrimaryStoreObj); + try { + objectInDataStoreMgr.update(obj, + ObjectInDataStoreStateMachine.Event.OperationSuccessed); + } catch (NoTransitionException e) { + s_logger.debug("Failed to update copying state: ", e); + try { + objectInDataStoreMgr.update(templateOnPrimaryStoreObj, + ObjectInDataStoreStateMachine.Event.OperationFailed); + } catch (NoTransitionException e1) { + } + + res.setResult("Failed to update copying state: " + e.toString()); + context.getParentCallback().complete(res); + } + context.getParentCallback().complete(res); + return null; + }*/ + @Override + public Void installAsync(TemplateInfo template, PrimaryDataStore store, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.java new file mode 100644 index 00000000000..e0ecd165d7f --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeDataFactoryImpl.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 org.apache.cloudstack.storage.volume; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.springframework.stereotype.Component; + +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VolumeDao; + +@Component +public class VolumeDataFactoryImpl implements VolumeDataFactory { + @Inject + VolumeDao volumeDao; + @Inject + ObjectInDataStoreManager objMap; + @Inject + DataStoreManager storeMgr; + @Override + public VolumeInfo getVolume(long volumeId, DataStore store) { + VolumeVO volumeVO = volumeDao.findById(volumeId); + + VolumeObject vol = VolumeObject.getVolumeObject(store, volumeVO); + + return vol; + } + + @Override + public VolumeInfo getVolume(long volumeId) { + VolumeVO volumeVO = volumeDao.findById(volumeId); + VolumeObject vol = null; + if (volumeVO.getPoolId() == null) { + DataStore store = objMap.findStore(volumeVO.getUuid(), DataObjectType.VOLUME, DataStoreRole.Image); + vol = VolumeObject.getVolumeObject(store, volumeVO); + } else { + DataStore store = this.storeMgr.getDataStore(volumeVO.getPoolId(), DataStoreRole.Primary); + vol = VolumeObject.getVolumeObject(store, volumeVO); + } + return vol; + } + + @Override + public VolumeInfo getVolume(DataObject volume, DataStore store) { + VolumeInfo vol = (VolumeObject)getVolume(volume.getId(), store); + vol.addPayload(((VolumeInfo)volume).getpayload()); + return vol; + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java new file mode 100644 index 00000000000..f8d50437d14 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeEntityImpl.java @@ -0,0 +1,204 @@ +/* + * 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.storage.volume; + +import java.lang.reflect.Method; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.engine.cloud.entity.api.SnapshotEntity; +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.apache.cloudstack.engine.datacenter.entity.api.StorageEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService.VolumeApiResult; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.engine.subsystem.api.storage.type.VolumeType; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreEntityImpl; + +public class VolumeEntityImpl implements VolumeEntity { + private VolumeInfo volumeInfo; + private final VolumeService vs; + private VolumeApiResult result; + + protected VolumeEntityImpl() { + this.vs = null; + } + + public VolumeEntityImpl(VolumeInfo volumeObject, VolumeService vs) { + this.volumeInfo = volumeObject; + this.vs = vs; + } + + public VolumeInfo getVolumeInfo() { + return volumeInfo; + } + + @Override + public String getUuid() { + return volumeInfo.getUuid(); + } + + @Override + public long getId() { + return volumeInfo.getId(); + } + + public String getExternalId() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getCurrentState() { + return null; + } + + @Override + public String getDesiredState() { + return null; + } + + @Override + public Date getCreatedTime() { + return null; + } + + @Override + public Date getLastUpdatedTime() { + return null; + } + + @Override + public String getOwner() { + return null; + } + + + @Override + public List getApplicableActions() { + // TODO Auto-generated method stub + return null; + } + + @Override + public SnapshotEntity takeSnapshotOf(boolean full) { + // TODO Auto-generated method stub + return null; + } + + @Override + public String reserveForMigration(long expirationTime) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void migrate(String reservationToken) { + // TODO Auto-generated method stub + + } + + @Override + public VolumeEntity setupForCopy() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void copy(VolumeEntity dest) { + // TODO Auto-generated method stub + + } + + @Override + public void attachTo(String vm, long deviceId) { + // TODO Auto-generated method stub + + } + + @Override + public void detachFrom() { + // TODO Auto-generated method stub + + } + + + @Override + public long getSize() { + return volumeInfo.getSize(); + } + + @Override + public DiskFormat getDiskType() { + return null; + } + + @Override + public VolumeType getType() { + return null; + } + + @Override + public StorageEntity getDataStore() { + return new PrimaryDataStoreEntityImpl((PrimaryDataStoreInfo) volumeInfo.getDataStore()); + } + + @Override + public void destroy() { + /*AsyncCallFuture future = vs.deleteVolumeAsync(volumeInfo); + try { + result = future.get(); + if (!result.isSuccess()) { + throw new CloudRuntimeException("Failed to create volume:" + result.getResult()); + } + } catch (InterruptedException e) { + throw new CloudRuntimeException("wait to delete volume info failed", e); + } catch (ExecutionException e) { + throw new CloudRuntimeException("wait to delete volume failed", e); + }*/ + } + + @Override + public Map getDetails() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void addDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void delDetail(String name, String value) { + // TODO Auto-generated method stub + + } + + @Override + public void updateDetail(String name, String value) { + // TODO Auto-generated method stub + + } + +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java new file mode 100644 index 00000000000..9349e6b11cc --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeMotionService.java @@ -0,0 +1,23 @@ +/* + * 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.storage.volume; + +public interface VolumeMotionService { + boolean copyVolume(String volumeUri, String destVolumeUri); +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java new file mode 100644 index 00000000000..6ad6cc9486f --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java @@ -0,0 +1,330 @@ +// 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.storage.volume; + +import java.util.Date; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectInStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObjectType; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.log4j.Logger; + +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.storage.Volume; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.fsm.NoTransitionException; +import com.cloud.utils.fsm.StateMachine2; +import com.cloud.utils.storage.encoding.EncodingType; + +public class VolumeObject implements VolumeInfo { + private static final Logger s_logger = Logger.getLogger(VolumeObject.class); + protected VolumeVO volumeVO; + private StateMachine2 _volStateMachine; + protected DataStore dataStore; + @Inject + VolumeDao volumeDao; + @Inject + ObjectInDataStoreManager ojbectInStoreMgr; + private Object payload; + + protected VolumeObject() { + _volStateMachine = Volume.State.getStateMachine(); + } + + protected void configure(DataStore dataStore, VolumeVO volumeVO) { + this.volumeVO = volumeVO; + this.dataStore = dataStore; + } + + public static VolumeObject getVolumeObject(DataStore dataStore, VolumeVO volumeVO) { + VolumeObject vo = ComponentContext.inject(VolumeObject.class); + vo.configure(dataStore, volumeVO); + return vo; + } + + @Override + public String getUuid() { + return volumeVO.getUuid(); + } + + public void setPath(String uuid) { + volumeVO.setPath(uuid); + } + + public void setSize(Long size) { + volumeVO.setSize(size); + } + + public Volume.State getState() { + return volumeVO.getState(); + } + + @Override + public DataStore getDataStore() { + return dataStore; + } + + @Override + public Long getSize() { + return volumeVO.getSize(); + } + + public long getVolumeId() { + return volumeVO.getId(); + } + public boolean stateTransit(Volume.Event event) { + boolean result = false; + try { + result = _volStateMachine.transitTo(volumeVO, event, null, volumeDao); + volumeVO = volumeDao.findById(volumeVO.getId()); + } catch (NoTransitionException e) { + String errorMessage = "Failed to transit volume: " + this.getVolumeId() + ", due to: " + e.toString(); + s_logger.debug(errorMessage); + throw new CloudRuntimeException(errorMessage); + } + return result; + } + + public void update() { + volumeDao.update(volumeVO.getId(), volumeVO); + volumeVO = volumeDao.findById(volumeVO.getId()); + } + + @Override + public long getId() { + return this.volumeVO.getId(); + } + + @Override + public boolean isAttachedVM() { + return (this.volumeVO.getInstanceId() == null) ? false : true; + } + + @Override + public String getUri() { + if (this.dataStore == null) { + throw new CloudRuntimeException("datastore must be set before using this object"); + } + DataObjectInStore obj = ojbectInStoreMgr.findObject(this.volumeVO.getUuid(), DataObjectType.VOLUME, this.dataStore.getUuid(), this.dataStore.getRole()); + if (obj.getState() != ObjectInDataStoreStateMachine.State.Ready) { + return this.dataStore.getUri() + + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + + "&" + EncodingType.SIZE + "=" + this.volumeVO.getSize() + + "&" + EncodingType.NAME + "=" + this.volumeVO.getName(); + } else { + return this.dataStore.getUri() + + "&" + EncodingType.OBJTYPE + "=" + DataObjectType.VOLUME + + "&" + EncodingType.PATH + "=" + obj.getInstallPath(); + } + } + + @Override + public DataObjectType getType() { + return DataObjectType.VOLUME; + } + + @Override + public DiskFormat getFormat() { + // TODO Auto-generated method stub + return null; + } + + @Override + public void processEvent( + ObjectInDataStoreStateMachine.Event event) { + if (this.dataStore == null) { + return; + } + try { + Volume.Event volEvent = null; + if (this.dataStore.getRole() == DataStoreRole.Image) { + ojbectInStoreMgr.update(this, event); + if (event == ObjectInDataStoreStateMachine.Event.CreateRequested) { + volEvent = Volume.Event.UploadRequested; + } else if (event == ObjectInDataStoreStateMachine.Event.OperationSuccessed) { + volEvent = Volume.Event.CopySucceeded; + } else if (event == ObjectInDataStoreStateMachine.Event.OperationFailed) { + volEvent = Volume.Event.CopyFailed; + } + } else { + if (event == ObjectInDataStoreStateMachine.Event.CreateRequested || + event == ObjectInDataStoreStateMachine.Event.CreateOnlyRequested) { + volEvent = Volume.Event.CreateRequested; + } else if (event == ObjectInDataStoreStateMachine.Event.CopyingRequested) { + volEvent = Volume.Event.CopyRequested; + } + } + + if (event == ObjectInDataStoreStateMachine.Event.DestroyRequested) { + volEvent = Volume.Event.DestroyRequested; + } else if (event == ObjectInDataStoreStateMachine.Event.ExpungeRequested) { + volEvent = Volume.Event.ExpungingRequested; + } else if (event == ObjectInDataStoreStateMachine.Event.OperationSuccessed) { + volEvent = Volume.Event.OperationSucceeded; + } else if (event == ObjectInDataStoreStateMachine.Event.OperationFailed) { + volEvent = Volume.Event.OperationFailed; + } else if (event == ObjectInDataStoreStateMachine.Event.ResizeRequested) { + volEvent = Volume.Event.ResizeRequested; + } + this.stateTransit(volEvent); + } catch (Exception e) { + s_logger.debug("Failed to update state", e); + throw new CloudRuntimeException("Failed to update state:" + e.toString()); + } + + } + + @Override + public String getName() { + return this.volumeVO.getName(); + } + + @Override + public Long getInstanceId() { + return this.volumeVO.getInstanceId(); + } + + @Override + public String getFolder() { + return this.volumeVO.getFolder(); + } + + @Override + public String getPath() { + return this.volumeVO.getPath(); + } + + @Override + public Long getPodId() { + return this.volumeVO.getPodId(); + } + + @Override + public long getDataCenterId() { + return this.volumeVO.getDataCenterId(); + } + + @Override + public Type getVolumeType() { + return this.volumeVO.getVolumeType(); + } + + @Override + public Long getPoolId() { + return this.volumeVO.getPoolId(); + } + + @Override + public Date getAttached() { + return this.volumeVO.getAttached(); + } + + @Override + public Long getDeviceId() { + return this.volumeVO.getDeviceId(); + } + + @Override + public Date getCreated() { + return this.volumeVO.getCreated(); + } + + @Override + public long getDiskOfferingId() { + return this.volumeVO.getDiskOfferingId(); + } + + @Override + public String getChainInfo() { + return this.volumeVO.getChainInfo(); + } + + @Override + public boolean isRecreatable() { + return this.volumeVO.isRecreatable(); + } + + @Override + public long getUpdatedCount() { + return this.volumeVO.getUpdatedCount(); + } + + @Override + public void incrUpdatedCount() { + this.volumeVO.incrUpdatedCount(); + } + + @Override + public Date getUpdated() { + return this.volumeVO.getUpdated(); + } + + @Override + public String getReservationId() { + return this.volumeVO.getReservationId(); + } + + @Override + public void setReservationId(String reserv) { + this.volumeVO.setReservationId(reserv); + } + + @Override + public long getAccountId() { + return this.volumeVO.getAccountId(); + } + + @Override + public long getDomainId() { + return this.volumeVO.getDomainId(); + } + + @Override + public Long getTemplateId() { + return this.volumeVO.getTemplateId(); + } + + @Override + public void addPayload(Object data) { + this.payload = data; + } + + @Override + public Object getpayload() { + return this.payload; + } + + @Override + public HypervisorType getHypervisorType() { + return this.volumeDao.getHypervisorType(this.volumeVO.getId()); + } + + @Override + public Long getLastPoolId() { + return this.volumeVO.getLastPoolId(); + } +} diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java new file mode 100644 index 00000000000..c019374d9b9 --- /dev/null +++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java @@ -0,0 +1,650 @@ +/* + * 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.storage.volume; + +import javax.inject.Inject; + +import org.apache.cloudstack.engine.cloud.entity.api.VolumeEntity; +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.ObjectInDataStoreStateMachine.Event; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo; +import org.apache.cloudstack.engine.subsystem.api.storage.VolumeService; +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.apache.cloudstack.storage.datastore.DataObjectManager; +import org.apache.cloudstack.storage.datastore.ObjectInDataStoreManager; +import org.apache.cloudstack.storage.datastore.PrimaryDataStore; +import org.apache.cloudstack.storage.datastore.PrimaryDataStoreProviderManager; +import org.apache.cloudstack.storage.motion.DataMotionService; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.storage.StoragePool; +import com.cloud.storage.Volume; +import com.cloud.storage.Volume.Type; +import com.cloud.storage.VolumeVO; +import com.cloud.storage.dao.VolumeDao; +import com.cloud.storage.snapshot.SnapshotManager; +import com.cloud.utils.db.DB; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.dao.VMInstanceDao; + +@Component +public class VolumeServiceImpl implements VolumeService { + private static final Logger s_logger = Logger + .getLogger(VolumeServiceImpl.class); + @Inject + VolumeDao volDao; + @Inject + PrimaryDataStoreProviderManager dataStoreMgr; + @Inject + ObjectInDataStoreManager objectInDataStoreMgr; + @Inject + DataObjectManager dataObjectMgr; + @Inject + DataMotionService motionSrv; + @Inject + TemplateInstallStrategy templateInstallStrategy; + @Inject + VolumeDataFactory volFactory; + @Inject SnapshotManager snapshotMgr; + @Inject VMInstanceDao vmDao; + + public VolumeServiceImpl() { + } + + private class CreateVolumeContext extends AsyncRpcConext { + + private DataObject volume; + private AsyncCallFuture future; + /** + * @param callback + */ + public CreateVolumeContext(AsyncCompletionCallback callback, DataObject volume, AsyncCallFuture future) { + super(callback); + this.volume = volume; + this.future = future; + } + + public DataObject getVolume() { + return this.volume; + } + + public AsyncCallFuture getFuture() { + return this.future; + } + + } + + @Override + public AsyncCallFuture createVolumeAsync(VolumeInfo volume, DataStore dataStore) { + AsyncCallFuture future = new AsyncCallFuture(); + DataObject volumeOnStore = dataStore.create(volume); + volumeOnStore.processEvent(Event.CreateOnlyRequested); + + CreateVolumeContext context = new CreateVolumeContext(null, volumeOnStore, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createVolumeCallback(null, null)) + .setContext(context); + + dataStore.getDriver().createAsync(volumeOnStore, caller); + return future; + } + + protected Void createVolumeCallback(AsyncCallbackDispatcher callback, CreateVolumeContext context) { + CreateCmdResult result = callback.getResult(); + DataObject vo = context.getVolume(); + String errMsg = null; + if (result.isSuccess()) { + vo.processEvent(Event.OperationSuccessed); + } else { + vo.processEvent(Event.OperationFailed); + errMsg = result.getResult(); + } + VolumeApiResult volResult = new VolumeApiResult((VolumeObject)vo); + if (errMsg != null) { + volResult.setResult(errMsg); + } + context.getFuture().complete(volResult); + return null; + } + + private class DeleteVolumeContext extends AsyncRpcConext { + private final VolumeObject volume; + private AsyncCallFuture future; + /** + * @param callback + */ + public DeleteVolumeContext(AsyncCompletionCallback callback, VolumeObject volume, AsyncCallFuture future) { + super(callback); + this.volume = volume; + this.future = future; + } + + public VolumeObject getVolume() { + return this.volume; + } + + public AsyncCallFuture getFuture() { + return this.future; + } + } + + @DB + @Override + public AsyncCallFuture expungeVolumeAsync(VolumeInfo volume) { + AsyncCallFuture future = new AsyncCallFuture(); + VolumeApiResult result = new VolumeApiResult(volume); + if (volume.getDataStore() == null) { + this.volDao.remove(volume.getId()); + future.complete(result); + return future; + } + + String vmName = null; + VolumeVO vol = this.volDao.findById(volume.getId()); + if (vol.getVolumeType() == Type.ROOT && vol.getInstanceId() != null) { + VirtualMachine vm = vmDao.findByIdIncludingRemoved(vol + .getInstanceId()); + if (vm != null) { + vmName = vm.getInstanceName(); + } + } + + String volumePath = vol.getPath(); + Long poolId = vol.getPoolId(); + if (poolId == null || volumePath == null || volumePath.trim().isEmpty()) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Marking volume that was never created as destroyed: " + + vol); + } + this.volDao.remove(vol.getId()); + future.complete(result); + return future; + } + VolumeObject vo = (VolumeObject)volume; + + volume.processEvent(Event.ExpungeRequested); + + + DeleteVolumeContext context = new DeleteVolumeContext(null, vo, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().deleteVolumeCallback(null, null)) + .setContext(context); + + volume.getDataStore().getDriver().deleteAsync(volume, caller); + return future; + } + + public Void deleteVolumeCallback(AsyncCallbackDispatcher callback, DeleteVolumeContext context) { + CommandResult result = callback.getResult(); + VolumeObject vo = context.getVolume(); + VolumeApiResult apiResult = new VolumeApiResult(vo); + if (result.isSuccess()) { + vo.processEvent(Event.OperationSuccessed); + volDao.remove(vo.getId()); + } else { + vo.processEvent(Event.OperationFailed); + apiResult.setResult(result.getResult()); + } + context.getFuture().complete(apiResult); + return null; + } + + @Override + public boolean cloneVolume(long volumeId, long baseVolId) { + // TODO Auto-generated method stub + return false; + } + + @Override + public VolumeEntity getVolumeEntity(long volumeId) { + VolumeVO vo = volDao.findById(volumeId); + if (vo == null) { + return null; + } + + if (vo.getPoolId() == null) { + return new VolumeEntityImpl(VolumeObject.getVolumeObject(null, vo), this); + } else { + PrimaryDataStore dataStore = dataStoreMgr.getPrimaryDataStore(vo.getPoolId()); + return new VolumeEntityImpl(dataStore.getVolume(volumeId), this); + } + } + + class CreateBaseImageContext extends AsyncRpcConext { + private final VolumeInfo volume; + private final PrimaryDataStore dataStore; + private final TemplateInfo srcTemplate; + private final AsyncCallFuture future; + final DataObject destObj; + public CreateBaseImageContext(AsyncCompletionCallback callback, VolumeInfo volume, PrimaryDataStore datastore, + TemplateInfo srcTemplate, + AsyncCallFuture future, DataObject destObj) { + super(callback); + this.volume = volume; + this.dataStore = datastore; + this.future = future; + this.srcTemplate = srcTemplate; + this.destObj = destObj; + } + + public VolumeInfo getVolume() { + return this.volume; + } + + public PrimaryDataStore getDataStore() { + return this.dataStore; + } + + public TemplateInfo getSrcTemplate() { + return this.srcTemplate; + } + + public AsyncCallFuture getFuture() { + return this.future; + } + + } + + static class CreateBaseImageResult extends CommandResult { + final TemplateInfo template; + public CreateBaseImageResult(TemplateInfo template) { + super(); + this.template = template; + } + } + + @DB + protected void createBaseImageAsync(VolumeInfo volume, PrimaryDataStore dataStore, TemplateInfo template, AsyncCallFuture future) { + + DataObject templateOnPrimaryStoreObj = dataStore.create(template); + CreateBaseImageContext context = new CreateBaseImageContext(null, volume, + dataStore, + template, + future, templateOnPrimaryStoreObj); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyBaseImageCallback(null, null)) + .setContext(context); + + templateOnPrimaryStoreObj.processEvent(Event.CreateOnlyRequested); + + try { + motionSrv.copyAsync(template, templateOnPrimaryStoreObj, caller); + } catch (Exception e) { + s_logger.debug("failed to create template on storage", e); + templateOnPrimaryStoreObj.processEvent(Event.OperationFailed); + VolumeApiResult result = new VolumeApiResult(volume); + result.setResult(e.toString()); + caller.complete(result); + } + return; + } + + @DB + protected Void copyBaseImageCallback(AsyncCallbackDispatcher callback, CreateBaseImageContext context) { + CopyCommandResult result = callback.getResult(); + VolumeApiResult res = new VolumeApiResult(context.getVolume()); + + AsyncCallFuture future = context.getFuture(); + DataObject templateOnPrimaryStoreObj = context.destObj; + if (!result.isSuccess()) { + templateOnPrimaryStoreObj.processEvent(Event.OperationFailed); + res.setResult(result.getResult()); + future.complete(res); + return null; + } + + templateOnPrimaryStoreObj.processEvent(Event.OperationSuccessed); + createVolumeFromBaseImageAsync(context.volume, templateOnPrimaryStoreObj, context.dataStore, future); + return null; + } + + private class CreateVolumeFromBaseImageContext extends AsyncRpcConext { + private final VolumeObject vo; + private final AsyncCallFuture future; + private final DataStore primaryStore; + private final DataObject templateOnStore; + public CreateVolumeFromBaseImageContext(AsyncCompletionCallback callback, VolumeObject vo, + DataStore primaryStore, + DataObject templateOnStore, + AsyncCallFuture future) { + super(callback); + this.vo = vo; + this.future = future; + this.primaryStore = primaryStore; + this.templateOnStore = templateOnStore; + } + + + public AsyncCallFuture getFuture() { + return this.future; + } + } + + @DB + protected void createVolumeFromBaseImageAsync(VolumeInfo volume, DataObject templateOnPrimaryStore, PrimaryDataStore pd, AsyncCallFuture future) { + VolumeObject vo = (VolumeObject)volume; + CreateVolumeFromBaseImageContext context = new CreateVolumeFromBaseImageContext(null, vo, pd, templateOnPrimaryStore, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyBaseImageCallBack(null, null)) + .setContext(context); + + DataObject volumeOnPrimaryStorage = pd.create(volume); + volume.processEvent(Event.CreateOnlyRequested); + + motionSrv.copyAsync(context.templateOnStore, volumeOnPrimaryStorage, caller); + return; + } + + @DB + public Void copyBaseImageCallBack(AsyncCallbackDispatcher callback, CreateVolumeFromBaseImageContext context) { + VolumeObject vo = context.vo; + CopyCommandResult result = callback.getResult(); + VolumeApiResult volResult = new VolumeApiResult(vo); + + if (result.isSuccess()) { + if (result.getPath() != null) { + vo.setPath(result.getPath()); + } + vo.processEvent(Event.OperationSuccessed); + } else { + vo.processEvent(Event.OperationFailed); + volResult.setResult(result.getResult()); + } + + AsyncCallFuture future = context.getFuture(); + future.complete(volResult); + return null; + } + + @DB + @Override + public AsyncCallFuture createVolumeFromTemplateAsync(VolumeInfo volume, long dataStoreId, TemplateInfo template) { + PrimaryDataStore pd = dataStoreMgr.getPrimaryDataStore(dataStoreId); + TemplateInfo templateOnPrimaryStore = pd.getTemplate(template.getId()); + AsyncCallFuture future = new AsyncCallFuture(); + VolumeApiResult result = new VolumeApiResult(volume); + + if (templateOnPrimaryStore == null) { + createBaseImageAsync(volume, pd, template, future); + return future; + } + + createVolumeFromBaseImageAsync(volume, templateOnPrimaryStore, pd, future); + return future; + } + + @Override + @DB + public boolean destroyVolume(long volumeId) + throws ConcurrentOperationException { + + VolumeInfo vol = this.volFactory.getVolume(volumeId); + vol.processEvent(Event.DestroyRequested); + this.snapshotMgr.deletePoliciesForVolume(volumeId); + + vol.processEvent(Event.OperationSuccessed); + + return true; + } + + @Override + public AsyncCallFuture createVolumeFromSnapshot( + VolumeInfo volume, DataStore store, SnapshotInfo snapshot) { + AsyncCallFuture future = new AsyncCallFuture(); + + try { + DataObject volumeOnStore = store.create(volume); + volume.processEvent(Event.CreateOnlyRequested); + CreateVolumeFromBaseImageContext context = new CreateVolumeFromBaseImageContext(null, + (VolumeObject)volume, store, volumeOnStore, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().createVolumeFromSnapshotCallback(null, null)) + .setContext(context); + this.motionSrv.copyAsync(snapshot, volumeOnStore, caller); + } catch (Exception e) { + s_logger.debug("create volume from snapshot failed", e); + VolumeApiResult result = new VolumeApiResult(volume); + result.setResult(e.toString()); + future.complete(result); + } + + return future; + } + + protected Void createVolumeFromSnapshotCallback(AsyncCallbackDispatcher callback, + CreateVolumeFromBaseImageContext context) { + CopyCommandResult result = callback.getResult(); + VolumeInfo volume = context.vo; + VolumeApiResult apiResult = new VolumeApiResult(volume); + Event event = null; + if (result.isFailed()) { + apiResult.setResult(result.getResult()); + event = Event.OperationFailed; + } else { + event = Event.OperationSuccessed; + } + + try { + volume.processEvent(event); + } catch (Exception e) { + s_logger.debug("create volume from snapshot failed", e); + apiResult.setResult(e.toString()); + } + + AsyncCallFuture future = context.future; + future.complete(apiResult); + return null; + } + + protected VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePool pool) { + Long lastPoolId = volume.getPoolId(); + VolumeVO newVol = new VolumeVO(volume); + newVol.setPoolId(pool.getId()); + newVol.setFolder(pool.getPath()); + newVol.setPodId(pool.getPodId()); + newVol.setPoolId(pool.getId()); + newVol.setLastPoolId(lastPoolId); + newVol.setPodId(pool.getPodId()); + return this.volDao.persist(newVol); + } + + + private class CopyVolumeContext extends AsyncRpcConext { + final VolumeInfo srcVolume; + final VolumeInfo destVolume; + final DataStore destStore; + final AsyncCallFuture future; + /** + * @param callback + */ + public CopyVolumeContext(AsyncCompletionCallback callback, AsyncCallFuture future, VolumeInfo srcVolume, VolumeInfo destVolume, + DataStore destStore) { + super(callback); + this.srcVolume = srcVolume; + this.destVolume = destVolume; + this.destStore = destStore; + this.future = future; + } + + } + @Override + public AsyncCallFuture copyVolume(VolumeInfo srcVolume, + DataStore destStore) { + AsyncCallFuture future = new AsyncCallFuture(); + VolumeApiResult res = new VolumeApiResult(srcVolume); + try { + if (!this.snapshotMgr.canOperateOnVolume(srcVolume)) { + s_logger.debug( + "There are snapshots creating on this volume, can not move this volume"); + + res.setResult("There are snapshots creating on this volume, can not move this volume"); + future.complete(res); + return future; + } + + VolumeVO destVol = duplicateVolumeOnAnotherStorage(srcVolume, (StoragePool)destStore); + VolumeInfo destVolume = this.volFactory.getVolume(destVol.getId(), destStore); + destVolume.processEvent(Event.CreateOnlyRequested); + srcVolume.processEvent(Event.CopyingRequested); + + CopyVolumeContext context = new CopyVolumeContext(null, future, srcVolume, + destVolume, + destStore); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().copyVolumeCallBack(null, null)) + .setContext(context); + this.motionSrv.copyAsync(srcVolume, destVolume, caller); + } catch (Exception e) { + s_logger.debug("Failed to copy volume", e); + res.setResult(e.toString()); + future.complete(res); + } + return future; + } + + protected Void copyVolumeCallBack(AsyncCallbackDispatcher callback, CopyVolumeContext context) { + VolumeInfo srcVolume = context.srcVolume; + VolumeInfo destVolume = context.destVolume; + CopyCommandResult result = callback.getResult(); + AsyncCallFuture future = context.future; + VolumeApiResult res = new VolumeApiResult(destVolume); + try { + if (result.isFailed()) { + res.setResult(result.getResult()); + destVolume.processEvent(Event.OperationFailed); + srcVolume.processEvent(Event.OperationFailed); + AsyncCallFuture destroyFuture = this.expungeVolumeAsync(destVolume); + destroyFuture.get(); + future.complete(res); + return null; + } + srcVolume.processEvent(Event.OperationSuccessed); + destVolume.processEvent(Event.OperationSuccessed); + AsyncCallFuture destroyFuture = this.expungeVolumeAsync(srcVolume); + destroyFuture.get(); + future.complete(res); + return null; + } catch (Exception e) { + s_logger.debug("Failed to process copy volume callback",e); + res.setResult(e.toString()); + future.complete(res); + } + + return null; + } + + @Override + public AsyncCallFuture registerVolume(VolumeInfo volume, DataStore store) { + + AsyncCallFuture future = new AsyncCallFuture(); + VolumeObject vo = (VolumeObject) volume; + vo.stateTransit(Volume.Event.UploadRequested); + + CreateVolumeContext context = new CreateVolumeContext(null, vo, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().registerVolumeCallback(null, null)) + .setContext(context); + + dataObjectMgr.createAsync(volume, store, caller, true); + return future; + } + + protected Void registerVolumeCallback(AsyncCallbackDispatcher callback, CreateVolumeContext context) { + CreateCmdResult result = callback.getResult(); + VolumeObject vo = (VolumeObject)context.volume; + /*if (result.isFailed()) { + vo.stateTransit(Volume.Event.OperationFailed); + } else { + vo.stateTransit(Volume.Event.OperationSucceeded); + }*/ + VolumeApiResult res = new VolumeApiResult(vo); + context.future.complete(res); + return null; + } + + + @Override + public AsyncCallFuture resize(VolumeInfo volume) { + AsyncCallFuture future = new AsyncCallFuture(); + VolumeApiResult result = new VolumeApiResult(volume); + try { + volume.processEvent(Event.ResizeRequested); + } catch (Exception e) { + s_logger.debug("Failed to change state to resize", e); + result.setResult(e.toString()); + future.complete(result); + return future; + } + CreateVolumeContext context = new CreateVolumeContext(null, volume, future); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().registerVolumeCallback(null, null)) + .setContext(context); + volume.getDataStore().getDriver().resize(volume, caller); + return future; + } + + protected Void resizeVolumeCallback(AsyncCallbackDispatcher callback, CreateVolumeContext context) { + CreateCmdResult result = callback.getResult(); + AsyncCallFuture future = context.future; + VolumeInfo volume = (VolumeInfo)context.volume; + + if (result.isFailed()) { + try { + volume.processEvent(Event.OperationFailed); + } catch (Exception e) { + s_logger.debug("Failed to change state", e); + } + VolumeApiResult res = new VolumeApiResult(volume); + res.setResult(result.getResult()); + future.complete(res); + return null; + } + + try { + volume.processEvent(Event.OperationSuccessed); + } catch(Exception e) { + s_logger.debug("Failed to change state", e); + VolumeApiResult res = new VolumeApiResult(volume); + res.setResult(result.getResult()); + future.complete(res); + return null; + } + + VolumeApiResult res = new VolumeApiResult(volume); + future.complete(res); + + return null; + } + + + +} diff --git a/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/ConfiguratorTest.java b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/ConfiguratorTest.java new file mode 100644 index 00000000000..829694bd753 --- /dev/null +++ b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/ConfiguratorTest.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.storage.volume.test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.cloud.dc.ClusterVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/testContext.xml") +public class ConfiguratorTest { + + @Inject + List providers; + + @Inject + ClusterDao clusterDao; + @Before + public void setup() { + /* ClusterVO cluster = new ClusterVO(); + cluster.setHypervisorType(HypervisorType.XenServer.toString()); + Mockito.when(clusterDao.findById(Mockito.anyLong())).thenReturn(cluster); + try { + providerMgr.configure("manager", null); + } catch (ConfigurationException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }*/ + } + @Test + public void testLoadConfigurator() { + /*for (PrimaryDataStoreConfigurator configurator : configurators) { + System.out.println(configurator.getClass().getName()); + }*/ + } + + @Test + public void testProvider() { + for (PrimaryDataStoreProvider provider : providers) { + if (provider.getName().startsWith("default")) { + assertTrue(true); + } + } + } + + @Test + public void getProvider() { + // assertNotNull(providerMgr.getDataStoreProvider("default primary data store provider")); + } + + @Test + public void createDataStore() { + /*PrimaryDataStoreProvider provider = providerMgr.getDataStoreProvider("default primary data store provider"); + Map params = new HashMap(); + params.put("url", "nfs://localhost/mnt"); + params.put("clusterId", "1"); + params.put("name", "nfsprimary"); + assertNotNull(provider.registerDataStore(params));*/ + } +} diff --git a/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server.java b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server.java new file mode 100644 index 00000000000..f19d68e8ea1 --- /dev/null +++ b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server.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 org.apache.cloudstack.storage.volume.test; + +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; + +public class Server { + Server1 svr; + public Server() { + svr = new Server1(); + } + void foo() { + // svr.foo1("foo", new AsyncCallbackDispatcher(this).setOperationName("callback").setContextParam("name", "foo")); + } + + void foocallback(AsyncCallbackDispatcher callback) { + /* + System.out.println(callback.getContextParam("name")); + String result = callback.getResult(); + System.out.println(result); + */ + } + +} diff --git a/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server1.java b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server1.java new file mode 100644 index 00000000000..bf56e6e4b33 --- /dev/null +++ b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/Server1.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 org.apache.cloudstack.storage.volume.test; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public class Server1 { + public void foo1(String name, AsyncCompletionCallback callback) { + callback.complete("success"); + } +} diff --git a/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestConfiguration.java b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestConfiguration.java new file mode 100644 index 00000000000..1d3202f123b --- /dev/null +++ b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestConfiguration.java @@ -0,0 +1,41 @@ +/* + * 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.storage.volume.test; + +import org.apache.cloudstack.storage.image.motion.ImageMotionService; + +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.ClusterDaoImpl; + +@Configuration +public class TestConfiguration { + @Bean + public ImageMotionService imageMotion() { + return Mockito.mock(ImageMotionService.class); + } + + @Bean + public ClusterDao clusterDao() { + return Mockito.mock(ClusterDaoImpl.class); + } +} \ No newline at end of file diff --git a/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestInProcessAsync.java b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestInProcessAsync.java new file mode 100644 index 00000000000..67418717989 --- /dev/null +++ b/engine/storage/volume/test/org/apache/cloudstack/storage/volume/test/TestInProcessAsync.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 org.apache.cloudstack.storage.volume.test; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/resource/testContext.xml") +public class TestInProcessAsync { + Server svr; + @Before + public void setup() { + svr = new Server(); + } + + @Test + public void testRpc() { + svr.foo(); + } +} diff --git a/engine/storage/volume/test/resource/testContext.xml b/engine/storage/volume/test/resource/testContext.xml new file mode 100644 index 00000000000..67f242273f3 --- /dev/null +++ b/engine/storage/volume/test/resource/testContext.xml @@ -0,0 +1,79 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.cloudstack.framework + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/framework/api/pom.xml b/framework/api/pom.xml new file mode 100644 index 00000000000..5260ebc4bf6 --- /dev/null +++ b/framework/api/pom.xml @@ -0,0 +1,42 @@ + + + 4.0.0 + cloud-framework-api + + org.apache.cloudstack + cloudstack-framework + 4.2.0-SNAPSHOT + ../pom.xml + + + + + org.apache.cloudstack + cloud-utils + 4.2.0-SNAPSHOT + + + + + + install + src + ${project.basedir}/test + + + ${project.basedir}/test/resources + + + + diff --git a/framework/api/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java b/framework/api/src/org/apache/cloudstack/framework/async/AsyncCallFuture.java new file mode 100644 index 00000000000..57489ffeabb --- /dev/null +++ b/framework/api/src/org/apache/cloudstack/framework/async/AsyncCallFuture.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.framework.async; + +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class AsyncCallFuture implements Future, AsyncCompletionCallback { + + Object _completed = new Object(); + boolean _done = false; + T _resultObject; // we will store a copy of the result object + + public AsyncCallFuture() { + } + + @Override + public boolean cancel(boolean mayInterruptIfRunning) { + // TODO we don't support cancel yet + return false; + } + + @Override + public T get() throws InterruptedException, ExecutionException { + synchronized(_completed) { + if(!_done) + _completed.wait(); + } + + return _resultObject; + } + + @Override + public T get(long timeout, TimeUnit timeUnit) throws InterruptedException, + ExecutionException, TimeoutException { + + TimeUnit milliSecondsUnit = TimeUnit.MILLISECONDS; + + synchronized(_completed) { + if(!_done) + _completed.wait(milliSecondsUnit.convert(timeout, timeUnit)); + } + + return _resultObject; + } + + @Override + public boolean isCancelled() { + // TODO we don't support cancel yet + return false; + } + + @Override + public boolean isDone() { + return _done; + } + + @Override + public void complete(T resultObject) { + _resultObject = resultObject; + synchronized(_completed) { + _done = true; + _completed.notifyAll(); + } + } +} + diff --git a/framework/api/src/org/apache/cloudstack/framework/async/AsyncCompletionCallback.java b/framework/api/src/org/apache/cloudstack/framework/async/AsyncCompletionCallback.java new file mode 100644 index 00000000000..7cdf5fed468 --- /dev/null +++ b/framework/api/src/org/apache/cloudstack/framework/async/AsyncCompletionCallback.java @@ -0,0 +1,23 @@ +/* + * 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.framework.async; + +public interface AsyncCompletionCallback { + void complete(T resultObject); +} diff --git a/framework/events/pom.xml b/framework/events/pom.xml new file mode 100644 index 00000000000..7c788c35bbd --- /dev/null +++ b/framework/events/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + cloud-framework-events + Apache CloudStack Framework - Event Notification + + org.apache.cloudstack + cloudstack-framework + 4.2.0-SNAPSHOT + ../pom.xml + + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + com.google.code.gson + gson + ${cs.gson.version} + + + + install + src + test + + diff --git a/framework/events/src/org/apache/cloudstack/framework/events/Event.java b/framework/events/src/org/apache/cloudstack/framework/events/Event.java new file mode 100644 index 00000000000..eb6f48de3b8 --- /dev/null +++ b/framework/events/src/org/apache/cloudstack/framework/events/Event.java @@ -0,0 +1,94 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.framework.events; + +import com.google.gson.Gson; + +public class Event { + + String eventCategory; + String eventType; + String eventSource; + String resourceType; + String resourceUUID; + String description; + + public Event(String eventSource, String eventCategory, String eventType, String resourceType, + String resourceUUID) { + this.eventCategory = eventCategory; + this.eventType = eventType; + this.eventSource = eventSource; + this.resourceType = resourceType; + this.resourceUUID = resourceUUID; + } + + public String getEventCategory() { + return eventCategory; + } + + public void setEventCategory(String category) { + eventCategory = category; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String type) { + eventType = type; + } + + public String getEventSource() { + return eventSource; + } + + void setEventSource(String source) { + eventSource = source; + } + + public String getDescription() { + return description; + } + + public void setDescription (Object message) { + Gson gson = new Gson(); + this.description = gson.toJson(message).toString(); + } + + public void setDescription(String description) { + this.description = description; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(String resourceType) { + this.resourceType = resourceType; + } + + public void setResourceUUID(String uuid) { + this.resourceUUID = uuid; + } + + public String getResourceUUID () { + return resourceUUID; + } +} \ No newline at end of file diff --git a/framework/events/src/org/apache/cloudstack/framework/events/EventBus.java b/framework/events/src/org/apache/cloudstack/framework/events/EventBus.java new file mode 100644 index 00000000000..c16ee6f96f4 --- /dev/null +++ b/framework/events/src/org/apache/cloudstack/framework/events/EventBus.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.cloudstack.framework.events; + +import com.cloud.utils.component.Adapter; + +import java.util.UUID; + +/** + * Interface to publish and subscribe to CloudStack events + * + */ +public interface EventBus extends Adapter{ + + /** + * publish an event on to the event bus + * + * @param event event that needs to be published on the event bus + */ + void publish(Event event) throws EventBusException; + + /** + * subscribe to events that matches specified event topics + * + * @param topic defines category and type of the events being subscribed to + * @param subscriber subscriber that intends to receive event notification + * @return UUID returns the subscription ID + */ + UUID subscribe(EventTopic topic, EventSubscriber subscriber) throws EventBusException; + + /** + * unsubscribe to events of a category and a type + * + * @param subscriber subscriber that intends to unsubscribe from the event notification + */ + void unsubscribe(UUID subscriberId, EventSubscriber subscriber) throws EventBusException; + +} diff --git a/framework/events/src/org/apache/cloudstack/framework/events/EventBusException.java b/framework/events/src/org/apache/cloudstack/framework/events/EventBusException.java new file mode 100644 index 00000000000..5654ba04804 --- /dev/null +++ b/framework/events/src/org/apache/cloudstack/framework/events/EventBusException.java @@ -0,0 +1,26 @@ +/* + * 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.framework.events; + +public class EventBusException extends Exception{ + public EventBusException (String msg) { + super(msg); + } +} diff --git a/framework/events/src/org/apache/cloudstack/framework/events/EventSubscriber.java b/framework/events/src/org/apache/cloudstack/framework/events/EventSubscriber.java new file mode 100644 index 00000000000..511ebff17d2 --- /dev/null +++ b/framework/events/src/org/apache/cloudstack/framework/events/EventSubscriber.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 org.apache.cloudstack.framework.events; + +public interface EventSubscriber { + + /** + * Callback method. EventBus calls this method on occurrence of subscribed event + * + * @param event details of the event + */ + void onEvent(Event event); +} diff --git a/framework/events/src/org/apache/cloudstack/framework/events/EventTopic.java b/framework/events/src/org/apache/cloudstack/framework/events/EventTopic.java new file mode 100644 index 00000000000..19b727d4519 --- /dev/null +++ b/framework/events/src/org/apache/cloudstack/framework/events/EventTopic.java @@ -0,0 +1,57 @@ +/* + * 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.framework.events; + +public class EventTopic { + + String eventCategory; + String eventType; + String resourceType; + String resourceUUID; + String eventSource; + + public EventTopic(String eventCategory, String eventType, String resourceType, String resourceUUID, String eventSource) { + this.eventCategory = eventCategory; + this.eventType = eventType; + this.resourceType = resourceType; + this.resourceUUID = resourceUUID; + this.eventSource = eventSource; + } + + public String getEventCategory() { + return eventCategory; + } + + public String getEventType() { + return eventType; + } + + public String getResourceType() { + return resourceType; + } + + public String getEventSource() { + return eventSource; + } + + public String getResourceUUID() { + return resourceUUID; + } +} diff --git a/framework/ipc/pom.xml b/framework/ipc/pom.xml new file mode 100644 index 00000000000..b7f4fcc78ce --- /dev/null +++ b/framework/ipc/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + cloud-framework-ipc + Apache CloudStack Framework - IPC + + org.apache.cloudstack + cloudstack-framework + 4.2.0-SNAPSHOT + ../pom.xml + + + + + org.apache.cloudstack + cloud-core + 4.2.0-SNAPSHOT + + + + org.apache.cloudstack + cloud-utils + 4.2.0-SNAPSHOT + + + + + + install + src + ${project.basedir}/test + + + ${project.basedir}/test/resources + + + + diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java new file mode 100644 index 00000000000..26f46da37ba --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDispatcher.java @@ -0,0 +1,136 @@ +/* + * 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.framework.async; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import net.sf.cglib.proxy.CallbackFilter; +import net.sf.cglib.proxy.Callback; +import net.sf.cglib.proxy.Enhancer; +import net.sf.cglib.proxy.MethodInterceptor; +import net.sf.cglib.proxy.MethodProxy; + +@SuppressWarnings("rawtypes") +public class AsyncCallbackDispatcher implements AsyncCompletionCallback { + private Method _callbackMethod; + private T _targetObject; + private Object _contextObject; + private Object _resultObject; + private AsyncCallbackDriver _driver = new InplaceAsyncCallbackDriver(); + + private AsyncCallbackDispatcher(T target) { + assert(target != null); + _targetObject = target; + } + + public AsyncCallbackDispatcher attachDriver(AsyncCallbackDriver driver) { + assert(driver != null); + _driver = driver; + + return this; + } + + public Method getCallbackMethod() { + return _callbackMethod; + } + + @SuppressWarnings("unchecked") + public T getTarget() { + Enhancer en = new Enhancer(); + en.setSuperclass(_targetObject.getClass()); + en.setCallbacks(new Callback[]{new MethodInterceptor() { + @Override + public Object intercept(Object arg0, Method arg1, Object[] arg2, + MethodProxy arg3) throws Throwable { + _callbackMethod = arg1; + _callbackMethod.setAccessible(true); + return null; + } + }, + new MethodInterceptor() { + @Override + public Object intercept(Object arg0, Method arg1, Object[] arg2, + MethodProxy arg3) throws Throwable { + return null; + } + } + }); + en.setCallbackFilter(new CallbackFilter() { + public int accept(Method method) { + if (method.getParameterTypes().length == 0 && method.getName().equals("finalize")) { + return 1; + } + return 0; + }} + ); + return (T)en.create(); + } + + public AsyncCallbackDispatcher setCallback(Object useless) { + return this; + } + + public AsyncCallbackDispatcher setContext(Object context) { + _contextObject = context; + return this; + } + + @SuppressWarnings("unchecked") + public

P getContext() { + return (P)_contextObject; + } + + public void complete(Object resultObject) { + _resultObject = resultObject; + _driver.performCompletionCallback(this); + } + + @SuppressWarnings("unchecked") + public R getResult() { + return (R)_resultObject; + } + + // for internal use + Object getTargetObject() { + return _targetObject; + } + + public static AsyncCallbackDispatcher create(P target) { + return new AsyncCallbackDispatcher(target); + } + + public static boolean dispatch(Object target, AsyncCallbackDispatcher callback) { + assert(callback != null); + assert(target != null); + + try { + callback.getCallbackMethod().invoke(target, callback, callback.getContext()); + } catch (IllegalArgumentException e) { + throw new RuntimeException("IllegalArgumentException when invoking RPC callback for command: " + callback.getCallbackMethod().getName()); + } catch (IllegalAccessException e) { + throw new RuntimeException("IllegalAccessException when invoking RPC callback for command: " + callback.getCallbackMethod().getName()); + } catch (InvocationTargetException e) { + throw new RuntimeException("InvocationTargetException when invoking RPC callback for command: " + callback.getCallbackMethod().getName(), e); + } + + return true; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDriver.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDriver.java new file mode 100644 index 00000000000..d14f1a7a5fc --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncCallbackDriver.java @@ -0,0 +1,24 @@ +/* + * 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.framework.async; + + +public interface AsyncCallbackDriver { + public void performCompletionCallback(AsyncCallbackDispatcher dispatcher); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java new file mode 100644 index 00000000000..102364c932c --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/AsyncRpcConext.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.async; + +public class AsyncRpcConext { + protected final AsyncCompletionCallback parentCallBack; + public AsyncRpcConext(AsyncCompletionCallback callback) { + this.parentCallBack = callback; + } + + public AsyncCompletionCallback getParentCallback() { + return this.parentCallBack; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/InplaceAsyncCallbackDriver.java b/framework/ipc/src/org/apache/cloudstack/framework/async/InplaceAsyncCallbackDriver.java new file mode 100644 index 00000000000..ece9121f28a --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/InplaceAsyncCallbackDriver.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 org.apache.cloudstack.framework.async; + + +public class InplaceAsyncCallbackDriver implements AsyncCallbackDriver { + + @Override + public void performCompletionCallback(AsyncCallbackDispatcher callback) { + AsyncCallbackDispatcher.dispatch(callback.getTargetObject(), callback); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/async/Void.java b/framework/ipc/src/org/apache/cloudstack/framework/async/Void.java new file mode 100644 index 00000000000..b4c6d4a173c --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/async/Void.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 org.apache.cloudstack.framework.async; + +/** + * This is place-holder class to help AsyncMethod to indicate void return value + * public void AsyncMethod(Object realParam, AsyncCompletionCallback callback) { + * + */ +public class Void { +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/client/ClientEventBus.java b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientEventBus.java new file mode 100644 index 00000000000..7930bf2fea0 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientEventBus.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.framework.client; + +import org.apache.cloudstack.framework.eventbus.EventBusBase; +import org.apache.cloudstack.framework.transport.TransportMultiplexier; + +public class ClientEventBus extends EventBusBase implements TransportMultiplexier { + + @Override + public void onTransportMessage(String senderEndpointAddress, + String targetEndpointAddress, String multiplexer, String message) { + // TODO Auto-generated method stub + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportConnection.java b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportConnection.java new file mode 100644 index 00000000000..34cd5efeb15 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportConnection.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.client; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.cloudstack.framework.transport.TransportAddress; +import org.apache.cloudstack.framework.transport.TransportAttachResponsePdu; +import org.apache.cloudstack.framework.transport.TransportConnectResponsePdu; +import org.apache.cloudstack.framework.transport.TransportPdu; + +public class ClientTransportConnection { + enum State { + Idle, + Connecting, + Open, + Closing + } + + private ClientTransportProvider _provider; + + // TODO, use state machine + private State _state = State.Idle; + + private TransportAddress _connectionTpAddress; + private List _outputQueue = new ArrayList(); + + public ClientTransportConnection(ClientTransportProvider provider) { + _provider = provider; + } + + public void connect(String serverAddress, int serverPort) { + boolean doConnect = false; + synchronized(this) { + if(_state == State.Idle) { + setState(State.Connecting); + doConnect = true; + } + } + + if(doConnect) { + // ??? + } + } + + public void handleConnectResponsePdu(TransportConnectResponsePdu pdu) { + // TODO assume it is always succeeds + _connectionTpAddress = TransportAddress.fromAddressString(pdu.getDestAddress()); + + // ??? + } + + public void handleAttachResponsePdu(TransportAttachResponsePdu pdu) { + // ??? + } + + private void setState(State state) { + synchronized(this) { + if(_state != state) { + _state = state; + } + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpoint.java b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpoint.java new file mode 100644 index 00000000000..37fe5af41de --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpoint.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 org.apache.cloudstack.framework.client; + +import org.apache.cloudstack.framework.transport.TransportEndpoint; + +public class ClientTransportEndpoint implements TransportEndpoint { + + @Override + public void onAttachConfirm(boolean bSuccess, String endpointAddress) { + // TODO Auto-generated method stub + } + + @Override + public void onDetachIndication(String endpointAddress) { + } + + @Override + public void onTransportMessage(String senderEndpointAddress, + String targetEndpointAddress, String multiplexer, String message) { + // TODO Auto-generated method stub + + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpointSite.java b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpointSite.java new file mode 100644 index 00000000000..d75c5b6636a --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportEndpointSite.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 org.apache.cloudstack.framework.client; + +import org.apache.cloudstack.framework.transport.TransportEndpoint; +import org.apache.cloudstack.framework.transport.TransportEndpointSite; +import org.apache.cloudstack.framework.transport.TransportProvider; + +public class ClientTransportEndpointSite extends TransportEndpointSite { + private String _predefinedAddress; + private int _providerKey; + + public ClientTransportEndpointSite(TransportProvider provider, TransportEndpoint endpoint, String predefinedAddress, int providerKey) { + super(provider, endpoint); + + _predefinedAddress = predefinedAddress; + _providerKey = providerKey; + } + + public String getPredefinedAddress() { + return _predefinedAddress; + } + + public int getProviderKey() { + return _providerKey; + } + + public void setProviderKey(int providerKey) { + _providerKey = providerKey; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportProvider.java b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportProvider.java new file mode 100644 index 00000000000..bd93824ea85 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/client/ClientTransportProvider.java @@ -0,0 +1,140 @@ +/* + * 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.framework.client; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; +import org.apache.cloudstack.framework.transport.TransportEndpoint; +import org.apache.cloudstack.framework.transport.TransportEndpointSite; +import org.apache.cloudstack.framework.transport.TransportProvider; + +import com.cloud.utils.concurrency.NamedThreadFactory; + +public class ClientTransportProvider implements TransportProvider { + public static final int DEFAULT_WORKER_POOL_SIZE = 5; + + private Map _endpointSites = new HashMap(); + private Map _attachedMap = new HashMap(); + + private MessageSerializer _messageSerializer; + + private ClientTransportConnection _connection; + private String _serverAddress; + private int _serverPort; + + private int _poolSize = DEFAULT_WORKER_POOL_SIZE; + private ExecutorService _executor; + + private int _nextProviderKey = 1; + + public ClientTransportProvider() { + } + + public ClientTransportProvider setPoolSize(int poolSize) { + _poolSize = poolSize; + return this; + } + + public void initialize(String serverAddress, int serverPort) { + _serverAddress = serverAddress; + _serverPort = serverPort; + + _executor = Executors.newFixedThreadPool(_poolSize, new NamedThreadFactory("Transport-Worker")); + _connection = new ClientTransportConnection(this); + + _executor.execute(new Runnable() { + + @Override + public void run() { + try { + _connection.connect(_serverAddress, _serverPort); + } catch(Throwable e) { + } + } + }); + } + + @Override + public TransportEndpointSite attach(TransportEndpoint endpoint, String predefinedAddress) { + + ClientTransportEndpointSite endpointSite; + synchronized(this) { + endpointSite = getEndpointSite(endpoint); + if(endpointSite != null) { + // already attached + return endpointSite; + } + + endpointSite = new ClientTransportEndpointSite(this, endpoint, predefinedAddress, getNextProviderKey()); + _endpointSites.put(endpointSite.getProviderKey(), endpointSite); + } + + return endpointSite; + } + + @Override + public boolean detach(TransportEndpoint endpoint) { + // TODO Auto-generated method stub + + return false; + } + + @Override + public void setMessageSerializer(MessageSerializer messageSerializer) { + assert(messageSerializer != null); + _messageSerializer = messageSerializer; + } + + @Override + public MessageSerializer getMessageSerializer() { + return _messageSerializer; + } + + @Override + public void requestSiteOutput(TransportEndpointSite site) { + // ??? + } + + @Override + public void sendMessage(String soureEndpointAddress, String targetEndpointAddress, + String multiplexier, String message) { + // TODO + } + + private ClientTransportEndpointSite getEndpointSite(TransportEndpoint endpoint) { + synchronized(this) { + for(ClientTransportEndpointSite endpointSite : _endpointSites.values()) { + if(endpointSite.getEndpoint() == endpoint) + return endpointSite; + } + } + + return null; + } + + public int getNextProviderKey() { + synchronized(this) { + return _nextProviderKey++; + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBus.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBus.java new file mode 100644 index 00000000000..200715c396f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBus.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 org.apache.cloudstack.framework.eventbus; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; + +public interface EventBus { + void setMessageSerializer(MessageSerializer messageSerializer); + MessageSerializer getMessageSerializer(); + + void subscribe(String subject, Subscriber subscriber); + void unsubscribe(String subject, Subscriber subscriber); + + void publish(String senderAddress, String subject, PublishScope scope, Object args); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusBase.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusBase.java new file mode 100644 index 00000000000..30a847f0f9a --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusBase.java @@ -0,0 +1,308 @@ +/* + * 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.framework.eventbus; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; + +public class EventBusBase implements EventBus { + + private Gate _gate; + private List _pendingActions; + + private SubscriptionNode _subscriberRoot; + private MessageSerializer _messageSerializer; + + public EventBusBase() { + _gate = new Gate(); + _pendingActions = new ArrayList(); + + _subscriberRoot = new SubscriptionNode("/", null); + } + + @Override + public void setMessageSerializer(MessageSerializer messageSerializer) { + _messageSerializer = messageSerializer; + } + + @Override + public MessageSerializer getMessageSerializer() { + return _messageSerializer; + } + + @Override + public void subscribe(String subject, Subscriber subscriber) { + assert(subject != null); + assert(subscriber != null); + if(_gate.enter()) { + SubscriptionNode current = locate(subject, null, true); + assert(current != null); + current.addSubscriber(subscriber); + _gate.leave(); + } else { + synchronized(_pendingActions) { + _pendingActions.add(new ActionRecord(ActionType.Subscribe, subject, subscriber)); + } + } + } + + @Override + public void unsubscribe(String subject, Subscriber subscriber) { + if(_gate.enter()) { + SubscriptionNode current = locate(subject, null, false); + if(current != null) + current.removeSubscriber(subscriber); + + _gate.leave(); + } else { + synchronized(_pendingActions) { + _pendingActions.add(new ActionRecord(ActionType.Unsubscribe, subject, subscriber)); + } + } + } + + @Override + public void publish(String senderAddress, String subject, PublishScope scope, + Object args) { + + if(_gate.enter(true)) { + + List chainFromTop = new ArrayList(); + SubscriptionNode current = locate(subject, chainFromTop, false); + + if(current != null) + current.notifySubscribers(senderAddress, subject, args); + + Collections.reverse(chainFromTop); + for(SubscriptionNode node : chainFromTop) + node.notifySubscribers(senderAddress, subject, args); + + _gate.leave(); + } + } + + private void onGateOpen() { + synchronized(_pendingActions) { + ActionRecord record = null; + if(_pendingActions.size() > 0) { + while((record = _pendingActions.remove(0)) != null) { + switch(record.getType()) { + case Subscribe : + { + SubscriptionNode current = locate(record.getSubject(), null, true); + assert(current != null); + current.addSubscriber(record.getSubscriber()); + } + break; + + case Unsubscribe : + { + SubscriptionNode current = locate(record.getSubject(), null, false); + if(current != null) + current.removeSubscriber(record.getSubscriber()); + } + break; + + default : + assert(false); + break; + + } + } + } + } + } + + + private SubscriptionNode locate(String subject, List chainFromTop, + boolean createPath) { + + assert(subject != null); + + String[] subjectPathTokens = subject.split("\\."); + return locate(subjectPathTokens, _subscriberRoot, chainFromTop, createPath); + } + + private static SubscriptionNode locate(String[] subjectPathTokens, + SubscriptionNode current, List chainFromTop, boolean createPath) { + + assert(current != null); + assert(subjectPathTokens != null); + assert(subjectPathTokens.length > 0); + + if(chainFromTop != null) + chainFromTop.add(current); + + SubscriptionNode next = current.getChild(subjectPathTokens[0]); + if(next == null) { + if(createPath) { + next = new SubscriptionNode(subjectPathTokens[0], null); + current.addChild(subjectPathTokens[0], next); + } else { + return null; + } + } + + if(subjectPathTokens.length > 1) { + return locate((String[])Arrays.copyOfRange(subjectPathTokens, 1, subjectPathTokens.length), + next, chainFromTop, createPath); + } else { + return next; + } + } + + + // + // Support inner classes + // + private static enum ActionType { + Subscribe, + Unsubscribe + } + + private static class ActionRecord { + private ActionType _type; + private String _subject; + private Subscriber _subscriber; + + public ActionRecord(ActionType type, String subject, Subscriber subscriber) { + _type = type; + _subject = subject; + _subscriber = subscriber; + } + + public ActionType getType() { + return _type; + } + + public String getSubject() { + return _subject; + } + + public Subscriber getSubscriber() { + return _subscriber; + } + } + + private class Gate { + private int _reentranceCount; + private Thread _gateOwner; + + public Gate() { + _reentranceCount = 0; + _gateOwner = null; + } + + public boolean enter() { + return enter(false); + } + + public boolean enter(boolean wait) { + while(true) { + synchronized(this) { + if(_reentranceCount == 0) { + assert(_gateOwner == null); + + _reentranceCount++; + _gateOwner = Thread.currentThread(); + return true; + } else { + if(wait) { + try { + wait(); + } catch (InterruptedException e) { + } + } else { + break; + } + } + } + } + + return false; + } + + public void leave() { + synchronized(this) { + if(_reentranceCount > 0) { + assert(_gateOwner == Thread.currentThread()); + + onGateOpen(); + _reentranceCount--; + assert(_reentranceCount == 0); + _gateOwner = null; + + notifyAll(); + } + } + } + } + + private static class SubscriptionNode { + @SuppressWarnings("unused") + private String _nodeKey; + private List _subscribers; + private Map _children; + + public SubscriptionNode(String nodeKey, Subscriber subscriber) { + assert(nodeKey != null); + _nodeKey = nodeKey; + _subscribers = new ArrayList(); + + if(subscriber != null) + _subscribers.add(subscriber); + + _children = new HashMap(); + } + + @SuppressWarnings("unused") + public List getSubscriber() { + return _subscribers; + } + + public void addSubscriber(Subscriber subscriber) { + _subscribers.add(subscriber); + } + + public void removeSubscriber(Subscriber subscriber) { + _subscribers.remove(subscriber); + } + + public SubscriptionNode getChild(String key) { + return _children.get(key); + } + + public void addChild(String key, SubscriptionNode childNode) { + _children.put(key, childNode); + } + + public void notifySubscribers(String senderAddress, String subject, Object args) { + for(Subscriber subscriber : _subscribers) { + subscriber.onPublishEvent(senderAddress, subject, args); + } + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusEndpoint.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusEndpoint.java new file mode 100644 index 00000000000..19a9b03dad9 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventBusEndpoint.java @@ -0,0 +1,61 @@ +/* + * 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.framework.eventbus; + + +public class EventBusEndpoint { + private EventBus _eventBus; + private String _sender; + private PublishScope _scope; + + public EventBusEndpoint(EventBus eventBus, String sender, PublishScope scope) { + _eventBus = eventBus; + _sender = sender; + _scope = scope; + } + + public EventBusEndpoint setEventBus(EventBus eventBus) { + _eventBus = eventBus; + return this; + } + + public EventBusEndpoint setScope(PublishScope scope) { + _scope = scope; + return this; + } + + public PublishScope getScope() { + return _scope; + } + + public EventBusEndpoint setSender(String sender) { + _sender = sender; + return this; + } + + public String getSender() { + return _sender; + } + + public void Publish(String subject, Object args) { + assert(_eventBus != null); + _eventBus.publish(_sender, subject, _scope, args); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventDispatcher.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventDispatcher.java new file mode 100644 index 00000000000..336a994a6cc --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventDispatcher.java @@ -0,0 +1,104 @@ +/* + * 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.framework.eventbus; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + + +public class EventDispatcher implements Subscriber { + private static Map, Method> s_handlerCache = new HashMap, Method>(); + + private static Map s_targetMap = new HashMap(); + private Object _targetObject; + + public EventDispatcher(Object targetObject) { + _targetObject = targetObject; + } + + @Override + public void onPublishEvent(String senderAddress, String subject, Object args) { + dispatch(_targetObject, subject, senderAddress, args); + } + + public static EventDispatcher getDispatcher(Object targetObject) { + EventDispatcher dispatcher; + synchronized(s_targetMap) { + dispatcher = s_targetMap.get(targetObject); + if(dispatcher == null) { + dispatcher = new EventDispatcher(targetObject); + s_targetMap.put(targetObject, dispatcher); + } + } + return dispatcher; + } + + public static void removeDispatcher(Object targetObject) { + synchronized(s_targetMap) { + s_targetMap.remove(targetObject); + } + } + + public static boolean dispatch(Object target, String subject, String senderAddress, Object args) { + assert(subject != null); + assert(target != null); + + Method handler = resolveHandler(target.getClass(), subject); + if(handler == null) + return false; + + try { + handler.invoke(target, subject, senderAddress, args); + } catch (IllegalArgumentException e) { + throw new RuntimeException("IllegalArgumentException when invoking event handler for subject: " + subject); + } catch (IllegalAccessException e) { + throw new RuntimeException("IllegalAccessException when invoking event handler for subject: " + subject); + } catch (InvocationTargetException e) { + throw new RuntimeException("InvocationTargetException when invoking event handler for subject: " + subject); + } + + return true; + } + + public static Method resolveHandler(Class handlerClz, String subject) { + synchronized(s_handlerCache) { + Method handler = s_handlerCache.get(handlerClz); + if(handler != null) + return handler; + + for(Method method : handlerClz.getMethods()) { + EventHandler annotation = method.getAnnotation(EventHandler.class); + if(annotation != null) { + if(match(annotation.topic(), subject)) { + s_handlerCache.put(handlerClz, method); + return method; + } + } + } + } + + return null; + } + + private static boolean match(String expression, String param) { + return param.matches(expression); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventHandler.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventHandler.java new file mode 100644 index 00000000000..1ed3a00b96f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/EventHandler.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.eventbus; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface EventHandler { + public String topic(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/PublishScope.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/PublishScope.java new file mode 100644 index 00000000000..539a242a55f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/PublishScope.java @@ -0,0 +1,24 @@ +/* + * 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.framework.eventbus; + +public enum PublishScope { + LOCAL, GLOBAL +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/eventbus/Subscriber.java b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/Subscriber.java new file mode 100644 index 00000000000..28b86de050e --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/eventbus/Subscriber.java @@ -0,0 +1,24 @@ +/* + * 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.framework.eventbus; + +public interface Subscriber { + void onPublishEvent(String senderAddress, String subject, Object args); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallRequestPdu.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallRequestPdu.java new file mode 100644 index 00000000000..b85316e8158 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallRequestPdu.java @@ -0,0 +1,68 @@ +/* + * 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.framework.rpc; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="RpcRequest") +public class RpcCallRequestPdu { + + private long requestTag; + private long requestStartTick; + + private String command; + private String serializedCommandArg; + + public RpcCallRequestPdu() { + requestTag = 0; + requestStartTick = System.currentTimeMillis(); + } + + public long getRequestTag() { + return requestTag; + } + + public void setRequestTag(long requestTag) { + this.requestTag = requestTag; + } + + public long getRequestStartTick() { + return requestStartTick; + } + + public void setRequestStartTick(long requestStartTick) { + this.requestStartTick = requestStartTick; + } + + public String getCommand() { + return command; + } + + public void setCommand(String command) { + this.command = command; + } + + public String getSerializedCommandArg() { + return serializedCommandArg; + } + + public void setSerializedCommandArg(String serializedCommandArg) { + this.serializedCommandArg = serializedCommandArg; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallResponsePdu.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallResponsePdu.java new file mode 100644 index 00000000000..f6cd0a0f23d --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallResponsePdu.java @@ -0,0 +1,80 @@ +/* + * 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.framework.rpc; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="RpcResponse") +public class RpcCallResponsePdu { + public static final int RESULT_SUCCESSFUL = 0; + public static final int RESULT_HANDLER_NOT_EXIST = 1; + public static final int RESULT_HANDLER_EXCEPTION = 2; + + private long requestTag; + private long requestStartTick; + + private int result; + private String command; + private String serializedResult; + + public RpcCallResponsePdu() { + requestTag = 0; + requestStartTick = 0; + } + + public long getRequestTag() { + return requestTag; + } + + public void setRequestTag(long requestTag) { + this.requestTag = requestTag; + } + + public long getRequestStartTick() { + return requestStartTick; + } + + public void setRequestStartTick(long requestStartTick) { + this.requestStartTick = requestStartTick; + } + + public int getResult() { + return result; + } + + public void setResult(int result) { + this.result = result; + } + + public String getCommand() { + return command; + } + + public void setCommand(String command) { + this.command = command; + } + + public String getSerializedResult() { + return serializedResult; + } + + public void setSerializedResult(String serializedResult) { + this.serializedResult = serializedResult; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackDispatcher.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackDispatcher.java new file mode 100644 index 00000000000..828a772b758 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackDispatcher.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 org.apache.cloudstack.framework.rpc; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import net.sf.cglib.proxy.Enhancer; +import net.sf.cglib.proxy.MethodInterceptor; +import net.sf.cglib.proxy.MethodProxy; + +public class RpcCallbackDispatcher { + private Method _callbackMethod; + private T _targetObject; + + private RpcCallbackDispatcher(T target) { + _targetObject = target; + } + + @SuppressWarnings("unchecked") + public T getTarget() { + return (T)Enhancer.create(_targetObject.getClass(), new MethodInterceptor() { + @Override + public Object intercept(Object arg0, Method arg1, Object[] arg2, + MethodProxy arg3) throws Throwable { + _callbackMethod = arg1; + return null; + } + }); + } + + public RpcCallbackDispatcher setCallback(Object useless) { + return this; + } + + public static

RpcCallbackDispatcher

create(P target) { + return new RpcCallbackDispatcher

(target); + } + + public boolean dispatch(RpcClientCall clientCall) { + assert(clientCall != null); + + if(_callbackMethod == null) + return false; + + try { + _callbackMethod.invoke(_targetObject, clientCall, clientCall.getContext()); + } catch (IllegalArgumentException e) { + throw new RpcException("IllegalArgumentException when invoking RPC callback for command: " + clientCall.getCommand()); + } catch (IllegalAccessException e) { + throw new RpcException("IllegalAccessException when invoking RPC callback for command: " + clientCall.getCommand()); + } catch (InvocationTargetException e) { + throw new RpcException("InvocationTargetException when invoking RPC callback for command: " + clientCall.getCommand()); + } + + return true; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackListener.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackListener.java new file mode 100644 index 00000000000..0ab94ac2fb5 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcCallbackListener.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.rpc; + + +public interface RpcCallbackListener { + void onSuccess(T result); + void onFailure(RpcException e); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCall.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCall.java new file mode 100644 index 00000000000..0e7516f2f48 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCall.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 org.apache.cloudstack.framework.rpc; + + +public interface RpcClientCall { + final static int DEFAULT_RPC_TIMEOUT = 10000; + + String getCommand(); + RpcClientCall setCommand(String cmd); + RpcClientCall setTimeout(int timeoutMilliseconds); + + RpcClientCall setCommandArg(Object arg); + Object getCommandArg(); + + RpcClientCall setContext(Object param); + T getContext(); + + RpcClientCall addCallbackListener(RpcCallbackListener listener); + RpcClientCall setCallbackDispatcher(RpcCallbackDispatcher dispatcher); + + RpcClientCall setOneway(); + + RpcClientCall apply(); + void cancel(); + + /** + * @return the result object, it may also throw RpcException to indicate RPC failures + */ + T get(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCallImpl.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCallImpl.java new file mode 100644 index 00000000000..cd427a40b4e --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcClientCallImpl.java @@ -0,0 +1,234 @@ +/* + * 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.framework.rpc; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class RpcClientCallImpl implements RpcClientCall { + + private String _command; + private Object _commandArg; + + private int _timeoutMilliseconds = DEFAULT_RPC_TIMEOUT; + private Object _contextObject; + private boolean _oneway = false; + + @SuppressWarnings("rawtypes") + private List _callbackListeners = new ArrayList(); + + @SuppressWarnings("rawtypes") + private RpcCallbackDispatcher _callbackDispatcher; + + private RpcProvider _rpcProvider; + private long _startTickInMs; + private long _callTag; + private String _sourceAddress; + private String _targetAddress; + + private Object _responseLock = new Object(); + private boolean _responseDone = false;; + private Object _responseResult; + + public RpcClientCallImpl(RpcProvider rpcProvider) { + assert(rpcProvider != null); + _rpcProvider = rpcProvider; + } + + @Override + public String getCommand() { + return _command; + } + + @Override + public RpcClientCall setCommand(String cmd) { + _command = cmd; + return this; + } + + @Override + public RpcClientCall setTimeout(int timeoutMilliseconds) { + _timeoutMilliseconds = timeoutMilliseconds; + return this; + } + + @Override + public RpcClientCall setCommandArg(Object arg) { + _commandArg = arg; + return this; + } + + @Override + public Object getCommandArg() { + return _commandArg; + } + + @Override + public RpcClientCall setContext(Object param) { + _contextObject = param; + return this; + } + + @SuppressWarnings("unchecked") + @Override + public T getContext() { + return (T)_contextObject; + } + + @Override + public RpcClientCall addCallbackListener(RpcCallbackListener listener) { + assert(listener != null); + _callbackListeners.add(listener); + return this; + } + + @Override + public RpcClientCall setCallbackDispatcher(RpcCallbackDispatcher dispatcher) { + _callbackDispatcher = dispatcher; + return this; + } + + @Override + public RpcClientCall setOneway() { + _oneway = true; + return this; + } + + public String getSourceAddress() { + return _sourceAddress; + } + + public void setSourceAddress(String sourceAddress) { + _sourceAddress = sourceAddress; + } + + public String getTargetAddress() { + return _targetAddress; + } + + public void setTargetAddress(String targetAddress) { + _targetAddress = targetAddress; + } + + public long getCallTag() { + return _callTag; + } + + public void setCallTag(long callTag) { + _callTag = callTag; + } + + @Override + public RpcClientCall apply() { + // sanity check + assert(_sourceAddress != null); + assert(_targetAddress != null); + + if(!_oneway) + _rpcProvider.registerCall(this); + + RpcCallRequestPdu pdu = new RpcCallRequestPdu(); + pdu.setCommand(getCommand()); + if(_commandArg != null) + pdu.setSerializedCommandArg(_rpcProvider.getMessageSerializer().serializeTo(_commandArg.getClass(), _commandArg)); + pdu.setRequestTag(this.getCallTag()); + + _rpcProvider.sendRpcPdu(getSourceAddress(), getTargetAddress(), + _rpcProvider.getMessageSerializer().serializeTo(RpcCallRequestPdu.class, pdu)); + + return this; + } + + @Override + public void cancel() { + _rpcProvider.cancelCall(this); + } + + @Override + public T get() { + if(!_oneway) { + synchronized(_responseLock) { + if(!_responseDone) { + long timeToWait = _timeoutMilliseconds - (System.currentTimeMillis() - _startTickInMs); + if(timeToWait < 0) + timeToWait = 0; + + try { + _responseLock.wait(timeToWait); + } catch (InterruptedException e) { + throw new RpcTimeoutException("RPC call timed out"); + } + } + + assert(_responseDone); + + if(_responseResult == null) + return null; + + if(_responseResult instanceof RpcException) + throw (RpcException)_responseResult; + + assert(_rpcProvider.getMessageSerializer() != null); + assert(_responseResult instanceof String); + return _rpcProvider.getMessageSerializer().serializeFrom((String)_responseResult); + } + } + return null; + } + + @SuppressWarnings("unchecked") + public void complete(String result) { + _responseResult = result; + + synchronized(_responseLock) { + _responseDone = true; + _responseLock.notifyAll(); + } + + if(_callbackListeners.size() > 0) { + assert(_rpcProvider.getMessageSerializer() != null); + Object resultObject = _rpcProvider.getMessageSerializer().serializeFrom(result); + for(@SuppressWarnings("rawtypes") RpcCallbackListener listener: _callbackListeners) + listener.onSuccess(resultObject); + } else { + if(_callbackDispatcher != null) + _callbackDispatcher.dispatch(this); + } + } + + public void complete(RpcException e) { + _responseResult = e; + + synchronized(_responseLock) { + _responseDone = true; + + _responseLock.notifyAll(); + } + + if(_callbackListeners.size() > 0) { + for(@SuppressWarnings("rawtypes") RpcCallbackListener listener: _callbackListeners) + listener.onFailure(e); + } else { + if(_callbackDispatcher != null) + _callbackDispatcher.dispatch(this); + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcException.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcException.java new file mode 100644 index 00000000000..618e6ab2448 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcException.java @@ -0,0 +1,35 @@ +/* + * 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.framework.rpc; + +public class RpcException extends RuntimeException { + private static final long serialVersionUID = -3164514701087423787L; + + public RpcException() { + super(); + } + + public RpcException(String message) { + super(message); + } + + public RpcException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcIOException.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcIOException.java new file mode 100644 index 00000000000..8479e38554b --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcIOException.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 org.apache.cloudstack.framework.rpc; + + +public class RpcIOException extends RpcException { + + private static final long serialVersionUID = -6108039302920641533L; + + public RpcIOException() { + super(); + } + + public RpcIOException(String message) { + super(message); + } + + public RpcIOException(String message, Throwable cause) { + super(message, cause); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProvider.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProvider.java new file mode 100644 index 00000000000..fb4f04bad2f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProvider.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 org.apache.cloudstack.framework.rpc; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; +import org.apache.cloudstack.framework.transport.TransportAddressMapper; +import org.apache.cloudstack.framework.transport.TransportMultiplexier; + +public interface RpcProvider extends TransportMultiplexier { + final static String RPC_MULTIPLEXIER = "rpc"; + + void setMessageSerializer(MessageSerializer messageSerializer); + MessageSerializer getMessageSerializer(); + boolean initialize(); + + void registerRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint); + void unregisteRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint); + + RpcClientCall newCall(); + RpcClientCall newCall(String targetAddress); + RpcClientCall newCall(TransportAddressMapper targetAddress); + + // + // low-level public API + // + void registerCall(RpcClientCall call); + void cancelCall(RpcClientCall call); + + void sendRpcPdu(String sourceAddress, String targetAddress, String serializedPdu); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProviderImpl.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProviderImpl.java new file mode 100644 index 00000000000..a68a65e91ea --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcProviderImpl.java @@ -0,0 +1,250 @@ +/* + * 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.framework.rpc; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; +import org.apache.cloudstack.framework.transport.TransportAddress; +import org.apache.cloudstack.framework.transport.TransportAddressMapper; +import org.apache.cloudstack.framework.transport.TransportEndpoint; +import org.apache.cloudstack.framework.transport.TransportEndpointSite; +import org.apache.cloudstack.framework.transport.TransportProvider; + +public class RpcProviderImpl implements RpcProvider { + public static final String RPC_MULTIPLEXIER = "rpc"; + + private TransportProvider _transportProvider; + private String _transportAddress; + private RpcTransportEndpoint _transportEndpoint = new RpcTransportEndpoint(); // transport attachment at RPC layer + + private MessageSerializer _messageSerializer; + private List _serviceEndpoints = new ArrayList(); + private Map _outstandingCalls = new HashMap(); + + private long _nextCallTag = System.currentTimeMillis(); + + public RpcProviderImpl() { + } + + public RpcProviderImpl(TransportProvider transportProvider) { + _transportProvider = transportProvider; + } + + public TransportProvider getTransportProvider() { + return _transportProvider; + } + + public void setTransportProvider(TransportProvider transportProvider) { + _transportProvider = transportProvider; + } + + @Override + public void onTransportMessage(String senderEndpointAddress, + String targetEndpointAddress, String multiplexer, String message) { + assert(_messageSerializer != null); + + Object pdu = _messageSerializer.serializeFrom(message); + if(pdu instanceof RpcCallRequestPdu) { + handleCallRequestPdu(senderEndpointAddress, targetEndpointAddress, (RpcCallRequestPdu)pdu); + } else if(pdu instanceof RpcCallResponsePdu) { + handleCallResponsePdu(senderEndpointAddress, targetEndpointAddress, (RpcCallResponsePdu)pdu); + } else { + assert(false); + } + } + + @Override + public void setMessageSerializer(MessageSerializer messageSerializer) { + assert(messageSerializer != null); + _messageSerializer = messageSerializer; + } + + @Override + public MessageSerializer getMessageSerializer() { + return _messageSerializer; + } + + @Override + public boolean initialize() { + assert(_transportProvider != null); + if(_transportProvider == null) + return false; + + TransportEndpointSite endpointSite = _transportProvider.attach(_transportEndpoint, "RpcProvider"); + endpointSite.registerMultiplexier(RPC_MULTIPLEXIER, this); + return true; + } + + @Override + public void registerRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint) { + synchronized(_serviceEndpoints) { + _serviceEndpoints.add(rpcEndpoint); + } + } + + @Override + public void unregisteRpcServiceEndpoint(RpcServiceEndpoint rpcEndpoint) { + synchronized(_serviceEndpoints) { + _serviceEndpoints.remove(rpcEndpoint); + } + } + + @Override + public RpcClientCall newCall() { + return newCall(TransportAddress.getLocalPredefinedTransportAddress("RpcProvider").toString()); + } + + @Override + public RpcClientCall newCall(String targetAddress) { + + long callTag = getNextCallTag(); + RpcClientCallImpl call = new RpcClientCallImpl(this); + call.setSourceAddress(_transportAddress); + call.setTargetAddress(targetAddress); + call.setCallTag(callTag); + + return call; + } + + @Override + public RpcClientCall newCall(TransportAddressMapper targetAddress) { + return newCall(targetAddress.getAddress()); + } + + @Override + public void registerCall(RpcClientCall call) { + assert(call != null); + synchronized(this) { + _outstandingCalls.put(((RpcClientCallImpl)call).getCallTag(), call); + } + } + + @Override + public void cancelCall(RpcClientCall call) { + synchronized(this) { + _outstandingCalls.remove(((RpcClientCallImpl)call).getCallTag()); + } + + ((RpcClientCallImpl)call).complete(new RpcException("Call is cancelled")); + } + + @Override + public void sendRpcPdu(String sourceAddress, String targetAddress, String serializedPdu) { + assert(_transportProvider != null); + _transportProvider.sendMessage(sourceAddress, targetAddress, RpcProvider.RPC_MULTIPLEXIER, serializedPdu); + } + + protected synchronized long getNextCallTag() { + long tag = _nextCallTag++; + if(tag == 0) + tag++; + + return tag; + } + + private void handleCallRequestPdu(String sourceAddress, String targetAddress, RpcCallRequestPdu pdu) { + try { + RpcServerCall call = new RpcServerCallImpl(this, sourceAddress, targetAddress, pdu); + + // TODO, we are trying to avoid locking when calling into callbacks + // this should be optimized later + List endpoints = new ArrayList(); + synchronized(_serviceEndpoints) { + endpoints.addAll(_serviceEndpoints); + } + + for(RpcServiceEndpoint endpoint : endpoints) { + if(endpoint.onCallReceive(call)) + return; + } + + RpcCallResponsePdu responsePdu = new RpcCallResponsePdu(); + responsePdu.setCommand(pdu.getCommand()); + responsePdu.setRequestStartTick(pdu.getRequestStartTick()); + responsePdu.setRequestTag(pdu.getRequestTag()); + responsePdu.setResult(RpcCallResponsePdu.RESULT_HANDLER_NOT_EXIST); + sendRpcPdu(targetAddress, sourceAddress, _messageSerializer.serializeTo(RpcCallResponsePdu.class, responsePdu)); + + } catch (Throwable e) { + + RpcCallResponsePdu responsePdu = new RpcCallResponsePdu(); + responsePdu.setCommand(pdu.getCommand()); + responsePdu.setRequestStartTick(pdu.getRequestStartTick()); + responsePdu.setRequestTag(pdu.getRequestTag()); + responsePdu.setResult(RpcCallResponsePdu.RESULT_HANDLER_EXCEPTION); + + sendRpcPdu(targetAddress, sourceAddress, _messageSerializer.serializeTo(RpcCallResponsePdu.class, responsePdu)); + } + } + + private void handleCallResponsePdu(String sourceAddress, String targetAddress, RpcCallResponsePdu pdu) { + RpcClientCallImpl call = null; + + synchronized(this) { + call = (RpcClientCallImpl)_outstandingCalls.remove(pdu.getRequestTag()); + } + + if(call != null) { + switch(pdu.getResult()) { + case RpcCallResponsePdu.RESULT_SUCCESSFUL : + call.complete(pdu.getSerializedResult()); + break; + + case RpcCallResponsePdu.RESULT_HANDLER_NOT_EXIST : + call.complete(new RpcException("Handler does not exist")); + break; + + case RpcCallResponsePdu.RESULT_HANDLER_EXCEPTION : + call.complete(new RpcException("Exception in handler")); + break; + + default : + assert(false); + break; + } + } + } + + private class RpcTransportEndpoint implements TransportEndpoint { + + @Override + public void onTransportMessage(String senderEndpointAddress, + String targetEndpointAddress, String multiplexer, String message) { + + // we won't handle generic transport message toward RPC transport endpoint + } + + @Override + public void onAttachConfirm(boolean bSuccess, String endpointAddress) { + if(bSuccess) + _transportAddress = endpointAddress; + + } + + @Override + public void onDetachIndication(String endpointAddress) { + if(_transportAddress != null && _transportAddress.equals(endpointAddress)) + _transportAddress = null; + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCall.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCall.java new file mode 100644 index 00000000000..a102503e14b --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCall.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 org.apache.cloudstack.framework.rpc; + +public interface RpcServerCall { + String getCommand(); + T getCommandArgument(); + + // for receiver to response call + void completeCall(Object returnObject); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCallImpl.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCallImpl.java new file mode 100644 index 00000000000..d1ac7a99d69 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServerCallImpl.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.framework.rpc; + + +public class RpcServerCallImpl implements RpcServerCall { + + private RpcProvider _rpcProvider; + private String _sourceAddress; + private String _targetAddress; + + private RpcCallRequestPdu _requestPdu; + + public RpcServerCallImpl(RpcProvider provider, String sourceAddress, String targetAddress, + RpcCallRequestPdu requestPdu) { + + _rpcProvider = provider; + _sourceAddress = sourceAddress; + _targetAddress = targetAddress; + _requestPdu = requestPdu; + } + + @Override + public String getCommand() { + assert(_requestPdu != null); + return _requestPdu.getCommand(); + } + + @Override + public T getCommandArgument() { + if(_requestPdu.getSerializedCommandArg() == null) + return null; + + assert(_rpcProvider.getMessageSerializer() != null); + return _rpcProvider.getMessageSerializer().serializeFrom(_requestPdu.getSerializedCommandArg()); + } + + @Override + public void completeCall(Object returnObject) { + assert(_sourceAddress != null); + assert(_targetAddress != null); + + RpcCallResponsePdu pdu = new RpcCallResponsePdu(); + pdu.setCommand(_requestPdu.getCommand()); + pdu.setRequestTag(_requestPdu.getRequestTag()); + pdu.setRequestStartTick(_requestPdu.getRequestStartTick()); + pdu.setRequestStartTick(RpcCallResponsePdu.RESULT_SUCCESSFUL); + if(returnObject != null) { + assert(_rpcProvider.getMessageSerializer() != null); + pdu.setSerializedResult(_rpcProvider.getMessageSerializer().serializeTo(returnObject.getClass(), returnObject)); + } + + _rpcProvider.sendRpcPdu(_targetAddress, _sourceAddress, + _rpcProvider.getMessageSerializer().serializeTo(RpcCallResponsePdu.class, pdu)); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceDispatcher.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceDispatcher.java new file mode 100644 index 00000000000..c0d1566ba81 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceDispatcher.java @@ -0,0 +1,118 @@ +/* + * 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.framework.rpc; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.HashMap; +import java.util.Map; + + +public class RpcServiceDispatcher implements RpcServiceEndpoint { + + private static Map, Map> s_handlerCache = new HashMap, Map>(); + + private static Map s_targetMap = new HashMap(); + private Object _targetObject; + + public RpcServiceDispatcher(Object targetObject) { + _targetObject = targetObject; + } + + public static RpcServiceDispatcher getDispatcher(Object targetObject) { + RpcServiceDispatcher dispatcher; + synchronized(s_targetMap) { + dispatcher = s_targetMap.get(targetObject); + if(dispatcher == null) { + dispatcher = new RpcServiceDispatcher(targetObject); + s_targetMap.put(targetObject, dispatcher); + } + } + return dispatcher; + } + + public static void removeDispatcher(Object targetObject) { + synchronized(s_targetMap) { + s_targetMap.remove(targetObject); + } + } + + public static boolean dispatch(Object target, RpcServerCall serviceCall) { + assert(serviceCall != null); + assert(target != null); + + Method handler = resolveHandler(target.getClass(), serviceCall.getCommand()); + if(handler == null) + return false; + + try { + handler.invoke(target, serviceCall); + } catch (IllegalArgumentException e) { + throw new RpcException("IllegalArgumentException when invoking RPC service command: " + serviceCall.getCommand()); + } catch (IllegalAccessException e) { + throw new RpcException("IllegalAccessException when invoking RPC service command: " + serviceCall.getCommand()); + } catch (InvocationTargetException e) { + throw new RpcException("InvocationTargetException when invoking RPC service command: " + serviceCall.getCommand()); + } + + return true; + } + + public static Method resolveHandler(Class handlerClz, String command) { + synchronized(s_handlerCache) { + Map handlerMap = getAndSetHandlerMap(handlerClz); + + Method handler = handlerMap.get(command); + if(handler != null) + return handler; + + for(Method method : handlerClz.getDeclaredMethods()) { + RpcServiceHandler annotation = method.getAnnotation(RpcServiceHandler.class); + if(annotation != null) { + if(annotation.command().equals(command)) { + method.setAccessible(true); + handlerMap.put(command, method); + return method; + } + } + } + } + + return null; + } + + private static Map getAndSetHandlerMap(Class handlerClz) { + Map handlerMap; + synchronized(s_handlerCache) { + handlerMap = s_handlerCache.get(handlerClz); + + if(handlerMap == null) { + handlerMap = new HashMap(); + s_handlerCache.put(handlerClz, handlerMap); + } + } + + return handlerMap; + } + + @Override + public boolean onCallReceive(RpcServerCall call) { + return dispatch(_targetObject, call); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceEndpoint.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceEndpoint.java new file mode 100644 index 00000000000..31dc0831cb0 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceEndpoint.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.framework.rpc; + + +public interface RpcServiceEndpoint { + /* + * @return + * true call has been handled + * false can not find the call handler + * @throws + * RpcException, exception when + */ + boolean onCallReceive(RpcServerCall call); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceHandler.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceHandler.java new file mode 100644 index 00000000000..6a77f930815 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcServiceHandler.java @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.rpc; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface RpcServiceHandler { + String command(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcTimeoutException.java b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcTimeoutException.java new file mode 100644 index 00000000000..5c876c7fb97 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/rpc/RpcTimeoutException.java @@ -0,0 +1,33 @@ +/* + * 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.framework.rpc; + + +public class RpcTimeoutException extends RpcException { + + private static final long serialVersionUID = -3618654987984665833L; + + public RpcTimeoutException() { + super(); + } + + public RpcTimeoutException(String message) { + super(message); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/serializer/JsonMessageSerializer.java b/framework/ipc/src/org/apache/cloudstack/framework/serializer/JsonMessageSerializer.java new file mode 100644 index 00000000000..2fcab54fddb --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/serializer/JsonMessageSerializer.java @@ -0,0 +1,87 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.serializer; + + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; + +public class JsonMessageSerializer implements MessageSerializer { + + // this will be injected from external to allow installation of + // type adapters needed by upper layer applications + private Gson _gson; + + private OnwireClassRegistry _clzRegistry; + + public JsonMessageSerializer() { + GsonBuilder gsonBuilder = new GsonBuilder(); + gsonBuilder.setVersion(1.5); + _gson = gsonBuilder.create(); + } + + public Gson getGson() { + return _gson; + } + + public void setGson(Gson gson) { + _gson = gson; + } + + public OnwireClassRegistry getOnwireClassRegistry() { + return _clzRegistry; + } + + public void setOnwireClassRegistry(OnwireClassRegistry clzRegistry) { + _clzRegistry = clzRegistry; + } + + @Override + public String serializeTo(Class clz, T object) { + assert(clz != null); + assert(object != null); + + StringBuffer sbuf = new StringBuffer(); + + OnwireName onwire = clz.getAnnotation(OnwireName.class); + if(onwire == null) + throw new RuntimeException("Class " + clz.getCanonicalName() + " is not declared to be onwire"); + + sbuf.append(onwire.name()).append("|"); + sbuf.append(_gson.toJson(object)); + + return sbuf.toString(); + } + + @SuppressWarnings("unchecked") + @Override + public T serializeFrom(String message) { + assert(message != null); + int contentStartPos = message.indexOf('|'); + if(contentStartPos < 0) + throw new RuntimeException("Invalid on-wire message format"); + + String onwireName = message.substring(0, contentStartPos); + Class clz = _clzRegistry.getOnwireClass(onwireName); + if(clz == null) + throw new RuntimeException("Onwire class is not registered. name: " + onwireName); + + return (T)_gson.fromJson(message.substring(contentStartPos + 1), clz); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/serializer/MessageSerializer.java b/framework/ipc/src/org/apache/cloudstack/framework/serializer/MessageSerializer.java new file mode 100644 index 00000000000..65d818e9c9d --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/serializer/MessageSerializer.java @@ -0,0 +1,24 @@ +/* + * 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.framework.serializer; + +public interface MessageSerializer { + String serializeTo(Class clz, T object); + T serializeFrom(String message); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java new file mode 100644 index 00000000000..ac9c6bc5699 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireClassRegistry.java @@ -0,0 +1,180 @@ +/* + * 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.framework.serializer; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; + + +// +// Finding classes in a given package code is taken and modified from +// Credit: http://internna.blogspot.com/2007/11/java-5-retrieving-all-classes-from.html +// +public class OnwireClassRegistry { + + private List packages = new ArrayList(); + private Map> registry = new HashMap>(); + + public OnwireClassRegistry() { + registry.put("Object", Object.class); + } + + public OnwireClassRegistry(String packageName) { + addPackage(packageName); + } + + public OnwireClassRegistry(List packages) { + packages.addAll(packages); + } + + public List getPackages() { + return packages; + } + + public void setPackages(List packages) { + this.packages = packages; + } + + public void addPackage(String packageName) { + packages.add(packageName); + } + + public void scan() { + Set> classes = new HashSet>(); + for(String pkg : packages) { + classes.addAll(getClasses(pkg)); + } + + for(Class clz : classes) { + OnwireName onwire = clz.getAnnotation(OnwireName.class); + if(onwire != null) { + assert(onwire.name() != null); + + registry.put(onwire.name(), clz); + } + } + } + + public Class getOnwireClass(String onwireName) { + return registry.get(onwireName); + } + + static Set> getClasses(String packageName) { + ClassLoader loader = Thread.currentThread().getContextClassLoader(); + return getClasses(loader, packageName); + } + + // + // Following helper methods can be put in a separated helper class, + // will do that later + // + static Set> getClasses(ClassLoader loader, String packageName) { + Set> classes = new HashSet>(); + String path = packageName.replace('.', '/'); + try { + Enumeration resources = loader.getResources(path); + if (resources != null) { + while (resources.hasMoreElements()) { + String filePath = resources.nextElement().getFile(); + // WINDOWS HACK + if(filePath.indexOf("%20") > 0) + filePath = filePath.replaceAll("%20", " "); + if (filePath != null) { + if ((filePath.indexOf("!") > 0) && (filePath.indexOf(".jar") > 0)) { + String jarPath = filePath.substring(0, filePath.indexOf("!")) + .substring(filePath.indexOf(":") + 1); + // WINDOWS HACK + if (jarPath.indexOf(":") >= 0) jarPath = jarPath.substring(1); + classes.addAll(getFromJARFile(jarPath, path)); + } else { + classes.addAll(getFromDirectory(new File(filePath), packageName)); + } + } + } + } + } catch(IOException e) { + } catch(ClassNotFoundException e) { + } + return classes; + } + + static Set> getFromDirectory(File directory, String packageName) throws ClassNotFoundException { + Set> classes = new HashSet>(); + if (directory.exists()) { + for (String file : directory.list()) { + if (file.endsWith(".class")) { + String name = packageName + '.' + stripFilenameExtension(file); + try { + Class clazz = Class.forName(name); + classes.add(clazz); + } catch(ClassNotFoundException e) { + } catch(Exception e) { + } + } else { + File f = new File(directory.getPath() + "/" + file); + if(f.isDirectory()) { + classes.addAll(getFromDirectory(f, packageName + "." + file)); + } + } + } + } + return classes; + } + + static Set> getFromJARFile(String jar, String packageName) throws IOException, ClassNotFoundException { + Set> classes = new HashSet>(); + JarInputStream jarFile = new JarInputStream(new FileInputStream(jar)); + JarEntry jarEntry; + do { + jarEntry = jarFile.getNextJarEntry(); + if (jarEntry != null) { + String className = jarEntry.getName(); + if (className.endsWith(".class")) { + className = stripFilenameExtension(className); + if (className.startsWith(packageName)) { + try { + Class clz = Class.forName(className.replace('/', '.')); + classes.add(clz); + } catch(ClassNotFoundException e) { + } catch(NoClassDefFoundError e) { + } + } + } + } + } while (jarEntry != null); + + return classes; + } + + static String stripFilenameExtension(String file) { + return file.substring(0, file.lastIndexOf('.')); + } +} + diff --git a/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireName.java b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireName.java new file mode 100644 index 00000000000..ac195d0ef89 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/serializer/OnwireName.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.framework.serializer; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +public @interface OnwireName { + String name(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/server/ServerEventBus.java b/framework/ipc/src/org/apache/cloudstack/framework/server/ServerEventBus.java new file mode 100644 index 00000000000..11bc428a42b --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/server/ServerEventBus.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.framework.server; + +import org.apache.cloudstack.framework.eventbus.EventBusBase; +import org.apache.cloudstack.framework.transport.TransportMultiplexier; + +public class ServerEventBus extends EventBusBase implements TransportMultiplexier { + + @Override + public void onTransportMessage(String senderEndpointAddress, + String targetEndpointAddress, String multiplexer, String message) { + // TODO Auto-generated method stub + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/server/ServerTransportProvider.java b/framework/ipc/src/org/apache/cloudstack/framework/server/ServerTransportProvider.java new file mode 100644 index 00000000000..b19a7c9265f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/server/ServerTransportProvider.java @@ -0,0 +1,190 @@ +/* + * 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.framework.server; + +import java.util.HashMap; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; +import org.apache.cloudstack.framework.transport.TransportAddress; +import org.apache.cloudstack.framework.transport.TransportDataPdu; +import org.apache.cloudstack.framework.transport.TransportEndpoint; +import org.apache.cloudstack.framework.transport.TransportEndpointSite; +import org.apache.cloudstack.framework.transport.TransportPdu; +import org.apache.cloudstack.framework.transport.TransportProvider; +import org.apache.log4j.Logger; + +import com.cloud.utils.concurrency.NamedThreadFactory; + +public class ServerTransportProvider implements TransportProvider { + private static final Logger s_logger = Logger.getLogger(ServerTransportProvider.class); + + public static final int DEFAULT_WORKER_POOL_SIZE = 5; + + private String _nodeId; + + private Map _endpointMap = new HashMap(); + private int _poolSize = DEFAULT_WORKER_POOL_SIZE; + private ExecutorService _executor; + + private int _nextEndpointId = new Random().nextInt(); + + private MessageSerializer _messageSerializer; + + public ServerTransportProvider() { + } + + public String getNodeId() { + return _nodeId; + } + + public ServerTransportProvider setNodeId(String nodeId) { + _nodeId = nodeId; + return this; + } + + public int getWorkerPoolSize() { + return _poolSize; + } + + public ServerTransportProvider setWorkerPoolSize(int poolSize) { + assert(poolSize > 0); + + _poolSize = poolSize; + return this; + } + + @Override + public void setMessageSerializer(MessageSerializer messageSerializer) { + assert(messageSerializer != null); + _messageSerializer = messageSerializer; + } + + @Override + public MessageSerializer getMessageSerializer() { + return _messageSerializer; + } + + public void initialize() { + _executor = Executors.newFixedThreadPool(_poolSize, new NamedThreadFactory("Transport-Worker")); + } + + @Override + public TransportEndpointSite attach(TransportEndpoint endpoint, String predefinedAddress) { + + TransportAddress transportAddress; + String endpointId; + if(predefinedAddress != null && !predefinedAddress.isEmpty()) { + endpointId = predefinedAddress; + transportAddress = new TransportAddress(_nodeId, TransportAddress.LOCAL_SERVICE_CONNECTION, endpointId, 0); + } else { + endpointId = String.valueOf(getNextEndpointId()); + transportAddress = new TransportAddress(_nodeId, TransportAddress.LOCAL_SERVICE_CONNECTION, endpointId); + } + + TransportEndpointSite endpointSite; + synchronized(this) { + endpointSite = _endpointMap.get(endpointId); + if(endpointSite != null) { + // already attached + return endpointSite; + } + endpointSite = new TransportEndpointSite(this, endpoint, transportAddress); + _endpointMap.put(endpointId, endpointSite); + } + + endpoint.onAttachConfirm(true, transportAddress.toString()); + return endpointSite; + } + + @Override + public boolean detach(TransportEndpoint endpoint) { + synchronized(this) { + for(Map.Entry entry : _endpointMap.entrySet()) { + if(entry.getValue().getEndpoint() == endpoint) { + _endpointMap.remove(entry.getKey()); + return true; + } + } + } + + return false; + } + + @Override + public void requestSiteOutput(final TransportEndpointSite site) { + _executor.execute(new Runnable() { + + @Override + public void run() { + try { + site.processOutput(); + site.ackOutputProcessSignal(); + } catch(Throwable e) { + s_logger.error("Unhandled exception", e); + } + } + }); + } + + @Override + public void sendMessage(String sourceEndpointAddress, String targetEndpointAddress, + String multiplexier, String message) { + + TransportDataPdu pdu = new TransportDataPdu(); + pdu.setSourceAddress(sourceEndpointAddress); + pdu.setDestAddress(targetEndpointAddress); + pdu.setMultiplexier(multiplexier); + pdu.setContent(message); + + dispatchPdu(pdu); + } + + private void dispatchPdu(TransportPdu pdu) { + + TransportAddress transportAddress = TransportAddress.fromAddressString(pdu.getDestAddress()); + + if(isLocalAddress(transportAddress)) { + TransportEndpointSite endpointSite = null; + synchronized(this) { + endpointSite = _endpointMap.get(transportAddress.getEndpointId()); + } + + if(endpointSite != null) + endpointSite.addOutputPdu(pdu); + } else { + // do cross-node forwarding + // ??? + } + } + + private boolean isLocalAddress(TransportAddress address) { + if(address.getNodeId().equals(_nodeId) || address.getNodeId().equals(TransportAddress.LOCAL_SERVICE_NODE)) + return true; + + return false; + } + + private synchronized int getNextEndpointId() { + return _nextEndpointId++; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddress.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddress.java new file mode 100644 index 00000000000..e3cf9684e19 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddress.java @@ -0,0 +1,139 @@ +/* + * 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.framework.transport; + +import java.util.Random; + +public class TransportAddress { + public final static String LOCAL_SERVICE_NODE = ""; + public final static int LOCAL_SERVICE_CONNECTION = 0; + + private String _nodeId = LOCAL_SERVICE_NODE; + private int _connectionId = LOCAL_SERVICE_CONNECTION; + private String _endpointId; + private int _magic; + + public TransportAddress(String nodeId, int connectionId, String endpointId) { + assert(nodeId != null); + assert(endpointId != null); + assert(nodeId.indexOf(".") < 0); + assert(endpointId.indexOf(".") < 0); + + _nodeId = nodeId; + _connectionId = connectionId; + _endpointId = endpointId; + _magic = new Random().nextInt(); + } + + public TransportAddress(String nodeId, int connectionId, String endpointId, int magic) { + assert(nodeId != null); + assert(endpointId != null); + assert(nodeId.indexOf(".") < 0); + assert(endpointId.indexOf(".") < 0); + + _nodeId = nodeId; + _connectionId = connectionId; + _endpointId = endpointId; + _magic = magic; + } + + public String getNodeId() { + return _nodeId; + } + + public TransportAddress setNodeId(String nodeId) { + _nodeId = nodeId; + return this; + } + + public int getConnectionId() { + return _connectionId; + } + + public void setConnectionId(int connectionId) { + _connectionId = connectionId; + } + + public String getEndpointId() { + return _endpointId; + } + + public TransportAddress setEndpointId(String endpointId) { + _endpointId = endpointId; + return this; + } + + public static TransportAddress fromAddressString(String addressString) { + if(addressString == null || addressString.isEmpty()) + return null; + + String tokens[] = addressString.split("\\."); + if(tokens.length != 4) + return null; + + return new TransportAddress(tokens[0], Integer.parseInt(tokens[1]), tokens[2], Integer.parseInt(tokens[3])); + } + + public static TransportAddress getLocalPredefinedTransportAddress(String predefinedIdentifier) { + return new TransportAddress(LOCAL_SERVICE_NODE, LOCAL_SERVICE_CONNECTION, predefinedIdentifier, 0); + } + + @Override + public int hashCode() { + int hashCode = _magic; + hashCode = (hashCode << 3) ^ _nodeId.hashCode(); + hashCode = (hashCode << 3) ^ _connectionId; + hashCode = (hashCode << 3) ^ _endpointId.hashCode(); + + return hashCode; + } + + @Override + public boolean equals(Object other) { + if(other == null) + return false; + + if(!(other instanceof TransportAddress)) + return false; + + if(this == other) + return true; + + return _nodeId.equals(((TransportAddress)other)._nodeId) && + _connectionId == (((TransportAddress)other)._connectionId) && + _endpointId.equals(((TransportAddress)other)._endpointId) && + _magic == ((TransportAddress)other)._magic; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + if(_nodeId != null) + sb.append(_nodeId); + sb.append("."); + sb.append(_connectionId); + sb.append("."); + sb.append(_endpointId); + sb.append("."); + sb.append(_magic); + + return sb.toString(); + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddressMapper.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddressMapper.java new file mode 100644 index 00000000000..6edb7880733 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAddressMapper.java @@ -0,0 +1,23 @@ +/* + * 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.framework.transport; + +public interface TransportAddressMapper { + String getAddress(); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachRequestPdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachRequestPdu.java new file mode 100644 index 00000000000..736ae298756 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachRequestPdu.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 org.apache.cloudstack.framework.transport; + +public class TransportAttachRequestPdu extends TransportPdu { + private int _endpointProviderKey; + + public TransportAttachRequestPdu() { + } + + public int getEndpointProviderKey() { + return _endpointProviderKey; + } + + public void setEndpointProviderKey(int endpointProviderKey) { + _endpointProviderKey = endpointProviderKey; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachResponsePdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachResponsePdu.java new file mode 100644 index 00000000000..b2d15c6a2d7 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportAttachResponsePdu.java @@ -0,0 +1,43 @@ +/* + * 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.framework.transport; + +public class TransportAttachResponsePdu extends TransportPdu { + private int _statusCode; + private int _endpointProviderKey; + + public TransportAttachResponsePdu() { + } + + public int getStatusCode() { + return _statusCode; + } + + public void setStatusCode(int statusCode) { + _statusCode = statusCode; + } + + public int getEndpointProviderKey() { + return _endpointProviderKey; + } + + public void setEndpointProviderKey(int endpointProviderKey) { + _endpointProviderKey = endpointProviderKey; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectRequestPdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectRequestPdu.java new file mode 100644 index 00000000000..5b50e2487fa --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectRequestPdu.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 org.apache.cloudstack.framework.transport; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="TransportConnectRequestPdu") +public class TransportConnectRequestPdu extends TransportPdu { + String _authIdentity; + String _authCredential; + + public TransportConnectRequestPdu() { + } + + public String getAuthIdentity() { + return _authIdentity; + } + + public void setAuthIdentity(String authIdentity) { + _authIdentity = authIdentity; + } + + public String getAuthCredential() { + return _authCredential; + } + + public void setAuthCredential(String authCredential) { + _authCredential = authCredential; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectResponsePdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectResponsePdu.java new file mode 100644 index 00000000000..8015ad92dd1 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportConnectResponsePdu.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 org.apache.cloudstack.framework.transport; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="TransportConnectRequestPdu") +public class TransportConnectResponsePdu extends TransportPdu { + private int _statusCode; + + public TransportConnectResponsePdu() { + } + + public int getStatusCode() { + return _statusCode; + } + + public void setStatusCode(int statusCode) { + _statusCode = statusCode; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportDataPdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportDataPdu.java new file mode 100644 index 00000000000..ac9e06ddcfe --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportDataPdu.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 org.apache.cloudstack.framework.transport; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="TransportDataPdu") +public class TransportDataPdu extends TransportPdu { + + private String _multiplexier; + private String _content; + + public TransportDataPdu() { + } + + public String getMultiplexier() { + return _multiplexier; + } + + public void setMultiplexier(String multiplexier) { + _multiplexier = multiplexier; + } + + public String getContent() { + return _content; + } + + public void setContent(String content) { + _content = content; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpoint.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpoint.java new file mode 100644 index 00000000000..7767c35ca4f --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpoint.java @@ -0,0 +1,24 @@ +/* + * 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.framework.transport; + +public interface TransportEndpoint extends TransportMultiplexier { + void onAttachConfirm(boolean bSuccess, String endpointAddress); + void onDetachIndication(String endpointAddress); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpointSite.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpointSite.java new file mode 100644 index 00000000000..eb55190c1ff --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportEndpointSite.java @@ -0,0 +1,144 @@ +/* + * 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.framework.transport; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class TransportEndpointSite { + private TransportProvider _provider; + private TransportEndpoint _endpoint; + private TransportAddress _address; + + private List _outputQueue = new ArrayList(); + private Map _multiplexierMap = new HashMap(); + + private int _outstandingSignalRequests; + + public TransportEndpointSite(TransportProvider provider, TransportEndpoint endpoint, TransportAddress address) { + assert(provider != null); + assert(endpoint != null); + assert(address != null); + + _provider = provider; + _endpoint = endpoint; + _address = address; + + _outstandingSignalRequests = 0; + } + + public TransportEndpointSite(TransportProvider provider, TransportEndpoint endpoint) { + assert(provider != null); + assert(endpoint != null); + + _provider = provider; + _endpoint = endpoint; + + _outstandingSignalRequests = 0; + } + + public TransportEndpoint getEndpoint() { + return _endpoint; + } + + public TransportAddress getAddress() { + return _address; + } + + public void setAddress(TransportAddress address) { + _address = address; + } + + public void registerMultiplexier(String name, TransportMultiplexier multiplexier) { + assert(name != null); + assert(multiplexier != null); + assert(_multiplexierMap.get(name) == null); + + _multiplexierMap.put(name, multiplexier); + } + + public void unregisterMultiplexier(String name) { + assert(name != null); + _multiplexierMap.remove(name); + } + + public void addOutputPdu(TransportPdu pdu) { + synchronized(this) { + _outputQueue.add(pdu); + } + + signalOutputProcessRequest(); + } + + public TransportPdu getNextOutputPdu() { + synchronized(this) { + if(_outputQueue.size() > 0) + return _outputQueue.remove(0); + } + + return null; + } + + public void processOutput() { + TransportPdu pdu; + TransportEndpoint endpoint = getEndpoint(); + + if(endpoint != null) { + while((pdu = getNextOutputPdu()) != null) { + if(pdu instanceof TransportDataPdu) { + String multiplexierName = ((TransportDataPdu) pdu).getMultiplexier(); + TransportMultiplexier multiplexier = getRoutedMultiplexier(multiplexierName); + assert(multiplexier != null); + multiplexier.onTransportMessage(pdu.getSourceAddress(), pdu.getDestAddress(), + multiplexierName, ((TransportDataPdu) pdu).getContent()); + } + } + } + } + + private TransportMultiplexier getRoutedMultiplexier(String multiplexierName) { + TransportMultiplexier multiplexier = _multiplexierMap.get(multiplexierName); + if(multiplexier == null) + multiplexier = _endpoint; + + return multiplexier; + } + + private void signalOutputProcessRequest() { + boolean proceed = false; + synchronized(this) { + if(_outstandingSignalRequests == 0) { + _outstandingSignalRequests++; + proceed = true; + } + } + + if(proceed) + _provider.requestSiteOutput(this); + } + + public void ackOutputProcessSignal() { + synchronized(this) { + assert(_outstandingSignalRequests == 1); + _outstandingSignalRequests--; + } + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportMultiplexier.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportMultiplexier.java new file mode 100644 index 00000000000..b1019297638 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportMultiplexier.java @@ -0,0 +1,24 @@ +/* + * 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.framework.transport; + +public interface TransportMultiplexier { + public void onTransportMessage(String senderEndpointAddress, String targetEndpointAddress, + String multiplexer, String message); +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportPdu.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportPdu.java new file mode 100644 index 00000000000..74238a45705 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportPdu.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 org.apache.cloudstack.framework.transport; + +public class TransportPdu { + protected String _sourceAddress; + protected String _destAddress; + + public TransportPdu() { + } + + public String getSourceAddress() { return _sourceAddress; } + public void setSourceAddress(String sourceAddress) { + _sourceAddress = sourceAddress; + } + + public String getDestAddress() { + return _destAddress; + } + + public void setDestAddress(String destAddress) { + _destAddress = destAddress; + } +} diff --git a/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportProvider.java b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportProvider.java new file mode 100644 index 00000000000..12838115921 --- /dev/null +++ b/framework/ipc/src/org/apache/cloudstack/framework/transport/TransportProvider.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 org.apache.cloudstack.framework.transport; + +import org.apache.cloudstack.framework.serializer.MessageSerializer; + +public interface TransportProvider { + void setMessageSerializer(MessageSerializer messageSerializer); + MessageSerializer getMessageSerializer(); + + TransportEndpointSite attach(TransportEndpoint endpoint, String predefinedAddress); + boolean detach(TransportEndpoint endpoint); + + void requestSiteOutput(TransportEndpointSite site); + + void sendMessage(String soureEndpointAddress, String targetEndpointAddress, + String multiplexier, String message); +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.java new file mode 100644 index 00000000000..8833da2d36a --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleCallee.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 org.apache.cloudstack.framework.codestyle; + +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public class AsyncSampleCallee { + AsyncSampleCallee _driver; + + public AsyncCallFuture createVolume(Object realParam) { + + String result = realParam.toString(); + AsyncCallFuture call = new AsyncCallFuture(); + + call.complete(result); + return call; + } + + public void createVolumeAsync(String param, AsyncCompletionCallback callback) { + callback.complete(param); + } +} + diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java new file mode 100644 index 00000000000..db39588038a --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleEventDrivenStyleCaller.java @@ -0,0 +1,118 @@ +/* + * 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.framework.codestyle; + +import java.util.concurrent.ExecutionException; + +import org.apache.cloudstack.framework.async.AsyncCallFuture; +import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher; +import org.apache.cloudstack.framework.async.AsyncCallbackDriver; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; +import org.apache.cloudstack.framework.async.AsyncRpcConext; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/SampleManagementServerAppContext.xml") +public class AsyncSampleEventDrivenStyleCaller { + private AsyncSampleCallee _ds; + AsyncCallbackDriver _callbackDriver; + @Before + public void setup() { + _ds = new AsyncSampleCallee(); + } + @SuppressWarnings("unchecked") + @Test + public void MethodThatWillCallAsyncMethod() { + String vol = new String("Hello"); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + AsyncCallFuture future = _ds.createVolume(vol); + try { + String result = future.get(); + Assert.assertEquals(result, vol); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (ExecutionException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + private class TestContext extends AsyncRpcConext { + private boolean finished; + private String result; + /** + * @param callback + */ + public TestContext(AsyncCompletionCallback callback) { + super(callback); + this.finished = false; + } + + public void setResult(String result) { + this.result = result; + synchronized (this) { + this.finished = true; + this.notify(); + } + } + + public String getResult() { + synchronized (this) { + if (!this.finished) { + try { + this.wait(); + + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + return this.result; + } + } + + } + @Test + public void installCallback() { + TestContext context = new TestContext(null); + AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this); + caller.setCallback(caller.getTarget().HandleVolumeCreateAsyncCallback(null, null)) + .setContext(context); + String test = "test"; + _ds.createVolumeAsync(test, caller); + Assert.assertEquals(test, context.getResult()); + } + + protected Void HandleVolumeCreateAsyncCallback(AsyncCallbackDispatcher callback, TestContext context) { + String resultVol = callback.getResult(); + context.setResult(resultVol); + return null; + } + + public static void main(String[] args) { + AsyncSampleEventDrivenStyleCaller caller = new AsyncSampleEventDrivenStyleCaller(); + caller.MethodThatWillCallAsyncMethod(); + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleListenerStyleCaller.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleListenerStyleCaller.java new file mode 100644 index 00000000000..4a84f06a501 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/AsyncSampleListenerStyleCaller.java @@ -0,0 +1,38 @@ +/* + * 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.framework.codestyle; + +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public class AsyncSampleListenerStyleCaller { + AsyncSampleCallee _ds; + + public void MethodThatWillCallAsyncMethod() { + String vol = new String(); + + /* _ds.createVolume(vol, + new AsyncCompletionCallback() { + @Override + public void complete(String resultObject) { + // TODO Auto-generated method stub + + } + });*/ + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyEventDrivenStyle.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyEventDrivenStyle.java new file mode 100644 index 00000000000..b9ab85a58b5 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyEventDrivenStyle.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 org.apache.cloudstack.framework.codestyle; + +import org.apache.cloudstack.framework.rpc.RpcCallbackDispatcher; +import org.apache.cloudstack.framework.rpc.RpcClientCall; +import org.apache.cloudstack.framework.rpc.RpcException; +import org.apache.cloudstack.framework.rpc.RpcIOException; +import org.apache.cloudstack.framework.rpc.RpcProvider; +import org.apache.cloudstack.framework.rpc.RpcTimeoutException; + +public class ClientOnlyEventDrivenStyle { + RpcProvider _rpcProvider; + + public void AsyncCallRpcService() { + String cmd = new String(); + RpcCallbackDispatcher callbackDispatcher = RpcCallbackDispatcher.create(this); + callbackDispatcher.setCallback(callbackDispatcher.getTarget().OnAsyncCallRpcServiceCallback(null, null)); + _rpcProvider.newCall("host-2").setCommand("TestCommand").setCommandArg(cmd).setTimeout(10000) + .setCallbackDispatcher(callbackDispatcher) + .setContext("Context Object") // save context object for callback handler + .apply(); + } + + public Void OnAsyncCallRpcServiceCallback(RpcClientCall call, String context) { + try { + String answer = call.get(); + + } catch(RpcTimeoutException e) { + + } catch(RpcIOException e) { + + } catch(RpcException e) { + } + + return null; + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyListenerStyle.java b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyListenerStyle.java new file mode 100644 index 00000000000..2d795554c74 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/codestyle/ClientOnlyListenerStyle.java @@ -0,0 +1,59 @@ +/* + * 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.framework.codestyle; + +import org.apache.cloudstack.framework.rpc.RpcCallbackListener; +import org.apache.cloudstack.framework.rpc.RpcClientCall; +import org.apache.cloudstack.framework.rpc.RpcException; +import org.apache.cloudstack.framework.rpc.RpcIOException; +import org.apache.cloudstack.framework.rpc.RpcProvider; +import org.apache.cloudstack.framework.rpc.RpcTimeoutException; + +public class ClientOnlyListenerStyle { + + RpcProvider _rpcProvider; + + public void AsyncCallRpcService() { + String cmd = new String(); + _rpcProvider.newCall("host-2").setCommand("TestCommand").setCommandArg(cmd).setTimeout(10000) + .addCallbackListener(new RpcCallbackListener() { + @Override + public void onSuccess(String result) { + } + + @Override + public void onFailure(RpcException e) { + } + }).apply(); + } + + public void SyncCallRpcService() { + String cmd = new String(); + RpcClientCall call = _rpcProvider.newCall("host-2").setCommand("TestCommand").setCommandArg(cmd).setTimeout(10000).apply(); + + try { + String answer = call.get(); + } catch (RpcTimeoutException e) { + + } catch (RpcIOException e) { + + } catch (RpcException e) { + } + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServer.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServer.java new file mode 100644 index 00000000000..2a168ac7cd7 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServer.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 org.apache.cloudstack.framework.sampleserver; + +import org.springframework.stereotype.Component; + +@Component +public class SampleManagementServer { + + public void mainLoop() { + while(true) { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + } + } + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServerApp.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServerApp.java new file mode 100644 index 00000000000..a9479f309ee --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagementServerApp.java @@ -0,0 +1,56 @@ +/* + * 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.framework.sampleserver; + +import java.io.File; +import java.net.URISyntaxException; +import java.net.URL; + +import org.apache.log4j.xml.DOMConfigurator; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class SampleManagementServerApp { + + private static void setupLog4j() { + URL configUrl = System.class.getResource("/resources/log4j-cloud.xml"); + if(configUrl != null) { + System.out.println("Configure log4j using log4j-cloud.xml"); + + try { + File file = new File(configUrl.toURI()); + + System.out.println("Log4j configuration from : " + file.getAbsolutePath()); + DOMConfigurator.configureAndWatch(file.getAbsolutePath(), 10000); + } catch (URISyntaxException e) { + System.out.println("Unable to convert log4j configuration Url to URI"); + } + } else { + System.out.println("Configure log4j with default properties"); + } + } + + public static void main(String args[]) { + setupLog4j(); + + ApplicationContext context = new ClassPathXmlApplicationContext("/resources/SampleManagementServerAppContext.xml"); + SampleManagementServer server = context.getBean(SampleManagementServer.class); + server.mainLoop(); + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent.java new file mode 100644 index 00000000000..7b0a2eca192 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.sampleserver; + +import java.util.Timer; +import java.util.TimerTask; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.apache.cloudstack.framework.eventbus.EventBus; +import org.apache.cloudstack.framework.eventbus.EventDispatcher; +import org.apache.cloudstack.framework.eventbus.EventHandler; +import org.apache.cloudstack.framework.rpc.RpcCallbackListener; +import org.apache.cloudstack.framework.rpc.RpcException; +import org.apache.cloudstack.framework.rpc.RpcProvider; +import org.apache.cloudstack.framework.rpc.RpcServerCall; +import org.apache.cloudstack.framework.rpc.RpcServiceDispatcher; +import org.apache.cloudstack.framework.rpc.RpcServiceHandler; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +@Component +public class SampleManagerComponent { + private static final Logger s_logger = Logger.getLogger(SampleManagerComponent.class); + + @Inject + private EventBus _eventBus; + + @Inject + private RpcProvider _rpcProvider; + + private Timer _timer = new Timer(); + + public SampleManagerComponent() { + } + + @PostConstruct + public void init() { + _rpcProvider.registerRpcServiceEndpoint( + RpcServiceDispatcher.getDispatcher(this)); + + // subscribe to all network events (for example) + _eventBus.subscribe("network", + EventDispatcher.getDispatcher(this)); + + _timer.schedule(new TimerTask() { + public void run() { + testRpc(); + } + }, 3000); + } + + @RpcServiceHandler(command="NetworkPrepare") + void onStartCommand(RpcServerCall call) { + call.completeCall("NetworkPrepare completed"); + } + + @EventHandler(topic="network.prepare") + void onPrepareNetwork(String sender, String topic, Object args) { + } + + void testRpc() { + SampleStoragePrepareCommand cmd = new SampleStoragePrepareCommand(); + cmd.setStoragePool("Pool1"); + cmd.setVolumeId("vol1"); + + _rpcProvider.newCall() + .setCommand("StoragePrepare").setCommandArg(cmd).setTimeout(10000) + .addCallbackListener(new RpcCallbackListener() { + @Override + public void onSuccess(SampleStoragePrepareAnswer result) { + s_logger.info("StoragePrepare return result: " + result.getResult()); + } + + @Override + public void onFailure(RpcException e) { + s_logger.info("StoragePrepare failed"); + } + }).apply(); + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent2.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent2.java new file mode 100644 index 00000000000..dc482c035fb --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleManagerComponent2.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.sampleserver; + +import javax.annotation.PostConstruct; +import javax.inject.Inject; + +import org.apache.cloudstack.framework.eventbus.EventBus; +import org.apache.cloudstack.framework.eventbus.EventDispatcher; +import org.apache.cloudstack.framework.eventbus.EventHandler; +import org.apache.cloudstack.framework.rpc.RpcProvider; +import org.apache.cloudstack.framework.rpc.RpcServerCall; +import org.apache.cloudstack.framework.rpc.RpcServiceDispatcher; +import org.apache.cloudstack.framework.rpc.RpcServiceHandler; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +@Component +public class SampleManagerComponent2 { + private static final Logger s_logger = Logger.getLogger(SampleManagerComponent2.class); + + @Inject + private EventBus _eventBus; + + @Inject + private RpcProvider _rpcProvider; + + public SampleManagerComponent2() { + } + + @PostConstruct + public void init() { + _rpcProvider.registerRpcServiceEndpoint( + RpcServiceDispatcher.getDispatcher(this)); + + // subscribe to all network events (for example) + _eventBus.subscribe("storage", + EventDispatcher.getDispatcher(this)); + } + + @RpcServiceHandler(command="StoragePrepare") + void onStartCommand(RpcServerCall call) { + s_logger.info("Reevieved StoragePrpare call"); + SampleStoragePrepareCommand cmd = call.getCommandArgument(); + + s_logger.info("StoragePrepare command arg. pool: " + cmd.getStoragePool() + ", vol: " + cmd.getVolumeId()); + SampleStoragePrepareAnswer answer = new SampleStoragePrepareAnswer(); + answer.setResult("Successfully executed StoragePrepare command"); + + call.completeCall(answer); + } + + @EventHandler(topic="storage.prepare") + void onPrepareNetwork(String sender, String topic, Object args) { + } + + void test() { + + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareAnswer.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareAnswer.java new file mode 100644 index 00000000000..19a39e1368d --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareAnswer.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 org.apache.cloudstack.framework.sampleserver; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="SampleStoragePrepareAnswer") +public class SampleStoragePrepareAnswer { + String result; + + public SampleStoragePrepareAnswer() { + } + + public String getResult() { + return result; + } + + public void setResult(String result) { + this.result = result; + } +} diff --git a/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareCommand.java b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareCommand.java new file mode 100644 index 00000000000..841352215f1 --- /dev/null +++ b/framework/ipc/test/org/apache/cloudstack/framework/sampleserver/SampleStoragePrepareCommand.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 org.apache.cloudstack.framework.sampleserver; + +import org.apache.cloudstack.framework.serializer.OnwireName; + +@OnwireName(name="SampleStoragePrepareCommand") +public class SampleStoragePrepareCommand { + + String storagePool; + String volumeId; + + public SampleStoragePrepareCommand() { + } + + public String getStoragePool() { + return storagePool; + } + + public void setStoragePool(String storagePool) { + this.storagePool = storagePool; + } + + public String getVolumeId() { + return volumeId; + } + + public void setVolumeId(String volumeId) { + this.volumeId = volumeId; + } +} diff --git a/framework/ipc/test/resources/SampleManagementServerAppContext.xml b/framework/ipc/test/resources/SampleManagementServerAppContext.xml new file mode 100644 index 00000000000..4b1ff3e65c3 --- /dev/null +++ b/framework/ipc/test/resources/SampleManagementServerAppContext.xml @@ -0,0 +1,63 @@ + + + + + + + + + + + org.apache.cloudstack.framework + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/ipc/test/resources/log4j-cloud.xml b/framework/ipc/test/resources/log4j-cloud.xml new file mode 100644 index 00000000000..e9b1918b6e6 --- /dev/null +++ b/framework/ipc/test/resources/log4j-cloud.xml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/jobs/pom.xml b/framework/jobs/pom.xml new file mode 100644 index 00000000000..56490216f16 --- /dev/null +++ b/framework/jobs/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + org.apache.cloudstack + cloud-framework-jobs + 4.0.0-SNAPSHOT + + org.quartz-scheduler + quartz + 2.1.6 + + diff --git a/framework/jobs/src/org/apache/cloudstack/framework/job/Job.java b/framework/jobs/src/org/apache/cloudstack/framework/job/Job.java new file mode 100755 index 00000000000..62ed72fe8d7 --- /dev/null +++ b/framework/jobs/src/org/apache/cloudstack/framework/job/Job.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 org.apache.cloudstack.framework.job; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.METHOD) +public @interface Job { + + + +} diff --git a/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.java b/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.java new file mode 100755 index 00000000000..d81077d6d7a --- /dev/null +++ b/framework/jobs/src/org/apache/cloudstack/framework/job/JobInterceptor.java @@ -0,0 +1,23 @@ +/* + * 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.framework.job; + +public class JobInterceptor { + +} diff --git a/framework/pom.xml b/framework/pom.xml new file mode 100644 index 00000000000..4633dab2b30 --- /dev/null +++ b/framework/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + cloudstack-framework + Apache CloudStack Framework + pom + + org.apache.cloudstack + cloudstack + 4.2.0-SNAPSHOT + + + install + + + ipc + rest + events + api + + diff --git a/framework/rest/pom.xml b/framework/rest/pom.xml new file mode 100644 index 00000000000..2a22155603a --- /dev/null +++ b/framework/rest/pom.xml @@ -0,0 +1,73 @@ + + + 4.0.0 + + org.apache.cloudstack + cloudstack-framework + 4.2.0-SNAPSHOT + ../pom.xml + + cloud-framework-rest + Apache CloudStack Framework - REST + + install + src + test + + + + com.fasterxml.jackson.module + jackson-module-jaxb-annotations + 2.1.1 + + + com.fasterxml.jackson.core + jackson-annotations + 2.1.1 + + + com.fasterxml.jackson.core + jackson-core + 2.1.1 + + + com.fasterxml.jackson.core + jackson-databind + 2.1.1 + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + 2.1.1 + + + org.apache.cxf + cxf-bundle-jaxrs + 2.7.0 + + + org.eclipse.jetty + jetty-server + + + + + diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java new file mode 100644 index 00000000000..998bfa084b3 --- /dev/null +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationIntrospector.java @@ -0,0 +1,60 @@ +/* + * 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.framework.ws.jackson; + +import java.lang.reflect.AnnotatedElement; +import java.util.List; + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.introspect.Annotated; +import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector; + + +/** + * Adds introspectors for the annotations added specifically for CloudStack + * Web Services. + * + */ +public class CSJacksonAnnotationIntrospector extends NopAnnotationIntrospector { + + private static final long serialVersionUID = 5532727887216652602L; + + @Override + public Version version() { + return new Version(1, 7, 0, "abc", "org.apache.cloudstack", "cloudstack-framework-rest"); + } + + @Override + public Object findSerializer(Annotated a) { + AnnotatedElement ae = a.getAnnotated(); + Url an = ae.getAnnotation(Url.class); + if (an == null) { + return null; + } + + if (an.type() == String.class) { + return new UriSerializer(an); + } else if (an.type() == List.class){ + return new UrisSerializer(an); + } + + throw new UnsupportedOperationException("Unsupported type " + an.type()); + + } +} diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.java new file mode 100644 index 00000000000..55debd9b7b2 --- /dev/null +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationModule.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 org.apache.cloudstack.framework.ws.jackson; + + +import com.fasterxml.jackson.core.Version; +import com.fasterxml.jackson.databind.Module; + + +/** + * This module extends SimpleModle so that our annotations can be processed. + * + */ +public class CSJacksonAnnotationModule extends Module { + + @Override + public String getModuleName() { + return "CloudStackSupplementalModule"; + } + + @Override + public void setupModule(SetupContext ctx) { + ctx.appendAnnotationIntrospector(new CSJacksonAnnotationIntrospector()); + } + + @Override + public Version version() { + return new Version(1, 0, 0, "", "org.apache.cloudstack", "cloudstack-framework-rest"); + } + +} diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java new file mode 100644 index 00000000000..074d60f8a98 --- /dev/null +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UriSerializer.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cloudstack.framework.ws.jackson; + +import java.io.IOException; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +public class UriSerializer extends JsonSerializer { + + Url _annotation; + + public UriSerializer(Url annotation) { + _annotation = annotation; + } + + protected UriSerializer() { + } + + @Override + public void serialize(String id, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + jgen.writeStartObject(); + jgen.writeStringField("id", id); + jgen.writeFieldName("uri"); + jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); + jgen.writeEndObject(); + } + + protected String buildUri(Class clazz, String method, String id) { + ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); + UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); + ub.build(id); + return ub.toString(); + } +} diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.java new file mode 100644 index 00000000000..8b622123e3f --- /dev/null +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/UrisSerializer.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.framework.ws.jackson; + +import java.io.IOException; +import java.util.Iterator; +import java.util.List; + +import javax.ws.rs.core.UriBuilder; + +import org.apache.cxf.jaxrs.impl.tl.ThreadLocalUriInfo; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + + +/** + * Serializer for a list of ids. + * + */ +public class UrisSerializer extends JsonSerializer> { + Url _annotation; + + public UrisSerializer(Url annotation) { + _annotation = annotation; + } + + protected UrisSerializer() { + } + + @Override + public void serialize(List lst, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException { + Iterator it = lst.iterator(); + jgen.writeStartObject(); + while (it.hasNext()) { + Object id = it.next(); + jgen.writeStartObject(); + jgen.writeFieldName("id"); + jgen.writeObject(id); + jgen.writeFieldName("uri"); + jgen.writeString(buildUri(_annotation.clazz(), _annotation.method(), id)); + jgen.writeEndObject(); + } + jgen.writeEndObject(); + } + + protected String buildUri(Class clazz, String method, Object id) { + ThreadLocalUriInfo uriInfo = new ThreadLocalUriInfo(); + UriBuilder ub = uriInfo.getAbsolutePathBuilder().path(clazz, method); + ub.build(id); + return ub.toString(); + } +} diff --git a/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java new file mode 100644 index 00000000000..7094fb07f84 --- /dev/null +++ b/framework/rest/src/org/apache/cloudstack/framework/ws/jackson/Url.java @@ -0,0 +1,53 @@ +/* + * 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.framework.ws.jackson; + +import static java.lang.annotation.ElementType.FIELD; +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Url can be placed onto a method to construct an URL from the returned + * results. + * + * This annotation is supplemental to JAX-RS 2.0's annotations. JAX-RS 2.0 + * annotations do not include a way to construct an URL. Of + * course, this only works with how CloudStack works. + * + */ +@Target({FIELD, METHOD}) +@Retention(RUNTIME) +public @interface Url { + /** + * @return the class that the path should belong to. + */ + Class clazz() default Object.class; + + /** + * @return the name of the method that the path should call back to. + */ + String method(); + + String name() default ""; + + Class type() default String.class; +} diff --git a/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java new file mode 100644 index 00000000000..8869b218402 --- /dev/null +++ b/framework/rest/test/org/apache/cloudstack/framework/ws/jackson/CSJacksonAnnotationTest.java @@ -0,0 +1,118 @@ +// 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.framework.ws.jackson; + +import java.io.IOException; +import java.io.StringWriter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.junit.Before; +import org.junit.Ignore; +import org.junit.Test; + +import com.fasterxml.jackson.core.JsonGenerationException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule; +import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.Priority; + +public class CSJacksonAnnotationTest { + + @Before + public void setUp() throws Exception { + } + + @Test @Ignore + public void test() { + ObjectMapper mapper = new ObjectMapper(); + JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule(); + jaxbModule.setPriority(Priority.SECONDARY); + mapper.registerModule(jaxbModule); + mapper.registerModule(new CSJacksonAnnotationModule()); + + StringWriter writer = new StringWriter(); + + TestVO vo = new TestVO(1000, "name"); + vo.names = new ArrayList(); + vo.names.add("name1"); + vo.names.add("name2"); + vo.values = new HashMap(); + vo.values.put("key1", 1000l); + vo.values.put("key2", 2000l); + vo.vo2.name = "testvoname2"; + vo.pods="abcde"; + + try { + mapper.writeValue(writer, vo); + } catch (JsonGenerationException e) { + e.printStackTrace(); + } catch (JsonMappingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + System.out.print(writer.getBuffer().toString()); + + } + + @XmlRootElement(name="xml-test2") + public class Test2VO { + public String name; + } + + @XmlRootElement(name="abc") + public class TestVO { + public int id; + + public Map values; + + public String name; + + + public List names; + + public String pods; + + + @XmlElement(name="test2") + public Test2VO vo2 = new Test2VO(); + + public TestVO(int id, String name) { + this.id = id; + this.name = name; + } + + @Url(clazz=TestVO.class, method="getName") + public String getName() { + return name; + } + + @Url(clazz=TestVO.class, method="getNames", type=List.class) + public List getNames() { + return names; + } + + } + +} diff --git a/m2-settings.xml b/m2-settings.xml new file mode 100644 index 00000000000..9f6c934e282 --- /dev/null +++ b/m2-settings.xml @@ -0,0 +1,59 @@ + + + + + + admin + central + + + admin + snapshots + + + + + + + + false + + repo1 + repo1 + http://repo1.maven.org/maven2 + + + + false + + central + libs-release + http://cs.ibuildthecloud.com/artifactory/libs-release + + + artifactory + + + + artifactory + + + diff --git a/packaging/centos63/cloud-agent.rc b/packaging/centos63/cloud-agent.rc index 084b71543a8..65b0cd09250 100755 --- a/packaging/centos63/cloud-agent.rc +++ b/packaging/centos63/cloud-agent.rc @@ -24,14 +24,15 @@ . /etc/rc.d/init.d/functions -whatami=cloud-agent +whatami=cloudstack-agent # set environment variables SHORTNAME="$whatami" PIDFILE=/var/run/"$whatami".pid LOCKFILE=/var/lock/subsys/"$SHORTNAME" -LOGFILE=/var/log/cloud/agent/agent.log +LOGDIR=/var/log/cloudstack/agent +LOGFILE=${LOGDIR}/agent.log PROGNAME="Cloud Agent" CLASS="com.cloud.agent.AgentShell" JSVC=`which jsvc 2>/dev/null`; @@ -57,17 +58,18 @@ export JAVA_HOME SCP="" DCP="" -ACP=`ls /usr/share/cloud/java/* | tr '\n' ':'` -JCP="/usr/share/java/commons-daemon.jar" +ACP=`ls /usr/share/cloudstack-agent/cloud-plugin-hypervisor-kvm-*.jar`":"`ls /usr/share/cloudstack-agent/lib/* | tr '\n' ':'` +JCP="/usr/share/java/jna.jar:/usr/share/java/commons-daemon.jar" # We need to append the JSVC daemon JAR to the classpath # AgentShell implements the JSVC daemon methods -export CLASSPATH="$SCP:$DCP:$ACP:$JCP:/etc/cloud/agent:/usr/lib64/cloud/agent" +export CLASSPATH="$SCP:$DCP:$ACP:$JCP:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts" start() { echo -n $"Starting $PROGNAME: " if hostname --fqdn >/dev/null 2>&1 ; then - $JSVC -cp "$CLASSPATH" -pidfile "$PIDFILE" $CLASS + $JSVC -cp "$CLASSPATH" -pidfile "$PIDFILE" \ + -errfile $LOGDIR/cloudstack-agent.out -outfile $LOGDIR/cloudstack-agent.out $CLASS RETVAL=$? echo else diff --git a/packaging/centos63/cloud-management.rc b/packaging/centos63/cloud-management.rc index 48c2ab44a62..6fd435b555d 100755 --- a/packaging/centos63/cloud-management.rc +++ b/packaging/centos63/cloud-management.rc @@ -46,8 +46,8 @@ NAME="$(basename $0)" stop() { SHUTDOWN_WAIT="30" count="0" - if [ -f /var/run/cloud-management.pid ]; then - pid=`cat /var/run/cloud-management.pid` + if [ -f /var/run/${NAME}.pid ]; then + pid=`cat /var/run/${NAME}.pid` kill $pid &>/dev/null until [ "$(ps --pid $pid | grep -c $pid)" -eq "0" ] || \ [ "$count" -gt "$SHUTDOWN_WAIT" ] @@ -78,8 +78,8 @@ set_ulimit() { handle_pid_file() { if [ "$1" -ne 0 ] ; then - echo "The pid file locates at /var/run/cloud-management.pid and lock file at /var/lock/subsys/cloud-management. - Starting cloud-management will take care of them or you can manually clean up." + echo "The pid file locates at /var/run/${NAME}.pid and lock file at /var/lock/subsys/${NAME}. + Starting ${NAME} will take care of them or you can manually clean up." fi } diff --git a/packaging/centos63/cloud-management.sysconfig b/packaging/centos63/cloud-management.sysconfig index 15df8cdab92..cbc8b8b36c1 100644 --- a/packaging/centos63/cloud-management.sysconfig +++ b/packaging/centos63/cloud-management.sysconfig @@ -18,6 +18,6 @@ # This file is loaded in /etc/init.d/vmopsmanagement # ATM we only do two things here: -dummy=1 ; export TOMCAT_CFG=/etc/cloud/management/tomcat6.conf ; . /etc/cloud/management/tomcat6.conf +dummy=1 ; export TOMCAT_CFG=/etc/cloudstack/management/tomcat6.conf ; . /etc/cloudstack/management/tomcat6.conf #-------------------------- diff --git a/packaging/centos63/cloud-usage.rc b/packaging/centos63/cloud-usage.rc new file mode 100755 index 00000000000..6eff1233806 --- /dev/null +++ b/packaging/centos63/cloud-usage.rc @@ -0,0 +1,140 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: cloud usage +# Required-Start: $network $local_fs +# Required-Stop: $network $local_fs +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +# Short-Description: Start/stop Apache CloudStack Usage Monitor +# Description: This scripts Starts/Stops the Apache CloudStack Usage Monitor +## The CloudStack Usage Monitor is a part of the Apache CloudStack project and is used +## for storing usage statistics from instances. +## JSVC (Java daemonizing) is used for starting and stopping the usage monitor. +### END INIT INFO + +# 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. + +. /etc/rc.d/init.d/functions + +SHORTNAME="cloudstack-usage" +PIDFILE=/var/run/"$SHORTNAME".pid +LOCKFILE=/var/lock/subsys/"$SHORTNAME" +LOGDIR=/var/log/cloudstack/usage +LOGFILE=${LOGDIR}/usage.log +PROGNAME="CloudStack Usage Monitor" +CLASS="com.cloud.usage.UsageServer" +PROG="jsvc" +DAEMON="/usr/bin/jsvc" +USER=cloud + +unset OPTIONS +[ -r /etc/sysconfig/default/"$SHORTNAME" ] && source /etc/sysconfig/default/"$SHORTNAME" + +# The first existing directory is used for JAVA_HOME (if JAVA_HOME is not defined in $DEFAULT) +JDK_DIRS="/usr/lib/jvm/java-6-openjdk /usr/lib/jvm/java-6-openjdk-i386 /usr/lib/jvm/java-6-openjdk-amd64 /usr/lib/jvm/java-6-sun /usr/lib/jvm/jre-1.6.0 /usr/lib/j2sdk1.5-sun /usr/lib/jre-openjdk" + +for jdir in $JDK_DIRS; do + if [ -r "$jdir/bin/java" -a -z "${JAVA_HOME}" ]; then + JAVA_HOME="$jdir" + fi +done +export JAVA_HOME + +SCP="" +DCP="" +UCP=`ls /usr/share/cloudstack-usage/cloud-usage-*.jar`":"`ls /usr/share/cloudstack-usage/lib/* | tr '\n' ':'` +JCP="/usr/share/java/commons-daemon.jar" + +# We need to append the JSVC daemon JAR to the classpath +# AgentShell implements the JSVC daemon methods +export CLASSPATH="$SCP:$DCP:$UCP:$JCP:/etc/sysconfig" + +start() { + if [ -s "$PIDFILE" ] && kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then + echo "$PROGNAME apparently already running" + exit 0 + fi + + if hostname --fqdn >/dev/null 2>&1 ; then + true + else + echo "The host name does not resolve properly to an IP address. Cannot start $PROGNAME" + exit 1 + fi + + echo -n "Starting $PROGNAME" "$SHORTNAME" + + if daemon --pidfile $PIDFILE $DAEMON -cp "$CLASSPATH" -pidfile "$PIDFILE" -user "$USER" \ + -errfile $LOGDIR/cloudstack-usage.out -outfile $LOGDIR/cloudstack-usage.out -Dpid=$$ $CLASS + RETVAL=$? + then + rc=0 + sleep 1 + if ! kill -0 $(cat "$PIDFILE") >/dev/null 2>&1; then + failure + rc=1 + fi + else + rc=1 + fi + + if [ $rc -eq 0 ]; then + success + else + failure + rm -f "$PIDFILE" + fi + echo +} + +stop() { + echo -n "Stopping $PROGNAME" "$SHORTNAME" + killproc -p $PIDFILE $DAEMON + if [ "$?" -eq 0 ]; then + success + else + failure + fi + rm -f "$PIDFILE" + echo +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status -p $PIDFILE $SHORTNAME + RETVAL=$? + ;; + restart | force-reload) + stop + sleep 3 + start + ;; + *) + echo "Usage: $0 {start|stop|restart|force-reload|status}" + RETVAL=3 +esac + +exit $RETVAL + diff --git a/packaging/centos63/cloud.spec b/packaging/centos63/cloud.spec index d828e673c97..9f54d0b47b9 100644 --- a/packaging/centos63/cloud.spec +++ b/packaging/centos63/cloud.spec @@ -21,7 +21,7 @@ # DISABLE the post-percentinstall java repacking and line number stripping # we need to find a way to just disable the java repacking and line number stripping, but not the autodeps -Name: cloud +Name: cloudstack Summary: CloudStack IaaS Platform #http://fedoraproject.org/wiki/PackageNamingGuidelines#Pre-Release_packages %if "%{?_prerelease}" != "" @@ -54,7 +54,7 @@ BuildRequires: MySQL-python CloudStack is a highly-scalable elastic, open source, intelligent IaaS cloud implementation. -%package management-server +%package management Summary: CloudStack management server UI Requires: tomcat6 Requires: java >= 1.6.0 @@ -78,221 +78,303 @@ Requires: mkisofs Requires: MySQL-python Requires: python-paramiko Requires: ipmitool -Requires: %{name}-setup = %{_ver} +Requires: %{name}-common = %{_ver} +Obsoletes: cloud-client < 4.1.0 +Obsoletes: cloud-client-ui < 4.1.0 +Obsoletes: cloud-daemonize < 4.1.0 +Obsoletes: cloud-server < 4.1.0 +Obsoletes: cloud-test < 4.1.0 +Provides: cloud-client Group: System Environment/Libraries -%description management-server +%description management The CloudStack management server is the central point of coordination, management, and intelligence in CloudStack. -%package setup -Summary: CloudStack database setup scripts -Requires: java >= 1.6.0 +%package common +Summary: Apache CloudStack common files and scripts Requires: python -Requires: MySQL-python -Requires: %{name}-python = %{_ver} -Group: System Environment/Libraries -%description setup -The scripts and commands used to setup and configure the database - -%package python -Summary: CloudStack Python library -# FIXME nuke the archdependency -Requires: python -Group: System Environment/Libraries -%description python -The CloudStack Python library contains a few Python modules that the -CloudStack uses. +Obsoletes: cloud-test < 4.1.0 +Obsoletes: cloud-scripts < 4.1.0 +Obsoletes: cloud-utils < 4.1.0 +Obsoletes: cloud-core < 4.1.0 +Obsoletes: cloud-deps < 4.1.0 +Obsoletes: cloud-python < 4.1.0 +Obsoletes: cloud-setup < 4.1.0 +Obsoletes: cloud-cli < 4.1.0 +Group: System Environment/Libraries +%description common +The Apache CloudStack files shared between agent and management server %package agent Summary: CloudStack Agent for KVM hypervisors Requires: java >= 1.6.0 -Requires: %{name}-python = %{_ver} +Requires: %{name}-common = %{_ver} Requires: libvirt Requires: bridge-utils Requires: ebtables Requires: jsvc Requires: jna +Requires: jakarta-commons-daemon +Requires: jakarta-commons-daemon-jsvc +Provides: cloud-agent +Obsoletes: cloud-agent < 4.1.0 +Obsoletes: cloud-test < 4.1.0 Group: System Environment/Libraries %description agent The CloudStack agent for KVM hypervisors +%package usage +Summary: CloudStack Usage calculation server +Requires: java >= 1.6.0 +Requires: jsvc +Requires: jakarta-commons-daemon +Requires: jakarta-commons-daemon-jsvc +Obsoletes: cloud-usage < 4.1.0 +Provides: cloud-usage +%description usage +The CloudStack usage calculation service + +%package cli +Summary: Apache CloudStack CLI +Provides: python-cloudmonkey +Provides: python-marvin +%description cli +Apache CloudStack command line interface + +%package awsapi +Summary: Apache CloudStack AWS API compatibility wrapper +Requires: %{name}-management = %{_ver} +%description awsapi +Apache Cloudstack AWS API compatibility wrapper + +%package docs +Summary: Apache CloudStack documentation +%description docs +Apache CloudStack documentations + %prep echo Doing CloudStack build - %setup -q -n %{name}-%{_maventag} %build -# this fixes the /usr/com bug on centos5 -%define _localstatedir /var -%define _sharedstatedir /var/lib cp packaging/centos63/replace.properties build/replace.properties echo VERSION=%{_maventag} >> build/replace.properties echo PACKAGE=%{name} >> build/replace.properties -mvn package -Dsystemvm +mvn -P awsapi package -Dsystemvm %install [ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} +# Common directories mkdir -p ${RPM_BUILD_ROOT}%{_bindir} -mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}/setup -mkdir -p ${RPM_BUILD_ROOT}/usr/share/%{name}/management/ -ln -sf /usr/share/tomcat6/bin ${RPM_BUILD_ROOT}/usr/share/%{name}/management/bin -ln -sf /etc/cloud/management ${RPM_BUILD_ROOT}/usr/share/%{name}/management/conf -ln -sf /usr/share/tomcat6/lib ${RPM_BUILD_ROOT}/usr/share/%{name}/management/lib -ln -sf /var/log/cloud/management ${RPM_BUILD_ROOT}/usr/share/%{name}/management/logs -ln -sf /var/cache/cloud/management/temp ${RPM_BUILD_ROOT}/usr/share/%{name}/management/temp -ln -sf /var/cache/cloud/management/work ${RPM_BUILD_ROOT}/usr/share/%{name}/management/work -mkdir -p ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client -mkdir -p ${RPM_BUILD_ROOT}/var/log/%{name}/management -mkdir -p ${RPM_BUILD_ROOT}/var/log/%{name}/agent -mkdir -p ${RPM_BUILD_ROOT}/var/log/%{name}/awsapi -mkdir -p ${RPM_BUILD_ROOT}/var/log/%{name}/ipallocator -mkdir -p ${RPM_BUILD_ROOT}/var/cache/%{name}/management/work -mkdir -p ${RPM_BUILD_ROOT}/var/cache/%{name}/management/temp -mkdir -p ${RPM_BUILD_ROOT}/var/lib/%{name}/mnt -mkdir -p ${RPM_BUILD_ROOT}/var/lib/%{name}/management -mkdir -p ${RPM_BUILD_ROOT}/etc/%{name}/management -mkdir -p ${RPM_BUILD_ROOT}/etc/%{name}/management/Catalina/localhost/client -mkdir -p ${RPM_BUILD_ROOT}/etc/rc.d/init.d -mkdir -p ${RPM_BUILD_ROOT}/etc/sysconfig -mkdir -p ${RPM_BUILD_ROOT}/etc/%{name}/management/Catalina/localhost/client +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/awsapi +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/ipallocator +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/work +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/temp +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management +mkdir -p ${RPM_BUILD_ROOT}%{_initrddir} +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig -install -D client/target/utilities/bin/* ${RPM_BUILD_ROOT}%{_bindir} -install -D console-proxy/dist/systemvm.iso ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client/WEB-INF/classes/vms/systemvm.iso -install -D console-proxy/dist/systemvm.zip ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client/WEB-INF/classes/vms/systemvm.zip +# Common +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms +mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/ +cp -r scripts/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/scripts +install -D services/console-proxy/server/dist/systemvm.iso ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms/systemvm.iso +install -D services/console-proxy/server/dist/systemvm.zip ${RPM_BUILD_ROOT}%{_datadir}/%{name}-common/vms/systemvm.zip +install python/lib/cloud_utils.py ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/cloud_utils.py +cp -r python/lib/cloudutils ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/ +python -m py_compile ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/cloud_utils.py +python -m compileall ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/cloudutils -cp -r client/target/utilities/scripts/db/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}/setup -cp -r client/target/cloud-client-ui-4.1.0-SNAPSHOT/* ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client +# Management +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/ +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/management +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/awsapi +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management + +# Specific for tomcat +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client +ln -sf /usr/share/tomcat6/bin ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/bin +ln -sf /etc/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/conf +ln -sf /usr/share/tomcat6/lib ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/lib +ln -sf /var/log/%{name}/management ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/logs +ln -sf /var/cache/%{name}/management/temp ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/temp +ln -sf /var/cache/%{name}/management/work ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/work + +install -D client/target/utilities/bin/cloud-migrate-databases ${RPM_BUILD_ROOT}%{_bindir}/%{name}-migrate-databases +install -D client/target/utilities/bin/cloud-set-guest-password ${RPM_BUILD_ROOT}%{_bindir}/%{name}-set-guest-password +install -D client/target/utilities/bin/cloud-set-guest-sshkey ${RPM_BUILD_ROOT}%{_bindir}/%{name}-set-guest-sshkey +install -D client/target/utilities/bin/cloud-setup-databases ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-databases +install -D client/target/utilities/bin/cloud-setup-encryption ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-encryption +install -D client/target/utilities/bin/cloud-setup-management ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-management +install -D client/target/utilities/bin/cloud-sysvmadm ${RPM_BUILD_ROOT}%{_bindir}/%{name}-sysvmadm +install -D client/target/utilities/bin/cloud-update-xenserver-licenses ${RPM_BUILD_ROOT}%{_bindir}/%{name}-update-xenserver-licenses + +cp -r client/target/utilities/scripts/db/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/setup +cp -r client/target/cloud-client-ui-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client + +# Don't package the scripts in the management webapp +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/scripts +rm -rf ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/vms for name in db.properties log4j-cloud.xml tomcat6-nonssl.conf tomcat6-ssl.conf server-ssl.xml server-nonssl.xml \ - catalina.policy catalina.properties db-enc.properties classpath.conf tomcat-users.xml web.xml ; do - mv ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client/WEB-INF/classes/$name \ - ${RPM_BUILD_ROOT}/etc/%{name}/management/$name + catalina.policy catalina.properties db-enc.properties classpath.conf tomcat-users.xml web.xml environment.properties ; do + mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/$name \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/$name done -mv ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client/WEB-INF/classes/context.xml \ - ${RPM_BUILD_ROOT}/etc/%{name}/management/Catalina/localhost/client +mv ${RPM_BUILD_ROOT}%{_datadir}/%{name}-management/webapps/client/WEB-INF/classes/context.xml \ + ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client -mkdir -p ${RPM_BUILD_ROOT}/usr/lib/python2.6/site-packages/ -cp -r python/lib/cloudutils ${RPM_BUILD_ROOT}/usr/lib/python2.6/site-packages/ -cp -r cloud-cli/cloudtool ${RPM_BUILD_ROOT}/usr/lib/python2.6/site-packages/ -install python/lib/cloud_utils.py ${RPM_BUILD_ROOT}/usr/lib/python2.6/site-packages/cloud_utils.py -install cloud-cli/cloudapis/cloud.py ${RPM_BUILD_ROOT}/usr/lib/python2.6/site-packages/cloudapis.py -install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/ +install python/bindir/cloud-external-ipallocator.py ${RPM_BUILD_ROOT}%{_bindir}/%{name}-external-ipallocator.py install -D client/target/pythonlibs/jasypt-1.9.0.jar ${RPM_BUILD_ROOT}%{_javadir}/jasypt-1.9.0.jar install -D client/target/pythonlibs/jasypt-1.8.jar ${RPM_BUILD_ROOT}%{_javadir}/jasypt-1.8.jar -install -D packaging/centos63/cloud-ipallocator.rc ${RPM_BUILD_ROOT}/etc/rc.d/init.d/%{name}-ipallocator -install -D packaging/centos63/cloud-management.rc ${RPM_BUILD_ROOT}/etc/rc.d/init.d/%{name}-management -install -D packaging/centos63/cloud-management.sysconfig ${RPM_BUILD_ROOT}/etc/sysconfig/%{name}-management +install -D packaging/centos63/cloud-ipallocator.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-ipallocator +install -D packaging/centos63/cloud-management.rc ${RPM_BUILD_ROOT}%{_initrddir}/%{name}-management +install -D packaging/centos63/cloud-management.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/%{name}-management chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost chmod 770 ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/management/Catalina/localhost/client -chmod 770 ${RPM_BUILD_ROOT}%{_sharedstatedir}/%{name}/mnt -chmod 770 ${RPM_BUILD_ROOT}%{_sharedstatedir}/%{name}/management +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/mnt +chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}/management chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/work chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/cache/%{name}/management/temp chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/management chmod 770 ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent -chmod -R ugo+x ${RPM_BUILD_ROOT}/usr/share/%{name}/management/webapps/client/WEB-INF/classes/scripts -mkdir -p ${RPM_BUILD_ROOT}/etc/cloud/agent -mkdir -p ${RPM_BUILD_ROOT}/var/log/cloud/agent -install -D packaging/centos63/cloud-agent.rc ${RPM_BUILD_ROOT}/etc/init.d/%{name}-agent -install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}/etc/cloud/agent/agent.properties -install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}/etc/cloud/agent/environment.properties -install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}/etc/cloud/agent/log4j-cloud.xml -install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}/usr/bin/cloud-setup-agent -install -D agent/target/transformed/cloud-ssh ${RPM_BUILD_ROOT}/usr/bin/cloud-ssh +# KVM Agent +mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/agent +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib +install -D packaging/centos63/cloud-agent.rc ${RPM_BUILD_ROOT}%{_sysconfdir}/init.d/%{name}-agent +install -D agent/target/transformed/agent.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/agent.properties +install -D agent/target/transformed/environment.properties ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/environment.properties +install -D agent/target/transformed/log4j-cloud.xml ${RPM_BUILD_ROOT}%{_sysconfdir}/%{name}/agent/log4j-cloud.xml +install -D agent/target/transformed/cloud-setup-agent ${RPM_BUILD_ROOT}%{_bindir}/%{name}-setup-agent +install -D agent/target/transformed/cloud-ssh ${RPM_BUILD_ROOT}%{_bindir}/%{name}-ssh +install -D plugins/hypervisors/kvm/target/cloud-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%name-agent/cloud-plugin-hypervisor-kvm-%{_maventag}.jar +cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-agent/lib -install -D plugins/hypervisors/kvm/target/%{name}-plugin-hypervisor-kvm-%{_maventag}.jar ${RPM_BUILD_ROOT}/usr/share/cloud/java/%{name}-plugin-hypervisor-kvm-%{_maventag}.jar -cp plugins/hypervisors/kvm/target/dependencies/* ${RPM_BUILD_ROOT}/usr/share/cloud/java -mkdir -p ${RPM_BUILD_ROOT}/usr/share/cloud/scripts -cp -r scripts/* ${RPM_BUILD_ROOT}/usr/share/cloud/scripts +# Usage server +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib +install -D usage/target/cloud-usage-%{_maventag}.jar ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/cloud-usage-%{_maventag}.jar +cp usage/target/dependencies/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-usage/lib/ +install -D packaging/centos63/cloud-usage.rc ${RPM_BUILD_ROOT}/%{_sysconfdir}/init.d/%{name}-usage +mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/log/%{name}/usage/ + +# CLI +cp -r cloud-cli/cloudtool ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/ +install cloud-cli/cloudapis/cloud.py ${RPM_BUILD_ROOT}%{_libdir}/python2.6/site-packages/cloudapis.py + +# AWS API +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/bridge +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/setup +cp -r awsapi/target/cloud-awsapi-%{_maventag}/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/webapps/bridge +install -D awsapi-setup/setup/cloud-setup-bridge ${RPM_BUILD_ROOT}%{_bindir}/cloudstack-setup-bridge +install -D awsapi-setup/setup/cloudstack-aws-api-register ${RPM_BUILD_ROOT}%{_bindir}/cloudstack-aws-api-register +cp -r awsapi-setup/db/mysql/* ${RPM_BUILD_ROOT}%{_datadir}/%{name}-bridge/setup %clean [ ${RPM_BUILD_ROOT} != "/" ] && rm -rf ${RPM_BUILD_ROOT} -%preun management-server -/sbin/service %{name}-management stop || true +%preun management +/sbin/service cloud-management stop || true if [ "$1" == "0" ] ; then - /sbin/chkconfig --del %{name}-management > /dev/null 2>&1 || true - /sbin/service %{name}-management stop > /dev/null 2>&1 || true + /sbin/chkconfig --del cloud-management > /dev/null 2>&1 || true + /sbin/service cloud-management stop > /dev/null 2>&1 || true fi -%pre management-server -id %{name} > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ - -r -s /bin/sh -d %{_sharedstatedir}/%{name}/management %{name}|| true +%pre management +id cloud > /dev/null 2>&1 || /usr/sbin/useradd -M -c "CloudStack unprivileged user" \ + -r -s /bin/sh -d %{_localstatedir}/cloudstack/management cloud|| true # set max file descriptors for cloud user to 4096 sed -i /"cloud hard nofile"/d /etc/security/limits.conf sed -i /"cloud soft nofile"/d /etc/security/limits.conf echo "cloud hard nofile 4096" >> /etc/security/limits.conf echo "cloud soft nofile 4096" >> /etc/security/limits.conf -rm -rf %{_localstatedir}/cache/%{name} +rm -rf %{_localstatedir}/cache/cloud # user harcoded here, also hardcoded on wscript -%post management-server +%post management if [ "$1" == "1" ] ; then - /sbin/chkconfig --add %{name}-management > /dev/null 2>&1 || true - /sbin/chkconfig --level 345 %{name}-management on > /dev/null 2>&1 || true + /sbin/chkconfig --add cloud-management > /dev/null 2>&1 || true + /sbin/chkconfig --level 345 cloud-management on > /dev/null 2>&1 || true fi -if [ ! -f %{_datadir}/%{name}/management/webapps/client/WEB-INF/classes/scripts/scripts/vm/hypervisor/xenserver/vhd-util ] ; then +if [ ! -f %{_datadir}/cloudstack/management/webapps/client/WEB-INF/classes/scripts/scripts/vm/hypervisor/xenserver/vhd-util ] ; then echo Please download vhd-util from http://download.cloud.com.s3.amazonaws.com/tools/vhd-util and put it in - echo %{_datadir}/%{name}/management/webapps/client/WEB-INF/classes/scripts/vm/hypervisor/xenserver/ + echo %{_datadir}/cloudstack/management/webapps/client/WEB-INF/classes/scripts/vm/hypervisor/xenserver/ +fi + +%post awsapi +if [ -d "%{_datadir}/%{name}-management" ] ; then + ln %{_datadir}/%{name}-bridge/webapps %{_datadir}/%{name}-management/webapps7080 fi #No default permission as the permission setup is complex -%files management-server +%files management %defattr(-,root,root,-) %doc LICENSE %doc NOTICE -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina/localhost -%dir %attr(0770,root,%{name}) %{_sysconfdir}/%{name}/management/Catalina/localhost/client -%dir %{_datadir}/%{name}/management -%dir %attr(0770,root,%{name}) %{_sharedstatedir}/%{name}/mnt -%dir %attr(0770,%{name},%{name}) %{_sharedstatedir}/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management/work -%dir %attr(0770,root,%{name}) %{_localstatedir}/cache/%{name}/management/temp -%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/management -%dir %attr(0770,root,%{name}) %{_localstatedir}/log/%{name}/agent +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost +%dir %attr(0770,root,cloud) %{_sysconfdir}/%{name}/management/Catalina/localhost/client +%dir %{_datadir}/%{name}-management +%dir %attr(0770,root,cloud) %{_localstatedir}/%{name}/mnt +%dir %attr(0770,cloud,cloud) %{_localstatedir}/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/work +%dir %attr(0770,root,cloud) %{_localstatedir}/cache/%{name}/management/temp +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/management +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/agent +%dir %attr(0770,root,cloud) %{_localstatedir}/log/%{name}/awsapi %config(noreplace) %{_sysconfdir}/sysconfig/%{name}-management -%config(noreplace) %{_sysconfdir}/%{name}/management -%config(noreplace) %attr(0640,root,%{name}) %{_sysconfdir}/%{name}/management/db.properties -%config(noreplace) %{_sysconfdir}/%{name}/management/log4j-%{name}.xml +%config(noreplace) %attr(0640,root,cloud) %{_sysconfdir}/%{name}/management/db.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/log4j-cloud.xml %config(noreplace) %{_sysconfdir}/%{name}/management/tomcat6-nonssl.conf %config(noreplace) %{_sysconfdir}/%{name}/management/tomcat6-ssl.conf +%config(noreplace) %{_sysconfdir}/%{name}/management/Catalina/localhost/client/context.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/catalina.policy +%config(noreplace) %{_sysconfdir}/%{name}/management/catalina.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/classpath.conf +%config(noreplace) %{_sysconfdir}/%{name}/management/db-enc.properties +%config(noreplace) %{_sysconfdir}/%{name}/management/server-nonssl.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/server-ssl.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/tomcat-users.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/web.xml +%config(noreplace) %{_sysconfdir}/%{name}/management/environment.properties %attr(0755,root,root) %{_initrddir}/%{name}-management %attr(0755,root,root) %{_bindir}/%{name}-setup-management %attr(0755,root,root) %{_bindir}/%{name}-update-xenserver-licenses -%{_datadir}/%{name}/management/* - -%files setup +%{_datadir}/%{name}-management/webapps +%dir %{_datadir}/%{name}-management/bin +%dir %{_datadir}/%{name}-management/conf +%dir %{_datadir}/%{name}-management/lib +%dir %{_datadir}/%{name}-management/logs +%dir %{_datadir}/%{name}-management/temp +%dir %{_datadir}/%{name}-management/work %attr(0755,root,root) %{_bindir}/%{name}-setup-databases %attr(0755,root,root) %{_bindir}/%{name}-migrate-databases %attr(0755,root,root) %{_bindir}/%{name}-set-guest-password %attr(0755,root,root) %{_bindir}/%{name}-set-guest-sshkey %attr(0755,root,root) %{_bindir}/%{name}-sysvmadm %attr(0755,root,root) %{_bindir}/%{name}-setup-encryption -%dir %{_datadir}/%{name}/setup -%{_datadir}/%{name}/setup/*.sql -%{_datadir}/%{name}/setup/db/*.sql -%{_datadir}/%{name}/setup/*.sh -%{_datadir}/%{name}/setup/server-setup.xml +%{_datadir}/%{name}-management/setup/*.sql +%{_datadir}/%{name}-management/setup/db/*.sql +%{_datadir}/%{name}-management/setup/*.sh +%{_datadir}/%{name}-management/setup/server-setup.xml %{_javadir}/jasypt-1.9.0.jar %{_javadir}/jasypt-1.8.jar -%doc LICENSE -%doc NOTICE - -%files python -%defattr(0644,root,root,0755) -%{_prefix}/lib*/python*/site-packages/%{name}* -%attr(0755,root,root) %{_bindir}/cloud-external-ipallocator.py -%attr(0755,root,root) %{_initrddir}/cloud-ipallocator +%attr(0755,root,root) %{_bindir}/%{name}-external-ipallocator.py +%attr(0755,root,root) %{_initrddir}/%{name}-ipallocator %dir %attr(0770,root,root) %{_localstatedir}/log/%{name}/ipallocator %doc LICENSE %doc NOTICE @@ -300,11 +382,54 @@ fi %files agent %attr(0755,root,root) %{_bindir}/%{name}-setup-agent %attr(0755,root,root) %{_bindir}/%{name}-ssh -%attr(0755,root,root) %{_sysconfdir}/init.d/cloud-agent -%config(noreplace) %{_sysconfdir}/cloud/agent -%dir /var/log/cloud/agent -%attr(0644,root,root) /usr/share/cloud/java/*.jar -%attr(0755,root,root) /usr/share/cloud/scripts +%attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-agent +%config(noreplace) %{_sysconfdir}/%{name}/agent +%dir %{_localstatedir}/log/%{name}/agent +%attr(0644,root,root) %{_datadir}/%{name}-agent/*.jar +%attr(0644,root,root) %{_datadir}/%{name}-agent/lib/*.jar +%doc LICENSE +%doc NOTICE + +%files common +%dir %attr(0755,root,root) %{_libdir}/python2.6/site-packages/cloudutils +%dir %attr(0755,root,root) %{_datadir}/%{name}-common/vms +%attr(0755,root,root) %{_datadir}/%{name}-common/scripts +%attr(0644, root, root) %{_datadir}/%{name}-common/vms/systemvm.iso +%attr(0644, root, root) %{_datadir}/%{name}-common/vms/systemvm.zip +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloud_utils.py +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloud_utils.pyc +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloudutils/* +%doc LICENSE +%doc NOTICE + +%files usage +%attr(0755,root,root) %{_sysconfdir}/init.d/%{name}-usage +%attr(0644,root,root) %{_datadir}/%{name}-usage/*.jar +%attr(0644,root,root) %{_datadir}/%{name}-usage/lib/*.jar +%dir /var/log/%{name}/usage +%doc LICENSE +%doc NOTICE + +%files cli +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloudapis.py +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloudtool/__init__.py +%attr(0644,root,root) %{_libdir}/python2.6/site-packages/cloudtool/utils.py +%doc LICENSE +%doc NOTICE + +%files docs +%doc LICENSE +%doc NOTICE + +%files awsapi +%defattr(0644,cloud,cloud,0755) +%{_datadir}/%{name}-bridge/webapps/bridge +%attr(0644,root,root) %{_datadir}/%{name}-bridge/setup/* +%attr(0755,root,root) %{_bindir}/cloudstack-aws-api-register +%attr(0755,root,root) %{_bindir}/cloudstack-setup-bridge +%doc LICENSE +%doc NOTICE + %changelog * Fri Oct 03 2012 Hugo Trippaers 4.1.0 diff --git a/packaging/centos63/package.sh b/packaging/centos63/package.sh old mode 100644 new mode 100755 index 83c0e5eda4c..2515ecba11f --- a/packaging/centos63/package.sh +++ b/packaging/centos63/package.sh @@ -18,10 +18,10 @@ CWD=`pwd` RPMDIR=$CWD/../../dist/rpmbuild +PACK_PROJECT=cloudstack - -VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep -v '^\['` +VERSION=`(cd ../../; mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version) | grep '^[0-9]\.'` if echo $VERSION | grep SNAPSHOT ; then REALVER=`echo $VERSION | cut -d '-' -f 1` DEFVER="-D_ver $REALVER" @@ -34,12 +34,12 @@ else fi mkdir -p $RPMDIR/SPECS -mkdir -p $RPMDIR/SOURCES/cloud-$VERSION +mkdir -p $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -(cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/cloud-$VERSION -x ) -(cd $RPMDIR/SOURCES/; tar -czf cloud-$VERSION.tgz cloud-$VERSION) +(cd ../../; tar -c --exclude .git --exclude dist . | tar -C $RPMDIR/SOURCES/$PACK_PROJECT-$VERSION -x ) +(cd $RPMDIR/SOURCES/; tar -czf $PACK_PROJECT-$VERSION.tgz $PACK_PROJECT-$VERSION) cp cloud.spec $RPMDIR/SPECS -(cd $RPMDIR; rpmbuild -ba SPECS/cloud.spec "-D_topdir $RPMDIR" "$DEFVER" "$DEFREL" "$DEFPRE" ) +(cd $RPMDIR; rpmbuild -ba SPECS/cloud.spec "-D_topdir $RPMDIR" "$DEFVER" "$DEFREL" "$DEFPRE") diff --git a/packaging/centos63/replace.properties b/packaging/centos63/replace.properties index e6efc76278c..211cc95449f 100644 --- a/packaging/centos63/replace.properties +++ b/packaging/centos63/replace.properties @@ -21,41 +21,40 @@ DBROOTPW= MSLOG=vmops.log APISERVERLOG=api.log DBHOST=localhost -MSMNTDIR=/mnt COMPONENTS-SPEC=components-premium.xml AWSAPILOG=awsapi.log REMOTEHOST=localhost AGENTCLASSPATH= -AGENTLOG=/var/log/cloud/agent/agent.log -AGENTLOGDIR=/var/log/cloud/agent/ -AGENTSYSCONFDIR=/etc/cloud/agent -APISERVERLOG=/var/log/cloud/management/apilog.log -AWSAPILOG=/var/log/cloud/awsapi/awsapi.log +AGENTLOG=/var/log/cloudstack/agent/agent.log +AGENTLOGDIR=/var/log/cloudstack/agent/ +AGENTSYSCONFDIR=/etc/cloudstack/agent +APISERVERLOG=/var/log/cloudstack/management/apilog.log +AWSAPILOG=/var/log/cloudstack/awsapi/awsapi.log BINDIR=/usr/bin -COMMONLIBDIR=/usr/share/java +COMMONLIBDIR=/usr/share/cloudstack-common CONFIGUREVARS= DEPSCLASSPATH= DOCDIR= -IPALOCATORLOG=/var/log/cloud/management/ipallocator.log +IPALOCATORLOG=/var/log/cloudstack/management/ipallocator.log JAVADIR=/usr/share/java LIBEXECDIR=/usr/libexec LOCKDIR=/var/lock MSCLASSPATH= -MSCONF=/etc/cloud/management -MSENVIRON=/usr/share/cloud/management -MSLOG=/var/log/cloud/management/management-server.log -MSLOGDIR=/var/log/cloud/management/ -MSMNTDIR=/var/lib/cloud/mnt +MSCONF=/etc/cloudstack/management +MSENVIRON=/usr/share/cloudstack-management +MSLOG=/var/log/cloudstack/management/management-server.log +MSLOGDIR=/var/log/cloudstack/management/ +MSMNTDIR=/var/cloudstack/mnt MSUSER=cloud PIDDIR=/var/run -PLUGINJAVADIR= -PREMIUMJAVADIR= +PLUGINJAVADIR=/usr/share/cloudstack-management/plugin +PREMIUMJAVADIR=/usr/share/cloudstack-management/premium PYTHONDIR=/usr/lib/python2.6/site-packages/ SERVERSYSCONFDIR=/etc/sysconfig -SETUPDATADIR=/usr/share/cloud/setup +SETUPDATADIR=/usr/share/cloudstack-management/setup SYSCONFDIR=/etc/sysconfig SYSTEMCLASSPATH= SYSTEMJARS= USAGECLASSPATH= -USAGELOG=/var/log/cloud/usage +USAGELOG=/var/log/cloudstack/usage USAGESYSCONFDIR=/etc/sysconfig diff --git a/patches/pom.xml b/patches/pom.xml index a662bcb9791..00eec02ddc9 100644 --- a/patches/pom.xml +++ b/patches/pom.xml @@ -17,7 +17,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT install diff --git a/patches/systemvm/debian/config/etc/dnsmasq.conf b/patches/systemvm/debian/config/etc/dnsmasq.conf index 8f999a75cb1..7d656cb2b77 100644 --- a/patches/systemvm/debian/config/etc/dnsmasq.conf +++ b/patches/systemvm/debian/config/etc/dnsmasq.conf @@ -4,11 +4,16 @@ # as the long options legal on the command line. See # "/usr/sbin/dnsmasq --help" or "man 8 dnsmasq" for details. +# Listen on this specific port instead of the standard DNS port +# (53). Setting this to zero completely disables DNS function, +# leaving only DHCP and/or TFTP. +#port=5353 + # The following two options make you a better netizen, since they # tell dnsmasq to filter out queries which the public DNS cannot # answer, and which load the servers (especially the root servers) -# uneccessarily. If you have a dial-on-demand link they also stop -# these requests from bringing up the link uneccessarily. +# unnecessarily. If you have a dial-on-demand link they also stop +# these requests from bringing up the link unnecessarily. # Never forward plain names (without a dot or domain part) domain-needed @@ -19,10 +24,10 @@ bogus-priv # Uncomment this to filter useless windows-originated DNS requests # which can trigger dial-on-demand links needlessly. # Note that (amongst other things) this blocks all SRV requests, -# so don't use it if you use eg Kerberos. +# so don't use it if you use eg Kerberos, SIP, XMMP or Google-talk. # This option only affects forwarding, SRV records originating for # dnsmasq (via srv-host= lines) are not suppressed by it. -#filterwin2k +filterwin2k # Change this line if you want dns to get its upstream servers from # somewhere other that /etc/resolv.conf @@ -48,7 +53,7 @@ resolv-file=/etc/dnsmasq-resolv.conf # non-public domains. #server=/localnet/192.168.0.1 -# Example of routing PTR queries to nameservers: this will send all +# Example of routing PTR queries to nameservers: this will send all # address->name queries for 192.168.3/24 to nameserver 10.1.2.3 #server=/3.168.192.in-addr.arpa/10.1.2.3 @@ -57,9 +62,21 @@ resolv-file=/etc/dnsmasq-resolv.conf local=/2.vmops-test.vmops.com/ # Add domains which you want to force to an IP address here. -# The example below send any host in doubleclick.net to a local -# webserver. -#address=/doubleclick.net/127.0.0.1 +# The example below send any host in double-click.net to a local +# web-server. +#address=/double-click.net/127.0.0.1 + +# --address (and --server) work with IPv6 addresses too. +#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83 + +# You can control how dnsmasq talks to a server: this forces +# queries to 10.1.2.3 to be routed via eth1 +# server=10.1.2.3@eth1 + +# and this sets the source (ie local) address used to talk to +# 10.1.2.3 to 192.168.1.1 port 55 (there must be a interface with that +# IP on the machine, obviously). +# server=10.1.2.3@192.168.1.1#55 # If you want dnsmasq to change uid and gid to something other # than the default, edit the following lines. @@ -80,7 +97,7 @@ except-interface=lo #listen-address= # If you want dnsmasq to provide only DNS service on an interface, # configure it as shown above, and then use the following line to -# disable DHCP on it. +# disable DHCP and TFTP on it. no-dhcp-interface=eth1 no-dhcp-interface=eth2 @@ -113,13 +130,19 @@ expand-hosts # 3) Provides the domain part for "expand-hosts" domain=2.vmops-test.vmops.com +# Set a different domain for a particular subnet +#domain=wireless.thekelleys.org.uk,192.168.2.0/24 + +# Same idea, but range rather then subnet +#domain=reserved.thekelleys.org.uk,192.68.3.100,192.168.3.200 + # Uncomment this to enable the integrated DHCP server, you need # to supply the range of addresses available for lease and optionally # a lease time. If you have more than one network, you will need to # repeat this for each network on which you want to supply DHCP # service. -dhcp-range=10.1.1.1,static -#dhcp-range=10.0.0.1,10.255.255.255 +dhcp-range_ip4=10.1.1.1,static +dhcp-range_ip6=::1,static dhcp-hostsfile=/etc/dhcphosts.txt # This is an example of a DHCP range where the netmask is given. This @@ -128,17 +151,68 @@ dhcp-hostsfile=/etc/dhcphosts.txt # don't need to worry about this. #dhcp-range=192.168.0.50,192.168.0.150,255.255.255.0,12h -# This is an example of a DHCP range with a network-id, so that +# This is an example of a DHCP range which sets a tag, so that # some DHCP options may be set only for this network. -#dhcp-range=red,192.168.0.50,192.168.0.150 +#dhcp-range=set:red,192.168.0.50,192.168.0.150 + +# Use this DHCP range only when the tag "green" is set. +#dhcp-range=tag:green,192.168.0.50,192.168.0.150,12h + +# Specify a subnet which can't be used for dynamic address allocation, +# is available for hosts with matching --dhcp-host lines. Note that +# dhcp-host declarations will be ignored unless there is a dhcp-range +# of some type for the subnet in question. +# In this case the netmask is implied (it comes from the network +# configuration on the machine running dnsmasq) it is possible to give +# an explicit netmask instead. +#dhcp-range=192.168.0.0,static + +# Enable DHCPv6. Note that the prefix-length does not need to be specified +# and defaults to 64 if missing/ +#dhcp-range=1234::2, 1234::500, 64, 12h + +# Do Router Advertisements, BUT NOT DHCP for this subnet. +#dhcp-range=1234::, ra-only + +# Do Router Advertisements, BUT NOT DHCP for this subnet, also try and +# add names to the DNS for the IPv6 address of SLAAC-configured dual-stack +# hosts. Use the DHCPv4 lease to derive the name, network segment and +# MAC address and assume that the host will also have an +# IPv6 address calculated using the SLAAC alogrithm. +#dhcp-range=1234::, ra-names + +# Do Router Advertisements, BUT NOT DHCP for this subnet. +# Set the lifetime to 46 hours. (Note: minimum lifetime is 2 hours.) +#dhcp-range=1234::, ra-only, 48h + +# Do DHCP and Router Advertisements for this subnet. Set the A bit in the RA +# so that clients can use SLAAC addresses as well as DHCP ones. +#dhcp-range=1234::2, 1234::500, slaac + +# Do Router Advertisements and stateless DHCP for this subnet. Clients will +# not get addresses from DHCP, but they will get other configuration information. +# They will use SLAAC for addresses. +#dhcp-range=1234::, ra-stateless + +# Do stateless DHCP, SLAAC, and generate DNS names for SLAAC addresses +# from DHCPv4 leases. +#dhcp-range=1234::, ra-stateless, ra-names + +# Do router advertisements for all subnets where we're doing DHCPv6 +# Unless overriden by ra-stateless, ra-names, et al, the router +# advertisements will have the M and O bits set, so that the clients +# get addresses and configuration from DHCPv6, and the A bit reset, so the +# clients don't use SLAAC addresses. +#enable-ra # Supply parameters for specified hosts using DHCP. There are lots # of valid alternatives, so we will give examples of each. Note that # IP addresses DO NOT have to be in the range given above, they just # need to be on the same network. The order of the parameters in these -# do not matter, it's permissble to give name,adddress and MAC in any order +# do not matter, it's permissible to give name, address and MAC in any +# order. -# Always allocate the host with ethernet address 11:22:33:44:55:66 +# Always allocate the host with Ethernet address 11:22:33:44:55:66 # The IP address 192.168.0.60 #dhcp-host=11:22:33:44:55:66,192.168.0.60 @@ -146,11 +220,19 @@ dhcp-hostsfile=/etc/dhcphosts.txt # 11:22:33:44:55:66 to be "fred" #dhcp-host=11:22:33:44:55:66,fred -# Always give the host with ethernet address 11:22:33:44:55:66 +# Always give the host with Ethernet address 11:22:33:44:55:66 # the name fred and IP address 192.168.0.60 and lease time 45 minutes #dhcp-host=11:22:33:44:55:66,fred,192.168.0.60,45m -# Give the machine which says it's name is "bert" IP address +# Give a host with Ethernet address 11:22:33:44:55:66 or +# 12:34:56:78:90:12 the IP address 192.168.0.60. Dnsmasq will assume +# that these two Ethernet interfaces will never be in use at the same +# time, and give the IP address to the second, even if it is already +# in use by the first. Useful for laptops with wired and wireless +# addresses. +#dhcp-host=11:22:33:44:55:66,12:34:56:78:90:12,192.168.0.60 + +# Give the machine which says its name is "bert" IP address # 192.168.0.70 and an infinite lease #dhcp-host=bert,192.168.0.70,infinite @@ -167,41 +249,47 @@ dhcp-hostsfile=/etc/dhcphosts.txt # it asks for a DHCP lease. #dhcp-host=judge -# Never offer DHCP service to a machine whose ethernet +# Never offer DHCP service to a machine whose Ethernet # address is 11:22:33:44:55:66 #dhcp-host=11:22:33:44:55:66,ignore -# Ignore any client-id presented by the machine with ethernet +# Ignore any client-id presented by the machine with Ethernet # address 11:22:33:44:55:66. This is useful to prevent a machine # being treated differently when running under different OS's or # between PXE boot and OS boot. #dhcp-host=11:22:33:44:55:66,id:* # Send extra options which are tagged as "red" to -# the machine with ethernet address 11:22:33:44:55:66 -#dhcp-host=11:22:33:44:55:66,net:red +# the machine with Ethernet address 11:22:33:44:55:66 +#dhcp-host=11:22:33:44:55:66,set:red # Send extra options which are tagged as "red" to -# any machine with ethernet address starting 11:22:33: -#dhcp-host=11:22:33:*:*:*,net:red +# any machine with Ethernet address starting 11:22:33: +#dhcp-host=11:22:33:*:*:*,set:red -# Ignore any clients which are specified in dhcp-host lines -# or /etc/ethers. Equivalent to ISC "deny unkown-clients". -# This relies on the special "known" tag which is set when +# Give a fixed IPv6 address and name to client with +# DUID 00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2 +# Note the MAC addresses CANNOT be used to identify DHCPv6 clients. +# Note also the they [] around the IPv6 address are obilgatory. +#dhcp-host=id:00:01:00:01:16:d2:83:fc:92:d4:19:e2:d8:b2, fred, [1234::5] + +# Ignore any clients which are not specified in dhcp-host lines +# or /etc/ethers. Equivalent to ISC "deny unknown-clients". +# This relies on the special "known" tag which is set when # a host is matched. -#dhcp-ignore=#known +#dhcp-ignore=tag:!known # Send extra options which are tagged as "red" to any machine whose # DHCP vendorclass string includes the substring "Linux" -#dhcp-vendorclass=red,Linux +#dhcp-vendorclass=set:red,Linux # Send extra options which are tagged as "red" to any machine one # of whose DHCP userclass strings includes the substring "accounts" -#dhcp-userclass=red,accounts +#dhcp-userclass=set:red,accounts # Send extra options which are tagged as "red" to any machine whose # MAC address matches the pattern. -#dhcp-mac=red,00:60:8C:*:*:* +#dhcp-mac=set:red,00:60:8C:*:*:* # If this line is uncommented, dnsmasq will read /etc/ethers and act # on the ethernet-address/IP pairs found there just as if they had @@ -211,11 +299,11 @@ dhcp-hostsfile=/etc/dhcphosts.txt # Send options to hosts which ask for a DHCP lease. # See RFC 2132 for details of available options. -# Common options can be given to dnsmasq by name: +# Common options can be given to dnsmasq by name: # run "dnsmasq --help dhcp" to get a list. # Note that all the common settings, such as netmask and # broadcast address, DNS server and default route, are given -# sane defaults by dnsmasq. You very likely will not need +# sane defaults by dnsmasq. You very likely will not need # any dhcp-options. If you use Windows clients and Samba, there # are some options which are recommended, they are detailed at the # end of this section. @@ -229,13 +317,20 @@ dhcp-hostsfile=/etc/dhcphosts.txt # Override the default route supplied by dnsmasq and send no default # route at all. Note that this only works for the options sent by -# default (1, 3, 6, 12, 28) the same line will send a zero-length option +# default (1, 3, 6, 12, 28) the same line will send a zero-length option # for all other option numbers. #dhcp-option=3 # Set the NTP time server addresses to 192.168.0.4 and 10.10.0.5 #dhcp-option=option:ntp-server,192.168.0.4,10.10.0.5 +# Send DHCPv6 option. Note [] around IPv6 addresses. +#dhcp-option=option6:dns-server,[1234::77],[1234::88] + +# Send DHCPv6 option for namservers as the machine running +# dnsmasq and another. +#dhcp-option=option6:dns-server,[::],[1234::88] + # Set the NTP time server address to be the same machine as # is running dnsmasq #dhcp-option=42,0.0.0.0 @@ -258,20 +353,23 @@ dhcp-option=15,"2.vmops-test.vmops.com" # Specify an option which will only be sent to the "red" network # (see dhcp-range for the declaration of the "red" network) -# Note that the net: part must precede the option: part. -#dhcp-option = net:red, option:ntp-server, 192.168.1.1 +# Note that the tag: part must precede the option: part. +#dhcp-option = tag:red, option:ntp-server, 192.168.1.1 # The following DHCP options set up dnsmasq in the same way as is specified # for the ISC dhcpcd in # http://www.samba.org/samba/ftp/docs/textdocs/DHCP-Server-Configuration.txt # adapted for a typical dnsmasq installation where the host running # dnsmasq is also the host running samba. -# you may want to uncomment them if you use Windows clients and Samba. +# you may want to uncomment some or all of them if you use +# Windows clients and Samba. #dhcp-option=19,0 # option ip-forwarding off #dhcp-option=44,0.0.0.0 # set netbios-over-TCP/IP nameserver(s) aka WINS server(s) #dhcp-option=45,0.0.0.0 # netbios datagram distribution server #dhcp-option=46,8 # netbios node type -#dhcp-option=47 # empty netbios scope. + +# Send an empty WPAD option. This may be REQUIRED to get windows 7 to behave. +#dhcp-option=252,"\n" # Send RFC-3397 DNS domain search DHCP option. WARNING: Your DHCP client # probably doesn't support this...... @@ -280,10 +378,10 @@ dhcp-option=15,"2.vmops-test.vmops.com" # Send RFC-3442 classless static routes (note the netmask encoding) #dhcp-option=121,192.168.1.0/24,1.2.3.4,10.0.0.0/8,5.6.7.8 -# Send vendor-class specific options encapsulated in DHCP option 43. +# Send vendor-class specific options encapsulated in DHCP option 43. # The meaning of the options is defined by the vendor-class so # options are sent only when the client supplied vendor class -# matches the class given here. (A substring match is OK, so "MSFT" +# matches the class given here. (A substring match is OK, so "MSFT" # matches "MSFT" and "MSFT 5.0"). This example sets the # mtftp address to 0.0.0.0 for PXEClients. #dhcp-option=vendor:PXEClient,1,0.0.0.0 @@ -300,7 +398,7 @@ dhcp-option=vendor:MSFT,2,1i # Send options to PXELinux. Note that we need to send the options even # though they don't appear in the parameter request list, so we need -# to use dhcp-option-force here. +# to use dhcp-option-force here. # See http://syslinux.zytor.com/pxe.php#special for details. # Magic number - needed before anything else is recognised #dhcp-option-force=208,f1:00:74:7e @@ -311,29 +409,97 @@ dhcp-option=vendor:MSFT,2,1i # Reboot time. (Note 'i' to send 32-bit value) #dhcp-option-force=211,30i -# Set the boot filename for BOOTP. You will only need +# Set the boot filename for netboot/PXE. You will only need # this is you want to boot machines over the network and you will need # a TFTP server; either dnsmasq's built in TFTP server or an # external one. (See below for how to enable the TFTP server.) #dhcp-boot=pxelinux.0 +# The same as above, but use custom tftp-server instead machine running dnsmasq +#dhcp-boot=pxelinux,server.name,192.168.1.100 + +# Boot for Etherboot gPXE. The idea is to send two different +# filenames, the first loads gPXE, and the second tells gPXE what to +# load. The dhcp-match sets the gpxe tag for requests from gPXE. +#dhcp-match=set:gpxe,175 # gPXE sends a 175 option. +#dhcp-boot=tag:!gpxe,undionly.kpxe +#dhcp-boot=mybootimage + +# Encapsulated options for Etherboot gPXE. All the options are +# encapsulated within option 175 +#dhcp-option=encap:175, 1, 5b # priority code +#dhcp-option=encap:175, 176, 1b # no-proxydhcp +#dhcp-option=encap:175, 177, string # bus-id +#dhcp-option=encap:175, 189, 1b # BIOS drive code +#dhcp-option=encap:175, 190, user # iSCSI username +#dhcp-option=encap:175, 191, pass # iSCSI password + +# Test for the architecture of a netboot client. PXE clients are +# supposed to send their architecture as option 93. (See RFC 4578) +#dhcp-match=peecees, option:client-arch, 0 #x86-32 +#dhcp-match=itanics, option:client-arch, 2 #IA64 +#dhcp-match=hammers, option:client-arch, 6 #x86-64 +#dhcp-match=mactels, option:client-arch, 7 #EFI x86-64 + +# Do real PXE, rather than just booting a single file, this is an +# alternative to dhcp-boot. +#pxe-prompt="What system shall I netboot?" +# or with timeout before first available action is taken: +#pxe-prompt="Press F8 for menu.", 60 + +# Available boot services. for PXE. +#pxe-service=x86PC, "Boot from local disk" + +# Loads /pxelinux.0 from dnsmasq TFTP server. +#pxe-service=x86PC, "Install Linux", pxelinux + +# Loads /pxelinux.0 from TFTP server at 1.2.3.4. +# Beware this fails on old PXE ROMS. +#pxe-service=x86PC, "Install Linux", pxelinux, 1.2.3.4 + +# Use bootserver on network, found my multicast or broadcast. +#pxe-service=x86PC, "Install windows from RIS server", 1 + +# Use bootserver at a known IP address. +#pxe-service=x86PC, "Install windows from RIS server", 1, 1.2.3.4 + +# If you have multicast-FTP available, +# information for that can be passed in a similar way using options 1 +# to 5. See page 19 of +# http://download.intel.com/design/archives/wfm/downloads/pxespec.pdf + + # Enable dnsmasq's built-in TFTP server #enable-tftp -# Set the root directory for files availble via FTP. +# Set the root directory for files available via FTP. #tftp-root=/var/ftpd # Make the TFTP server more secure: with this set, only files owned by # the user dnsmasq is running as will be send over the net. #tftp-secure +# This option stops dnsmasq from negotiating a larger blocksize for TFTP +# transfers. It will slow things down, but may rescue some broken TFTP +# clients. +#tftp-no-blocksize + # Set the boot file name only when the "red" tag is set. #dhcp-boot=net:red,pxelinux.red-net -# An example of dhcp-boot with an external server: the name and IP +# An example of dhcp-boot with an external TFTP server: the name and IP # address of the server are given after the filename. +# Can fail with old PXE ROMS. Overridden by --pxe-service. #dhcp-boot=/var/ftpd/pxelinux.0,boothost,192.168.0.3 +# If there are multiple external tftp servers having a same name +# (using /etc/hosts) then that name can be specified as the +# tftp_servername (the third option to dhcp-boot) and in that +# case dnsmasq resolves this name and returns the resultant IP +# addresses in round robin fasion. This facility can be used to +# load balance the tftp load among a set of servers. +#dhcp-boot=/var/ftpd/pxelinux.0,boothost,tftp_server_name + # Set the limit on DHCP leases, the default is 150 #dhcp-lease-max=150 @@ -347,16 +513,16 @@ leasefile-ro # and take over the lease for any client which broadcasts on the network, # whether it has a record of the lease or not. This avoids long timeouts # when a machine wakes up on a new network. DO NOT enable this if there's -# the slighest chance that you might end up accidentally configuring a DHCP +# the slightest chance that you might end up accidentally configuring a DHCP # server for your campus/company accidentally. The ISC server uses # the same option, and this URL provides more information: -# http://www.isc.org/index.pl?/sw/dhcp/authoritative.php +# http://www.isc.org/files/auth.html #dhcp-authoritative # Run an executable when a DHCP lease is created or destroyed. -# The arguments sent to the script are "add" or "del", +# The arguments sent to the script are "add" or "del", # then the MAC address, the IP address and finally the hostname -# if there is one. +# if there is one. #dhcp-script=/bin/echo # Set the cachesize here. @@ -385,7 +551,8 @@ leasefile-ro #alias=1.2.3.4,5.6.7.8 # and this maps 1.2.3.x to 5.6.7.x #alias=1.2.3.0,5.6.7.0,255.255.255.0 - +# and this maps 192.168.0.10->192.168.0.40 to 10.0.0.10->10.0.0.40 +#alias=192.168.0.10-192.168.0.40,10.0.0.0,255.255.255.0 # Change these lines if you want dnsmasq to serve MX records. @@ -415,12 +582,12 @@ leasefile-ro # set for this to work.) # A SRV record sending LDAP for the example.com domain to -# ldapserver.example.com port 289 +# ldapserver.example.com port 389 #srv-host=_ldap._tcp.example.com,ldapserver.example.com,389 # A SRV record sending LDAP for the example.com domain to -# ldapserver.example.com port 289 (using domain=) -###domain=example.com +# ldapserver.example.com port 389 (using domain=) +#domain=example.com #srv-host=_ldap._tcp,ldapserver.example.com,389 # Two SRV records for LDAP, each with different priorities @@ -448,6 +615,10 @@ leasefile-ro #Example zeroconf #txt-record=_http._tcp.example.com,name=value,paper=A4 +# Provide an alias for a "local" DNS name. Note that this _only_ works +# for targets which are names from DHCP or /etc/hosts. Give host +# "bert" another name, bertrand +#cname=bertand,bert # For debugging purposes, log each DNS query as it passes through # dnsmasq. @@ -461,6 +632,3 @@ log-facility=/var/log/dnsmasq.log # Include a another lot of configuration options. #conf-file=/etc/dnsmasq.more.conf conf-dir=/etc/dnsmasq.d - -# Don't reply Windows's periodical DNS request -filterwin2k diff --git a/patches/systemvm/debian/config/etc/init.d/cloud-early-config b/patches/systemvm/debian/config/etc/init.d/cloud-early-config index fe536cbb5a9..8ddccd582f7 100755 --- a/patches/systemvm/debian/config/etc/init.d/cloud-early-config +++ b/patches/systemvm/debian/config/etc/init.d/cloud-early-config @@ -229,6 +229,23 @@ setup_interface() { fi } +setup_interface_ipv6() { + sysctl net.ipv6.conf.all.disable_ipv6=0 + sysctl net.ipv6.conf.all.accept_ra=1 + + local intfnum=$1 + local ipv6="$2" + local prelen="$3" + local intf=eth${intfnum} + + echo "iface $intf inet6 static" >> /etc/network/interfaces + echo " address $ipv6 " >> /etc/network/interfaces + echo " netmask $prelen" >> /etc/network/interfaces + echo " accept_ra 1" >> /etc/network/interfaces + ifdown $intf + ifup $intf +} + enable_fwding() { local enabled=$1 log_it "cloud: enable_fwding = $1" @@ -303,7 +320,14 @@ disable_hvc() { setup_common() { init_interfaces $1 $2 $3 - setup_interface "0" $ETH0_IP $ETH0_MASK $GW + if [ -n "$ETH0_IP" ] + then + setup_interface "0" $ETH0_IP $ETH0_MASK $GW + fi + if [ -n "$ETH0_IP6" ] + then + setup_interface_ipv6 "0" $ETH0_IP6 $ETH0_IP6_PRELEN + fi setup_interface "1" $ETH1_IP $ETH1_MASK $GW if [ -n "$ETH2_IP" ] then @@ -339,6 +363,18 @@ setup_common() { echo "nameserver $NS2" >> /etc/dnsmasq-resolv.conf echo "nameserver $NS2" >> /etc/resolv.conf fi + + if [ -n "$IP6_NS1" ] + then + echo "nameserver $IP6_NS1" >> /etc/dnsmasq-resolv.conf + echo "nameserver $IP6_NS1" >> /etc/resolv.conf + fi + if [ -n "$IP6_NS2" ] + then + echo "nameserver $IP6_NS2" >> /etc/dnsmasq-resolv.conf + echo "nameserver $IP6_NS2" >> /etc/resolv.conf + fi + if [ -n "$MGMTNET" -a -n "$LOCAL_GW" ] then ip route add $MGMTNET via $LOCAL_GW dev eth1 @@ -374,7 +410,8 @@ setup_common() { setup_dnsmasq() { log_it "Setting up dnsmasq" - [ -z $DHCP_RANGE ] && DHCP_RANGE=$ETH0_IP + [ -z $DHCP_RANGE ] && [ $ETH0_IP ] && DHCP_RANGE=$ETH0_IP + [ $ETH0_IP6 ] && DHCP_RANGE_IP6=$ETH0_IP6 [ -z $DOMAIN ] && DOMAIN="cloudnine.internal" if [ -n "$DOMAIN" ] @@ -398,17 +435,53 @@ setup_dnsmasq() { sed -i s/[#]*dhcp-option=15.*$/dhcp-option=15,\""$DNS_SEARCH_ORDER"\"/ /etc/dnsmasq.conf fi - sed -i -e "s/^dhcp-range=.*$/dhcp-range=$DHCP_RANGE,static/" /etc/dnsmasq.conf - sed -i -e "s/^[#]*listen-address=.*$/listen-address=$ETH0_IP/" /etc/dnsmasq.conf + if [ $DHCP_RANGE ] + then + sed -i -e "s/^dhcp-range_ip4=.*$/dhcp-range=$DHCP_RANGE,static/" /etc/dnsmasq.conf + else + sed -i -e "s/^dhcp-range_ip4=.*$//" /etc/dnsmasq.conf + fi + if [ $DHCP_RANGE_IP6 ] + then + sed -i -e "s/^dhcp-range_ip6=.*$/dhcp-range=$DHCP_RANGE_IP6,static/" /etc/dnsmasq.conf + else + sed -i -e "s/^dhcp-range_ip6=.*$//" /etc/dnsmasq.conf + fi + + sed -i -e "s/^[#]*listen-address=.*$/listen-address=$LOCAL_ADDRS/" /etc/dnsmasq.conf if [ "$RROUTER" == "1" ] then - sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=option:router,$GUEST_GW" >> /etc/dnsmasq.conf - sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=6,$GUEST_GW" >> /etc/dnsmasq.conf + DEFAULT_GW=$GUEST_GW + INTERNAL_DNS=$GUEST_GW + else + if [ "$TYPE" == "dhcpsrvr" ] + then + DEFAULT_GW=$GW + else + DEFAULT_GW=$ETH0_IP + fi + INTERNAL_DNS=$ETH0_IP fi + sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf + [ $DEFAULT_GW ] && echo "dhcp-option=option:router,$DEFAULT_GW" >> /etc/dnsmasq.conf + [ $ETH0_IP ] && [ $NS1 ] && NS="$NS1," + [ $ETH0_IP ] && [ $NS2 ] && NS="$NS$NS2," + [ $ETH0_IP6 ] && [ $IP6_NS1 ] && NS6="[$IP6_NS1]," + [ $ETH0_IP6 ] && [ $IP6_NS2 ] && NS6="$NS6[$IP6_NS2]," + #for now set up ourself as the dns server as well + sed -i -e "/^[#]*dhcp-option=6,.*$/d" /etc/dnsmasq.conf + sed -i -e "/^[#]*dhcp-option=option6:dns-server,.*$/d" /etc/dnsmasq.conf + if [ "$USE_EXTERNAL_DNS" != "true" ] + then + [ $ETH0_IP ] && NS="$INTERNAL_DNS,$NS" + [ $ETH0_IP6 ] && NS6="[::],$NS6" + fi + NS=${NS%?} + NS6=${NS6%?} + [ $ETH0_IP ] && echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf + [ $ETH0_IP6 ] && echo "dhcp-option=option6:dns-server,$NS6" >> /etc/dnsmasq.conf } setup_sshd(){ @@ -569,14 +642,6 @@ setup_router() { setup_dnsmasq - NS=$NS1 - [ -n "$NS2" ] && NS=$NS1,$NS2 - if [ "$USE_EXTERNAL_DNS" == "true" ] - then - sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf - fi - setup_apache2 $ETH0_IP sed -i /gateway/d /etc/hosts @@ -660,7 +725,7 @@ EOF enable_svc dnsmasq 1 enable_svc haproxy 1 enable_svc cloud 0 - disable_rpfilter_domR + disable_rpfilter enable_fwding 1 cp /etc/iptables/iptables-vpcrouter /etc/iptables/rules setup_sshd $ETH0_IP "eth0" @@ -678,29 +743,9 @@ setup_dhcpsrvr() { setup_dnsmasq setup_apache2 $ETH0_IP - NS=$NS1 - [ -n "$NS2" ] && NS=$NS1,$NS2 - if [ "$DEFAULTROUTE" != "false" ] - then - sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=option:router,$GW" >> /etc/dnsmasq.conf - #for now set up ourself as the dns server as well - sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf - if [ "$USE_EXTERNAL_DNS" == "true" ] - then - echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf - else - echo "dhcp-option=6,$ETH0_IP,$NS" >> /etc/dnsmasq.conf - fi - else - sed -i -e "/^[#]*dhcp-option=option:router.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=option:router" >> /etc/dnsmasq.conf - sed -i -e "/^[#]*dhcp-option=6.*$/d" /etc/dnsmasq.conf - echo "dhcp-option=6,$NS" >> /etc/dnsmasq.conf - fi - sed -i /gateway/d /etc/hosts - echo "$ETH0_IP $NAME" >> /etc/hosts + [ $ETH0_IP ] && echo "$ETH0_IP $NAME" >> /etc/hosts + [ $ETH0_IP6 ] && echo "$ETH0_IP6 $NAME" >> /etc/hosts enable_svc dnsmasq 1 enable_svc haproxy 0 @@ -903,6 +948,9 @@ for i in $CMDLINE gateway) GW=$VALUE ;; + ip6gateway) + IP6GW=$VALUE + ;; eth0mask) ETH0_MASK=$VALUE ;; @@ -912,6 +960,12 @@ for i in $CMDLINE eth2mask) ETH2_MASK=$VALUE ;; + eth0ip6) + ETH0_IP6=$VALUE + ;; + eth0ip6prelen) + ETH0_IP6_PRELEN=$VALUE + ;; internaldns1) internalNS1=$VALUE ;; @@ -924,6 +978,12 @@ for i in $CMDLINE dns2) NS2=$VALUE ;; + ip6dns1) + IP6_NS1=$VALUE + ;; + ip6dns2) + IP6_NS2=$VALUE + ;; domain) DOMAIN=$VALUE ;; @@ -1001,8 +1061,11 @@ for i in $CMDLINE ;; esac done -} +[ $ETH0_IP ] && LOCAL_ADDRS=$ETH0_IP +[ $ETH0_IP6 ] && LOCAL_ADDRS=$ETH0_IP6 +[ $ETH0_IP ] && [ $ETH0_IP6 ] && LOCAL_ADDRS="$ETH0_IP,$ETH0_IP6" +} case "$1" in start) diff --git a/patches/systemvm/debian/config/etc/iptables/iptables-router b/patches/systemvm/debian/config/etc/iptables/iptables-router index 28469fbc639..3f5bc5f736b 100644 --- a/patches/systemvm/debian/config/etc/iptables/iptables-router +++ b/patches/systemvm/debian/config/etc/iptables/iptables-router @@ -24,6 +24,7 @@ COMMIT :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT ACCEPT [0:0] +:FW_OUTBOUND - [0:0] -A INPUT -d 224.0.0.18/32 -j ACCEPT -A INPUT -d 225.0.0.50/32 -j ACCEPT -A INPUT -i eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT @@ -37,10 +38,11 @@ COMMIT -A INPUT -i eth1 -p tcp -m state --state NEW --dport 3922 -j ACCEPT -A INPUT -i eth0 -p tcp -m state --state NEW --dport 80 -j ACCEPT -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT --A FORWARD -i eth0 -o eth2 -j ACCEPT -A FORWARD -i eth2 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i eth0 -o eth0 -m state --state NEW -j ACCEPT -A FORWARD -i eth0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT +-A FORWARD -i eth0 -o eth2 -j FW_OUTBOUND +-I FW_OUTBOUND -m state --state RELATED,ESTABLISHED -j ACCEPT COMMIT *mangle :PREROUTING ACCEPT [0:0] diff --git a/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq b/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq index f448420e176..838415d3049 100644 --- a/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq +++ b/patches/systemvm/debian/config/etc/logrotate.d/dnsmasq @@ -6,7 +6,7 @@ delaycompress sharedscripts postrotate - [ ! -f /var/run/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq.pid` + [ ! -f /var/run/dnsmasq/dnsmasq.pid ] || kill -USR2 `cat /var/run/dnsmasq/dnsmasq.pid` endscript create 0640 nobody root } diff --git a/patches/systemvm/debian/config/etc/sysctl.conf b/patches/systemvm/debian/config/etc/sysctl.conf index 961d471dfa9..586d5bdb7c6 100644 --- a/patches/systemvm/debian/config/etc/sysctl.conf +++ b/patches/systemvm/debian/config/etc/sysctl.conf @@ -42,8 +42,8 @@ net.ipv4.tcp_max_tw_buckets=1000000 net.core.somaxconn=1000000 # Disable IPv6 -net.ipv6.conf.all.disable_ipv6 = 1 -net.ipv6.conf.all.forwarding = 0 -net.ipv6.conf.all.accept_ra = 0 +net.ipv6.conf.all.disable_ipv6 = 0 +net.ipv6.conf.all.forwarding = 1 +net.ipv6.conf.all.accept_ra = 1 net.ipv6.conf.all.accept_redirects = 0 net.ipv6.conf.all.autoconf = 0 diff --git a/build/build-aws-api.properties b/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh old mode 100644 new mode 100755 similarity index 79% rename from build/build-aws-api.properties rename to patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh index 0a02d1b5579..80e3213753b --- a/build/build-aws-api.properties +++ b/patches/systemvm/debian/config/opt/cloud/bin/checkbatchs2svpn.sh @@ -1,3 +1,4 @@ +#!/bin/bash # 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 @@ -5,9 +6,9 @@ # 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 @@ -15,14 +16,10 @@ # specific language governing permissions and limitations # under the License. -company.major.version=1 -company.minor.version=0 -company.patch.version=8 +for i in $* +do + info=`/opt/cloud/bin/checks2svpn.sh $i` + ret=$? + echo -n "$i:$ret:$info&" +done -target.compat.version=1.6 -source.compat.version=1.6 - -debug=true -build.type=developer -debuglevel=lines,source,vars -deprecation=off diff --git a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh index 5af5d9233a7..f326fac9e54 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/ipassoc.sh @@ -212,9 +212,9 @@ add_first_ip() { ip_addr_add $ethDev $pubIp sudo iptables -D FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT - sudo iptables -D FORWARD -i eth0 -o $ethDev -j ACCEPT + sudo iptables -D FORWARD -i eth0 -o $ethDev -j FW_OUTBOUND sudo iptables -A FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT - sudo iptables -A FORWARD -i eth0 -o $ethDev -j ACCEPT + sudo iptables -A FORWARD -i eth0 -o $ethDev -j FW_OUTBOUND add_snat $1 if [ $? -gt 0 -a $? -ne 2 ] @@ -246,7 +246,7 @@ remove_first_ip() { [ "$mask" == "" ] && mask="32" sudo iptables -D FORWARD -i $ethDev -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT - sudo iptables -D FORWARD -i eth0 -o $ethDev -j ACCEPT + sudo iptables -D FORWARD -i eth0 -o $ethDev -j FW_OUTBOUND remove_snat $1 sudo ip addr del dev $ethDev "$ipNoMask/$mask" diff --git a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh index d20ed5a05d2..c909cf796d1 100755 --- a/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh +++ b/patches/systemvm/debian/config/opt/cloud/bin/vpc_guestnw.sh @@ -134,6 +134,7 @@ create_guest_network() { sudo ip addr add dev $dev $ip/$mask brd + sudo ip link set $dev up sudo arping -c 3 -I $dev -A -U -s $ip $ip + echo 1 > /proc/sys/net/ipv4/conf/$dev/rp_filter # restore mark from connection mark local tableName="Table_$dev" sudo ip route add $subnet/$mask dev $dev table $tableName proto static diff --git a/patches/systemvm/debian/config/root/edithosts.sh b/patches/systemvm/debian/config/root/edithosts.sh index 37c75a53022..257de926724 100755 --- a/patches/systemvm/debian/config/root/edithosts.sh +++ b/patches/systemvm/debian/config/root/edithosts.sh @@ -26,12 +26,43 @@ # $5 : nameserver on default nic # $6 : comma separated static routes -mac=$1 -ip=$2 -host=$3 -dflt=$4 -dns=$5 -routes=$6 +usage() { + printf "Usage: %s: -m -4 -6 -h -d -n -s -u \n" $(basename $0) >&2 +} + +mac= +ipv4= +ipv6= +host= +dflt= +dns= +routes= +duid= + +while getopts 'm:4:h:d:n:s:6:u:' OPTION +do + case $OPTION in + m) mac="$OPTARG" + ;; + 4) ipv4="$OPTARG" + ;; + 6) ipv6="$OPTARG" + ;; + u) duid="$OPTARG" + ;; + h) host="$OPTARG" + ;; + d) dflt="$OPTARG" + ;; + n) dns="$OPTARG" + ;; + s) routes="$OPTARG" + ;; + ?) usage + exit 2 + ;; + esac +done DHCP_HOSTS=/etc/dhcphosts.txt DHCP_OPTS=/etc/dhcpopts.txt @@ -70,26 +101,69 @@ logger -t cloud "edithosts: update $1 $2 $3 to hosts" [ ! -f $DHCP_LEASES ] && touch $DHCP_LEASES #delete any previous entries from the dhcp hosts file -sed -i /$mac/d $DHCP_HOSTS -sed -i /$ip,/d $DHCP_HOSTS -sed -i /$host,/d $DHCP_HOSTS +sed -i /$mac/d $DHCP_HOSTS +if [ $ipv4 ] +then + sed -i /$ipv4,/d $DHCP_HOSTS +fi +if [ $ipv6 ] +then + sed -i /$ipv6,/d $DHCP_HOSTS +fi +sed -i /$host,/d $DHCP_HOSTS #put in the new entry -echo "$mac,$ip,$host,infinite" >>$DHCP_HOSTS +if [ $ipv4 ] +then + echo "$mac,$ipv4,$host,infinite" >>$DHCP_HOSTS +fi +if [ $ipv6 ] +then + echo "id:$duid,[$ipv6],$host,infinite" >>$DHCP_HOSTS +fi #delete leases to supplied mac and ip addresses -sed -i /$mac/d $DHCP_LEASES -sed -i /"$ip "/d $DHCP_LEASES +if [ $ipv4 ] +then + sed -i /$mac/d $DHCP_LEASES + sed -i /"$ipv4 "/d $DHCP_LEASES +fi +if [ $ipv6 ] +then + sed -i /$duid/d $DHCP_LEASES + sed -i /"$ipv6 "/d $DHCP_LEASES +fi sed -i /"$host "/d $DHCP_LEASES #put in the new entry -echo "0 $mac $ip $host *" >> $DHCP_LEASES +if [ $ipv4 ] +then + echo "0 $mac $ipv4 $host *" >> $DHCP_LEASES +fi +if [ $ipv6 ] +then + echo "0 $duid $ipv6 $host *" >> $DHCP_LEASES +fi #edit hosts file as well -sed -i /"$ip "/d $HOSTS +if [ $ipv4 ] +then + sed -i /"$ipv4 "/d $HOSTS +fi +if [ $ipv6 ] +then + sed -i /"$ipv6 "/d $HOSTS +fi sed -i /" $host$"/d $HOSTS -echo "$ip $host" >> $HOSTS +if [ $ipv4 ] +then + echo "$ipv4 $host" >> $HOSTS +fi +if [ $ipv6 ] +then + echo "$ipv6 $host" >> $HOSTS +fi if [ "$dflt" != "" ] then @@ -97,26 +171,21 @@ then sed -i /dhcp-optsfile/d /etc/dnsmasq.conf echo "dhcp-optsfile=$DHCP_OPTS" >> /etc/dnsmasq.conf - tag=$(echo $ip | tr '.' '_') + tag=$(echo $ipv4 | tr '.' '_') sed -i /$tag/d $DHCP_OPTS - if [ "$dflt" != "0.0.0.0" ] + if [ "$dflt" == "0.0.0.0" ] then - logger -t cloud "$0: setting default router for $ip to $dflt" - echo "$tag,3,$dflt" >> $DHCP_OPTS - else - logger -t cloud "$0: unset default router for $ip" - echo "$tag,3," >> $DHCP_OPTS - fi - if [ "$dns" != "" ] - then - logger -t cloud "$0: setting dns server for $ip to $dns" - echo "$tag,6,$dns" >> $DHCP_OPTS + logger -t cloud "$0: unset default router for $ipv4" + echo "$tag,3" >> $DHCP_OPTS + logger -t cloud "$0: setting dns server for $ipv4 to $dns" + echo "$tag,6" >> $DHCP_OPTS + echo "$tag,15" >> $DHCP_OPTS fi [ "$routes" != "" ] && echo "$tag,121,$routes" >> $DHCP_OPTS #delete entry we just put in because we need a tag - sed -i /$mac/d $DHCP_HOSTS + sed -i /$ipv4/d $DHCP_HOSTS #put it back with a tag - echo "$mac,set:$tag,$ip,$host,infinite" >>$DHCP_HOSTS + echo "$mac,set:$tag,$ipv4,$host,infinite" >>$DHCP_HOSTS fi # make dnsmasq re-read files diff --git a/patches/systemvm/debian/config/root/firewallRule_egress.sh b/patches/systemvm/debian/config/root/firewallRule_egress.sh new file mode 100755 index 00000000000..0da7718741d --- /dev/null +++ b/patches/systemvm/debian/config/root/firewallRule_egress.sh @@ -0,0 +1,171 @@ +#!/usr/bin/env bash +# 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. +# $Id: firewallRule_egress.sh 9947 2013-01-17 19:34:24Z manuel $ $HeadURL: svn://svn.lab.vmops.com/repos/vmdev/java/patches/xenserver/root/firewallRule_egress.sh $ +# firewallRule_egress.sh -- allow some ports / protocols from vm instances +# @VERSION@ + +source /root/func.sh + +lock="biglock" +locked=$(getLockFile $lock) +if [ "$locked" != "1" ] +then + exit 1 +fi +#set -x +usage() { + printf "Usage: %s: -a protocol:startport:endport:sourcecidrs> \n" $(basename $0) >&2 + printf "sourcecidrs format: cidr1-cidr2-cidr3-...\n" +} + +fw_egress_remove_backup() { + sudo iptables -D FW_OUTBOUND -j _FW_EGRESS_RULES + sudo iptables -F _FW_EGRESS_RULES + sudo iptables -X _FW_EGRESS_RULES +} + +fw_egress_save() { + sudo iptables -E FW_EGRESS_RULES _FW_EGRESS_RULES +} + +fw_egress_chain () { +#supress errors 2>/dev/null + fw_egress_remove_backup + fw_egress_save + sudo iptables -N FW_EGRESS_RULES + sudo iptables -A FW_OUTBOUND -j FW_EGRESS_RULES +} + +fw_egress_backup_restore() { + sudo iptables -A FW_OUTBOUND -j FW_EGRESS_RULES + sudo iptables -E _FW_EGRESS_RULES FW_EGRESS_RULES + fw_egress_remove_backup +} + + +fw_entry_for_egress() { + local rule=$1 + + local prot=$(echo $rule | cut -d: -f2) + local sport=$(echo $rule | cut -d: -f3) + local eport=$(echo $rule | cut -d: -f4) + local cidrs=$(echo $rule | cut -d: -f5 | sed 's/-/ /g') + if [ "$sport" == "0" -a "$eport" == "0" ] + then + DPORT="" + else + DPORT="--dport $sport:$eport" + fi + logger -t cloud "$(basename $0): enter apply fw egress rules for guest $prot:$sport:$eport:$cidrs" + + for lcidr in $cidrs + do + [ "$prot" == "reverted" ] && continue; + if [ "$prot" == "icmp" ] + then + typecode="$sport/$eport" + [ "$eport" == "-1" ] && typecode="$sport" + [ "$sport" == "-1" ] && typecode="any" + sudo iptables -A FW_EGRESS_RULES -p $prot -s $lcidr --icmp-type $typecode \ + -j ACCEPT + result=$? + elif [ "$prot" == "all" ] + then + sudo iptables -A FW_EGRESS_RULES -p $prot -s $lcidr -j ACCEPT + result=$? + else + sudo iptables -A FW_EGRESS_RULES -p $prot -s $lcidr \ + $DPORT -j ACCEPT + result=$? + fi + + [ $result -gt 0 ] && + logger -t cloud "Error adding iptables entry for guest network $prot:$sport:$eport:$cidrs" && + break + done + + logger -t cloud "$(basename $0): exit apply egress firewall rules for guest network" + return $result +} + + +aflag=0 +rules="" +rules_list="" +ip="" +dev="" +shift +shift +while getopts 'a:' OPTION +do + case $OPTION in + a) aflag=1 + rules="$OPTARG" + ;; + ?) usage + unlock_exit 2 $lock $locked + ;; + esac +done + +if [ "$aflag" != "1" ] +then + usage + unlock_exit 2 $lock $locked +fi + +if [ -n "$rules" ] +then + rules_list=$(echo $rules | cut -d, -f1- --output-delimiter=" ") +fi + +# rule format +# protocal:sport:eport:cidr +#-a tcp:80:80:0.0.0.0/0::tcp:220:220:0.0.0.0/0:,tcp:222:222:192.168.10.0/24-75.57.23.0/22-88.100.33.1/32 +# if any entry is reverted , entry will be in the format reverted:0:0:0 +# example : tcp:80:80:0.0.0.0/0:, tcp:220:220:0.0.0.0/0:,200.1.1.2:reverted:0:0:0 + +success=0 + +fw_egress_chain +for r in $rules_list +do + fw_entry_for_egress $r + success=$? + if [ $success -gt 0 ] + then + logger -t cloud "failure to apply fw egress rules " + break + else + logger -t cloud "successful in applying fw egress rules" + fi +done + +if [ $success -gt 0 ] +then + logger -t cloud "restoring from backup for guest network" + fw_egress_backup_restore +else + logger -t cloud "deleting backup for guest network" +fi + +fw_egress_remove_backup + +unlock_exit $success $lock $locked + + diff --git a/patches/systemvm/debian/config/root/func.sh b/patches/systemvm/debian/config/root/func.sh index 4047a4047a6..86317a06843 100644 --- a/patches/systemvm/debian/config/root/func.sh +++ b/patches/systemvm/debian/config/root/func.sh @@ -42,7 +42,11 @@ getLockFile() { psline=`ps u $$` echo $psline > $__LOCKFILE - + if [ ! -e $__LOCKFILE ] + then + return + fi + for i in `seq 1 $(($__TIMEOUT * 10))` do currlock=`ls -tr /tmp/$1-*.lock | head -n1` diff --git a/plugins/acl/static-role-based/pom.xml b/plugins/acl/static-role-based/pom.xml index a2e8d05d48e..e40cecb9d65 100644 --- a/plugins/acl/static-role-based/pom.xml +++ b/plugins/acl/static-role-based/pom.xml @@ -26,7 +26,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java index 16357846cba..d4d73d1f77b 100644 --- a/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java +++ b/plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java @@ -16,27 +16,29 @@ // under the License. package org.apache.cloudstack.acl; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + import com.cloud.exception.PermissionDeniedException; -import com.cloud.server.ManagementServer; import com.cloud.user.Account; import com.cloud.user.AccountService; import com.cloud.user.User; import com.cloud.utils.PropertiesUtil; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.ComponentLocator; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import org.apache.log4j.Logger; +import com.cloud.utils.component.PluggableService; // This is the default API access checker that grab's the user's account // based on the account type, access is granted -@Local(value = APIChecker.class) +@Local(value=APIChecker.class) public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIChecker { protected static final Logger s_logger = Logger.getLogger(StaticRoleBasedAPIAccessChecker.class); @@ -44,23 +46,24 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC private static Map> s_roleBasedApisMap = new HashMap>(); - private static AccountService s_accountService; + @Inject List _services; + @Inject AccountService _accountService; protected StaticRoleBasedAPIAccessChecker() { super(); - for (RoleType roleType : RoleType.values()) + for (RoleType roleType: RoleType.values()) s_roleBasedApisMap.put(roleType, new HashSet()); } @Override public boolean checkAccess(User user, String commandName) throws PermissionDeniedException { - Account account = s_accountService.getAccount(user.getAccountId()); + Account account = _accountService.getAccount(user.getAccountId()); if (account == null) { throw new PermissionDeniedException("The account id=" + user.getAccountId() + "for user id=" + user.getId() + "is null"); } - RoleType roleType = s_accountService.getRoleType(account); + RoleType roleType = _accountService.getRoleType(account); boolean isAllowed = s_roleBasedApisMap.get(roleType).contains(commandName); if (!isAllowed) { throw new PermissionDeniedException("The API does not exist or is blacklisted. Role type=" + roleType.toString() + " is not allowed to request the api: " + commandName); @@ -72,23 +75,18 @@ public class StaticRoleBasedAPIAccessChecker extends AdapterBase implements APIC public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - // Read command properties files to build the static map per role. - ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name); - s_accountService = locator.getManager(AccountService.class); - processMapping(PropertiesUtil.processConfigFile(new String[] {"commands.properties"})); - return true; } private void processMapping(Map configMap) { - for (Map.Entry entry : configMap.entrySet()) { + for (Map.Entry entry: configMap.entrySet()) { String apiName = entry.getKey(); String roleMask = entry.getValue(); try { short cmdPermissions = Short.parseShort(roleMask); - for (RoleType roleType : RoleType.values()) { + for (RoleType roleType: RoleType.values()) { if ((cmdPermissions & roleType.getValue()) != 0) s_roleBasedApisMap.get(roleType).add(apiName); } diff --git a/plugins/api/discovery/pom.xml b/plugins/api/discovery/pom.xml index a61b275addc..5d9ad75ea3a 100644 --- a/plugins/api/discovery/pom.xml +++ b/plugins/api/discovery/pom.xml @@ -20,25 +20,47 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 4.0.0 - cloud-plugin-api-discovery - Apache CloudStack Plugin - API Discovery - - org.apache.cloudstack - cloudstack-plugins - 4.1.0-SNAPSHOT - ../../pom.xml - - - - org.apache.cloudstack - cloud-api - ${project.version} - - - org.apache.cloudstack - cloud-utils - ${project.version} - - + 4.0.0 + cloud-plugin-api-discovery + Apache CloudStack Plugin - API Discovery + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + + + org.apache.cloudstack + cloud-api + ${project.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + + install + src + test + + + test/resources + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -Xmx1024m + + org/apache/cloudstack/discovery/integration/* + + + + + diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java index bad7ca7b5f6..5de04f01e11 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/command/user/discovery/ListApisCmd.java @@ -16,27 +16,29 @@ // under the License. package org.apache.cloudstack.api.command.user.discovery; -import com.cloud.user.User; -import com.cloud.user.UserContext; +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.PlugService; import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ApiDiscoveryResponse; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.discovery.ApiDiscoveryService; -import org.apache.cloudstack.api.response.ApiDiscoveryResponse; - import org.apache.log4j.Logger; +import com.cloud.user.User; +import com.cloud.user.UserContext; + @APICommand(name = "listApis", responseObject = ApiDiscoveryResponse.class, description = "lists all available apis on the server, provided by the Api Discovery plugin", since = "4.1.0") public class ListApisCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListApisCmd.class.getName()); private static final String s_name = "listapisresponse"; - @PlugService + @Inject ApiDiscoveryService _apiDiscoveryService; @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="API name") @@ -48,7 +50,7 @@ public class ListApisCmd extends BaseCmd { User user = UserContext.current().getCallerUser(); ListResponse response = (ListResponse) _apiDiscoveryService.listApis(user, name); if (response == null) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Api Discovery plugin was unable to find an api by that name or process any apis"); } response.setResponseName(getCommandName()); this.setResponseObject(response); diff --git a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java index de6a9f93965..77484f0f7e7 100644 --- a/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/api/response/ApiDiscoveryResponse.java @@ -57,18 +57,34 @@ public class ApiDiscoveryResponse extends BaseResponse { this.name = name; } + public String getName() { + return name; + } + public void setDescription(String description) { this.description = description; } + public String getDescription() { + return description; + } + public void setSince(String since) { this.since = since; } + public String getSince() { + return since; + } + public void setAsync(Boolean isAsync) { this.isAsync = isAsync; } + public boolean getAsync() { + return isAsync; + } + public String getRelated() { return related; } diff --git a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java old mode 100644 new mode 100755 index f06e2005552..293a1a47c19 --- a/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java +++ b/plugins/api/discovery/src/org/apache/cloudstack/discovery/ApiDiscoveryServiceImpl.java @@ -16,28 +16,6 @@ // under the License. package org.apache.cloudstack.discovery; -import com.cloud.serializer.Param; -import com.cloud.user.User; -import com.cloud.utils.ReflectUtil; -import com.cloud.utils.StringUtils; -import com.cloud.utils.component.Adapters; -import com.cloud.utils.component.ComponentLocator; -import com.google.gson.annotations.SerializedName; -import org.apache.cloudstack.acl.APIChecker; -import org.apache.cloudstack.api.APICommand; -import org.apache.cloudstack.api.BaseCmd; -import org.apache.cloudstack.api.BaseAsyncCmd; -import org.apache.cloudstack.api.BaseAsyncCreateCmd; -import org.apache.cloudstack.api.BaseResponse; -import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.command.user.discovery.ListApisCmd; -import org.apache.cloudstack.api.response.ApiDiscoveryResponse; -import org.apache.cloudstack.api.response.ApiParameterResponse; -import org.apache.cloudstack.api.response.ApiResponseResponse; -import org.apache.cloudstack.api.response.ListResponse; -import org.apache.log4j.Logger; - -import javax.ejb.Local; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.HashMap; @@ -46,33 +24,65 @@ import java.util.List; import java.util.Map; import java.util.Set; +import javax.annotation.PostConstruct; +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.acl.APIChecker; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.BaseAsyncCreateCmd; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.user.discovery.ListApisCmd; +import org.apache.cloudstack.api.response.ApiDiscoveryResponse; +import org.apache.cloudstack.api.response.ApiParameterResponse; +import org.apache.cloudstack.api.response.ApiResponseResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.serializer.Param; +import com.cloud.user.User; +import com.cloud.utils.ReflectUtil; +import com.cloud.utils.StringUtils; +import com.cloud.utils.component.PluggableService; +import com.google.gson.annotations.SerializedName; + +@Component @Local(value = ApiDiscoveryService.class) public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { private static final Logger s_logger = Logger.getLogger(ApiDiscoveryServiceImpl.class); - protected static Adapters s_apiAccessCheckers = null; + @Inject protected List _apiAccessCheckers = null; + @Inject protected List _services = null; private static Map s_apiNameDiscoveryResponseMap = null; protected ApiDiscoveryServiceImpl() { super(); + } + + @PostConstruct + void init() { if (s_apiNameDiscoveryResponseMap == null) { long startTime = System.nanoTime(); s_apiNameDiscoveryResponseMap = new HashMap(); - cacheResponseMap(); + Set> cmdClasses = new HashSet>(); + for(PluggableService service: _services) { + s_logger.debug(String.format("getting api commands of service: %s", service.getClass().getName())); + cmdClasses.addAll(service.getCommands()); + } + cacheResponseMap(cmdClasses); long endTime = System.nanoTime(); s_logger.info("Api Discovery Service: Annotation, docstrings, api relation graph processed in " + (endTime - startTime) / 1000000.0 + " ms"); } } - private void cacheResponseMap() { - Set> cmdClasses = ReflectUtil.getClassesWithAnnotation(APICommand.class, - new String[]{"org.apache.cloudstack.api", "com.cloud.api"}); - - //TODO: Fix and use PluggableService to get the classes - + protected void cacheResponseMap(Set> cmdClasses) { Map> responseApiNameListMap = new HashMap>(); - for (Class cmdClass : cmdClasses) { + for(Class cmdClass: cmdClasses) { APICommand apiCmdAnnotation = cmdClass.getAnnotation(APICommand.class); if (apiCmdAnnotation == null) apiCmdAnnotation = cmdClass.getSuperclass().getAnnotation(APICommand.class); @@ -96,9 +106,9 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { response.setRelated(responseName); Field[] responseFields = apiCmdAnnotation.responseObject().getDeclaredFields(); - for (Field responseField : responseFields) { + for(Field responseField: responseFields) { SerializedName serializedName = responseField.getAnnotation(SerializedName.class); - if (serializedName != null) { + if(serializedName != null) { ApiResponseResponse responseResponse = new ApiResponseResponse(); responseResponse.setName(serializedName.value()); Param param = responseField.getAnnotation(Param.class); @@ -109,15 +119,15 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { } } - Field[] fields = ReflectUtil.getAllFieldsForClass(cmdClass, + Set fields = ReflectUtil.getAllFieldsForClass(cmdClass, new Class[]{BaseCmd.class, BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); boolean isAsync = ReflectUtil.isCmdClassAsync(cmdClass, - new Class[]{BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); + new Class[] {BaseAsyncCmd.class, BaseAsyncCreateCmd.class}); response.setAsync(isAsync); - for (Field field : fields) { + for(Field field: fields) { Parameter parameterAnnotation = field.getAnnotation(Parameter.class); if (parameterAnnotation != null && parameterAnnotation.expose() @@ -142,7 +152,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { ApiDiscoveryResponse response = s_apiNameDiscoveryResponseMap.get(apiName); Set processedParams = new HashSet(); - for (ApiParameterResponse param : response.getParams()) { + for (ApiParameterResponse param: response.getParams()) { if (responseApiNameListMap.containsKey(param.getRelated())) { List relatedApis = responseApiNameListMap.get(param.getRelated()); param.setRelated(StringUtils.join(relatedApis, ",")); @@ -169,11 +179,6 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { ListResponse response = new ListResponse(); List responseList = new ArrayList(); - if (s_apiAccessCheckers == null) { - ComponentLocator locator = ComponentLocator.getCurrentLocator(); - s_apiAccessCheckers = locator.getAdapters(APIChecker.class); - } - if (user == null) return null; @@ -181,7 +186,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { if (!s_apiNameDiscoveryResponseMap.containsKey(name)) return null; - for (APIChecker apiChecker : s_apiAccessCheckers) { + for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, name); } catch (Exception ex) { @@ -193,7 +198,7 @@ public class ApiDiscoveryServiceImpl implements ApiDiscoveryService { } else { for (String apiName : s_apiNameDiscoveryResponseMap.keySet()) { boolean isAllowed = true; - for (APIChecker apiChecker : s_apiAccessCheckers) { + for (APIChecker apiChecker : _apiAccessCheckers) { try { apiChecker.checkAccess(user, apiName); } catch (Exception ex) { diff --git a/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.java new file mode 100644 index 00000000000..afff746c848 --- /dev/null +++ b/plugins/api/discovery/test/org/apache/cloudstack/discovery/ApiDiscoveryTest.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.discovery; + +import com.cloud.user.User; +import com.cloud.user.UserVO; + +import java.util.*; +import javax.naming.ConfigurationException; + +import com.cloud.utils.component.PluggableService; +import org.apache.cloudstack.acl.APIChecker; +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.command.user.discovery.ListApisCmd; +import org.apache.cloudstack.api.response.ApiDiscoveryResponse; +import org.apache.cloudstack.api.response.ListResponse; + +import org.junit.BeforeClass; +import org.junit.Test; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +public class ApiDiscoveryTest { + private static APIChecker _apiChecker = mock(APIChecker.class); + private static PluggableService _pluggableService = mock(PluggableService.class); + private static ApiDiscoveryServiceImpl _discoveryService = new ApiDiscoveryServiceImpl(); + + private static Class testCmdClass = ListApisCmd.class; + private static User testUser; + private static String testApiName; + private static String testApiDescription; + private static String testApiSince; + private static boolean testApiAsync; + + @BeforeClass + public static void setUp() throws ConfigurationException { + testApiName = testCmdClass.getAnnotation(APICommand.class).name(); + testApiDescription = testCmdClass.getAnnotation(APICommand.class).description(); + testApiSince = testCmdClass.getAnnotation(APICommand.class).since(); + testApiAsync = false; + testUser = new UserVO(); + + _discoveryService._apiAccessCheckers = (List) mock(List.class); + _discoveryService._services = (List) mock(List.class); + + when(_apiChecker.checkAccess(any(User.class), anyString())).thenReturn(true); + when(_pluggableService.getCommands()).thenReturn(new ArrayList>()); + when(_discoveryService._apiAccessCheckers.iterator()).thenReturn(Arrays.asList(_apiChecker).iterator()); + when(_discoveryService._services.iterator()).thenReturn(Arrays.asList(_pluggableService).iterator()); + + Set> cmdClasses = new HashSet>(); + cmdClasses.add(ListApisCmd.class); + _discoveryService.init(); + _discoveryService.cacheResponseMap(cmdClasses); + } + + @Test + public void verifyListSingleApi() throws Exception { + ListResponse responses = (ListResponse) _discoveryService.listApis(testUser, testApiName); + ApiDiscoveryResponse response = responses.getResponses().get(0); + assertTrue("No. of response items should be one", responses.getCount() == 1); + assertEquals("Error in api name", testApiName, response.getName()); + assertEquals("Error in api description", testApiDescription, response.getDescription()); + assertEquals("Error in api since", testApiSince, response.getSince()); + assertEquals("Error in api isAsync", testApiAsync, response.getAsync()); + } + + @Test + public void verifyListApis() throws Exception { + ListResponse responses = (ListResponse) _discoveryService.listApis(testUser, null); + assertTrue("No. of response items > 1", responses.getCount() == 1); + for (ApiDiscoveryResponse response: responses.getResponses()) { + assertFalse("API name is empty", response.getName().isEmpty()); + assertFalse("API description is empty", response.getDescription().isEmpty()); + } + } +} diff --git a/plugins/api/rate-limit/pom.xml b/plugins/api/rate-limit/pom.xml new file mode 100644 index 00000000000..5645f0b3a32 --- /dev/null +++ b/plugins/api/rate-limit/pom.xml @@ -0,0 +1,51 @@ + + + 4.0.0 + cloud-plugin-api-limit-account-based + Apache CloudStack Plugin - API Rate Limit + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + + install + src + test + + + test/resources + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -Xmx1024m + + org/apache/cloudstack/ratelimit/integration/* + + + + + + diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.java new file mode 100644 index 00000000000..5a7ac863abc --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/admin/ratelimit/ResetApiLimitCmd.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.ratelimit; + +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.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.ApiLimitResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.cloudstack.ratelimit.ApiRateLimitService; +import org.apache.log4j.Logger; + +import com.cloud.user.Account; +import com.cloud.user.UserContext; + +import javax.inject.Inject; + +@APICommand(name = "resetApiLimit", responseObject=ApiLimitResponse.class, description="Reset api count") +public class ResetApiLimitCmd extends BaseCmd { + private static final Logger s_logger = Logger.getLogger(ResetApiLimitCmd.class.getName()); + + private static final String s_name = "resetapilimitresponse"; + + @Inject + ApiRateLimitService _apiLimitService; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @ACL + @Parameter(name=ApiConstants.ACCOUNT, type=CommandType.UUID, entityType=AccountResponse.class, + description="the ID of the acount whose limit to be reset") + private Long accountId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + + public Long getAccountId() { + return accountId; + } + + + public void setAccountId(Long accountId) { + this.accountId = accountId; + } + + + ///////////////////////////////////////////////////// + /////////////// 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 void execute(){ + boolean result = _apiLimitService.resetApiLimit(this.accountId); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to reset api limit counter"); + } + } +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java new file mode 100644 index 00000000000..1afa9322d75 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/command/user/ratelimit/GetApiLimitCmd.java @@ -0,0 +1,87 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.api.command.user.ratelimit; + +import java.util.ArrayList; +import java.util.List; + +import org.apache.cloudstack.api.ACL; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.BaseCmd.CommandType; +import org.apache.cloudstack.api.command.admin.ratelimit.ResetApiLimitCmd; +import org.apache.cloudstack.api.response.AccountResponse; +import org.apache.cloudstack.api.response.ApiLimitResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.log4j.Logger; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.ratelimit.ApiRateLimitService; +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.user.Account; +import com.cloud.user.UserContext; +import com.cloud.utils.exception.CloudRuntimeException; + +import javax.inject.Inject; + +@APICommand(name = "getApiLimit", responseObject=ApiLimitResponse.class, description="Get API limit count for the caller") +public class GetApiLimitCmd extends BaseCmd { + private static final Logger s_logger = Logger.getLogger(GetApiLimitCmd.class.getName()); + + private static final String s_name = "getapilimitresponse"; + + @Inject + ApiRateLimitService _apiLimitService; + + ///////////////////////////////////////////////////// + /////////////// 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 void execute(){ + Account caller = UserContext.current().getCaller(); + ApiLimitResponse response = _apiLimitService.searchApiLimit(caller); + response.setResponseName(getCommandName()); + response.setObjectName("apilimit"); + this.setResponseObject(response); + } +} + + diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/api/response/ApiLimitResponse.java b/plugins/api/rate-limit/src/org/apache/cloudstack/api/response/ApiLimitResponse.java new file mode 100644 index 00000000000..245e8f15d8a --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/api/response/ApiLimitResponse.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 org.apache.cloudstack.api.response; + +import org.apache.cloudstack.api.ApiConstants; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +import org.apache.cloudstack.api.BaseResponse; + + +public class ApiLimitResponse extends BaseResponse { + @SerializedName(ApiConstants.ACCOUNT_ID) @Param(description="the account uuid of the api remaining count") + private String accountId; + + @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account name of the api remaining count") + private String accountName; + + @SerializedName("apiIssued") @Param(description="number of api already issued") + private int apiIssued; + + @SerializedName("apiAllowed") @Param(description="currently allowed number of apis") + private int apiAllowed; + + @SerializedName("expireAfter") @Param(description="seconds left to reset counters") + private long expireAfter; + + public void setAccountId(String accountId) { + this.accountId = accountId; + } + + public void setAccountName(String accountName) { + this.accountName = accountName; + } + + public void setApiIssued(int apiIssued) { + this.apiIssued = apiIssued; + } + + public void setApiAllowed(int apiAllowed) { + this.apiAllowed = apiAllowed; + } + + public void setExpireAfter(long duration) { + this.expireAfter = duration; + } + + public String getAccountId() { + return accountId; + } + + public String getAccountName() { + return accountName; + } + + public int getApiIssued() { + return apiIssued; + } + + public int getApiAllowed() { + return apiAllowed; + } + + public long getExpireAfter() { + return expireAfter; + } + + +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitService.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitService.java new file mode 100644 index 00000000000..a135556a502 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitService.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 org.apache.cloudstack.ratelimit; + +import org.apache.cloudstack.api.response.ApiLimitResponse; +import com.cloud.user.Account; +import com.cloud.utils.component.PluggableService; + +/** + * Provide API rate limit service + * + */ +public interface ApiRateLimitService extends PluggableService{ + + public ApiLimitResponse searchApiLimit(Account caller); + + public boolean resetApiLimit(Long accountId); + + public void setTimeToLive(int timeToLive); + + public void setMaxAllowed(int max); +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java new file mode 100644 index 00000000000..1f84ca18bbb --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/ApiRateLimitServiceImpl.java @@ -0,0 +1,196 @@ +// 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.ratelimit; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import net.sf.ehcache.Cache; +import net.sf.ehcache.CacheManager; + +import org.apache.log4j.Logger; + +import org.apache.cloudstack.acl.APIChecker; +import org.apache.cloudstack.api.ApiConstants.LDAPParams; +import org.apache.cloudstack.api.command.admin.ratelimit.ResetApiLimitCmd; +import org.apache.cloudstack.api.command.user.ratelimit.GetApiLimitCmd; +import org.apache.cloudstack.api.response.ApiLimitResponse; + +import com.cloud.configuration.Config; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.exception.PermissionDeniedException; +import com.cloud.exception.RequestLimitException; +import com.cloud.user.Account; +import com.cloud.user.AccountService; +import com.cloud.user.User; +import com.cloud.utils.component.AdapterBase; +import org.springframework.stereotype.Component; + +@Component +@Local(value = APIChecker.class) +public class ApiRateLimitServiceImpl extends AdapterBase implements APIChecker, ApiRateLimitService { + private static final Logger s_logger = Logger.getLogger(ApiRateLimitServiceImpl.class); + + /** + * Fixed time duration where api rate limit is set, in seconds + */ + private int timeToLive = 1; + + /** + * Max number of api requests during timeToLive duration. + */ + private int maxAllowed = 30; + + private LimitStore _store = null; + + @Inject + AccountService _accountService; + + @Inject + ConfigurationDao _configDao; + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + super.configure(name, params); + + if (_store == null) { + // get global configured duration and max values + String duration = _configDao.getValue(Config.ApiLimitInterval.key()); + if (duration != null) { + timeToLive = Integer.parseInt(duration); + } + String maxReqs = _configDao.getValue(Config.ApiLimitMax.key()); + if (maxReqs != null) { + maxAllowed = Integer.parseInt(maxReqs); + } + // create limit store + EhcacheLimitStore cacheStore = new EhcacheLimitStore(); + int maxElements = 10000; + String cachesize = _configDao.getValue(Config.ApiLimitCacheSize.key()); + if ( cachesize != null ){ + maxElements = Integer.parseInt(cachesize); + } + CacheManager cm = CacheManager.create(); + Cache cache = new Cache("api-limit-cache", maxElements, false, false, timeToLive, timeToLive); + cm.addCache(cache); + s_logger.info("Limit Cache created with timeToLive=" + timeToLive + ", maxAllowed=" + maxAllowed + ", maxElements=" + maxElements ); + cacheStore.setCache(cache); + _store = cacheStore; + + } + + return true; + } + + @Override + public ApiLimitResponse searchApiLimit(Account caller) { + ApiLimitResponse response = new ApiLimitResponse(); + response.setAccountId(caller.getUuid()); + response.setAccountName(caller.getAccountName()); + StoreEntry entry = _store.get(caller.getId()); + if (entry == null) { + + /* Populate the entry, thus unlocking any underlying mutex */ + entry = _store.create(caller.getId(), timeToLive); + response.setApiIssued(0); + response.setApiAllowed(maxAllowed); + response.setExpireAfter(timeToLive); + } + else{ + response.setApiIssued(entry.getCounter()); + response.setApiAllowed(maxAllowed - entry.getCounter()); + response.setExpireAfter(entry.getExpireDuration()); + } + + return response; + } + + + + @Override + public boolean resetApiLimit(Long accountId) { + if ( accountId != null ){ + _store.create(accountId, timeToLive); + } + else{ + _store.resetCounters(); + } + return true; + } + + + + @Override + public boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException, RequestLimitException { + Long accountId = user.getAccountId(); + Account account = _accountService.getAccount(accountId); + if ( _accountService.isRootAdmin(account.getType())){ + // no API throttling on root admin + return true; + } + StoreEntry entry = _store.get(accountId); + + if (entry == null) { + + /* Populate the entry, thus unlocking any underlying mutex */ + entry = _store.create(accountId, timeToLive); + } + + /* Increment the client count and see whether we have hit the maximum allowed clients yet. */ + int current = entry.incrementAndGet(); + + if (current <= maxAllowed) { + s_logger.trace("account (" + account.getAccountId() + "," + account.getAccountName() + ") has current count = " + current); + return true; + } else { + long expireAfter = entry.getExpireDuration(); + // for this exception, we can just show the same message to user and admin users. + String msg = "The given user has reached his/her account api limit, please retry after " + expireAfter + " ms."; + s_logger.warn(msg); + throw new RequestLimitException(msg); + } + } + + + @Override + public List> getCommands() { + List> cmdList = new ArrayList>(); + cmdList.add(ResetApiLimitCmd.class); + cmdList.add(GetApiLimitCmd.class); + return cmdList; + } + + + @Override + public void setTimeToLive(int timeToLive) { + this.timeToLive = timeToLive; + } + + + + @Override + public void setMaxAllowed(int max) { + this.maxAllowed = max; + + } + + +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/EhcacheLimitStore.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/EhcacheLimitStore.java new file mode 100644 index 00000000000..ee7c528bd07 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/EhcacheLimitStore.java @@ -0,0 +1,98 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.ratelimit; + +import net.sf.ehcache.Ehcache; +import net.sf.ehcache.Element; +import net.sf.ehcache.constructs.blocking.BlockingCache; +import net.sf.ehcache.constructs.blocking.LockTimeoutException; + +/** + * A Limit store implementation using Ehcache. + * + */ +public class EhcacheLimitStore implements LimitStore { + + + private BlockingCache cache; + + + public void setCache(Ehcache cache) { + BlockingCache ref; + + if (!(cache instanceof BlockingCache)) { + ref = new BlockingCache(cache); + cache.getCacheManager().replaceCacheWithDecoratedCache(cache, new BlockingCache(cache)); + } else { + ref = (BlockingCache) cache; + } + + this.cache = ref; + } + + + @Override + public StoreEntry create(Long key, int timeToLive) { + StoreEntryImpl result = new StoreEntryImpl(timeToLive); + Element element = new Element(key, result); + element.setTimeToLive(timeToLive); + cache.put(element); + return result; + } + + @Override + public StoreEntry get(Long key) { + + Element entry = null; + + try { + + /* This may block. */ + entry = cache.get(key); + } catch (LockTimeoutException e) { + throw new RuntimeException(); + } catch (RuntimeException e) { + + /* Release the lock that may have been acquired. */ + cache.put(new Element(key, null)); + } + + StoreEntry result = null; + + if (entry != null) { + + /* + * We don't need to check isExpired() on the result, since ehcache takes care of expiring entries for us. + * c.f. the get(Key) implementation in this class. + */ + result = (StoreEntry) entry.getObjectValue(); + } + + return result; + } + + + + @Override + public void resetCounters() { + cache.removeAll(); + + } + + + +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/LimitStore.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/LimitStore.java new file mode 100644 index 00000000000..373d9652ee9 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/LimitStore.java @@ -0,0 +1,50 @@ +// 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.ratelimit; + +import com.cloud.user.Account; + +/** + * Interface to define how an api limit store should work. + * + */ +public interface LimitStore { + + /** + * Returns a store entry for the given account. A value of null means that there is no + * such entry and the calling client must call create to avoid + * other clients potentially being blocked without any hope of progressing. A non-null + * entry means that it has not expired and can be used to determine whether the current client should be allowed to + * proceed with the rate-limited action or not. + * + */ + StoreEntry get(Long account); + + /** + * Creates a new store entry + * + * @param account + * the user account, key to the store + * @param timeToLiveInSecs + * the positive time-to-live in seconds + * @return a non-null entry + */ + StoreEntry create(Long account, int timeToLiveInSecs); + + void resetCounters(); + +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntry.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntry.java new file mode 100644 index 00000000000..05a7029dcb0 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntry.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 org.apache.cloudstack.ratelimit; + +/** + * Interface for each entry in LimitStore. + * + */ +public interface StoreEntry { + + int getCounter(); + + int incrementAndGet(); + + boolean isExpired(); + + long getExpireDuration(); /* seconds to reset counter */ +} diff --git a/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntryImpl.java b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntryImpl.java new file mode 100644 index 00000000000..9f10fe68a41 --- /dev/null +++ b/plugins/api/rate-limit/src/org/apache/cloudstack/ratelimit/StoreEntryImpl.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 org.apache.cloudstack.ratelimit; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Implementation of limit store entry. + * + */ +public class StoreEntryImpl implements StoreEntry { + + private final long expiry; + + private final AtomicInteger counter; + + StoreEntryImpl(int timeToLive) { + this.expiry = System.currentTimeMillis() + timeToLive * 1000; + this.counter = new AtomicInteger(0); + } + + + @Override + public boolean isExpired() { + return System.currentTimeMillis() > expiry; + } + + + + @Override + public long getExpireDuration() { + if ( isExpired() ) + return 0; // already expired + else { + return expiry - System.currentTimeMillis(); + } + } + + + @Override + public int incrementAndGet() { + return this.counter.incrementAndGet(); + } + + @Override + public int getCounter(){ + return this.counter.get(); + } +} diff --git a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java new file mode 100644 index 00000000000..1a77a4ef3a6 --- /dev/null +++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/ApiRateLimitTest.java @@ -0,0 +1,235 @@ +// 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.ratelimit; + +import java.util.Collections; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.api.response.ApiLimitResponse; +import org.apache.cloudstack.ratelimit.ApiRateLimitServiceImpl; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import com.cloud.configuration.Config; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.exception.RequestLimitException; +import com.cloud.user.Account; +import com.cloud.user.AccountService; +import com.cloud.user.AccountVO; +import com.cloud.user.User; +import com.cloud.user.UserVO; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +public class ApiRateLimitTest { + + static ApiRateLimitServiceImpl _limitService = new ApiRateLimitServiceImpl(); + static AccountService _accountService = mock(AccountService.class); + static ConfigurationDao _configDao = mock(ConfigurationDao.class); + private static long acctIdSeq = 5L; + private static Account testAccount; + + @BeforeClass + public static void setUp() throws ConfigurationException { + + when(_configDao.getValue(Config.ApiLimitInterval.key())).thenReturn(null); + when(_configDao.getValue(Config.ApiLimitMax.key())).thenReturn(null); + when(_configDao.getValue(Config.ApiLimitCacheSize.key())).thenReturn(null); + _limitService._configDao = _configDao; + + _limitService.configure("ApiRateLimitTest", Collections. emptyMap()); + + _limitService._accountService = _accountService; + + // Standard responses + AccountVO acct = new AccountVO(acctIdSeq); + acct.setType(Account.ACCOUNT_TYPE_NORMAL); + acct.setAccountName("demo"); + testAccount = acct; + + when(_accountService.getAccount(5L)).thenReturn(testAccount); + when(_accountService.isRootAdmin(Account.ACCOUNT_TYPE_NORMAL)).thenReturn(false); + } + + @Before + public void testSetUp() { + // reset counter for each test + _limitService.resetApiLimit(null); + } + + private User createFakeUser(){ + UserVO user = new UserVO(); + user.setAccountId(acctIdSeq); + return user; + } + + private boolean isUnderLimit(User key){ + try{ + _limitService.checkAccess(key, null); + return true; + } + catch (RequestLimitException ex){ + return false; + } + } + + @Test + public void sequentialApiAccess() { + int allowedRequests = 1; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + User key = createFakeUser(); + assertTrue("Allow for the first request", isUnderLimit(key)); + + assertFalse("Second request should be blocked, since we assume that the two api " + + " accesses take less than a second to perform", isUnderLimit(key)); + } + + @Test + public void canDoReasonableNumberOfApiAccessPerSecond() throws Exception { + int allowedRequests = 200; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + User key = createFakeUser(); + + for (int i = 0; i < allowedRequests; i++) { + assertTrue("We should allow " + allowedRequests + " requests per second, but failed at request " + i, isUnderLimit(key)); + } + + + assertFalse("We should block >" + allowedRequests + " requests per second", isUnderLimit(key)); + } + + @Test + public void multipleClientsCanAccessWithoutBlocking() throws Exception { + int allowedRequests = 200; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + + final User key = createFakeUser(); + + int clientCount = allowedRequests; + Runnable[] clients = new Runnable[clientCount]; + final boolean[] isUsable = new boolean[clientCount]; + + final CountDownLatch startGate = new CountDownLatch(1); + + final CountDownLatch endGate = new CountDownLatch(clientCount); + + + for (int i = 0; i < isUsable.length; ++i) { + final int j = i; + clients[j] = new Runnable() { + + /** + * {@inheritDoc} + */ + @Override + public void run() { + try { + startGate.await(); + + isUsable[j] = isUnderLimit(key); + + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + endGate.countDown(); + } + } + }; + } + + ExecutorService executor = Executors.newFixedThreadPool(clientCount); + + for (Runnable runnable : clients) { + executor.execute(runnable); + } + + startGate.countDown(); + + endGate.await(); + + for (boolean b : isUsable) { + assertTrue("Concurrent client request should be allowed within limit", b); + } + } + + @Test + public void expiryOfCounterIsSupported() throws Exception { + int allowedRequests = 1; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + User key = this.createFakeUser(); + + assertTrue("The first request should be allowed", isUnderLimit(key)); + + // Allow the token to expire + Thread.sleep(1020); + + assertTrue("Another request after interval should be allowed as well", isUnderLimit(key)); + } + + @Test + public void verifyResetCounters() throws Exception { + int allowedRequests = 1; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + User key = this.createFakeUser(); + + assertTrue("The first request should be allowed", isUnderLimit(key)); + + assertFalse("Another request should be blocked", isUnderLimit(key)); + + _limitService.resetApiLimit(key.getAccountId()); + + assertTrue("Another request should be allowed after reset counter", isUnderLimit(key)); + } + + + @Test + public void verifySearchCounter() throws Exception { + int allowedRequests = 10; + _limitService.setMaxAllowed(allowedRequests); + _limitService.setTimeToLive(1); + + User key = this.createFakeUser(); + + for ( int i = 0; i < 5; i++ ){ + assertTrue("Issued 5 requests", isUnderLimit(key)); + } + + ApiLimitResponse response = _limitService.searchApiLimit(testAccount); + assertEquals("apiIssued is incorrect", 5, response.getApiIssued()); + assertEquals("apiAllowed is incorrect", 5, response.getApiAllowed()); + // using <= to account for inaccurate System.currentTimeMillis() clock in Windows environment + assertTrue("expiredAfter is incorrect", response.getExpireAfter() <= 1000); + + } + +} diff --git a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/APITest.java b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/APITest.java new file mode 100644 index 00000000000..e75e852f0b7 --- /dev/null +++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/APITest.java @@ -0,0 +1,209 @@ +// 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 +// 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.ratelimit.integration; + +import java.io.BufferedReader; +import java.io.EOFException; +import java.io.InputStreamReader; +import java.math.BigInteger; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.HashMap; +import java.util.Iterator; + +import org.apache.cloudstack.api.response.SuccessResponse; + +import com.cloud.api.ApiGsonHelper; +import com.cloud.utils.exception.CloudRuntimeException; +import com.google.gson.Gson; + +/** + * Base class for API Test + * + */ +public abstract class APITest { + + protected String rootUrl = "http://localhost:8080/client/api"; + protected String sessionKey = null; + protected String cookieToSent = null; + + + /** + * Sending an api request through Http GET + * @param command command name + * @param params command query parameters in a HashMap + * @return http request response string + */ + protected String sendRequest(String command, HashMap params){ + try { + // Construct query string + StringBuilder sBuilder = new StringBuilder(); + sBuilder.append("command="); + sBuilder.append(command); + if ( params != null && params.size() > 0){ + Iterator keys = params.keySet().iterator(); + while (keys.hasNext()){ + String key = keys.next(); + sBuilder.append("&"); + sBuilder.append(key); + sBuilder.append("="); + sBuilder.append(URLEncoder.encode(params.get(key), "UTF-8")); + } + } + + // Construct request url + String reqUrl = rootUrl + "?" + sBuilder.toString(); + + // Send Http GET request + URL url = new URL(reqUrl); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + conn.setRequestMethod("GET"); + + if ( !command.equals("login") && cookieToSent != null){ + // add the cookie to a request + conn.setRequestProperty("Cookie", cookieToSent); + } + conn.connect(); + + + if ( command.equals("login")){ + // if it is login call, store cookie + String headerName=null; + for (int i=1; (headerName = conn.getHeaderFieldKey(i))!=null; i++) { + if (headerName.equals("Set-Cookie")) { + String cookie = conn.getHeaderField(i); + cookie = cookie.substring(0, cookie.indexOf(";")); + String cookieName = cookie.substring(0, cookie.indexOf("=")); + String cookieValue = cookie.substring(cookie.indexOf("=") + 1, cookie.length()); + cookieToSent = cookieName + "=" + cookieValue; + } + } + } + + // Get the response + StringBuilder response = new StringBuilder(); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + String line; + try { + while ((line = rd.readLine()) != null) { + response.append(line); + } + } catch (EOFException ex) { + // ignore this exception + System.out.println("EOF exception due to java bug"); + } + rd.close(); + + + + return response.toString(); + + } catch (Exception e) { + throw new CloudRuntimeException("Problem with sending api request", e); + } + } + + protected String createMD5String(String password) { + MessageDigest md5; + try { + md5 = MessageDigest.getInstance("MD5"); + } catch (NoSuchAlgorithmException e) { + throw new CloudRuntimeException("Error", e); + } + + md5.reset(); + BigInteger pwInt = new BigInteger(1, md5.digest(password.getBytes())); + + // make sure our MD5 hash value is 32 digits long... + StringBuffer sb = new StringBuffer(); + String pwStr = pwInt.toString(16); + int padding = 32 - pwStr.length(); + for (int i = 0; i < padding; i++) { + sb.append('0'); + } + sb.append(pwStr); + return sb.toString(); + } + + + protected Object fromSerializedString(String result, Class repCls) { + try { + if (result != null && !result.isEmpty()) { + // get real content + int start; + int end; + if (repCls == LoginResponse.class || repCls == SuccessResponse.class) { + + start = result.indexOf('{', result.indexOf('{') + 1); // find + // the + // second + // { + + end = result.lastIndexOf('}', result.lastIndexOf('}') - 1); // find + // the + // second + // } + // backwards + + } else { + // get real content + start = result.indexOf('{', result.indexOf('{', result.indexOf('{') + 1) + 1); // find + // the + // third + // { + end = result.lastIndexOf('}', result.lastIndexOf('}', result.lastIndexOf('}') - 1) - 1); // find + // the + // third + // } + // backwards + } + if (start < 0 || end < 0) { + throw new CloudRuntimeException("Response format is wrong: " + result); + } + String content = result.substring(start, end + 1); + Gson gson = ApiGsonHelper.getBuilder().create(); + return gson.fromJson(content, repCls); + } + return null; + } catch (RuntimeException e) { + throw new CloudRuntimeException("Caught runtime exception when doing GSON deserialization on: " + result, e); + } + } + + /** + * Login call + * @param username user name + * @param password password (plain password, we will do MD5 hash here for you) + * @return login response string + */ + protected void login(String username, String password) + { + //String md5Psw = createMD5String(password); + // send login request + HashMap params = new HashMap(); + params.put("response", "json"); + params.put("username", username); + params.put("password", password); + String result = this.sendRequest("login", params); + LoginResponse loginResp = (LoginResponse)fromSerializedString(result, LoginResponse.class); + sessionKey = loginResp.getSessionkey(); + + } +} diff --git a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/LoginResponse.java b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/LoginResponse.java new file mode 100644 index 00000000000..61a178033af --- /dev/null +++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/LoginResponse.java @@ -0,0 +1,140 @@ +// 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 +// 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.ratelimit.integration; + +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +/** + * Login Response object + * + */ +public class LoginResponse extends BaseResponse { + + @SerializedName("timeout") + @Param(description = "session timeout period") + private String timeout; + + @SerializedName("sessionkey") + @Param(description = "login session key") + private String sessionkey; + + @SerializedName("username") + @Param(description = "login username") + private String username; + + @SerializedName("userid") + @Param(description = "login user internal uuid") + private String userid; + + @SerializedName("firstname") + @Param(description = "login user firstname") + private String firstname; + + @SerializedName("lastname") + @Param(description = "login user lastname") + private String lastname; + + @SerializedName("account") + @Param(description = "login user account type") + private String account; + + @SerializedName("domainid") + @Param(description = "login user domain id") + private String domainid; + + @SerializedName("type") + @Param(description = "login user type") + private int type; + + public String getTimeout() { + return timeout; + } + + public void setTimeout(String timeout) { + this.timeout = timeout; + } + + public String getSessionkey() { + return sessionkey; + } + + public void setSessionkey(String sessionkey) { + this.sessionkey = sessionkey; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getUserid() { + return userid; + } + + public void setUserid(String userid) { + this.userid = userid; + } + + public String getFirstname() { + return firstname; + } + + public void setFirstname(String firstname) { + this.firstname = firstname; + } + + public String getLastname() { + return lastname; + } + + public void setLastname(String lastname) { + this.lastname = lastname; + } + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getDomainid() { + return domainid; + } + + public void setDomainid(String domainid) { + this.domainid = domainid; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + + +} diff --git a/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/RateLimitIntegrationTest.java b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/RateLimitIntegrationTest.java new file mode 100644 index 00000000000..f9352333d12 --- /dev/null +++ b/plugins/api/rate-limit/test/org/apache/cloudstack/ratelimit/integration/RateLimitIntegrationTest.java @@ -0,0 +1,211 @@ +// 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 +// 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.ratelimit.integration; + +import static org.junit.Assert.*; + +import java.util.HashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.apache.cloudstack.api.response.ApiLimitResponse; +import org.apache.cloudstack.api.response.SuccessResponse; +import org.junit.Before; +import org.junit.Test; + +import com.cloud.utils.exception.CloudRuntimeException; + + +/** + * Test fixture to do integration rate limit test. + * Currently we commented out this test suite since it requires a real MS and Db running. + */ +public class RateLimitIntegrationTest extends APITest { + + private static int apiMax = 25; // assuming ApiRateLimitService set api.throttling.max = 25 + + @Before + public void setup(){ + // always reset count for each testcase + login("admin", "password"); + + // issue reset api limit calls + final HashMap params = new HashMap(); + params.put("response", "json"); + params.put("sessionkey", sessionKey); + String resetResult = sendRequest("resetApiLimit", params); + assertNotNull("Reset count failed!", fromSerializedString(resetResult, SuccessResponse.class)); + + } + + + @Test + public void testNoApiLimitOnRootAdmin() throws Exception { + // issue list Accounts calls + final HashMap params = new HashMap(); + params.put("response", "json"); + params.put("listAll", "true"); + params.put("sessionkey", sessionKey); + // assuming ApiRateLimitService set api.throttling.max = 25 + int clientCount = 26; + Runnable[] clients = new Runnable[clientCount]; + final boolean[] isUsable = new boolean[clientCount]; + + final CountDownLatch startGate = new CountDownLatch(1); + + final CountDownLatch endGate = new CountDownLatch(clientCount); + + + for (int i = 0; i < isUsable.length; ++i) { + final int j = i; + clients[j] = new Runnable() { + + /** + * {@inheritDoc} + */ + @Override + public void run() { + try { + startGate.await(); + + sendRequest("listAccounts", params); + + isUsable[j] = true; + + } catch (CloudRuntimeException e){ + isUsable[j] = false; + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + endGate.countDown(); + } + } + }; + } + + ExecutorService executor = Executors.newFixedThreadPool(clientCount); + + for (Runnable runnable : clients) { + executor.execute(runnable); + } + + startGate.countDown(); + + endGate.await(); + + int rejectCount = 0; + for ( int i = 0; i < isUsable.length; ++i){ + if ( !isUsable[i]) + rejectCount++; + } + + assertEquals("No request should be rejected!", 0, rejectCount); + + } + + + @Test + public void testApiLimitOnUser() throws Exception { + // log in using normal user + login("demo", "password"); + // issue list Accounts calls + final HashMap params = new HashMap(); + params.put("response", "json"); + params.put("listAll", "true"); + params.put("sessionkey", sessionKey); + + int clientCount = apiMax + 1; + Runnable[] clients = new Runnable[clientCount]; + final boolean[] isUsable = new boolean[clientCount]; + + final CountDownLatch startGate = new CountDownLatch(1); + + final CountDownLatch endGate = new CountDownLatch(clientCount); + + + for (int i = 0; i < isUsable.length; ++i) { + final int j = i; + clients[j] = new Runnable() { + + /** + * {@inheritDoc} + */ + @Override + public void run() { + try { + startGate.await(); + + sendRequest("listAccounts", params); + + isUsable[j] = true; + + } catch (CloudRuntimeException e){ + isUsable[j] = false; + e.printStackTrace(); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + endGate.countDown(); + } + } + }; + } + + ExecutorService executor = Executors.newFixedThreadPool(clientCount); + + for (Runnable runnable : clients) { + executor.execute(runnable); + } + + startGate.countDown(); + + endGate.await(); + + int rejectCount = 0; + for ( int i = 0; i < isUsable.length; ++i){ + if ( !isUsable[i]) + rejectCount++; + } + + assertEquals("Only one request should be rejected!", 1, rejectCount); + + } + + @Test + public void testGetApiLimitOnUser() throws Exception { + // log in using normal user + login("demo", "password"); + + // issue an api call + HashMap params = new HashMap(); + params.put("response", "json"); + params.put("listAll", "true"); + params.put("sessionkey", sessionKey); + sendRequest("listAccounts", params); + + // issue get api limit calls + final HashMap params2 = new HashMap(); + params2.put("response", "json"); + params2.put("sessionkey", sessionKey); + String getResult = sendRequest("getApiLimit", params2); + ApiLimitResponse getLimitResp = (ApiLimitResponse)fromSerializedString(getResult, ApiLimitResponse.class); + assertEquals("Issued api count is incorrect!", 2, getLimitResp.getApiIssued() ); // should be 2 apis issues plus this getlimit api + assertEquals("Allowed api count is incorrect!", apiMax -2, getLimitResp.getApiAllowed()); + } +} diff --git a/plugins/deployment-planners/user-concentrated-pod/pom.xml b/plugins/deployment-planners/user-concentrated-pod/pom.xml index 78829356170..df7c660630e 100644 --- a/plugins/deployment-planners/user-concentrated-pod/pom.xml +++ b/plugins/deployment-planners/user-concentrated-pod/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/deployment-planners/user-dispersing/pom.xml b/plugins/deployment-planners/user-dispersing/pom.xml index 33f6582e72f..0e5dbd58eb6 100644 --- a/plugins/deployment-planners/user-dispersing/pom.xml +++ b/plugins/deployment-planners/user-dispersing/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/event-bus/rabbitmq/pom.xml b/plugins/event-bus/rabbitmq/pom.xml new file mode 100644 index 00000000000..bd4d0977c04 --- /dev/null +++ b/plugins/event-bus/rabbitmq/pom.xml @@ -0,0 +1,46 @@ + + + 4.0.0 + cloud-mom-rabbitmq + Apache CloudStack Plugin - RabbitMQ Event Bus + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + + + com.rabbitmq + amqp-client + 2.8.7 + + + org.apache.cloudstack + cloud-framework-events + ${project.version} + + + + install + src + + diff --git a/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java new file mode 100644 index 00000000000..ce0930d115d --- /dev/null +++ b/plugins/event-bus/rabbitmq/src/org/apache/cloudstack/mom/rabbitmq/RabbitMQEventBus.java @@ -0,0 +1,556 @@ +/* + * 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.mom.rabbitmq; + +import com.rabbitmq.client.*; +import org.apache.cloudstack.framework.events.*; +import org.apache.log4j.Logger; + +import com.cloud.utils.Ternary; +import com.cloud.utils.component.ManagerBase; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import java.io.IOException; +import java.net.ConnectException; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +@Local(value=EventBus.class) +public class RabbitMQEventBus extends ManagerBase implements EventBus { + + // details of AMQP server + private static String _amqpHost; + private static Integer _port; + private static String _username; + private static String _password; + + // AMQP exchange name where all CloudStack events will be published + private static String _amqpExchangeName; + + // hashmap to book keep the registered subscribers + private static ConcurrentHashMap> _subscribers; + + // connection to AMQP server, + private static Connection _connection=null; + + // AMQP server should consider messages acknowledged once delivered if _autoAck is true + private static boolean _autoAck = true; + + private ExecutorService executorService; + private String _name; + private static DisconnectHandler disconnectHandler; + private static Integer _retryInterval; + private static final Logger s_logger = Logger.getLogger(RabbitMQEventBus.class); + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + + _amqpHost = (String) params.get("server"); + if (_amqpHost == null || _amqpHost.isEmpty()) { + throw new ConfigurationException("Unable to get the AMQP server details"); + } + + _username = (String) params.get("username"); + if (_username == null || _username.isEmpty()) { + throw new ConfigurationException("Unable to get the username details"); + } + + _password = (String) params.get("password"); + if (_password == null || _password.isEmpty()) { + throw new ConfigurationException("Unable to get the password details"); + } + + _amqpExchangeName = (String) params.get("exchangename"); + if (_amqpExchangeName == null || _amqpExchangeName.isEmpty()) { + throw new ConfigurationException("Unable to get the _exchange details on the AMQP server"); + } + + try { + String portStr = (String) params.get("port"); + if (portStr == null || portStr.isEmpty()) { + throw new ConfigurationException("Unable to get the port details of AMQP server"); + } + _port = Integer.parseInt(portStr); + + String retryIntervalStr = (String) params.get("retryinterval"); + if (retryIntervalStr == null || retryIntervalStr.isEmpty()) { + // default to 10s to try out reconnect + retryIntervalStr = "10000"; + } + _retryInterval = Integer.parseInt(retryIntervalStr); + } catch (NumberFormatException e) { + throw new ConfigurationException("Invalid port number/retry interval"); + } + + _subscribers = new ConcurrentHashMap>(); + + executorService = Executors.newCachedThreadPool(); + disconnectHandler = new DisconnectHandler(); + _name = name; + return true; + } + + /** Call to subscribe to interested set of events + * + * @param topic defines category and type of the events being subscribed to + * @param subscriber subscriber that intends to receive event notification + * @return UUID that represents the subscription with event bus + * @throws EventBusException + */ + @Override + public UUID subscribe(EventTopic topic, EventSubscriber subscriber) throws EventBusException { + + if (subscriber == null || topic == null) { + throw new EventBusException("Invalid EventSubscriber/EventTopic object passed."); + } + + // create a UUID, that will be used for managing subscriptions and also used as queue name + // for on the queue used for the subscriber on the AMQP broker + UUID queueId = UUID.randomUUID(); + String queueName = queueId.toString(); + + try { + String bindingKey = createBindingKey(topic); + + // store the subscriber details before creating channel + _subscribers.put(queueName, new Ternary(bindingKey, null, subscriber)); + + // create a channel dedicated for this subscription + Connection connection = getConnection(); + Channel channel = createChannel(connection); + + // create a queue and bind it to the exchange with binding key formed from event topic + createExchange(channel, _amqpExchangeName); + channel.queueDeclare(queueName, false, false, false, null); + channel.queueBind(queueName, _amqpExchangeName, bindingKey); + + // register a callback handler to receive the events that a subscriber subscribed to + channel.basicConsume(queueName, _autoAck, queueName, + new DefaultConsumer(channel) { + @Override + public void handleDelivery(String queueName, + Envelope envelope, + AMQP.BasicProperties properties, + byte[] body) + throws IOException { + Ternary queueDetails = _subscribers.get(queueName); + if (queueDetails != null) { + EventSubscriber subscriber = queueDetails.third(); + String routingKey = envelope.getRoutingKey(); + String eventSource = getEventSourceFromRoutingKey(routingKey); + String eventCategory = getEventCategoryFromRoutingKey(routingKey); + String eventType = getEventTypeFromRoutingKey(routingKey); + String resourceType = getResourceTypeFromRoutingKey(routingKey); + String resourceUUID = getResourceUUIDFromRoutingKey(routingKey); + Event event = new Event(eventSource, eventCategory, eventType, + resourceType, resourceUUID); + event.setDescription(new String(body)); + + // deliver the event to call back object provided by subscriber + subscriber.onEvent(event); + } + } + } + ); + + // update the channel details for the subscription + Ternary queueDetails = _subscribers.get(queueName); + queueDetails.second(channel); + _subscribers.put(queueName, queueDetails); + + } catch (AlreadyClosedException closedException) { + s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + + " will be active after reconnection"); + } catch (ConnectException connectException) { + s_logger.warn("Connection to AMQP service is lost. Subscription:" + queueName + + " will be active after reconnection"); + } catch (Exception e) { + throw new EventBusException("Failed to subscribe to event due to " + e.getMessage()); + } + + return queueId; + } + + @Override + public void unsubscribe(UUID subscriberId, EventSubscriber subscriber) throws EventBusException { + try { + String classname = subscriber.getClass().getName(); + String queueName = UUID.nameUUIDFromBytes(classname.getBytes()).toString(); + Ternary queueDetails = _subscribers.get(queueName); + Channel channel = queueDetails.second(); + channel.basicCancel(queueName); + _subscribers.remove(queueName, queueDetails); + } catch (Exception e) { + throw new EventBusException("Failed to unsubscribe from event bus due to " + e.getMessage()); + } + } + + // publish event on to the exchange created on AMQP server + @Override + public void publish(Event event) throws EventBusException { + + String routingKey = createRoutingKey(event); + String eventDescription = event.getDescription(); + + try { + Connection connection = getConnection(); + Channel channel = createChannel(connection); + createExchange(channel, _amqpExchangeName); + publishEventToExchange(channel, _amqpExchangeName, routingKey, eventDescription); + channel.close(); + } catch (AlreadyClosedException e) { + closeConnection(); + throw new EventBusException("Failed to publish event to message broker as connection to AMQP broker in lost"); + } catch (Exception e) { + throw new EventBusException("Failed to publish event to message broker due to " + e.getMessage()); + } + } + + /** creates a routing key from the event details. + * created routing key will be used while publishing the message to exchange on AMQP server + */ + private String createRoutingKey(Event event) { + + StringBuilder routingKey = new StringBuilder(); + + String eventSource = replaceNullWithWildcard(event.getEventSource()); + eventSource = eventSource.replace(".", "-"); + + String eventCategory = replaceNullWithWildcard(event.getEventCategory()); + eventCategory = eventCategory.replace(".", "-"); + + String eventType = replaceNullWithWildcard(event.getEventType()); + eventType = eventType.replace(".", "-"); + + String resourceType = replaceNullWithWildcard(event.getResourceType()); + resourceType = resourceType.replace(".", "-"); + + String resourceUuid = replaceNullWithWildcard(event.getResourceUUID()); + resourceUuid = resourceUuid.replace(".", "-"); + + // routing key will be of format: eventSource.eventCategory.eventType.resourceType.resourceUuid + routingKey.append(eventSource); + routingKey.append("."); + routingKey.append(eventCategory); + routingKey.append("."); + routingKey.append(eventType); + routingKey.append("."); + routingKey.append(resourceType); + routingKey.append("."); + routingKey.append(resourceUuid); + + return routingKey.toString(); + } + + /** creates a binding key from the event topic that subscriber specified + * binding key will be used to bind the queue created for subscriber to exchange on AMQP server + */ + private String createBindingKey(EventTopic topic) { + + StringBuilder bindingKey = new StringBuilder(); + + String eventSource = replaceNullWithWildcard(topic.getEventSource()); + eventSource = eventSource.replace(".", "-"); + + String eventCategory = replaceNullWithWildcard(topic.getEventCategory()); + eventCategory = eventCategory.replace(".", "-"); + + String eventType = replaceNullWithWildcard(topic.getEventType()); + eventType = eventType.replace(".", "-"); + + String resourceType = replaceNullWithWildcard(topic.getResourceType()); + resourceType = resourceType.replace(".", "-"); + + String resourceUuid = replaceNullWithWildcard(topic.getResourceUUID()); + resourceUuid = resourceUuid.replace(".", "-"); + + // binding key will be of format: eventSource.eventCategory.eventType.resourceType.resourceUuid + bindingKey.append(eventSource); + bindingKey.append("."); + bindingKey.append(eventCategory); + bindingKey.append("."); + bindingKey.append(eventType); + bindingKey.append("."); + bindingKey.append(resourceType); + bindingKey.append("."); + bindingKey.append(resourceUuid); + + return bindingKey.toString(); + } + + private synchronized Connection getConnection() throws Exception { + if (_connection == null) { + try { + return createConnection(); + } catch (Exception e) { + s_logger.error("Failed to create a connection to AMQP server due to " + e.getMessage()); + throw e; + } + } else { + return _connection; + } + } + + private synchronized Connection createConnection() throws Exception { + try { + ConnectionFactory factory = new ConnectionFactory(); + factory.setUsername(_username); + factory.setPassword(_password); + factory.setVirtualHost("/"); + factory.setHost(_amqpHost); + factory.setPort(_port); + Connection connection = factory.newConnection(); + connection.addShutdownListener(disconnectHandler); + _connection = connection; + return _connection; + } catch (Exception e) { + throw e; + } + } + + private synchronized void closeConnection() { + try { + if (_connection != null) { + _connection.close(); + } + } catch (Exception e) { + s_logger.warn("Failed to close connection to AMQP server due to " + e.getMessage()); + } + _connection = null; + } + + private synchronized void abortConnection () { + if (_connection == null) + return; + + try { + _connection.abort(); + } catch (Exception e) { + s_logger.warn("Failed to abort connection due to " + e.getMessage()); + } + _connection = null; + } + + private String replaceNullWithWildcard(String key) { + if (key == null || key.isEmpty()) { + return "*"; + } else { + return key; + } + } + + private Channel createChannel(Connection connection) throws Exception { + try { + return connection.createChannel(); + } catch (java.io.IOException exception) { + s_logger.warn("Failed to create a channel due to " + exception.getMessage()); + throw exception; + } + } + + private void createExchange(Channel channel, String exchangeName) throws Exception { + try { + channel.exchangeDeclare(exchangeName, "topic", true); + } catch (java.io.IOException exception) { + s_logger.error("Failed to create exchange" + exchangeName + " on RabbitMQ server"); + throw exception; + } + } + + private void publishEventToExchange(Channel channel, String exchangeName, + String routingKey, String eventDescription) throws Exception { + try { + byte[] messageBodyBytes = eventDescription.getBytes(); + channel.basicPublish(exchangeName, routingKey, MessageProperties.PERSISTENT_TEXT_PLAIN, messageBodyBytes); + } catch (Exception e) { + s_logger.error("Failed to publish event " + routingKey + " on exchange " + exchangeName + + " of message broker due to " + e.getMessage()); + throw e; + } + } + + private String getEventCategoryFromRoutingKey(String routingKey) { + String[] keyParts = routingKey.split("\\."); + return keyParts[1]; + } + + private String getEventTypeFromRoutingKey(String routingKey) { + String[] keyParts = routingKey.split("\\."); + return keyParts[2]; + } + + private String getEventSourceFromRoutingKey(String routingKey) { + String[] keyParts = routingKey.split("\\."); + return keyParts[0]; + } + + private String getResourceTypeFromRoutingKey(String routingKey) { + String[] keyParts = routingKey.split("\\."); + return keyParts[3]; + } + + private String getResourceUUIDFromRoutingKey(String routingKey) { + String[] keyParts = routingKey.split("\\."); + return keyParts[4]; + } + + @Override + public String getName() { + return _name; + } + + @Override + public boolean start() { + ReconnectionTask reconnect = new ReconnectionTask(); // initiate connection to AMQP server + executorService.submit(reconnect); + return true; + } + + @Override + public boolean stop() { + + if (_connection.isOpen()) { + for (String subscriberId : _subscribers.keySet()) { + Ternary subscriberDetails = _subscribers.get(subscriberId); + Channel channel = subscriberDetails.second(); + String queueName = subscriberId; + try { + channel.queueDelete(queueName); + channel.abort(); + } catch (IOException ioe) { + s_logger.warn("Failed to delete queue: " + queueName + " on AMQP server due to " + ioe.getMessage() ); + } + } + } + + closeConnection(); + return true; + } + + // logic to deal with loss of connection to AMQP server + private class DisconnectHandler implements ShutdownListener { + + @Override + public void shutdownCompleted(ShutdownSignalException shutdownSignalException) { + if (!shutdownSignalException.isInitiatedByApplication()) { + + for (String subscriberId : _subscribers.keySet()) { + Ternary subscriberDetails = _subscribers.get(subscriberId); + subscriberDetails.second(null); + _subscribers.put(subscriberId, subscriberDetails); + } + + abortConnection(); // disconnected to AMQP server, so abort the connection and channels + s_logger.warn("Connection has been shutdown by AMQP server. Attempting to reconnect."); + + // initiate re-connect process + ReconnectionTask reconnect = new ReconnectionTask(); + executorService.submit(reconnect); + } + } + } + + // retry logic to connect back to AMQP server after loss of connection + private class ReconnectionTask implements Runnable { + + boolean connected = false; + Connection connection = null; + + public void run() { + + while (!connected) { + try { + Thread.sleep(_retryInterval); + } catch (InterruptedException ie) { + // ignore timer interrupts + } + + try { + try { + connection = createConnection(); + connected = true; + } catch (IOException ie) { + continue; // can't establish connection to AMQP server yet, so continue + } + + // prepare consumer on AMQP server for each of subscriber + for (String subscriberId : _subscribers.keySet()) { + Ternary subscriberDetails = _subscribers.get(subscriberId); + String bindingKey = subscriberDetails.first(); + EventSubscriber subscriber = subscriberDetails.third(); + + /** create a queue with subscriber ID as queue name and bind it to the exchange + * with binding key formed from event topic + */ + Channel channel = createChannel(connection); + createExchange(channel, _amqpExchangeName); + channel.queueDeclare(subscriberId, false, false, false, null); + channel.queueBind(subscriberId, _amqpExchangeName, bindingKey); + + // register a callback handler to receive the events that a subscriber subscribed to + channel.basicConsume(subscriberId, _autoAck, subscriberId, + new DefaultConsumer(channel) { + @Override + public void handleDelivery(String queueName, + Envelope envelope, + AMQP.BasicProperties properties, + byte[] body) + throws IOException { + + Ternary subscriberDetails + = _subscribers.get(queueName); // queue name == subscriber ID + + if (subscriberDetails != null) { + EventSubscriber subscriber = subscriberDetails.third(); + String routingKey = envelope.getRoutingKey(); + String eventSource = getEventSourceFromRoutingKey(routingKey); + String eventCategory = getEventCategoryFromRoutingKey(routingKey); + String eventType = getEventTypeFromRoutingKey(routingKey); + String resourceType = getResourceTypeFromRoutingKey(routingKey); + String resourceUUID = getResourceUUIDFromRoutingKey(routingKey); + + // create event object from the message details obtained from AMQP server + Event event = new Event(eventSource, eventCategory, eventType, + resourceType, resourceUUID); + event.setDescription(new String(body)); + + // deliver the event to call back object provided by subscriber + subscriber.onEvent(event); + } + } + } + ); + + // update the channel details for the subscription + subscriberDetails.second(channel); + _subscribers.put(subscriberId, subscriberDetails); + } + } catch (Exception e) { + s_logger.warn("Failed to recreate queues and binding for the subscribers due to " + e.getMessage()); + } + } + return; + } + } +} \ No newline at end of file diff --git a/plugins/file-systems/netapp/pom.xml b/plugins/file-systems/netapp/pom.xml index e1c8866d15d..0e6f427da36 100644 --- a/plugins/file-systems/netapp/pom.xml +++ b/plugins/file-systems/netapp/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java index c87c9242010..5d9ad078ca2 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/AssociateLunCmd.java @@ -18,9 +18,12 @@ package com.cloud.api.commands.netapp; import java.rmi.ServerException; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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; @@ -29,7 +32,7 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.AssociateLunCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "associateLun", description="Associate a LUN with a guest IQN", responseObject = AssociateLunCmdResponse.class) public class AssociateLunCmd extends BaseCmd { @@ -69,10 +72,10 @@ public class AssociateLunCmd extends BaseCmd { return s_name; } + @Inject NetappManager netappMgr; + @Override public void execute(){ - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { AssociateLunCmdResponse response = new AssociateLunCmdResponse(); @@ -85,9 +88,9 @@ public class AssociateLunCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java index 8c89730b978..a0c19833a7e 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateLunCmd.java @@ -18,9 +18,12 @@ package com.cloud.api.commands.netapp; import java.rmi.ServerException; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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; @@ -33,7 +36,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.CreateLunCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "createLunOnFiler", description="Create a LUN from a pool", responseObject = CreateLunCmdResponse.class) public class CreateLunCmd extends BaseCmd { @@ -57,13 +60,12 @@ public class CreateLunCmd extends BaseCmd { public long getLunSize() { return size; } + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { CreateLunCmdResponse response = new CreateLunCmdResponse(); @@ -76,9 +78,9 @@ public class CreateLunCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java index a2d4b96e6dd..56e9441638b 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumeOnFilerCmd.java @@ -19,7 +19,10 @@ package com.cloud.api.commands.netapp; import java.net.UnknownHostException; import java.rmi.ServerException; +import javax.inject.Inject; + 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; @@ -32,7 +35,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.CreateVolumeOnFilerCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "createVolumeOnFiler", description="Create a volume", responseObject = CreateVolumeOnFilerCmdResponse.class) public class CreateVolumeOnFilerCmd extends BaseCmd { @@ -101,6 +104,8 @@ public class CreateVolumeOnFilerCmd extends BaseCmd { public String getPassword() { return password; } + + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, @@ -110,9 +115,6 @@ public class CreateVolumeOnFilerCmd extends BaseCmd { if(snapshotReservation != null && (snapshotReservation<0 || snapshotReservation>100)) throw new InvalidParameterValueException("Invalid snapshot reservation"); - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); - StringBuilder s = new StringBuilder(getVolSize().toString()); s.append("g"); @@ -122,11 +124,11 @@ public class CreateVolumeOnFilerCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (UnknownHostException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java index 9e38c5fc097..a83b2c96501 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/CreateVolumePoolCmd.java @@ -16,9 +16,12 @@ // under the License. package com.cloud.api.commands.netapp; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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; @@ -31,7 +34,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.CreateVolumePoolCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "createPool", description="Create a pool", responseObject = CreateVolumePoolCmdResponse.class) public class CreateVolumePoolCmd extends BaseCmd { @@ -50,13 +53,12 @@ public class CreateVolumePoolCmd extends BaseCmd { public String getAlgorithm() { return algorithm; } + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { CreateVolumePoolCmdResponse response = new CreateVolumePoolCmdResponse(); @@ -64,7 +66,7 @@ public class CreateVolumePoolCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java index 1105ea53e9d..f17c61ca94a 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DeleteVolumePoolCmd.java @@ -17,9 +17,12 @@ package com.cloud.api.commands.netapp; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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; @@ -31,9 +34,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; -import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.DeleteVolumePoolCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "deletePool", description="Delete a pool", responseObject = DeleteVolumePoolCmdResponse.class) public class DeleteVolumePoolCmd extends BaseCmd { @@ -42,22 +44,22 @@ public class DeleteVolumePoolCmd extends BaseCmd { @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.") private String poolName; + + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { netappMgr.deletePool(poolName); DeleteVolumePoolCmdResponse response = new DeleteVolumePoolCmdResponse(); response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (ResourceInUseException e) { - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java index c5f7b117f5b..f08defc0159 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyLunCmd.java @@ -18,9 +18,12 @@ package com.cloud.api.commands.netapp; import java.rmi.ServerException; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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; @@ -33,7 +36,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.DeleteLUNCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "destroyLunOnFiler", description="Destroy a LUN", responseObject = DeleteLUNCmdResponse.class) public class DestroyLunCmd extends BaseCmd { @@ -44,21 +47,20 @@ public class DestroyLunCmd extends BaseCmd { @Parameter(name=ApiConstants.PATH, type=CommandType.STRING, required = true, description="LUN path.") private String path; + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { netappMgr.destroyLunOnFiler(path); DeleteLUNCmdResponse response = new DeleteLUNCmdResponse(); response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java index 4ddc0c9f6d0..05413701cd9 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DestroyVolumeOnFilerCmd.java @@ -18,6 +18,8 @@ package com.cloud.api.commands.netapp; import java.rmi.ServerException; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -29,9 +31,8 @@ import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; -import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.DeleteVolumeOnFilerCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "destroyVolumeOnFiler", description="Destroy a Volume", responseObject = DeleteVolumeOnFilerCmdResponse.class) public class DestroyVolumeOnFilerCmd extends BaseCmd { @@ -47,24 +48,24 @@ public class DestroyVolumeOnFilerCmd extends BaseCmd { @Parameter(name=ApiConstants.VOLUME_NAME, type=CommandType.STRING, required = true, description="volume name.") private String volumeName; + @Inject NetappManager netappMgr; + @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { netappMgr.destroyVolumeOnFiler(ipAddr, aggrName, volumeName); DeleteVolumeOnFilerCmdResponse response = new DeleteVolumeOnFilerCmdResponse(); response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (ResourceInUseException e) { - throw new ServerApiException(BaseCmd.RESOURCE_IN_USE_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.RESOURCE_IN_USE_ERROR, e.toString()); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java index 0a6c1a70ef1..ac6dbf0b561 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/DissociateLunCmd.java @@ -18,6 +18,8 @@ package com.cloud.api.commands.netapp; import java.rmi.ServerException; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -30,7 +32,7 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.DissociateLunCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "dissociateLun", description="Dissociate a LUN", responseObject = DissociateLunCmdResponse.class) public class DissociateLunCmd extends BaseCmd { @@ -43,21 +45,20 @@ public class DissociateLunCmd extends BaseCmd { @Parameter(name=ApiConstants.IQN, type=CommandType.STRING, required = true, description="Guest IQN.") private String guestIQN; + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { netappMgr.disassociateLun(guestIQN, path); DissociateLunCmdResponse response = new DissociateLunCmdResponse(); response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } catch (ServerException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java index 630b14994e7..90bc5f3f425 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListLunsCmd.java @@ -19,9 +19,12 @@ package com.cloud.api.commands.netapp; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.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; @@ -36,7 +39,7 @@ import com.cloud.netapp.LunVO; import com.cloud.netapp.NetappManager; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.ListLunsCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "listLunsOnFiler", description="List LUN", responseObject = ListLunsCmdResponse.class) public class ListLunsCmd extends BaseCmd @@ -47,12 +50,11 @@ public class ListLunsCmd extends BaseCmd @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.") private String poolName; + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { List lunList = netappMgr.listLunsOnFiler(poolName); ListResponse listResponse = new ListResponse(); @@ -70,7 +72,7 @@ public class ListLunsCmd extends BaseCmd listResponse.setResponseName(getCommandName()); this.setResponseObject(listResponse); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java index d77f4fad849..fd9b17d9ea1 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumePoolsCmd.java @@ -19,8 +19,11 @@ package com.cloud.api.commands.netapp; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.log4j.Logger; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.ServerApiException; @@ -34,20 +37,19 @@ import com.cloud.netapp.NetappManager; import com.cloud.netapp.PoolVO; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.ListVolumePoolsCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "listPools", description="List Pool", responseObject = ListVolumePoolsCmdResponse.class) public class ListVolumePoolsCmd extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ListVolumePoolsCmd.class.getName()); private static final String s_name = "listpoolresponse"; + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); try { List poolList = netappMgr.listPools(); ListResponse listResponse = new ListResponse(); @@ -64,7 +66,7 @@ public class ListVolumePoolsCmd extends BaseCmd { listResponse.setResponseName(getCommandName()); this.setResponseObject(listResponse); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java index 66a96f3a221..ac839ba58c5 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ListVolumesOnFilerCmd.java @@ -19,6 +19,8 @@ package com.cloud.api.commands.netapp; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -33,7 +35,7 @@ import com.cloud.netapp.NetappManager; import com.cloud.netapp.NetappVolumeVO; import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.ListVolumesOnFilerCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "listVolumesOnFiler", description="List Volumes", responseObject = ListVolumesOnFilerCmdResponse.class) public class ListVolumesOnFilerCmd extends BaseCmd { @@ -42,14 +44,13 @@ public class ListVolumesOnFilerCmd extends BaseCmd { @Parameter(name=ApiConstants.POOL_NAME, type=CommandType.STRING, required = true, description="pool name.") private String poolName; + + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); - try { List volumes = netappMgr.listVolumesOnFiler(poolName); ListResponse listResponse = new ListResponse(); @@ -71,7 +72,7 @@ public class ListVolumesOnFilerCmd extends BaseCmd { listResponse.setResponseName(getCommandName()); this.setResponseObject(listResponse); } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, e.toString()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.toString()); } } diff --git a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java index 3e32caebef3..268345a46cf 100644 --- a/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java +++ b/plugins/file-systems/netapp/src/com/cloud/api/commands/netapp/ModifyVolumePoolCmd.java @@ -17,6 +17,8 @@ package com.cloud.api.commands.netapp; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; @@ -29,9 +31,8 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; import com.cloud.netapp.NetappManager; -import com.cloud.server.ManagementService; import com.cloud.server.api.response.netapp.ModifyVolumePoolCmdResponse; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "modifyPool", description="Modify pool", responseObject = ModifyVolumePoolCmdResponse.class) public class ModifyVolumePoolCmd extends BaseCmd { @@ -43,14 +44,13 @@ public class ModifyVolumePoolCmd extends BaseCmd { @Parameter(name=ApiConstants.ALGORITHM, type=CommandType.STRING, required = true, description="algorithm.") private String algorithm; + + @Inject NetappManager netappMgr; @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - NetappManager netappMgr = locator.getManager(NetappManager.class); - netappMgr.modifyPool(poolName, algorithm); ModifyVolumePoolCmdResponse response = new ModifyVolumePoolCmdResponse(); diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java index 7216c50f428..1ee87f1a817 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManager.java @@ -24,8 +24,9 @@ import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.utils.component.Manager; +import com.cloud.utils.component.PluggableService; -public interface NetappManager extends Manager { +public interface NetappManager extends Manager, PluggableService { enum AlgorithmType { RoundRobin, LeastFull diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java index 1fdd2502694..8f7b6d8df8d 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/NetappManagerImpl.java @@ -17,6 +17,7 @@ package com.cloud.netapp; import java.io.IOException; +import java.lang.Override; import java.net.UnknownHostException; import java.rmi.ServerException; import java.util.ArrayList; @@ -27,6 +28,7 @@ import java.util.Map; import java.util.StringTokenizer; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import netapp.manage.NaAPIFailedException; @@ -37,25 +39,26 @@ import netapp.manage.NaProtocolException; import netapp.manage.NaServer; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; +import com.cloud.api.commands.netapp.*; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceInUseException; import com.cloud.netapp.dao.LunDao; import com.cloud.netapp.dao.PoolDao; import com.cloud.netapp.dao.VolumeDao; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; +@Component @Local(value = { NetappManager.class }) -public class NetappManagerImpl implements NetappManager +public class NetappManagerImpl extends ManagerBase implements NetappManager { public enum Algorithm { roundrobin,leastfull } - protected String _name; - public static final Logger s_logger = Logger.getLogger(NetappManagerImpl.class.getName()); @Inject public VolumeDao _volumeDao; @Inject public PoolDao _poolDao; @@ -122,7 +125,25 @@ public class NetappManagerImpl implements NetappManager return s; } - + + @Override + public List> getCommands() { + List> cmdList = new ArrayList>(); + cmdList.add(CreateLunCmd.class); + cmdList.add(ListLunsCmd.class); + cmdList.add(DissociateLunCmd.class); + cmdList.add(CreateVolumeOnFilerCmd.class); + cmdList.add(ModifyVolumePoolCmd.class); + cmdList.add(ListVolumesOnFilerCmd.class); + cmdList.add(ListVolumePoolsCmd.class); + cmdList.add(DestroyLunCmd.class); + cmdList.add(CreateVolumePoolCmd.class); + cmdList.add(DeleteVolumePoolCmd.class); + cmdList.add(AssociateLunCmd.class); + cmdList.add(DestroyVolumeOnFilerCmd.class); + return cmdList; + } + @Override public void modifyPool(String poolName, String algorithm) throws InvalidParameterValueException { @@ -1015,26 +1036,9 @@ public class NetappManagerImpl implements NetappManager public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _netappAllocator = new NetappDefaultAllocatorImpl( this ); return true; } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - } diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java index 9cc67b7e894..0218c99286d 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/LunDaoImpl.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.netapp.LunVO; import com.cloud.netapp.NetappVolumeVO; @@ -30,6 +31,7 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +@Component @Local(value={LunDao.class}) public class LunDaoImpl extends GenericDaoBase implements LunDao { private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java index 3e23644840d..a3383c23527 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/PoolDaoImpl.java @@ -21,12 +21,14 @@ import java.util.List; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.netapp.PoolVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +@Component @Local(value={PoolDao.class}) public class PoolDaoImpl extends GenericDaoBase implements PoolDao { private static final Logger s_logger = Logger.getLogger(PoolDaoImpl.class); diff --git a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java index 4a834294b6f..360c93664f0 100644 --- a/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java +++ b/plugins/file-systems/netapp/src/com/cloud/netapp/dao/VolumeDaoImpl.java @@ -21,6 +21,7 @@ import java.util.List; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.netapp.NetappVolumeVO; import com.cloud.utils.db.Filter; @@ -28,6 +29,7 @@ import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +@Component(value = "netappVolumeDaoImpl") @Local(value={VolumeDao.class}) public class VolumeDaoImpl extends GenericDaoBase implements VolumeDao { private static final Logger s_logger = Logger.getLogger(VolumeDaoImpl.class); diff --git a/plugins/host-allocators/random/pom.xml b/plugins/host-allocators/random/pom.xml index ba7e1ae1e65..6fc76fe8dad 100644 --- a/plugins/host-allocators/random/pom.xml +++ b/plugins/host-allocators/random/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java index 0887ee97969..a672efdc77e 100755 --- a/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java +++ b/plugins/host-allocators/random/src/com/cloud/agent/manager/allocator/impl/RandomAllocator.java @@ -22,8 +22,10 @@ import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.manager.allocator.HostAllocator; import com.cloud.deploy.DeploymentPlan; @@ -34,55 +36,55 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.offering.ServiceOffering; import com.cloud.resource.ResourceManager; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; +@Component @Local(value=HostAllocator.class) -public class RandomAllocator implements HostAllocator { +public class RandomAllocator extends AdapterBase implements HostAllocator { private static final Logger s_logger = Logger.getLogger(RandomAllocator.class); - private String _name; - private HostDao _hostDao; - private ResourceManager _resourceMgr; + @Inject private HostDao _hostDao; + @Inject private ResourceManager _resourceMgr; @Override public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo) { return allocateTo(vmProfile, plan, type, avoid, returnUpTo, true); } - + @Override public List allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, - ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) { + ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity) { + + long dcId = plan.getDataCenterId(); + Long podId = plan.getPodId(); + Long clusterId = plan.getClusterId(); + ServiceOffering offering = vmProfile.getServiceOffering(); + + List suitableHosts = new ArrayList(); - long dcId = plan.getDataCenterId(); - Long podId = plan.getPodId(); - Long clusterId = plan.getClusterId(); - ServiceOffering offering = vmProfile.getServiceOffering(); - - List suitableHosts = new ArrayList(); - if (type == Host.Type.Storage) { return suitableHosts; } String hostTag = offering.getHostTag(); if(hostTag != null){ - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); + s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId + " having host tag:" + hostTag); }else{ - s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); + s_logger.debug("Looking for hosts in dc: " + dcId + " pod:" + podId + " cluster:" + clusterId); } // list all computing hosts, regardless of whether they support routing...it's random after all List hosts = new ArrayList(); if(hostTag != null){ - hosts = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTag); + hosts = _hostDao.listByHostTag(type, clusterId, podId, dcId, hostTag); }else{ - hosts = _resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId); + hosts = _resourceMgr.listAllUpAndEnabledHosts(type, clusterId, podId, dcId); } - + s_logger.debug("Random Allocator found " + hosts.size() + " hosts"); - + if (hosts.size() == 0) { return suitableHosts; } @@ -90,12 +92,12 @@ public class RandomAllocator implements HostAllocator { Collections.shuffle(hosts); for (Host host : hosts) { - if(suitableHosts.size() == returnUpTo){ - break; - } - + if(suitableHosts.size() == returnUpTo){ + break; + } + if (!avoid.shouldAvoid(host)) { - suitableHosts.add(host); + suitableHosts.add(host); }else{ if (s_logger.isDebugEnabled()) { s_logger.debug("Host name: " + host.getName() + ", hostId: "+ host.getId() +" is in avoid set, skipping this and trying other available hosts"); @@ -114,33 +116,4 @@ public class RandomAllocator implements HostAllocator { // return true return true; } - - @Override - public boolean configure(String name, Map params) { - ComponentLocator locator = ComponentLocator.getCurrentLocator(); - _hostDao = locator.getDao(HostDao.class); - _resourceMgr = locator.getManager(ResourceManager.class); - if (_hostDao == null) { - s_logger.error("Unable to get host dao."); - return false; - } - _name=name; - - return true; - } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } } diff --git a/plugins/hypervisors/baremetal/pom.xml b/plugins/hypervisors/baremetal/pom.xml new file mode 100755 index 00000000000..328bd963c91 --- /dev/null +++ b/plugins/hypervisors/baremetal/pom.xml @@ -0,0 +1,37 @@ + + + 4.0.0 + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + cloud-plugin-hypervisor-baremetal + Apache CloudStack Plugin - Hypervisor Baremetal + + + commons-lang + commons-lang + 2.6 + + + + diff --git a/plugins/hypervisors/baremetal/resources/security_group_agent/cs-sgagent b/plugins/hypervisors/baremetal/resources/security_group_agent/cs-sgagent new file mode 100755 index 00000000000..02426d0aa10 --- /dev/null +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/cs-sgagent @@ -0,0 +1,67 @@ +#!/bin/sh +# the following is chkconfig init header +# +# cs-sgagent: cloudStack baremetal sercurity group agent +# +# chkconfig: 345 97 03 +# description: This is a daemon instructed by CloudStack management server \ +# to perform baremetal security group related operations\ +# +# processname: cs-sgagent +# pidfile: /var/run/cssgagent.pid +# + +# 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. + +check_status() { + pidfile='/var/run/cssgagent.pid' + if [ ! -f $pidfile ]; then + echo "cloudstack baremetal security group agent is stopped" + exit 1 + else + pid=`cat $pidfile` + ps -p $pid > /dev/null + if [ $? -eq 0 ]; then + echo "cloudstack baremetal security group agent is running, pid is $pid" + exit 0 + else + echo "cloudstack baremetal security group agent is stopped, but pidfile at $pidfile is not cleaned. It may be caused by the agent crashed at last time, manually cleaning it would be ok" + exit 1 + fi + fi +} + +if [ $# -eq 0 ]; then + echo "usage: $0 +[start|stop|restart|status]" + exit 1 +fi + +if [ "$@" = "status" ]; then + check_status +else + python -c "from security_group_agent import cs_sg_agent; cs_sg_agent.main()" $@ +fi + +if [ $? -eq 0 ]; then + echo "$@ cloudstack baremetal security group agent .... SUCCESS" + exit 0 +else + echo "$@ cloudstack baremetal security group agent .... FAILED" + exit 1 +fi diff --git a/build/.gitignore b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/__init__.py similarity index 92% rename from build/.gitignore rename to plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/__init__.py index d11410db1a5..f7f5f60ff05 100644 --- a/build/.gitignore +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/__init__.py @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. - -/override +# +# Automatically generated by addcopyright.py at 01/29/2013 diff --git a/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/cs_sg_agent.py b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/cs_sg_agent.py new file mode 100755 index 00000000000..a292c0bcfb8 --- /dev/null +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/cs_sg_agent.py @@ -0,0 +1,237 @@ +# 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. +# +# Automatically generated by addcopyright.py at 01/29/2013 +''' +Created on Jan 2, 2013 + +@author: frank +''' +import cherrypy +import sglib +import xmlobject +import types +import uuid +import os.path +import sys +import os + +class SGRule(object): + def __init__(self): + self.protocol = None + self.start_port = None + self.end_port = None + self.allowed_ips = [] + +class IPSet(object): + IPSET_TYPE = 'hash:ip' + def __init__(self, setname, ips): + self.ips = ips + self.name = setname + + def create(self): + tmpname = str(uuid.uuid4()).replace('-', '')[0:30] + sglib.ShellCmd('ipset -N %s %s' % (tmpname, self.IPSET_TYPE))() + try: + for ip in self.ips: + sglib.ShellCmd('ipset -A %s %s' % (tmpname, ip))() + + try: + sglib.ShellCmd('ipset -N %s %s' % (self.name, self.IPSET_TYPE))() + cherrypy.log('created new ipset: %s' % self.name) + except Exception: + cherrypy.log('%s already exists, no need to create new' % self.name) + finally: + sglib.ShellCmd('ipset -W %s %s' % (tmpname, self.name))() + sglib.ShellCmd('ipset -F %s' % tmpname)() + sglib.ShellCmd('ipset -X %s' % tmpname)() + + @staticmethod + def destroy_sets(sets_to_keep): + sets = sglib.ShellCmd('ipset list')() + for s in sets.split('\n'): + if 'Name:' in s: + set_name = s.split(':', 1)[1].strip() + if not set_name in sets_to_keep: + sglib.ShellCmd('ipset destroy %s' % set_name)() + cherrypy.log('destroyed unused ipset: %s' % set_name) + +class SGAgent(object): + def __init__(self): + pass + + def _self_list(self, obj): + if isinstance(obj, types.ListType): + return obj + else: + return [obj] + + def set_rules(self, req): + body = req.body + doc = xmlobject.loads(body) + vm_name = doc.vmName.text_ + vm_id = doc.vmId.text_ + vm_ip = doc.vmIp.text_ + vm_mac = doc.vmMac.text_ + sig = doc.signature.text_ + seq = doc.sequenceNumber.text_ + + def parse_rules(rules, lst): + for i in self._self_list(rules): + r = SGRule() + r.protocol = i.protocol.text_ + r.start_port = i.startPort.text_ + r.end_port = i.endPort.text_ + if hasattr(i, 'ip'): + for ip in self._self_list(i.ip): + r.allowed_ips.append(ip.text_) + lst.append(r) + + i_rules = [] + if hasattr(doc, 'ingressRules'): + parse_rules(doc.ingressRules, i_rules) + + e_rules = [] + if hasattr(doc, 'egressRules'): + parse_rules(doc.egressRules, e_rules) + + def create_chain(name): + try: + sglib.ShellCmd('iptables -F %s' % name)() + except Exception: + sglib.ShellCmd('iptables -N %s' % name)() + + def apply_rules(rules, chainname, direction, action, current_set_names): + create_chain(chainname) + for r in i_rules: + allow_any = False + if '0.0.0.0/0' in r.allowed_ips: + allow_any = True + r.allowed_ips.remove('0.0.0.0/0') + + if r.allowed_ips: + setname = '_'.join([chainname, r.protocol, r.start_port, r.end_port]) + ipset = IPSet(setname, r.allowed_ips) + ipset.create() + current_set_names.append(setname) + + if r.protocol == 'all': + cmd = ['iptables -I', chainname, '-m state --state NEW -m set --set', setname, direction, '-j', action] + sglib.ShellCmd(' '.join(cmd))() + elif r.protocol != 'icmp': + port_range = ":".join([r.start_port, r.end_port]) + cmd = ['iptables', '-I', chainname, '-p', r.protocol, '-m', r.protocol, '--dport', port_range, '-m state --state NEW -m set --set', setname, direction, '-j', action] + sglib.ShellCmd(' '.join(cmd))() + else: + port_range = "/".join([r.start_port, r.end_port]) + if r.start_port == "-1": + port_range = "any" + cmd = ['iptables', '-I', i_chain_name, '-p', 'icmp', '--icmp-type', port_range, '-m set --set', setname, direction, '-j', action] + sglib.ShellCmd(' '.join(cmd))() + + + if allow_any and r.protocol != 'all': + if r.protocol != 'icmp': + port_range = ":".join([r.start_port, r.end_port]) + cmd = ['iptables', '-I', chainname, '-p', r.protocol, '-m', r.protocol, '--dport', port_range, '-m', 'state', '--state', 'NEW', '-j', action] + sglib.ShellCmd(' '.join(cmd))() + else: + port_range = "/".join([r.start_port, r.end_port]) + if r.start_port == "-1": + port_range = "any" + cmd = ['iptables', '-I', i_chain_name, '-p', 'icmp', '--icmp-type', port_range, '-j', action] + sglib.ShellCmd(' '.join(cmd))() + + current_sets = [] + i_chain_name = vm_name + '-in' + apply_rules(i_rules, i_chain_name, 'src', 'ACCEPT', current_sets) + e_chain_name = vm_name + '-eg' + apply_rules(e_rules, e_chain_name, 'dst', 'RETURN', current_sets) + + if e_rules: + sglib.ShellCmd('iptables -A %s -j RETURN' % e_chain_name) + else: + sglib.ShellCmd('iptables -A %s -j DROP' % e_chain_name) + + sglib.ShellCmd('iptables -A %s -j DROP' % i_chain_name) + IPSet.destroy_sets(current_sets) + + + def echo(self, req): + cherrypy.log("echo: I am alive") + + def index(self): + req = sglib.Request.from_cherrypy_request(cherrypy.request) + cmd_name = req.headers['command'] + + if not hasattr(self, cmd_name): + raise ValueError("SecurityGroupAgent doesn't have a method called '%s'" % cmd_name) + method = getattr(self, cmd_name) + + return method(req) + index.exposed = True + + @staticmethod + def start(): + cherrypy.log.access_file = '/var/log/cs-securitygroup.log' + cherrypy.log.error_file = '/var/log/cs-securitygroup.log' + cherrypy.server.socket_host = '0.0.0.0' + cherrypy.server.socket_port = 9988 + cherrypy.quickstart(SGAgent()) + + @staticmethod + def stop(): + cherrypy.engine.exit() + +PID_FILE = '/var/run/cssgagent.pid' +class SGAgentDaemon(sglib.Daemon): + def __init__(self): + super(SGAgentDaemon, self).__init__(PID_FILE) + self.is_stopped = False + self.agent = SGAgent() + sglib.Daemon.register_atexit_hook(self._do_stop) + + def _do_stop(self): + if self.is_stopped: + return + self.is_stopped = True + self.agent.stop() + + def run(self): + self.agent.start() + + def stop(self): + self.agent.stop() + super(SGAgentDaemon, self).stop() + +def main(): + usage = 'usage: python -c "from security_group_agent import cs_sg_agent; cs_sg_agent.main()" start|stop|restart' + if len(sys.argv) != 2 or not sys.argv[1] in ['start', 'stop', 'restart']: + print usage + sys.exit(1) + + cmd = sys.argv[1] + agentdaemon = SGAgentDaemon() + if cmd == 'start': + agentdaemon.start() + elif cmd == 'stop': + agentdaemon.stop() + else: + agentdaemon.restart() + + sys.exit(0) + \ No newline at end of file diff --git a/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/sglib.py b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/sglib.py new file mode 100755 index 00000000000..bf64effa190 --- /dev/null +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/sglib.py @@ -0,0 +1,226 @@ +#!/usr/bin/env python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Automatically generated by addcopyright.py at 01/29/2013 + +import sys, os, time, atexit +import traceback +import subprocess +from signal import SIGTERM +import cherrypy +import copy + +class Request(object): + def __init__(self): + self.headers = None + self.body = None + self.method = None + self.query_string = None + + @staticmethod + def from_cherrypy_request(creq): + req = Request() + req.headers = copy.copy(creq.headers) + req.body = creq.body.fp.read() if creq.body else None + req.method = copy.copy(creq.method) + req.query_string = copy.copy(creq.query_string) if creq.query_string else None + return req + +class ShellError(Exception): + '''shell error''' + +class ShellCmd(object): + ''' + classdocs + ''' + def __init__(self, cmd, workdir=None, pipe=True): + ''' + Constructor + ''' + self.cmd = cmd + if pipe: + self.process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE, executable='/bin/sh', cwd=workdir) + else: + self.process = subprocess.Popen(cmd, shell=True, executable='/bin/sh', cwd=workdir) + + self.stdout = None + self.stderr = None + self.return_code = None + + def __call__(self, is_exception=True): + (self.stdout, self.stderr) = self.process.communicate() + if is_exception and self.process.returncode != 0: + err = [] + err.append('failed to execute shell command: %s' % self.cmd) + err.append('return code: %s' % self.process.returncode) + err.append('stdout: %s' % self.stdout) + err.append('stderr: %s' % self.stderr) + raise ShellError('\n'.join(err)) + + self.return_code = self.process.returncode + return self.stdout + +class Daemon(object): + """ + A generic daemon class. + + Usage: subclass the Daemon class and override the run() method + """ + atexit_hooks = [] + + def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): + self.stdin = stdin + self.stdout = stdout + self.stderr = stderr + self.pidfile = pidfile + + @staticmethod + def register_atexit_hook(hook): + Daemon.atexit_hooks.append(hook) + + @staticmethod + def _atexit(): + for hook in Daemon.atexit_hooks: + try: + hook() + except Exception: + content = traceback.format_exc() + err = 'Exception when calling atexit hook[%s]\n%s' % (hook.__name__, content) + #logger.error(err) + + def daemonize(self): + """ + do the UNIX double-fork magic, see Stevens' "Advanced + Programming in the UNIX Environment" for details (ISBN 0201563177) + http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 + """ + try: + pid = os.fork() + if pid > 0: + # exit first parent + sys.exit(0) + except OSError, e: + sys.stderr.write("fork #1 failed: %d (%s)\n" % (e.errno, e.strerror)) + sys.exit(1) + + # decouple from parent environment + os.chdir("/") + os.setsid() + os.umask(0) + + # do second fork + try: + pid = os.fork() + if pid > 0: + # exit from second parent + sys.exit(0) + except OSError, e: + sys.stderr.write("fork #2 failed: %d (%s)\n" % (e.errno, e.strerror)) + sys.exit(1) + + # redirect standard file descriptors + sys.stdout.flush() + sys.stderr.flush() + si = file(self.stdin, 'r') + so = file(self.stdout, 'a+') + se = file(self.stderr, 'a+', 0) + os.dup2(si.fileno(), sys.stdin.fileno()) + os.dup2(so.fileno(), sys.stdout.fileno()) + os.dup2(se.fileno(), sys.stderr.fileno()) + + # write pidfile + Daemon.register_atexit_hook(self.delpid) + atexit.register(Daemon._atexit) + pid = str(os.getpid()) + file(self.pidfile,'w').write("%s\n" % pid) + + def delpid(self): + os.remove(self.pidfile) + + def start(self): + """ + Start the daemon + """ + # Check for a pidfile to see if the daemon already runs + try: + pf = file(self.pidfile,'r') + pid = int(pf.read().strip()) + pf.close() + except IOError: + pid = None + + if pid: + pscmd = ShellCmd('ps -p %s > /dev/null' % pid) + pscmd(is_exception=False) + if pscmd.return_code == 0: + message = "Daemon already running, pid is %s\n" + sys.stderr.write(message % pid) + sys.exit(0) + + # Start the daemon + self.daemonize() + try: + self.run() + except Exception: + content = traceback.format_exc() + #logger.error(content) + sys.exit(1) + + def stop(self): + """ + Stop the daemon + """ + # Get the pid from the pidfile + try: + pf = file(self.pidfile,'r') + pid = int(pf.read().strip()) + pf.close() + except IOError: + pid = None + + if not pid: + message = "pidfile %s does not exist. Daemon not running?\n" + sys.stderr.write(message % self.pidfile) + return # not an error in a restart + + # Try killing the daemon process + try: + while 1: + os.kill(pid, SIGTERM) + time.sleep(0.1) + except OSError, err: + err = str(err) + if err.find("No such process") > 0: + if os.path.exists(self.pidfile): + os.remove(self.pidfile) + else: + print str(err) + sys.exit(1) + + def restart(self): + """ + Restart the daemon + """ + self.stop() + self.start() + + def run(self): + """ + You should override this method when you subclass Daemon. It will be called after the process has been + daemonized by start() or restart(). + """ diff --git a/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/xmlobject.py b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/xmlobject.py new file mode 100755 index 00000000000..cb66d265a5a --- /dev/null +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/security_group_agent/xmlobject.py @@ -0,0 +1,97 @@ +# 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. +# +# Automatically generated by addcopyright.py at 01/29/2013 +''' +Created on Dec 25, 2012 + +@author: Frank +''' +import xml.etree.ElementTree as etree +import re +import types + +class XmlObject(object): + def __init__(self, tag): + self.__tag_name__ = tag + + def put_attr(self, name, val): + val = val.strip().strip('\t') + setattr(self, name + '_', val) + + def put_text(self, val): + val = val.strip().strip('\n').strip('\t') + if val == "": + setattr(self, 'text_', None) + else: + setattr(self, 'text_', val) + + def put_node(self, name, val): + if not hasattr(self, name): + setattr(self, name, val) + return + + nodes = getattr(self, name) + if not isinstance(nodes, types.ListType): + nodes = [] + old = getattr(self, name) + nodes.append(old) + nodes.append(val) + setattr(self, name, nodes) + else: + nodes.append(val) + setattr(self, name, nodes) + + def get(self, name, default=None): + if hasattr(self, name): + val = getattr(self, name) + if name.endswith('_'): + return val + else: + return val.text_ + else: + return default + + def __getattr__(self, name): + if name.endswith('__'): + n = name[:-1] + if hasattr(self, n): + return getattr(self, n) + else: + return None + else: + e = AttributeError('%s has no attribute %s. missing attribute %s in element <%s>' % (self.__class__.__name__, name, name, self.__tag_name__)) + setattr(e, 'missing_attrib', name) + setattr(e, 'tag_name', self.__tag_name__) + raise e + + +def _loads(node): + xo = XmlObject(node.tag) + for key in node.attrib.keys(): + xo.put_attr(key, node.attrib.get(key)) + if node.text: + xo.put_text(node.text) + for n in list(node): + sub_xo = _loads(n) + xo.put_node(n.tag, sub_xo) + return xo + +def loads(xmlstr): + xmlstr = re.sub(r'xmlns=".*"', '', xmlstr) + root = etree.fromstring(xmlstr) + return _loads(root) \ No newline at end of file diff --git a/plugins/hypervisors/baremetal/resources/security_group_agent/setup.py b/plugins/hypervisors/baremetal/resources/security_group_agent/setup.py new file mode 100755 index 00000000000..2de41d265ba --- /dev/null +++ b/plugins/hypervisors/baremetal/resources/security_group_agent/setup.py @@ -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. +# +# Automatically generated by addcopyright.py at 01/29/2013 +from setuptools import setup, find_packages +import sys, os + +version = '1.0' + +setup(name='security_group_agent', + version=version, + description="security group agent for CloudStack Baremetal", + long_description="""\ +security group agent for CloudStack Baremetal""", + classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers + keywords='security group cloudstack', + author='Frank Zhang', + author_email='frank.zhang@citrix.com', + url='http://incubator.apache.org/cloudstack/', + license='Apache License 2', + packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), + include_package_data=True, + zip_safe=True, + install_requires=[ + 'CherryPy', + ], + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDao.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDao.java new file mode 100644 index 00000000000..fe6d86c80d4 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDao.java @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import com.cloud.utils.db.GenericDao; + +public interface BaremetalDhcpDao extends GenericDao { + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDaoImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDaoImpl.java new file mode 100644 index 00000000000..8123ee0f6b7 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpDaoImpl.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria2; + +@Component +@Local(value=BaremetalDhcpDao.class) +@DB(txn=false) +public class BaremetalDhcpDaoImpl extends GenericDaoBase implements BaremetalDhcpDao { + + public BaremetalDhcpDaoImpl() { + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpVO.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpVO.java new file mode 100644 index 00000000000..0bfd541ffbc --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalDhcpVO.java @@ -0,0 +1,118 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.EnumType; +import javax.persistence.Enumerated; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="baremetal_dhcp_devices") +public class BaremetalDhcpVO { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "pod_id") + private long podId; + + @Column(name = "physical_network_id") + private long physicalNetworkId; + + @Column(name = "nsp_id") + private long networkServiceProviderId ; + + @Column(name = "device_type") + private String deviceType; + + public BaremetalDhcpVO() { + super(); + this.uuid = UUID.randomUUID().toString(); + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + public long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(long physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + public long getNetworkServiceProviderId() { + return networkServiceProviderId; + } + + public void setNetworkServiceProviderId(long networkServiceProviderId) { + this.networkServiceProviderId = networkServiceProviderId; + } + + public long getPodId() { + return podId; + } + + public void setPodId(long podId) { + this.podId = podId; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDao.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDao.java new file mode 100644 index 00000000000..c640638e9ba --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDao.java @@ -0,0 +1,26 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.GenericDaoBase; + +public interface BaremetalPxeDao extends GenericDao { + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDaoImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDaoImpl.java new file mode 100644 index 00000000000..acd7f136b6d --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeDaoImpl.java @@ -0,0 +1,41 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria2; + +@Component +@Local(value = {BaremetalPxeDao.class}) +@DB(txn = false) +public class BaremetalPxeDaoImpl extends GenericDaoBase implements BaremetalPxeDao { +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeVO.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeVO.java new file mode 100644 index 00000000000..e0daa46d819 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/database/BaremetalPxeVO.java @@ -0,0 +1,115 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.database; + +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="baremetal_pxe_devices") +public class BaremetalPxeVO { + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name = "host_id") + private long hostId; + + @Column(name = "pod_id") + private long podId; + + @Column(name = "physical_network_id") + private long physicalNetworkId; + + @Column(name = "nsp_id") + private long networkServiceProviderId ; + + @Column(name = "device_type") + private String deviceType; + + public long getId() { + return id; + } + + public BaremetalPxeVO() { + uuid = UUID.randomUUID().toString(); + } + + public void setId(long id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getHostId() { + return hostId; + } + + public void setHostId(long hostId) { + this.hostId = hostId; + } + + public long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(long physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public long getNetworkServiceProviderId() { + return networkServiceProviderId; + } + + public void setNetworkServiceProviderId(long networkServiceProviderId) { + this.networkServiceProviderId = networkServiceProviderId; + } + + public long getPodId() { + return podId; + } + + public void setPodId(long podId) { + this.podId = podId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.java new file mode 100755 index 00000000000..f07b212173f --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/AddBaremetalHostCmd.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.manager; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.command.admin.host.AddHostCmd; +import org.apache.cloudstack.api.response.HostResponse; +@APICommand(name="addBaremetalHost", description="add a baremetal host", responseObject = HostResponse.class) +public class AddBaremetalHostCmd extends AddHostCmd { + + @Parameter(name=ApiConstants.IP_ADDRESS, type=CommandType.STRING, description="ip address intentionally allocated to this host after provisioning") + private String vmIpAddress; + + public AddBaremetalHostCmd() { + } + + @Override + public void execute(){ + this.getFullUrlParams().put(ApiConstants.BAREMETAL_DISCOVER_NAME, BareMetalDiscoverer.class.getName()); + super.execute(); + } + + public String getVmIpAddress() { + return vmIpAddress; + } + + public void setVmIpAddress(String vmIpAddress) { + this.vmIpAddress = vmIpAddress; + } +} diff --git a/server/src/com/cloud/baremetal/BareMetalDiscoverer.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java similarity index 78% rename from server/src/com/cloud/baremetal/BareMetalDiscoverer.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java index 7d368688783..28c83753c09 100755 --- a/server/src/com/cloud/baremetal/BareMetalDiscoverer.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalDiscoverer.java @@ -5,16 +5,22 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.manager; import java.net.InetAddress; import java.net.URI; @@ -24,13 +30,17 @@ import java.util.Map; import java.util.UUID; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.cloudstack.api.ApiConstants; import org.apache.log4j.Logger; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; -import org.apache.cloudstack.api.ApiConstants; +import com.cloud.baremetal.networkservice.BareMetalResourceBase; +import com.cloud.configuration.Config; +import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenterVO; import com.cloud.dc.dao.ClusterDao; @@ -48,7 +58,6 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; -import com.cloud.utils.component.Inject; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; import com.cloud.utils.script.Script2; @@ -59,12 +68,13 @@ import com.cloud.vm.dao.VMInstanceDao; @Local(value=Discoverer.class) public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter { - private static final Logger s_logger = Logger.getLogger(BareMetalDiscoverer.class); - @Inject ClusterDao _clusterDao; + protected static final Logger s_logger = Logger.getLogger(BareMetalDiscoverer.class); + @Inject protected ClusterDao _clusterDao; @Inject protected HostDao _hostDao; - @Inject DataCenterDao _dcDao; - @Inject VMInstanceDao _vmDao = null; - @Inject ResourceManager _resourceMgr; + @Inject protected DataCenterDao _dcDao; + @Inject protected VMInstanceDao _vmDao = null; + @Inject protected ResourceManager _resourceMgr; + @Inject protected ConfigurationDao _configDao; @Override public boolean configure(String name, Map params) throws ConfigurationException { @@ -81,6 +91,12 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R @Override public Map> find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { + + String discoverName = _params.get(ApiConstants.BAREMETAL_DISCOVER_NAME); + if (!this.getClass().getName().equals(discoverName)) { + return null; + } + Map> resources = new HashMap>(); Map details = new HashMap(); @@ -152,7 +168,20 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R params.put(ApiConstants.PRIVATE_IP, ipmiIp); params.put(ApiConstants.USERNAME, username); params.put(ApiConstants.PASSWORD, password); - BareMetalResourceBase resource = new BareMetalResourceBase(); + + String resourceClassName = _configDao.getValue(Config.ExternalBaremetalResourceClassName.key()); + BareMetalResourceBase resource = null; + if (resourceClassName != null) { + Class clazz = Class.forName(resourceClassName); + resource = (BareMetalResourceBase) clazz.newInstance(); + String externalUrl = _configDao.getValue(Config.ExternalBaremetalSystemUrl.key()); + if (externalUrl == null) { + throw new IllegalArgumentException(String.format("You must specify ExternalBaremetalSystemUrl in global config page as ExternalBaremetalResourceClassName is not null")); + } + details.put(BaremetalManager.ExternalBaremetalSystemUrl, externalUrl); + } else { + resource = new BareMetalResourceBase(); + } resource.configure("Bare Metal Agent", params); String memCapacity = (String)params.get(ApiConstants.MEMORY); @@ -169,6 +198,12 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R details.put(ApiConstants.USERNAME, username); details.put(ApiConstants.PASSWORD, password); details.put(ApiConstants.PRIVATE_IP, ipmiIp); + String vmIp = (String)params.get(ApiConstants.IP_ADDRESS); + if (vmIp != null) { + details.put(ApiConstants.IP_ADDRESS, vmIp); + } + String isEchoScAgent = _configDao.getValue(Config.EnableBaremetalSecurityGroupAgentEcho.key()); + details.put(BaremetalManager.EchoSecurityGroupAgent, isEchoScAgent); resources.put(resource, details); resource.start(); @@ -241,5 +276,13 @@ public class BareMetalDiscoverer extends DiscovererBase implements Discoverer, R return new DeleteHostAnswer(true); } + + @Override + protected HashMap buildConfigParams(HostVO host) { + HashMap params = super.buildConfigParams(host); + params.put("hostId", host.getId()); + params.put("ipaddress", host.getPrivateIpAddress()); + return params; + } } diff --git a/server/src/com/cloud/baremetal/BareMetalGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java similarity index 64% rename from server/src/com/cloud/baremetal/BareMetalGuru.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java index 9c1e0911b35..03ba3fae61b 100755 --- a/server/src/com/cloud/baremetal/BareMetalGuru.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalGuru.java @@ -5,33 +5,49 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.manager; + +import java.util.HashMap; +import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.log4j.Logger; import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.hypervisor.Hypervisor; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuru; import com.cloud.hypervisor.HypervisorGuruBase; -import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.GuestOSVO; import com.cloud.storage.dao.GuestOSDao; -import com.cloud.utils.component.Inject; +import com.cloud.vm.VMInstanceVO; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.dao.VMInstanceDao; @Local(value=HypervisorGuru.class) public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru { + private static final Logger s_logger = Logger.getLogger(BareMetalGuru.class); @Inject GuestOSDao _guestOsDao; + @Inject HostDao _hostDao; + @Inject VMInstanceDao _vmDao; protected BareMetalGuru() { super(); @@ -46,6 +62,15 @@ public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru public VirtualMachineTO implement(VirtualMachineProfile vm) { VirtualMachineTO to = toVirtualMachineTO(vm); + VMInstanceVO vo = _vmDao.findById(vm.getId()); + if (vo.getLastHostId() == null) { + to.setBootArgs(BaremetalManager.DO_PXE); + } + + Map details = new HashMap(); + details.put("template", vm.getTemplate().getUrl()); + to.setDetails(details); + // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); @@ -55,6 +80,8 @@ public class BareMetalGuru extends HypervisorGuruBase implements HypervisorGuru @Override public boolean trackVmHostChange() { - return true; + return false; } } + + diff --git a/server/src/com/cloud/deploy/BareMetalPlanner.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java similarity index 82% rename from server/src/com/cloud/deploy/BareMetalPlanner.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java index 7616a383d14..97b2840f419 100755 --- a/server/src/com/cloud/deploy/BareMetalPlanner.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalPlanner.java @@ -14,25 +14,29 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.deploy; +package com.cloud.baremetal.manager; import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; +import com.cloud.dc.*; +import com.cloud.dc.ClusterDetailsDao; import org.apache.log4j.Logger; import com.cloud.capacity.CapacityManager; import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.dc.ClusterVO; -import com.cloud.dc.DataCenter; -import com.cloud.dc.Pod; import com.cloud.dc.dao.ClusterDao; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.HostPodDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.deploy.DeploymentPlan; +import com.cloud.deploy.DeploymentPlanner; +import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.exception.InsufficientServerCapacityException; import com.cloud.host.Host; import com.cloud.host.HostVO; @@ -42,12 +46,12 @@ import com.cloud.offering.ServiceOffering; import com.cloud.org.Cluster; import com.cloud.resource.ResourceManager; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; @Local(value=DeploymentPlanner.class) -public class BareMetalPlanner implements DeploymentPlanner { +public class BareMetalPlanner extends AdapterBase implements DeploymentPlanner { private static final Logger s_logger = Logger.getLogger(BareMetalPlanner.class); @Inject protected DataCenterDao _dcDao; @Inject protected HostPodDao _podDao; @@ -56,17 +60,14 @@ public class BareMetalPlanner implements DeploymentPlanner { @Inject protected ConfigurationDao _configDao; @Inject protected CapacityManager _capacityMgr; @Inject protected ResourceManager _resourceMgr; - String _name; + @Inject protected ClusterDetailsDao _clusterDetailsDao; @Override public DeployDestination plan(VirtualMachineProfile vmProfile, DeploymentPlan plan, ExcludeList avoid) throws InsufficientServerCapacityException { VirtualMachine vm = vmProfile.getVirtualMachine(); - ServiceOffering offering = vmProfile.getServiceOffering(); + ServiceOffering offering = vmProfile.getServiceOffering(); String hostTag = null; - - String opFactor = _configDao.getValue(Config.CPUOverprovisioningFactor.key()); - float cpuOverprovisioningFactor = NumbersUtil.parseFloat(opFactor, 1); - + String haVmTag = (String)vmProfile.getParameter(VirtualMachineProfile.Param.HaTag); if (vm.getLastHostId() != null && haVmTag == null) { @@ -87,7 +88,7 @@ public class BareMetalPlanner implements DeploymentPlanner { } } - List clusters = _clusterDao.listByDcHyType(vm.getDataCenterIdToDeployIn(), HypervisorType.BareMetal.toString()); + List clusters = _clusterDao.listByDcHyType(vm.getDataCenterId(), HypervisorType.BareMetal.toString()); int cpu_requested; long ram_requested; HostVO target = null; @@ -122,7 +123,13 @@ public class BareMetalPlanner implements DeploymentPlanner { return null; } for (HostVO h : hosts) { - if (_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false, cpuOverprovisioningFactor, true)) { + long cluster_id = h.getClusterId(); + ClusterDetailsVO cluster_detail_cpu = _clusterDetailsDao.findDetail(cluster_id,"cpuOvercommitRatio") ; + ClusterDetailsVO cluster_detail_ram = _clusterDetailsDao.findDetail(cluster_id,"memoryOvercommitRatio"); + Float cpuOvercommitRatio = Float.parseFloat(cluster_detail_cpu.getValue()); + Float memoryOvercommitRatio = Float.parseFloat(cluster_detail_ram.getValue()); + + if (_capacityMgr.checkIfHostHasCapacity(h.getId(), cpu_requested, ram_requested, false, cpuOvercommitRatio, memoryOvercommitRatio, true)) { s_logger.debug("Find host " + h.getId() + " has enough capacity"); DataCenter dc = _dcDao.findById(h.getDataCenterId()); Pod pod = _podDao.findById(h.getPodId()); @@ -142,15 +149,9 @@ public class BareMetalPlanner implements DeploymentPlanner { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; return true; } - @Override - public String getName() { - return _name; - } - @Override public boolean start() { return true; diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java new file mode 100755 index 00000000000..33725f63b1c --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BareMetalTemplateAdapter.java @@ -0,0 +1,222 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.manager; + +import java.util.Date; +import java.util.List; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.api.command.user.iso.DeleteIsoCmd; +import org.apache.cloudstack.api.command.user.iso.RegisterIsoCmd; +import org.apache.cloudstack.api.command.user.template.RegisterTemplateCmd; +import org.apache.log4j.Logger; + +import com.cloud.configuration.Resource.ResourceType; +import com.cloud.dc.DataCenterVO; +import com.cloud.event.EventTypes; +import com.cloud.event.UsageEventVO; +import com.cloud.exception.ResourceAllocationException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.resource.ResourceManager; +import com.cloud.storage.TemplateProfile; +import com.cloud.storage.VMTemplateHostVO; +import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.VMTemplateZoneVO; +import com.cloud.template.TemplateAdapter; +import com.cloud.template.TemplateAdapterBase; +import com.cloud.user.Account; +import com.cloud.utils.db.DB; +import com.cloud.utils.exception.CloudRuntimeException; + +@Local(value=TemplateAdapter.class) +public class BareMetalTemplateAdapter extends TemplateAdapterBase implements TemplateAdapter { + private final static Logger s_logger = Logger.getLogger(BareMetalTemplateAdapter.class); + @Inject HostDao _hostDao; + @Inject ResourceManager _resourceMgr; + + @Override + public String getName() { + return TemplateAdapterType.BareMetal.getName(); + } + + @Override + public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException { + TemplateProfile profile = super.prepare(cmd); + + if (profile.getZoneId() == null || profile.getZoneId() == -1) { + List dcs = _dcDao.listAllIncludingRemoved(); + for (DataCenterVO dc : dcs) { + List pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, dc.getId()); + if (pxeServers.size() == 0) { + throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + dc.getName()); + } + } + } else { + List pxeServers = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, profile.getZoneId()); + if (pxeServers.size() == 0) { + throw new CloudRuntimeException("Please add PXE server before adding baremetal template in zone " + profile.getZoneId()); + } + } + + return profile; + } + + @Override + public TemplateProfile prepare(RegisterIsoCmd cmd) throws ResourceAllocationException { + throw new CloudRuntimeException("Baremetal doesn't support ISO template"); + } + + private void templateCreateUsage(VMTemplateVO template, HostVO host) { + if (template.getAccountId() != Account.ACCOUNT_ID_SYSTEM) { + UsageEventVO usageEvent = new UsageEventVO(EventTypes.EVENT_TEMPLATE_CREATE, template.getAccountId(), host.getDataCenterId(), + template.getId(), template.getName(), null, template.getSourceTemplateId(), 0L); + _usageEventDao.persist(usageEvent); + } + } + + @Override + public VMTemplateVO create(TemplateProfile profile) { + VMTemplateVO template = persistTemplate(profile); + Long zoneId = profile.getZoneId(); + + /* There is no secondary storage vm for baremetal, we use pxe server id. + * Tempalte is not bound to pxeserver right now, and we assume the pxeserver + * cannot be removed once it was added. so we use host id of first found pxe + * server as reference in template_host_ref. + * This maybe a FIXME in future. + */ + VMTemplateHostVO vmTemplateHost = null; + if (zoneId == null || zoneId == -1) { + List dcs = _dcDao.listAllIncludingRemoved(); + for (DataCenterVO dc : dcs) { + HostVO pxe = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, dc.getId()).get(0); + + vmTemplateHost = _tmpltHostDao.findByHostTemplate(dc.getId(), template.getId()); + if (vmTemplateHost == null) { + vmTemplateHost = new VMTemplateHostVO(pxe.getId(), template.getId(), new Date(), 100, + Status.DOWNLOADED, null, null, null, null, template.getUrl()); + _tmpltHostDao.persist(vmTemplateHost); + templateCreateUsage(template, pxe); + } + } + } else { + HostVO pxe = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, zoneId).get(0); + vmTemplateHost = new VMTemplateHostVO(pxe.getId(), template.getId(), new Date(), 100, + Status.DOWNLOADED, null, null, null, null, template.getUrl()); + _tmpltHostDao.persist(vmTemplateHost); + templateCreateUsage(template, pxe); + } + + _resourceLimitMgr.incrementResourceCount(profile.getAccountId(), ResourceType.template); + return template; + } + + public TemplateProfile prepareDelete(DeleteIsoCmd cmd) { + throw new CloudRuntimeException("Baremetal doesn't support ISO, how the delete get here???"); + } + + @Override @DB + public boolean delete(TemplateProfile profile) { + VMTemplateVO template = profile.getTemplate(); + Long templateId = template.getId(); + boolean success = true; + String zoneName; + boolean isAllZone; + + if (!template.isCrossZones() && profile.getZoneId() != null) { + isAllZone = false; + zoneName = profile.getZoneId().toString(); + } else { + zoneName = "all zones"; + isAllZone = true; + } + + s_logger.debug("Attempting to mark template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName); + Account account = _accountDao.findByIdIncludingRemoved(template.getAccountId()); + String eventType = EventTypes.EVENT_TEMPLATE_DELETE; + List templateHostVOs = _tmpltHostDao.listByTemplateId(templateId); + + for (VMTemplateHostVO vo : templateHostVOs) { + VMTemplateHostVO lock = null; + try { + HostVO pxeServer = _hostDao.findById(vo.getHostId()); + if (!isAllZone && pxeServer.getDataCenterId() != profile.getZoneId()) { + continue; + } + + lock = _tmpltHostDao.acquireInLockTable(vo.getId()); + if (lock == null) { + s_logger.debug("Failed to acquire lock when deleting templateHostVO with ID: " + vo.getId()); + success = false; + break; + } + + vo.setDestroyed(true); + _tmpltHostDao.update(vo.getId(), vo); + VMTemplateZoneVO templateZone = _tmpltZoneDao.findByZoneTemplate(pxeServer.getDataCenterId(), templateId); + if (templateZone != null) { + _tmpltZoneDao.remove(templateZone.getId()); + } + + UsageEventVO usageEvent = new UsageEventVO(eventType, account.getId(), pxeServer.getDataCenterId(), templateId, null); + _usageEventDao.persist(usageEvent); + } finally { + if (lock != null) { + _tmpltHostDao.releaseFromLockTable(lock.getId()); + } + } + } + + s_logger.debug("Successfully marked template host refs for template: " + template.getName() + " as destroyed in zone: " + zoneName); + + // If there are no more non-destroyed template host entries for this template, delete it + if (success && (_tmpltHostDao.listByTemplateId(templateId).size() == 0)) { + long accountId = template.getAccountId(); + + VMTemplateVO lock = _tmpltDao.acquireInLockTable(templateId); + + try { + if (lock == null) { + s_logger.debug("Failed to acquire lock when deleting template with ID: " + templateId); + success = false; + } else if (_tmpltDao.remove(templateId)) { + // Decrement the number of templates + _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.template); + } + + } finally { + if (lock != null) { + _tmpltDao.releaseFromLockTable(lock.getId()); + } + } + s_logger.debug("Removed template: " + template.getName() + " because all of its template host refs were marked as destroyed."); + } + + return success; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.java new file mode 100755 index 00000000000..6467c945795 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManager.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.manager; + +import com.cloud.network.Network.Provider; +import com.cloud.utils.component.Manager; +import com.cloud.utils.component.PluggableService; + +public interface BaremetalManager extends Manager, PluggableService { + public static final String EchoSecurityGroupAgent = "EchoSecurityGroupAgent"; + public static final String ExternalBaremetalSystemUrl = "ExternalBaremetalSystemUrl"; + public static final String DO_PXE = "doPxe"; +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java new file mode 100755 index 00000000000..b41d6ca0426 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalManagerImpl.java @@ -0,0 +1,122 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.manager; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.agent.api.StopAnswer; +import com.cloud.agent.manager.Commands; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.utils.component.ManagerBase; +import com.cloud.utils.fsm.StateListener; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineGuru; +import com.cloud.vm.VirtualMachineManager; +import com.cloud.vm.VirtualMachineName; +import com.cloud.vm.VirtualMachine.Event; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.dao.UserVmDao; +import com.cloud.vm.VirtualMachineProfile; + +@Local(value = {BaremetalManager.class}) +public class BaremetalManagerImpl extends ManagerBase implements BaremetalManager, StateListener { + private static final Logger s_logger = Logger.getLogger(BaremetalManagerImpl.class); + + @Inject + protected HostDao _hostDao; + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + VirtualMachine.State.getStateMachine().registerListener(this); + return true; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + return true; + } + + @Override + public String getName() { + return "Baremetal Manager"; + } + + @Override + public boolean preStateTransitionEvent(State oldState, Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + return false; + } + + @Override + public boolean postStateTransitionEvent(State oldState, Event event, State newState, VirtualMachine vo, boolean status, Object opaque) { + if (newState != State.Starting && newState != State.Error && newState != State.Expunging) { + return true; + } + + if (vo.getHypervisorType() != HypervisorType.BareMetal) { + return true; + } + + HostVO host = _hostDao.findById(vo.getHostId()); + if (host == null) { + s_logger.debug("Skip oldState " + oldState + " to " + "newState " + newState + " transimtion"); + return true; + } + _hostDao.loadDetails(host); + + if (newState == State.Starting) { + host.setDetail("vmName", vo.getInstanceName()); + s_logger.debug("Add vmName " + host.getDetail("vmName") + " to host " + host.getId() + " details"); + } else { + if (host.getDetail("vmName") != null && host.getDetail("vmName").equalsIgnoreCase(vo.getInstanceName())) { + s_logger.debug("Remove vmName " + host.getDetail("vmName") + " from host " + host.getId() + " details"); + host.getDetails().remove("vmName"); + } + } + _hostDao.saveDetails(host); + + + return true; + } + + @Override + public List> getCommands() { + List> cmds = new ArrayList>(); + cmds.add(AddBaremetalHostCmd.class); + return cmds; + } +} diff --git a/server/src/com/cloud/baremetal/PxeServerService.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalPlannerSelector.java old mode 100644 new mode 100755 similarity index 56% rename from server/src/com/cloud/baremetal/PxeServerService.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalPlannerSelector.java index 0a9918450f5..9daee3f3fe7 --- a/server/src/com/cloud/baremetal/PxeServerService.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/manager/BaremetalPlannerSelector.java @@ -1,35 +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.baremetal; - -import com.cloud.baremetal.PxeServerManager.PxeServerType; -import com.cloud.deploy.DeployDestination; -import com.cloud.host.Host; -import com.cloud.uservm.UserVm; -import com.cloud.utils.component.Adapter; -import com.cloud.vm.ReservationContext; -import com.cloud.vm.UserVmVO; -import com.cloud.vm.VirtualMachineProfile; - -public interface PxeServerService extends Adapter { - - public Host addPxeServer(PxeServerProfile profile); - - public boolean prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context, Long pxeServerId); - - public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl); -} +// 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.baremetal.manager; + +import java.util.Map; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; + +import com.cloud.deploy.AbstractDeployPlannerSelector; +import com.cloud.deploy.DeployPlannerSelector; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.vm.UserVmVO; +@Local(value = {DeployPlannerSelector.class}) +public class BaremetalPlannerSelector extends AbstractDeployPlannerSelector{ + + @Override + public String selectPlanner(UserVmVO vm) { + if (vm.getHypervisorType() == HypervisorType.BareMetal) { + return "BareMetalPlanner"; + } + return null; + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalDhcpCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalDhcpCmd.java new file mode 100755 index 00000000000..c74983222f2 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalDhcpCmd.java @@ -0,0 +1,153 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +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.BaseCmd.CommandType; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.log4j.Logger; + +import com.cloud.baremetal.database.BaremetalDhcpVO; +import com.cloud.event.EventTypes; +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; +import com.cloud.user.UserContext; +@APICommand(name="addBaremetalDhcp", description="adds a baremetal dhcp server", responseObject = BaremetalDhcpResponse.class) +public class AddBaremetalDhcpCmd extends BaseAsyncCmd { + private static final String s_name = "addexternaldhcpresponse"; + public static final Logger s_logger = Logger.getLogger(AddBaremetalDhcpCmd.class); + + @Inject BaremetalDhcpManager mgr; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType=PhysicalNetworkResponse.class, required=true, description="the Physical Network ID") + private Long physicalNetworkId; + + @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, required = true, description="Pod Id") + private Long podId; + + @Parameter(name=ApiConstants.DHCP_SERVER_TYPE, type=CommandType.STRING, required = true, description="Type of dhcp device") + private String dhcpType; + + @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the external dhcp appliance.") + private String url; + + @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Credentials to reach external dhcp device") + private String username; + + @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to reach external dhcp device") + private String password; + + @Override + public String getEventType() { + return EventTypes.EVENT_BAREMETAL_DHCP_SERVER_ADD; + } + + @Override + public String getEventDescription() { + return "Adding an external DHCP server"; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + BaremetalDhcpVO vo = mgr.addDchpServer(this); + BaremetalDhcpResponse response = mgr.generateApiResponse(vo); + response.setObjectName(s_name); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (Exception e) { + s_logger.warn("Unable to add external dhcp server with url: " + getUrl(), e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return UserContext.current().getCaller().getId(); + } + + public Long getPodId() { + return podId; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + public String getDhcpType() { + return dhcpType; + } + + public void setDhcpType(String dhcpType) { + this.dhcpType = dhcpType; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public Long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(Long physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalKickStartPxeCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalKickStartPxeCmd.java new file mode 100755 index 00000000000..596a86dac8f --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalKickStartPxeCmd.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd.CommandType; +import org.apache.cloudstack.api.Parameter; +@APICommand(name="addBaremetalPxeKickStartServer", description="add a baremetal pxe server", responseObject = BaremetalPxeKickStartResponse.class) +public class AddBaremetalKickStartPxeCmd extends AddBaremetalPxeCmd { + @Parameter(name=ApiConstants.TFTP_DIR, type=CommandType.STRING, required = true, description="Tftp root directory of PXE server") + private String tftpDir; + + public String getTftpDir() { + return tftpDir; + } + + public void setTftpDir(String tftpDir) { + this.tftpDir = tftpDir; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxeCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxeCmd.java new file mode 100755 index 00000000000..63e11478e4c --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxeCmd.java @@ -0,0 +1,147 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +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.BaseCmd.CommandType; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.cloudstack.api.response.PodResponse; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.log4j.Logger; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.event.EventTypes; +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; +import com.cloud.user.UserContext; +public class AddBaremetalPxeCmd extends BaseAsyncCmd { + private static final String s_name = "addexternalpxeresponse"; + public static final Logger s_logger = Logger.getLogger(AddBaremetalPxeCmd.class); + + @Inject BaremetalPxeManager pxeMgr; + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType=PhysicalNetworkResponse.class, required=true, description="the Physical Network ID") + private Long physicalNetworkId; + + @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, description="Pod Id") + private Long podId; + + @Parameter(name=ApiConstants.URL, type=CommandType.STRING, required = true, description="URL of the external pxe device") + private String url; + + @Parameter(name=ApiConstants.PXE_SERVER_TYPE, type=CommandType.STRING, required = true, description="type of pxe device") + private String deviceType; + + @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required = true, description="Credentials to reach external pxe device") + private String username; + + @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, required = true, description="Credentials to reach external pxe device") + private String password; + + @Override + public String getEventType() { + return EventTypes.EVENT_BAREMETAL_PXE_SERVER_ADD; + } + + @Override + public String getEventDescription() { + return "Adding an external pxe server"; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + BaremetalPxeVO vo = pxeMgr.addPxeServer(this); + } catch (Exception e) { + s_logger.warn("Unable to add external pxe server with url: " + getUrl(), e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return UserContext.current().getCaller().getId(); + } + + public Long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(Long physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public Long getPodId() { + return podId; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxePingServerCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxePingServerCmd.java new file mode 100755 index 00000000000..01cafd435da --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/AddBaremetalPxePingServerCmd.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.Parameter; + +@APICommand(name="addBaremetalPxePingServer", description="add a baremetal ping pxe server", responseObject = BaremetalPxePingResponse.class) +public class AddBaremetalPxePingServerCmd extends AddBaremetalPxeCmd { + + @Parameter(name=ApiConstants.PING_STORAGE_SERVER_IP, type=CommandType.STRING, required = true, description="PING storage server ip") + private String pingStorageServerIp; + + @Parameter(name=ApiConstants.PING_DIR, type=CommandType.STRING, required = true, description="Root directory on PING storage server") + private String pingDir; + + @Parameter(name=ApiConstants.TFTP_DIR, type=CommandType.STRING, required = true, description="Tftp root directory of PXE server") + private String tftpDir; + + @Parameter(name=ApiConstants.PING_CIFS_USERNAME, type=CommandType.STRING, description="Username of PING storage server") + private String pingStorageServerUserName; + + @Parameter(name=ApiConstants.PING_CIFS_PASSWORD, type=CommandType.STRING, description="Password of PING storage server") + private String pingStorageServerPassword; + + public String getPingStorageServerIp() { + return pingStorageServerIp; + } + + public void setPingStorageServerIp(String pingStorageServerIp) { + this.pingStorageServerIp = pingStorageServerIp; + } + + public String getPingDir() { + return pingDir; + } + + public void setPingDir(String pingDir) { + this.pingDir = pingDir; + } + + public String getTftpDir() { + return tftpDir; + } + + public void setTftpDir(String tftpDir) { + this.tftpDir = tftpDir; + } + + public String getPingStorageServerUserName() { + return pingStorageServerUserName; + } + + public void setPingStorageServerUserName(String pingStorageServerUserName) { + this.pingStorageServerUserName = pingStorageServerUserName; + } + + public String getPingStorageServerPassword() { + return pingStorageServerPassword; + } + + public void setPingStorageServerPassword(String pingStorageServerPassword) { + this.pingStorageServerPassword = pingStorageServerPassword; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java new file mode 100755 index 00000000000..d6b96a81807 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPingServiceImpl.java @@ -0,0 +1,306 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev; +import com.cloud.agent.api.baremetal.PreparePxeServerAnswer; +import com.cloud.agent.api.baremetal.PreparePxeServerCommand; +import com.cloud.agent.api.baremetal.prepareCreateTemplateCommand; +import com.cloud.baremetal.database.BaremetalPxeDao; +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.baremetal.networkservice.BaremetalPxeManager.BaremetalPxeType; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.deploy.DeployDestination; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDetailsDao; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.resource.ResourceManager; +import com.cloud.resource.ServerResource; +import com.cloud.uservm.UserVm; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.NicVO; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachineProfile; + +@Local(value=BaremetalPxeService.class) +public class BareMetalPingServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService { + private static final Logger s_logger = Logger.getLogger(BareMetalPingServiceImpl.class); + @Inject ResourceManager _resourceMgr; + @Inject PhysicalNetworkDao _physicalNetworkDao; + @Inject PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; + @Inject HostDetailsDao _hostDetailsDao; + @Inject BaremetalPxeDao _pxeDao; + + + @Override + public boolean prepare(VirtualMachineProfile profile, NicProfile pxeNic, DeployDestination dest, ReservationContext context) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString()); + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, dest.getPod().getId()); + BaremetalPxeVO pxeVo = sc.find(); + if (pxeVo == null) { + throw new CloudRuntimeException("No PING PXE server found in pod: " + dest.getPod().getId() + ", you need to add it before starting VM"); + } + long pxeServerId = pxeVo.getHostId(); + + String mac = pxeNic.getMacAddress(); + String ip = pxeNic.getIp4Address(); + String gateway = pxeNic.getGateway(); + String mask = pxeNic.getNetmask(); + String dns = pxeNic.getDns1(); + if (dns == null) { + dns = pxeNic.getDns2(); + } + + try { + String tpl = profile.getTemplate().getUrl(); + assert tpl != null : "How can a null template get here!!!"; + PreparePxeServerCommand cmd = new PreparePxeServerCommand(ip, mac, mask, gateway, dns, tpl, + profile.getVirtualMachine().getInstanceName(), dest.getHost().getName()); + PreparePxeServerAnswer ans = (PreparePxeServerAnswer) _agentMgr.send(pxeServerId, cmd); + if (!ans.getResult()) { + s_logger.warn("Unable tot program PXE server: " + pxeVo.getId() + " because " + ans.getDetails()); + return false; + } + + IpmISetBootDevCommand bootCmd = new IpmISetBootDevCommand(BootDev.pxe); + Answer anw = _agentMgr.send(dest.getHost().getId(), bootCmd); + if (!anw.getResult()) { + s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + anw.getDetails()); + } + + return anw.getResult(); + } catch (Exception e) { + s_logger.warn("Cannot prepare PXE server", e); + return false; + } + } + + + @Override + public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) { + List nics = _nicDao.listByVmId(vm.getId()); + if (nics.size() != 1) { + throw new CloudRuntimeException("Wrong nic number " + nics.size() + " of vm " + vm.getId()); + } + + /* use last host id when VM stopped */ + Long hostId = (vm.getHostId() == null ? vm.getLastHostId() : vm.getHostId()); + HostVO host = _hostDao.findById(hostId); + DataCenterVO dc = _dcDao.findById(host.getDataCenterId()); + NicVO nic = nics.get(0); + String mask = nic.getNetmask(); + String mac = nic.getMacAddress(); + String ip = nic.getIp4Address(); + String gateway = nic.getGateway(); + String dns = dc.getDns1(); + if (dns == null) { + dns = dc.getDns2(); + } + + try { + prepareCreateTemplateCommand cmd = new prepareCreateTemplateCommand(ip, mac, mask, gateway, dns, templateUrl); + Answer ans = _agentMgr.send(pxeServerId, cmd); + return ans.getResult(); + } catch (Exception e) { + s_logger.debug("Prepare for creating baremetal template failed", e); + return false; + } + } + + + @Override + @DB + public BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd) { + AddBaremetalPxePingServerCmd pcmd = (AddBaremetalPxePingServerCmd)cmd; + + PhysicalNetworkVO pNetwork = null; + long zoneId; + + if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) { + throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null"); + } + + pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId()); + if (pNetwork == null) { + throw new IllegalArgumentException("Could not find phyical network with ID: " + cmd.getPhysicalNetworkId()); + } + zoneId = pNetwork.getDataCenterId(); + + PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName()); + if (ntwkSvcProvider == null) { + throw new CloudRuntimeException("Network Service Provider: " + BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName() + + " is not enabled in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device"); + } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { + throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + + " is in shutdown state in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device"); + } + + HostPodVO pod = _podDao.findById(cmd.getPodId()); + if (pod == null) { + throw new IllegalArgumentException("Could not find pod with ID: " + cmd.getPodId()); + } + + List pxes = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalPxe, null, cmd.getPodId(), zoneId); + if (pxes.size() != 0) { + throw new IllegalArgumentException("Already had a PXE server in Pod: " + cmd.getPodId() + " zone: " + zoneId); + } + + String storageServerIp = pcmd.getPingStorageServerIp(); + if (storageServerIp == null) { + throw new IllegalArgumentException("No IP for storage server specified"); + } + String pingDir = pcmd.getPingDir(); + if (pingDir == null) { + throw new IllegalArgumentException("No direcotry for storage server specified"); + } + String tftpDir = pcmd.getTftpDir(); + if (tftpDir == null) { + throw new IllegalArgumentException("No TFTP directory specified"); + } + + String cifsUsername = pcmd.getPingStorageServerUserName(); + if (cifsUsername == null || cifsUsername.equalsIgnoreCase("")) { + cifsUsername = "xxx"; + } + String cifsPassword = pcmd.getPingStorageServerPassword(); + if (cifsPassword == null || cifsPassword.equalsIgnoreCase("")) { + cifsPassword = "xxx"; + } + + + URI uri; + try { + uri = new URI(cmd.getUrl()); + } catch (Exception e) { + s_logger.debug(e); + throw new IllegalArgumentException(e.getMessage()); + } + String ipAddress = uri.getHost(); + + String guid = getPxeServerGuid(Long.toString(zoneId) + "-" + pod.getId(), BaremetalPxeType.PING.toString(), ipAddress); + + ServerResource resource = null; + Map params = new HashMap(); + params.put(BaremetalPxeService.PXE_PARAM_ZONE, Long.toString(zoneId)); + params.put(BaremetalPxeService.PXE_PARAM_POD, String.valueOf(pod.getId())); + params.put(BaremetalPxeService.PXE_PARAM_IP, ipAddress); + params.put(BaremetalPxeService.PXE_PARAM_USERNAME, cmd.getUsername()); + params.put(BaremetalPxeService.PXE_PARAM_PASSWORD, cmd.getPassword()); + params.put(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_IP, storageServerIp); + params.put(BaremetalPxeService.PXE_PARAM_PING_ROOT_DIR, pingDir); + params.put(BaremetalPxeService.PXE_PARAM_TFTP_DIR, tftpDir); + params.put(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_USERNAME, cifsUsername); + params.put(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_PASSWORD, cifsPassword); + params.put(BaremetalPxeService.PXE_PARAM_GUID, guid); + + resource = new BaremetalPingPxeResource(); + try { + resource.configure("PING PXE resource", params); + } catch (Exception e) { + s_logger.debug(e); + throw new CloudRuntimeException(e.getMessage()); + } + + Host pxeServer = _resourceMgr.addHost(zoneId, resource, Host.Type.BaremetalPxe, params); + if (pxeServer == null) { + throw new CloudRuntimeException("Cannot add PXE server as a host"); + } + + BaremetalPxeVO vo = new BaremetalPxeVO(); + Transaction txn = Transaction.currentTxn(); + vo.setHostId(pxeServer.getId()); + vo.setNetworkServiceProviderId(ntwkSvcProvider.getId()); + vo.setPodId(pod.getId()); + vo.setPhysicalNetworkId(pcmd.getPhysicalNetworkId()); + vo.setDeviceType(BaremetalPxeType.PING.toString()); + txn.start(); + _pxeDao.persist(vo); + txn.commit(); + return vo; + } + + @Override + public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) { + BaremetalPxePingResponse response = new BaremetalPxePingResponse(); + response.setId(String.valueOf(vo.getId())); + response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId())); + response.setPodId(String.valueOf(vo.getPodId())); + Map details = _hostDetailsDao.findDetails(vo.getHostId()); + response.setPingStorageServerIp(details.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_IP)); + response.setPingDir(details.get(BaremetalPxeService.PXE_PARAM_PING_ROOT_DIR)); + response.setTftpDir(details.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR)); + return response; + } + + + @Override + public List listPxeServers(ListBaremetalPxePingServersCmd cmd) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.PING.toString()); + if (cmd.getPodId() != null) { + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId()); + if (cmd.getId() != null) { + sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId()); + } + } + List vos = sc.list(); + List responses = new ArrayList(vos.size()); + for (BaremetalPxeVO vo : vos) { + responses.add(getApiResponse(vo)); + } + return responses; + } + + + @Override + public String getPxeServiceType() { + return BaremetalPxeManager.BaremetalPxeType.PING.toString(); + } +} diff --git a/server/src/com/cloud/baremetal/BareMetalPxeServiceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPxeServiceBase.java similarity index 54% rename from server/src/com/cloud/baremetal/BareMetalPxeServiceBase.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPxeServiceBase.java index 8498c301067..cd1ada9f474 100644 --- a/server/src/com/cloud/baremetal/BareMetalPxeServiceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalPxeServiceBase.java @@ -5,74 +5,43 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.util.Map; +import javax.inject.Inject; import javax.naming.ConfigurationException; import com.cloud.agent.AgentManager; import com.cloud.dc.dao.DataCenterDao; import com.cloud.dc.dao.HostPodDao; -import com.cloud.deploy.DeployDestination; -import com.cloud.host.Host; import com.cloud.host.dao.HostDao; -import com.cloud.utils.component.Inject; -import com.cloud.utils.exception.CloudRuntimeException; -import com.cloud.vm.ReservationContext; -import com.cloud.vm.UserVmVO; -import com.cloud.vm.VirtualMachineProfile; +import com.cloud.utils.component.ManagerBase; import com.cloud.vm.dao.NicDao; -public abstract class BareMetalPxeServiceBase implements PxeServerService { - protected String _name; +public abstract class BareMetalPxeServiceBase extends ManagerBase implements BaremetalPxeService { @Inject DataCenterDao _dcDao; @Inject HostDao _hostDao; @Inject AgentManager _agentMgr; - @Inject ExternalDhcpManager exDhcpMgr; @Inject HostPodDao _podDao; @Inject NicDao _nicDao; - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; - return true; - } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - - - @Override - public boolean prepare(VirtualMachineProfile profile, DeployDestination dest, ReservationContext context, Long pxeServerId) { - throw new CloudRuntimeException("Dervied class should implement this method"); - } - protected String getPxeServerGuid(String zoneId, String name, String ip) { return zoneId + "-" + name + "-" + ip; } - - @Override - public abstract Host addPxeServer(PxeServerProfile profile); } diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java new file mode 100755 index 00000000000..4c99f6bf544 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BareMetalResourceBase.java @@ -0,0 +1,618 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.log4j.Logger; + +import com.cloud.agent.IAgentControl; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.CheckNetworkAnswer; +import com.cloud.agent.api.CheckNetworkCommand; +import com.cloud.agent.api.CheckVirtualMachineAnswer; +import com.cloud.agent.api.CheckVirtualMachineCommand; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.MaintainAnswer; +import com.cloud.agent.api.MaintainCommand; +import com.cloud.agent.api.MigrateAnswer; +import com.cloud.agent.api.MigrateCommand; +import com.cloud.agent.api.PingCommand; +import com.cloud.agent.api.PingRoutingCommand; +import com.cloud.agent.api.PrepareForMigrationAnswer; +import com.cloud.agent.api.PrepareForMigrationCommand; +import com.cloud.agent.api.ReadyAnswer; +import com.cloud.agent.api.ReadyCommand; +import com.cloud.agent.api.RebootAnswer; +import com.cloud.agent.api.RebootCommand; +import com.cloud.agent.api.SecurityGroupRulesCmd; +import com.cloud.agent.api.StartAnswer; +import com.cloud.agent.api.StartCommand; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.StartupRoutingCommand; +import com.cloud.agent.api.StopAnswer; +import com.cloud.agent.api.StopCommand; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev; +import com.cloud.agent.api.baremetal.IpmiBootorResetCommand; +import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.baremetal.manager.BaremetalManager; +import com.cloud.host.Host.Type; +import com.cloud.hypervisor.Hypervisor; +import com.cloud.resource.ServerResource; +import com.cloud.server.ManagementServer; +import com.cloud.utils.component.ComponentContext; +import com.cloud.utils.component.ManagerBase; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.OutputInterpreter; +import com.cloud.utils.script.Script; +import com.cloud.utils.script.Script2; +import com.cloud.utils.script.Script2.ParamType; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.dao.VMInstanceDao; + +import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit; + +@Local(value = ServerResource.class) +public class BareMetalResourceBase extends ManagerBase implements ServerResource { + private static final Logger s_logger = Logger.getLogger(BareMetalResourceBase.class); + protected HashMap _vms = new HashMap(2); + protected String _name; + protected String _uuid; + protected String _zone; + protected String _pod; + protected Long hostId; + protected String _cluster; + protected long _memCapacity; + protected long _cpuCapacity; + protected long _cpuNum; + protected String _mac; + protected String _username; + protected String _password; + protected String _ip; + protected boolean _isEchoScAgent; + protected IAgentControl _agentControl; + protected Script2 _pingCommand; + protected Script2 _setPxeBootCommand; + protected Script2 _setDiskBootCommand; + protected Script2 _rebootCommand; + protected Script2 _getStatusCommand; + protected Script2 _powerOnCommand; + protected Script2 _powerOffCommand; + protected Script2 _forcePowerOffCommand; + protected Script2 _bootOrRebootCommand; + protected String _vmName; + protected VMInstanceDao vmDao; + + private void changeVmState(String vmName, VirtualMachine.State state) { + synchronized (_vms) { + _vms.put(vmName, state); + } + } + + private State removeVmState(String vmName) { + synchronized (_vms) { + return _vms.remove(vmName); + } + } + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + _name = name; + _uuid = (String) params.get("guid"); + try { + _memCapacity = Long.parseLong((String) params.get(ApiConstants.MEMORY)) * 1024L * 1024L; + _cpuCapacity = Long.parseLong((String) params.get(ApiConstants.CPU_SPEED)); + _cpuNum = Long.parseLong((String) params.get(ApiConstants.CPU_NUMBER)); + } catch (NumberFormatException e) { + throw new ConfigurationException(String.format("Unable to parse number of CPU or memory capacity " + + "or cpu capacity(cpu number = %1$s memCapacity=%2$s, cpuCapacity=%3$s", (String) params.get(ApiConstants.CPU_NUMBER), + (String) params.get(ApiConstants.MEMORY), (String) params.get(ApiConstants.CPU_SPEED))); + } + + _zone = (String) params.get("zone"); + _pod = (String) params.get("pod"); + _cluster = (String) params.get("cluster"); + hostId = (Long) params.get("hostId"); + _ip = (String) params.get(ApiConstants.PRIVATE_IP); + _mac = (String) params.get(ApiConstants.HOST_MAC); + _username = (String) params.get(ApiConstants.USERNAME); + _password = (String) params.get(ApiConstants.PASSWORD); + _vmName = (String) params.get("vmName"); + String echoScAgent = (String) params.get(BaremetalManager.EchoSecurityGroupAgent); + + if (_pod == null) { + throw new ConfigurationException("Unable to get the pod"); + } + + if (_cluster == null) { + throw new ConfigurationException("Unable to get the pod"); + } + + if (_ip == null) { + throw new ConfigurationException("Unable to get the host address"); + } + + if (_mac.equalsIgnoreCase("unknown")) { + throw new ConfigurationException("Unable to get the host mac address"); + } + + if (_mac.split(":").length != 6) { + throw new ConfigurationException("Wrong MAC format(" + _mac + + "). It must be in format of for example 00:11:ba:33:aa:dd which is not case sensitive"); + } + + if (_uuid == null) { + throw new ConfigurationException("Unable to get the uuid"); + } + + if (echoScAgent != null) { + _isEchoScAgent = Boolean.valueOf(echoScAgent); + } + + String injectScript = "scripts/util/ipmi.py"; + String scriptPath = Script.findScript("", injectScript); + if (scriptPath == null) { + throw new ConfigurationException("Cannot find ping script " + scriptPath); + } + _pingCommand = new Script2(scriptPath, s_logger); + _pingCommand.add("ping"); + _pingCommand.add("hostname=" + _ip); + _pingCommand.add("usrname=" + _username); + _pingCommand.add("password=" + _password, ParamType.PASSWORD); + + _setPxeBootCommand = new Script2(scriptPath, s_logger); + _setPxeBootCommand.add("boot_dev"); + _setPxeBootCommand.add("hostname=" + _ip); + _setPxeBootCommand.add("usrname=" + _username); + _setPxeBootCommand.add("password=" + _password, ParamType.PASSWORD); + _setPxeBootCommand.add("dev=pxe"); + + _setDiskBootCommand = new Script2(scriptPath, s_logger); + _setDiskBootCommand.add("boot_dev"); + _setDiskBootCommand.add("hostname=" + _ip); + _setDiskBootCommand.add("usrname=" + _username); + _setDiskBootCommand.add("password=" + _password, ParamType.PASSWORD); + _setDiskBootCommand.add("dev=disk"); + + _rebootCommand = new Script2(scriptPath, s_logger); + _rebootCommand.add("reboot"); + _rebootCommand.add("hostname=" + _ip); + _rebootCommand.add("usrname=" + _username); + _rebootCommand.add("password=" + _password, ParamType.PASSWORD); + + _getStatusCommand = new Script2(scriptPath, s_logger); + _getStatusCommand.add("ping"); + _getStatusCommand.add("hostname=" + _ip); + _getStatusCommand.add("usrname=" + _username); + _getStatusCommand.add("password=" + _password, ParamType.PASSWORD); + + _powerOnCommand = new Script2(scriptPath, s_logger); + _powerOnCommand.add("power"); + _powerOnCommand.add("hostname=" + _ip); + _powerOnCommand.add("usrname=" + _username); + _powerOnCommand.add("password=" + _password, ParamType.PASSWORD); + _powerOnCommand.add("action=on"); + + _powerOffCommand = new Script2(scriptPath, s_logger); + _powerOffCommand.add("power"); + _powerOffCommand.add("hostname=" + _ip); + _powerOffCommand.add("usrname=" + _username); + _powerOffCommand.add("password=" + _password, ParamType.PASSWORD); + _powerOffCommand.add("action=soft"); + + _forcePowerOffCommand = new Script2(scriptPath, s_logger); + _forcePowerOffCommand.add("power"); + _forcePowerOffCommand.add("hostname=" + _ip); + _forcePowerOffCommand.add("usrname=" + _username); + _forcePowerOffCommand.add("password=" + _password, ParamType.PASSWORD); + _forcePowerOffCommand.add("action=off"); + + _bootOrRebootCommand = new Script2(scriptPath, s_logger); + _bootOrRebootCommand.add("boot_or_reboot"); + _bootOrRebootCommand.add("hostname=" + _ip); + _bootOrRebootCommand.add("usrname=" + _username); + _bootOrRebootCommand.add("password=" + _password, ParamType.PASSWORD); + + return true; + } + + protected boolean doScript(Script cmd) { + return doScript(cmd, null); + } + + protected boolean doScript(Script cmd, OutputInterpreter interpreter) { + int retry = 5; + String res = null; + while (retry-- > 0) { + if (interpreter == null) { + res = cmd.execute(); + } else { + res = cmd.execute(interpreter); + } + if (res != null && res.startsWith("Error: Unable to establish LAN")) { + s_logger.warn("IPMI script timeout(" + cmd.toString() + "), will retry " + retry + " times"); + continue; + } else if (res == null) { + return true; + } else { + break; + } + } + + s_logger.warn("IPMI Scirpt failed due to " + res + "(" + cmd.toString() + ")"); + return false; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + return true; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Type getType() { + return com.cloud.host.Host.Type.Routing; + } + + protected State getVmState() { + OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser(); + if (!doScript(_getStatusCommand, interpreter)) { + s_logger.warn("Cannot get power status of " + _name + ", assume VM state was not changed"); + return null; + } + if (isPowerOn(interpreter.getLines())) { + return State.Running; + } else { + return State.Stopped; + } + } + + protected Map fullSync() { + Map states = new HashMap(); + if (hostId != null) { + vmDao = ComponentContext.getComponent(VMInstanceDao.class); + final List vms = vmDao.listByHostId(hostId); + for (VMInstanceVO vm : vms) { + states.put(vm.getInstanceName(), vm.getState()); + } + } + /* + * Map changes = new HashMap(); + * + * if (_vmName != null) { State state = getVmState(); if (state != null) + * { changes.put(_vmName, state); } } + */ + + return states; + } + + @Override + public StartupCommand[] initialize() { + StartupRoutingCommand cmd = new StartupRoutingCommand(0, 0, 0, 0, null, Hypervisor.HypervisorType.BareMetal, new HashMap(), null); + cmd.setDataCenter(_zone); + cmd.setPod(_pod); + cmd.setCluster(_cluster); + cmd.setGuid(_uuid); + cmd.setName(_ip); + cmd.setPrivateIpAddress(_ip); + cmd.setStorageIpAddress(_ip); + cmd.setVersion(BareMetalResourceBase.class.getPackage().getImplementationVersion()); + cmd.setCpus((int) _cpuNum); + cmd.setSpeed(_cpuCapacity); + cmd.setMemory(_memCapacity); + cmd.setPrivateMacAddress(_mac); + cmd.setPublicMacAddress(_mac); + cmd.setStateChanges(fullSync()); + return new StartupCommand[] { cmd }; + } + + private boolean ipmiPing() { + return doScript(_pingCommand); + } + + @Override + public PingCommand getCurrentStatus(long id) { + try { + if (!ipmiPing()) { + Thread.sleep(1000); + if (!ipmiPing()) { + s_logger.warn("Cannot ping ipmi nic " + _ip); + return null; + } + } + } catch (Exception e) { + s_logger.debug("Cannot ping ipmi nic " + _ip, e); + return null; + } + + return new PingRoutingCommand(getType(), id, deltaSync()); + } + + protected Answer execute(IpmISetBootDevCommand cmd) { + Script bootCmd = null; + if (cmd.getBootDev() == BootDev.disk) { + bootCmd = _setDiskBootCommand; + } else if (cmd.getBootDev() == BootDev.pxe) { + bootCmd = _setPxeBootCommand; + } else { + throw new CloudRuntimeException("Unkonwn boot dev " + cmd.getBootDev()); + } + + String bootDev = cmd.getBootDev().name(); + if (!doScript(bootCmd)) { + s_logger.warn("Set " + _ip + " boot dev to " + bootDev + "failed"); + return new Answer(cmd, false, "Set " + _ip + " boot dev to " + bootDev + "failed"); + } + + s_logger.warn("Set " + _ip + " boot dev to " + bootDev + "Success"); + return new Answer(cmd, true, "Set " + _ip + " boot dev to " + bootDev + "Success"); + } + + protected MaintainAnswer execute(MaintainCommand cmd) { + return new MaintainAnswer(cmd, false); + } + + protected PrepareForMigrationAnswer execute(PrepareForMigrationCommand cmd) { + return new PrepareForMigrationAnswer(cmd); + } + + protected MigrateAnswer execute(MigrateCommand cmd) { + if (!doScript(_powerOffCommand)) { + return new MigrateAnswer(cmd, false, "IPMI power off failed", null); + } + return new MigrateAnswer(cmd, true, "success", null); + } + + protected CheckVirtualMachineAnswer execute(final CheckVirtualMachineCommand cmd) { + return new CheckVirtualMachineAnswer(cmd, State.Stopped, null); + } + + protected Answer execute(IpmiBootorResetCommand cmd) { + if (!doScript(_bootOrRebootCommand)) { + return new Answer(cmd, false, "IPMI boot or reboot failed"); + } + return new Answer(cmd, true, "Success"); + + } + + protected CheckNetworkAnswer execute(CheckNetworkCommand cmd) { + return new CheckNetworkAnswer(cmd, true, "Success"); + } + + protected Answer execute(SecurityGroupRulesCmd cmd) { + SecurityGroupHttpClient hc = new SecurityGroupHttpClient(); + return hc.call(cmd.getGuestIp(), cmd); + } + + @Override + public Answer executeRequest(Command cmd) { + try { + if (cmd instanceof ReadyCommand) { + return execute((ReadyCommand) cmd); + } else if (cmd instanceof StartCommand) { + return execute((StartCommand) cmd); + } else if (cmd instanceof StopCommand) { + return execute((StopCommand) cmd); + } else if (cmd instanceof RebootCommand) { + return execute((RebootCommand) cmd); + } else if (cmd instanceof IpmISetBootDevCommand) { + return execute((IpmISetBootDevCommand) cmd); + } else if (cmd instanceof MaintainCommand) { + return execute((MaintainCommand) cmd); + } else if (cmd instanceof PrepareForMigrationCommand) { + return execute((PrepareForMigrationCommand) cmd); + } else if (cmd instanceof MigrateCommand) { + return execute((MigrateCommand) cmd); + } else if (cmd instanceof CheckVirtualMachineCommand) { + return execute((CheckVirtualMachineCommand) cmd); + } else if (cmd instanceof IpmiBootorResetCommand) { + return execute((IpmiBootorResetCommand) cmd); + } else if (cmd instanceof SecurityGroupRulesCmd) { + return execute((SecurityGroupRulesCmd) cmd); + } else if (cmd instanceof CheckNetworkCommand) { + return execute((CheckNetworkCommand) cmd); + } else { + return Answer.createUnsupportedCommandAnswer(cmd); + } + } catch (Throwable t) { + s_logger.debug(t.getMessage(), t); + return new Answer(cmd, false, t.getMessage()); + } + } + + protected boolean isPowerOn(String str) { + if (str.startsWith("Chassis Power is on")) { + return true; + } else if (str.startsWith("Chassis Power is off")) { + return false; + } else { + throw new CloudRuntimeException("Cannot parse IPMI power status " + str); + } + } + + protected RebootAnswer execute(final RebootCommand cmd) { + if (!doScript(_rebootCommand)) { + return new RebootAnswer(cmd, "IPMI reboot failed", false); + } + + return new RebootAnswer(cmd, "reboot succeeded", true); + } + + protected StopAnswer execute(final StopCommand cmd) { + boolean success = false; + int count = 0; + Script powerOff = _powerOffCommand; + + while (count < 10) { + if (!doScript(powerOff)) { + break; + } + + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + break; + } + + OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser(); + if (!doScript(_getStatusCommand, interpreter)) { + s_logger.warn("Cannot get power status of " + _name + ", assume VM state was not changed"); + break; + } + + if (!isPowerOn(interpreter.getLines())) { + success = true; + break; + } else { + powerOff = _forcePowerOffCommand; + } + + count++; + } + + return success ? new StopAnswer(cmd, "Success", 0, true) : new StopAnswer(cmd, "IPMI power off failed", false); + } + + protected StartAnswer execute(StartCommand cmd) { + VirtualMachineTO vm = cmd.getVirtualMachine(); + State state = State.Stopped; + + try { + changeVmState(vm.getName(), State.Starting); + + OutputInterpreter.AllLinesParser interpreter = new OutputInterpreter.AllLinesParser(); + if (!doScript(_getStatusCommand, interpreter)) { + return new StartAnswer(cmd, "Cannot get current power status of " + _name); + } + + if (isPowerOn(interpreter.getLines())) { + if (!doScript(_rebootCommand)) { + return new StartAnswer(cmd, "IPMI reboot failed"); + } + } else { + if (!doScript(_powerOnCommand)) { + return new StartAnswer(cmd, "IPMI power on failed"); + } + } + + if (_isEchoScAgent) { + SecurityGroupHttpClient hc = new SecurityGroupHttpClient(); + boolean echoRet = hc.echo(vm.getNics()[0].getIp(), TimeUnit.MINUTES.toMillis(30), TimeUnit.MINUTES.toMillis(1)); + if (!echoRet) { + return new StartAnswer(cmd, String.format("Call security group agent on vm[%s] timeout", vm.getNics()[0].getIp())); + } + } + + s_logger.debug("Start bare metal vm " + vm.getName() + "successfully"); + state = State.Running; + _vmName = vm.getName(); + return new StartAnswer(cmd); + } finally { + if (state != State.Stopped) { + changeVmState(vm.getName(), state); + } else { + removeVmState(vm.getName()); + } + } + } + + protected HashMap deltaSync() { + final HashMap changes = new HashMap(); + /* + * Disable sync until we find a way that only tracks status but not does + * action + * + * The scenario is: Baremetal will reboot host when creating template. + * Given most servers take a long time to boot up, there would be a + * period that mgmt server finds the host is stopped through fullsync. + * Then mgmt server updates database with marking the host as stopped, + * after that, the host comes up and full sync then indicates it's + * running. Because in database the host is already stopped, mgmt server + * sends out a stop command. As a result, creating image gets never + * happened. + * + * if (_vmName == null) { return null; } + * + * State newState = getVmState(); if (newState == null) { + * s_logger.warn("Cannot get power state of VM " + _vmName); return + * null; } + * + * final State oldState = removeVmState(_vmName); if (oldState == null) + * { changeVmState(_vmName, newState); changes.put(_vmName, newState); } + * else if (oldState == State.Starting) { if (newState == State.Running) + * { changeVmState(_vmName, newState); } else if (newState == + * State.Stopped) { s_logger.debug("Ignoring vm " + _vmName + + * " because of a lag in starting the vm."); } } else if (oldState == + * State.Migrating) { + * s_logger.warn("How can baremetal VM get into migrating state???"); } + * else if (oldState == State.Stopping) { if (newState == State.Stopped) + * { changeVmState(_vmName, newState); } else if (newState == + * State.Running) { s_logger.debug("Ignoring vm " + _vmName + + * " because of a lag in stopping the vm. "); } } else if (oldState != + * newState) { changeVmState(_vmName, newState); changes.put(_vmName, + * newState); } + */ + return changes; + + } + + protected ReadyAnswer execute(ReadyCommand cmd) { + // derived resource should check if the PXE server is ready + s_logger.debug("Bare metal resource " + _name + " is ready"); + return new ReadyAnswer(cmd); + } + + @Override + public void disconnected() { + + } + + @Override + public IAgentControl getAgentControl() { + return _agentControl; + } + + @Override + public void setAgentControl(IAgentControl agentControl) { + _agentControl = agentControl; + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java new file mode 100755 index 00000000000..bec6e38b7c8 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetaNetworkGuru.java @@ -0,0 +1,173 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import java.net.URI; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.log4j.Logger; + +import com.cloud.dc.DataCenter; +import com.cloud.dc.Pod; +import com.cloud.dc.PodVlanMapVO; +import com.cloud.dc.Vlan; +import com.cloud.dc.Vlan.VlanType; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.PodVlanMapDao; +import com.cloud.dc.dao.VlanDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientAddressCapacityException; +import com.cloud.exception.InsufficientVirtualNetworkCapcityException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network; +import com.cloud.network.NetworkManager; +import com.cloud.network.Networks.AddressFormat; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.addr.PublicIp; +import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.IPAddressVO; +import com.cloud.network.guru.DirectPodBasedNetworkGuru; +import com.cloud.network.guru.NetworkGuru; +import com.cloud.offerings.dao.NetworkOfferingDao; +import com.cloud.utils.db.Transaction; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; + +@Local(value = { NetworkGuru.class }) +public class BaremetaNetworkGuru extends DirectPodBasedNetworkGuru { + private static final Logger s_logger = Logger.getLogger(BaremetaNetworkGuru.class); + @Inject + private HostDao _hostDao; + @Inject + DataCenterDao _dcDao; + @Inject + VlanDao _vlanDao; + @Inject + NetworkManager _networkMgr; + @Inject + IPAddressDao _ipAddressDao; + @Inject + NetworkOfferingDao _networkOfferingDao; + @Inject + PodVlanMapDao _podVlanDao; + + @Override + public void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) + throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { + if (dest.getHost().getHypervisorType() != HypervisorType.BareMetal) { + super.reserve(nic, network, vm, dest, context); + return; + } + + HostVO host = _hostDao.findById(dest.getHost().getId()); + _hostDao.loadDetails(host); + String intentIp = host.getDetail(ApiConstants.IP_ADDRESS); + if (intentIp == null) { + super.reserve(nic, network, vm, dest, context); + return; + } + + String oldIp = nic.getIp4Address(); + boolean getNewIp = false; + if (oldIp == null) { + getNewIp = true; + } else { + // we need to get a new ip address if we try to deploy a vm in a + // different pod + IPAddressVO ipVO = _ipAddressDao.findByIpAndSourceNetworkId(network.getId(), oldIp); + if (ipVO != null) { + PodVlanMapVO mapVO = _podVlanDao.listPodVlanMapsByVlan(ipVO.getVlanId()); + if (mapVO.getPodId() != dest.getPod().getId()) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + + // release the old ip here + _networkMgr.markIpAsUnavailable(ipVO.getId()); + _ipAddressDao.unassignIpAddress(ipVO.getId()); + + txn.commit(); + + nic.setIp4Address(null); + getNewIp = true; + } + } + } + + if (getNewIp) { + // we don't set reservationStrategy to Create because we need this + // method to be called again for the case when vm fails to deploy in + // Pod1, and we try to redeploy it in Pod2 + getBaremetalIp(nic, dest.getPod(), vm, network, intentIp); + } + + DataCenter dc = _dcDao.findById(network.getDataCenterId()); + nic.setDns1(dc.getDns1()); + nic.setDns2(dc.getDns2()); + + /* + * Pod pod = dest.getPod(); Pair ip = + * _dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(), + * dest.getPod().getId(), nic.getId(), context.getReservationId(), + * intentIp); if (ip == null) { throw new + * InsufficientAddressCapacityException + * ("Unable to get a management ip address", Pod.class, pod.getId()); } + * + * nic.setIp4Address(ip.first()); + * nic.setMacAddress(NetUtils.long2Mac(NetUtils + * .createSequenceBasedMacAddress(ip.second()))); + * nic.setGateway(pod.getGateway()); nic.setFormat(AddressFormat.Ip4); + * String netmask = NetUtils.getCidrNetmask(pod.getCidrSize()); + * nic.setNetmask(netmask); + * nic.setBroadcastType(BroadcastDomainType.Native); + * nic.setBroadcastUri(null); nic.setIsolationUri(null); + */ + + s_logger.debug("Allocated a nic " + nic + " for " + vm); + } + + private void getBaremetalIp(NicProfile nic, Pod pod, VirtualMachineProfile vm, Network network, String requiredIp) + throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException { + DataCenter dc = _dcDao.findById(pod.getDataCenterId()); + if (nic.getIp4Address() == null) { + s_logger.debug(String.format("Requiring ip address: %s", nic.getIp4Address())); + PublicIp ip = _networkMgr.assignPublicIpAddress(dc.getId(), pod.getId(), vm.getOwner(), VlanType.DirectAttached, network.getId(), requiredIp, false); + nic.setIp4Address(ip.getAddress().toString()); + nic.setFormat(AddressFormat.Ip4); + nic.setGateway(ip.getGateway()); + nic.setNetmask(ip.getNetmask()); + if (ip.getVlanTag() != null && ip.getVlanTag().equalsIgnoreCase(Vlan.UNTAGGED)) { + nic.setIsolationUri(URI.create("ec2://" + Vlan.UNTAGGED)); + nic.setBroadcastUri(URI.create("vlan://" + Vlan.UNTAGGED)); + nic.setBroadcastType(BroadcastDomainType.Native); + } + nic.setReservationId(String.valueOf(ip.getVlanTag())); + nic.setMacAddress(ip.getMacAddress()); + } + nic.setDns1(dc.getDns1()); + nic.setDns2(dc.getDns2()); + } +} diff --git a/server/src/com/cloud/network/element/ExternalDhcpElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java similarity index 60% rename from server/src/com/cloud/network/element/ExternalDhcpElement.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java index c5ad914e3ca..b72d1c8278f 100755 --- a/server/src/com/cloud/network/element/ExternalDhcpElement.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpElement.java @@ -5,16 +5,18 @@ // 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.element; +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; import java.util.HashMap; import java.util.List; @@ -22,13 +24,15 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; import org.apache.log4j.Logger; -import com.cloud.baremetal.ExternalDhcpManager; -import com.cloud.dc.DataCenter; -import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.baremetal.database.BaremetalDhcpVO; +import com.cloud.baremetal.database.BaremetalPxeVO; import com.cloud.dc.Pod; +import com.cloud.dc.DataCenter.NetworkType; import com.cloud.deploy.DeployDestination; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -36,47 +40,46 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Network; +import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.Network.Capability; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.Networks.TrafficType; -import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.element.DhcpServiceProvider; +import com.cloud.network.element.IpDeployer; +import com.cloud.network.element.NetworkElement; import com.cloud.offering.NetworkOffering; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.Inject; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; import com.cloud.vm.NicProfile; +import com.cloud.vm.NicVO; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.dao.NicDao; import com.cloud.vm.VirtualMachineProfile; @Local(value = NetworkElement.class) -public class ExternalDhcpElement extends AdapterBase implements NetworkElement, DhcpServiceProvider { - private static final Logger s_logger = Logger.getLogger(ExternalDhcpElement.class); - @Inject - ExternalDhcpManager _dhcpMgr; - private static final Map> capabilities = setCapabilities(); - - private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) { - DataCenter dc = dest.getDataCenter(); - Pod pod = dest.getPod(); - - if ((pod != null && pod.getExternalDhcp()) && dc.getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest - && networkType == Network.GuestType.Shared) { - s_logger.debug("External DHCP can handle"); - return true; - } - - return false; +public class BaremetalDhcpElement extends AdapterBase implements DhcpServiceProvider { + private static final Logger s_logger = Logger.getLogger(BaremetalDhcpElement.class); + private static final Map> capabilities; + + @Inject NicDao _nicDao; + @Inject BaremetalDhcpManager _dhcpMgr; + + static { + Capability cap = new Capability(BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_CAPABITLITY); + Map baremetalCaps = new HashMap(); + baremetalCaps.put(cap, null); + capabilities = new HashMap>(); + capabilities.put(Service.Dhcp, baremetalCaps); } - - private static Map> setCapabilities() { - // No external dhcp support for Acton release - Map> capabilities = new HashMap>(); - //capabilities.put(Service.Dhcp, null); - return capabilities; - } - + @Override public Map> getCapabilities() { return capabilities; @@ -84,21 +87,47 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement, @Override public Provider getProvider() { - return Provider.ExternalDhcpServer; + return BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_PROVIDER; } + private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) { + Pod pod = dest.getPod(); + if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalDhcpVO.class); + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, pod.getId()); + return sc.find() != null; + } + + return false; + } + @Override public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { - if (!canHandle(dest, offering.getTrafficType(), network.getGuestType())) { + if (offering.isSystemOnly() || !canHandle(dest, offering.getTrafficType(), network.getGuestType())) { + s_logger.debug("BaremetalDhcpElement can not handle networkoffering: " + offering.getName()); return false; } return true; } @Override + @DB public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + Host host = dest.getHost(); + if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) { + return false; + } + + Transaction txn = Transaction.currentTxn(); + txn.start(); + nic.setMacAddress(host.getPrivateMacAddress()); + NicVO vo = _nicDao.findById(nic.getId()); + assert vo != null : "Where ths nic " + nic.getId() + " going???"; + vo.setMacAddress(nic.getMacAddress()); + _nicDao.update(vo.getId(), vo); + txn.commit(); return true; } @@ -120,13 +149,12 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement, @Override public boolean isReady(PhysicalNetworkServiceProvider provider) { - // TODO Auto-generated method stub return true; } @Override - public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { - // TODO Auto-generated method stub + public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { return true; } @@ -136,18 +164,15 @@ public class ExternalDhcpElement extends AdapterBase implements NetworkElement, } @Override - public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException { - Host host = dest.getHost(); - if (host.getHypervisorType() == HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getGuestType())) { - // BareMetalElement or DhcpElement handle this + public boolean verifyServicesCombination(Set services) { + return true; + } + + public boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, + ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException { + if (vm.getHypervisorType() != HypervisorType.BareMetal || !canHandle(dest, network.getTrafficType(), network.getGuestType())) { return false; } return _dhcpMgr.addVirtualMachineIntoNetwork(network, nic, vm, dest, context); } - - @Override - public boolean verifyServicesCombination(Set services) { - return true; - } } diff --git a/server/src/com/cloud/baremetal/ExternalDhcpManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java similarity index 55% rename from server/src/com/cloud/baremetal/ExternalDhcpManager.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java index d256ef14267..a9c63bfed2b 100644 --- a/server/src/com/cloud/baremetal/ExternalDhcpManager.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManager.java @@ -5,50 +5,54 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; -import com.cloud.baremetal.ExternalDhcpEntryListener.DhcpEntryState; +import java.util.List; + +import com.cloud.baremetal.database.BaremetalDhcpVO; import com.cloud.deploy.DeployDestination; import com.cloud.exception.ResourceUnavailableException; import com.cloud.host.Host; import com.cloud.network.Network; +import com.cloud.network.Network.Provider; import com.cloud.uservm.UserVm; import com.cloud.utils.component.Manager; +import com.cloud.utils.component.PluggableService; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; -public interface ExternalDhcpManager extends Manager { - public static class DhcpServerType { - private String _name; - - public static final DhcpServerType Dnsmasq = new DhcpServerType("Dnsmasq"); - public static final DhcpServerType Dhcpd = new DhcpServerType("Dhcpd"); - - public DhcpServerType(String name) { - _name = name; - } - - public String getName() { - return _name; - } - - } - - - DhcpServerResponse getApiResponse(Host dhcpServer); +public interface BaremetalDhcpManager extends Manager, PluggableService { + public static enum BaremetalDhcpType { + DNSMASQ, + DHCPD, + } boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException; - Host addDhcpServer(Long zoneId, Long podId, String type, String url, String username, String password); + BaremetalDhcpVO addDchpServer(AddBaremetalDhcpCmd cmd); + + BaremetalDhcpResponse generateApiResponse(BaremetalDhcpVO vo); + + List listBaremetalDhcps(ListBaremetalDhcpCmd cmd); + + public static final String BAREMETAL_DHCP_SERVICE_CAPABITLITY = "BaremetalDhcp"; + public static final String BAREMETAL_DHCP_SERVICE_PROPERTIES = "baremetaldhcp_commands.properties"; + public static final Provider BAREMETAL_DHCP_SERVICE_PROVIDER = new Provider("BaremetalDhcpProvider", true); } diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java new file mode 100755 index 00000000000..f87bf71ca13 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpManagerImpl.java @@ -0,0 +1,327 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.StartupExternalDhcpCommand; +import com.cloud.agent.api.routing.DhcpEntryCommand; +import com.cloud.baremetal.database.BaremetalDhcpDao; +import com.cloud.baremetal.database.BaremetalDhcpVO; +import com.cloud.dc.DataCenter; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.host.Host; +import com.cloud.host.Host.Type; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.network.Network; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.resource.ResourceManager; +import com.cloud.resource.ResourceStateAdapter; +import com.cloud.resource.ServerResource; +import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.component.ManagerBase; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.dao.NicDao; +import com.cloud.vm.dao.UserVmDao; + +@Local(value = { BaremetalDhcpManager.class }) +public class BaremetalDhcpManagerImpl extends ManagerBase implements BaremetalDhcpManager, ResourceStateAdapter { + private static final org.apache.log4j.Logger s_logger = Logger.getLogger(BaremetalDhcpManagerImpl.class); + protected String _name; + @Inject + DataCenterDao _dcDao; + @Inject + HostDao _hostDao; + @Inject + AgentManager _agentMgr; + @Inject + HostPodDao _podDao; + @Inject + UserVmDao _userVmDao; + @Inject + ResourceManager _resourceMgr; + @Inject + NicDao _nicDao; + @Inject + PhysicalNetworkDao _physicalNetworkDao; + @Inject + PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; + @Inject + BaremetalDhcpDao _extDhcpDao; + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this); + return true; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); + return true; + } + + @Override + public String getName() { + return _name; + } + + protected String getDhcpServerGuid(String zoneId, String name, String ip) { + return zoneId + "-" + name + "-" + ip; + } + + @Override + public boolean addVirtualMachineIntoNetwork(Network network, NicProfile nic, VirtualMachineProfile profile, + DeployDestination dest, ReservationContext context) throws ResourceUnavailableException { + Long zoneId = profile.getVirtualMachine().getDataCenterId(); + Long podId = profile.getVirtualMachine().getPodIdToDeployIn(); + List hosts = _resourceMgr.listAllUpAndEnabledHosts(Type.BaremetalDhcp, null, podId, zoneId); + if (hosts.size() == 0) { + throw new CloudRuntimeException("No external Dhcp found in zone " + zoneId + " pod " + podId); + } + + if (hosts.size() > 1) { + throw new CloudRuntimeException("Something wrong, more than 1 external Dhcp found in zone " + zoneId + " pod " + podId); + } + + HostVO h = hosts.get(0); + String dns = nic.getDns1(); + if (dns == null) { + dns = nic.getDns2(); + } + DhcpEntryCommand dhcpCommand = new DhcpEntryCommand(nic.getMacAddress(), nic.getIp4Address(), profile.getVirtualMachine().getHostName(), null, dns, + nic.getGateway(), null); + String errMsg = String.format("Set dhcp entry on external DHCP %1$s failed(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), + nic.getIp4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName()); + // prepareBareMetalDhcpEntry(nic, dhcpCommand); + try { + Answer ans = _agentMgr.send(h.getId(), dhcpCommand); + if (ans.getResult()) { + s_logger.debug(String.format("Set dhcp entry on external DHCP %1$s successfully(ip=%2$s, mac=%3$s, vmname=%4$s)", h.getPrivateIpAddress(), + nic.getIp4Address(), nic.getMacAddress(), profile.getVirtualMachine().getHostName())); + return true; + } else { + s_logger.debug(errMsg + " " + ans.getDetails()); + throw new ResourceUnavailableException(errMsg, DataCenter.class, zoneId); + } + } catch (Exception e) { + s_logger.debug(errMsg, e); + throw new ResourceUnavailableException(errMsg + e.getMessage(), DataCenter.class, zoneId); + } + } + + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) { + // TODO Auto-generated method stub + return null; + } + + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map details, + List hostTags) { + if (!(startup[0] instanceof StartupExternalDhcpCommand)) { + return null; + } + + host.setType(Host.Type.BaremetalDhcp); + return host; + } + + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException { + // TODO Auto-generated method stub + return null; + } + + + @Override + @DB + public BaremetalDhcpVO addDchpServer(AddBaremetalDhcpCmd cmd) { + PhysicalNetworkVO pNetwork = null; + long zoneId; + + if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) { + throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null"); + } + + pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId()); + if (pNetwork == null) { + throw new IllegalArgumentException("Could not find phyical network with ID: " + cmd.getPhysicalNetworkId()); + } + zoneId = pNetwork.getDataCenterId(); + DataCenterVO zone = _dcDao.findById(zoneId); + + PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), + BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_PROVIDER.getName()); + if (ntwkSvcProvider == null) { + throw new CloudRuntimeException("Network Service Provider: " + BaremetalDhcpManager.BAREMETAL_DHCP_SERVICE_PROVIDER.getName() + " is not enabled in the physical network: " + + cmd.getPhysicalNetworkId() + "to add this device"); + } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { + throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + + " is in shutdown state in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device"); + } + + HostPodVO pod = _podDao.findById(cmd.getPodId()); + if (pod == null) { + throw new IllegalArgumentException("Could not find pod with ID: " + cmd.getPodId()); + } + + List dhcps = _resourceMgr.listAllUpAndEnabledHosts(Host.Type.BaremetalDhcp, null, cmd.getPodId(), zoneId); + if (dhcps.size() != 0) { + throw new IllegalArgumentException("Already had a DHCP server in Pod: " + cmd.getPodId() + " zone: " + zoneId); + } + + URI uri; + try { + uri = new URI(cmd.getUrl()); + } catch (Exception e) { + s_logger.debug(e); + throw new IllegalArgumentException(e.getMessage()); + } + + String ipAddress = uri.getHost(); + String guid = getDhcpServerGuid(Long.toString(zoneId) + "-" + Long.toString(cmd.getPodId()), "ExternalDhcp", ipAddress); + Map params = new HashMap(); + params.put("type", cmd.getDhcpType()); + params.put("zone", Long.toString(zoneId)); + params.put("pod", cmd.getPodId().toString()); + params.put("ip", ipAddress); + params.put("username", cmd.getUsername()); + params.put("password", cmd.getPassword()); + params.put("guid", guid); + params.put("gateway", pod.getGateway()); + String dns = zone.getDns1(); + if (dns == null) { + dns = zone.getDns2(); + } + params.put("dns", dns); + + ServerResource resource = null; + try { + if (cmd.getDhcpType().equalsIgnoreCase(BaremetalDhcpType.DNSMASQ.toString())) { + resource = new BaremetalDnsmasqResource(); + resource.configure("Dnsmasq resource", params); + } else if (cmd.getDhcpType().equalsIgnoreCase(BaremetalDhcpType.DHCPD.toString())) { + resource = new BaremetalDhcpdResource(); + resource.configure("Dhcpd resource", params); + } else { + throw new CloudRuntimeException("Unsupport DHCP server type: " + cmd.getDhcpType()); + } + } catch (Exception e) { + s_logger.debug(e); + throw new CloudRuntimeException(e.getMessage()); + } + + Host dhcpServer = _resourceMgr.addHost(zoneId, resource, Host.Type.BaremetalDhcp, params); + if (dhcpServer == null) { + throw new CloudRuntimeException("Cannot add external Dhcp server as a host"); + } + + BaremetalDhcpVO vo = new BaremetalDhcpVO(); + vo.setDeviceType(cmd.getDhcpType()); + vo.setHostId(dhcpServer.getId()); + vo.setNetworkServiceProviderId(ntwkSvcProvider.getId()); + vo.setPhysicalNetworkId(cmd.getPhysicalNetworkId()); + vo.setPodId(cmd.getPodId()); + Transaction txn = Transaction.currentTxn(); + txn.start(); + _extDhcpDao.persist(vo); + txn.commit(); + return vo; + } + + @Override + public BaremetalDhcpResponse generateApiResponse(BaremetalDhcpVO vo) { + BaremetalDhcpResponse response = new BaremetalDhcpResponse(); + response.setDeviceType(vo.getDeviceType()); + response.setId(String.valueOf(vo.getId())); + response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId())); + response.setProviderId(String.valueOf(vo.getNetworkServiceProviderId())); + return response; + } + + @Override + public List listBaremetalDhcps(ListBaremetalDhcpCmd cmd) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalDhcpVO.class); + if (cmd.getDeviceType() != null) { + sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, cmd.getDeviceType()); + } + if (cmd.getPodId() != null) { + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId()); + if (cmd.getId() != null) { + sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId()); + } + } + List vos = sc.list(); + List responses = new ArrayList(vos.size()); + for (BaremetalDhcpVO vo : vos) { + responses.add(generateApiResponse(vo)); + } + return responses; + } + + @Override + public List> getCommands() { + List> cmds = new ArrayList>(); + cmds.add(AddBaremetalDhcpCmd.class); + cmds.add(ListBaremetalDhcpCmd.class); + return cmds; + } +} diff --git a/server/src/com/cloud/baremetal/ExternalDhcpResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java similarity index 87% rename from server/src/com/cloud/baremetal/ExternalDhcpResourceBase.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java index cbfcfd15f9a..4496d5d0e70 100644 --- a/server/src/com/cloud/baremetal/ExternalDhcpResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResourceBase.java @@ -5,16 +5,22 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.util.HashMap; import java.util.Map; @@ -35,13 +41,14 @@ import com.cloud.agent.api.StartupExternalDhcpCommand; import com.cloud.agent.api.StartupPxeServerCommand; import com.cloud.host.Host.Type; import com.cloud.resource.ServerResource; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; -public class ExternalDhcpResourceBase implements ServerResource { - private static final Logger s_logger = Logger.getLogger(ExternalDhcpResourceBase.class); +public class BaremetalDhcpResourceBase extends ManagerBase implements ServerResource { + private static final Logger s_logger = Logger.getLogger(BaremetalDhcpResourceBase.class); String _name; String _guid; String _username; @@ -116,7 +123,7 @@ public class ExternalDhcpResourceBase implements ServerResource { @Override public Type getType() { - return Type.ExternalDhcp; + return Type.BaremetalDhcp; } @Override diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java new file mode 100755 index 00000000000..1875d3947a0 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpResponse.java @@ -0,0 +1,75 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; + +import com.cloud.baremetal.database.BaremetalDhcpVO; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value=BaremetalDhcpVO.class) +public class BaremetalDhcpResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) @Param(description="device id of ") + private String id; + + @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this external dhcp device belongs to") + private String physicalNetworkId; + + @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider") + private String providerId; + + @SerializedName(ApiConstants.DHCP_SERVER_TYPE) @Param(description="name of the provider") + private String deviceType; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(String physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public String getProviderId() { + return providerId; + } + + public void setProviderId(String providerId) { + this.providerId = providerId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } +} diff --git a/server/src/com/cloud/baremetal/DhcpdResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java similarity index 91% rename from server/src/com/cloud/baremetal/DhcpdResource.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java index 436d27598f8..a27a6f26896 100755 --- a/server/src/com/cloud/baremetal/DhcpdResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDhcpdResource.java @@ -5,16 +5,22 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.util.HashMap; import java.util.Map; @@ -33,8 +39,8 @@ import com.cloud.utils.ssh.SSHCmdHelper; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; -public class DhcpdResource extends ExternalDhcpResourceBase { - private static final Logger s_logger = Logger.getLogger(DhcpdResource.class); +public class BaremetalDhcpdResource extends BaremetalDhcpResourceBase { + private static final Logger s_logger = Logger.getLogger(BaremetalDhcpdResource.class); public boolean configure(String name, Map params) throws ConfigurationException { com.trilead.ssh2.Connection sshConnection = null; diff --git a/server/src/com/cloud/baremetal/DnsmasqResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java similarity index 90% rename from server/src/com/cloud/baremetal/DnsmasqResource.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java index 1001dfc5c12..6841c525107 100644 --- a/server/src/com/cloud/baremetal/DnsmasqResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalDnsmasqResource.java @@ -5,16 +5,22 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.io.IOException; import java.util.HashMap; @@ -34,8 +40,8 @@ import com.cloud.utils.ssh.SSHCmdHelper; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; -public class DnsmasqResource extends ExternalDhcpResourceBase { - private static final Logger s_logger = Logger.getLogger(DnsmasqResource.class); +public class BaremetalDnsmasqResource extends BaremetalDhcpResourceBase { + private static final Logger s_logger = Logger.getLogger(BaremetalDnsmasqResource.class); public boolean configure(String name, Map params) throws ConfigurationException { com.trilead.ssh2.Connection sshConnection = null; diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java new file mode 100755 index 00000000000..2b9b140607b --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartPxeResource.java @@ -0,0 +1,202 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.apache.commons.lang.StringUtils; +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.PingCommand; +import com.cloud.agent.api.PingRoutingCommand; +import com.cloud.agent.api.routing.VmDataCommand; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; +import com.cloud.utils.ssh.SSHCmdHelper; +import com.cloud.vm.VirtualMachine.State; +import com.trilead.ssh2.SCPClient; + +public class BaremetalKickStartPxeResource extends BaremetalPxeResourceBase { + private static final Logger s_logger = Logger.getLogger(BaremetalKickStartPxeResource.class); + private static final String _name = "BaremetalKickStartPxeResource"; + String _tftpDir; + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + super.configure(name, params); + _tftpDir = (String) params.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR); + if (_tftpDir == null) { + throw new ConfigurationException("No tftp directory specified"); + } + + com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22); + + s_logger.debug(String.format("Trying to connect to kickstart PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, "******")); + try { + sshConnection.connect(null, 60000, 60000); + if (!sshConnection.authenticateWithPassword(_username, _password)) { + s_logger.debug("SSH Failed to authenticate"); + throw new ConfigurationException(String.format("Cannot connect to kickstart PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, + "******")); + } + + String cmd = String.format("[ -f /%1$s/pxelinux.0 ]", _tftpDir); + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, cmd)) { + throw new ConfigurationException("Miss files in TFTP directory at " + _tftpDir + " check if pxelinux.0 are here"); + } + + SCPClient scp = new SCPClient(sshConnection); + String prepareScript = "scripts/network/ping/prepare_kickstart_bootfile.py"; + String prepareScriptPath = Script.findScript("", prepareScript); + if (prepareScriptPath == null) { + throw new ConfigurationException("Can not find prepare_kickstart_bootfile.py at " + prepareScript); + } + scp.put(prepareScriptPath, "/usr/bin/", "0755"); + + String cpScript = "scripts/network/ping/prepare_kickstart_kernel_initrd.py"; + String cpScriptPath = Script.findScript("", cpScript); + if (cpScriptPath == null) { + throw new ConfigurationException("Can not find prepare_kickstart_kernel_initrd.py at " + cpScript); + } + scp.put(cpScriptPath, "/usr/bin/", "0755"); + + String userDataScript = "scripts/network/ping/baremetal_user_data.py"; + String userDataScriptPath = Script.findScript("", userDataScript); + if (userDataScriptPath == null) { + throw new ConfigurationException("Can not find baremetal_user_data.py at " + userDataScript); + } + scp.put(userDataScriptPath, "/usr/bin/", "0755"); + + return true; + } catch (Exception e) { + throw new CloudRuntimeException(e); + } finally { + if (sshConnection != null) { + sshConnection.close(); + } + } + } + + @Override + public PingCommand getCurrentStatus(long id) { + com.trilead.ssh2.Connection sshConnection = SSHCmdHelper.acquireAuthorizedConnection(_ip, _username, _password); + if (sshConnection == null) { + return null; + } else { + SSHCmdHelper.releaseSshConnection(sshConnection); + return new PingRoutingCommand(getType(), id, new HashMap()); + } + } + + private Answer execute(VmDataCommand cmd) { + com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22); + try { + List vmData = cmd.getVmData(); + StringBuilder sb = new StringBuilder(); + for (String[] data : vmData) { + String folder = data[0]; + String file = data[1]; + String contents = (data[2] == null) ? "none" : data[2]; + sb.append(cmd.getVmIpAddress()); + sb.append(","); + sb.append(folder); + sb.append(","); + sb.append(file); + sb.append(","); + sb.append(contents); + sb.append(";"); + } + String arg = StringUtils.stripEnd(sb.toString(), ";"); + + sshConnection.connect(null, 60000, 60000); + if (!sshConnection.authenticateWithPassword(_username, _password)) { + s_logger.debug("SSH Failed to authenticate"); + throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, + _password)); + } + + String script = String.format("python /usr/bin/baremetal_user_data.py '%s'", arg); + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { + return new Answer(cmd, false, "Failed to add user data, command:" + script); + } + + return new Answer(cmd, true, "Success"); + } catch (Exception e){ + s_logger.debug("Prepare for creating baremetal template failed", e); + return new Answer(cmd, false, e.getMessage()); + } finally { + if (sshConnection != null) { + sshConnection.close(); + } + } + } + + @Override + public Answer executeRequest(Command cmd) { + if (cmd instanceof PrepareKickstartPxeServerCommand) { + return execute((PrepareKickstartPxeServerCommand) cmd); + } else if (cmd instanceof VmDataCommand) { + return execute((VmDataCommand)cmd); + } else { + return super.executeRequest(cmd); + } + } + + private Answer execute(PrepareKickstartPxeServerCommand cmd) { + com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22); + try { + sshConnection.connect(null, 60000, 60000); + if (!sshConnection.authenticateWithPassword(_username, _password)) { + s_logger.debug("SSH Failed to authenticate"); + throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, + _password)); + } + + String copyTo = String.format("%s/%s", _tftpDir, cmd.getTemplateUuid()); + String script = String.format("python /usr/bin/prepare_kickstart_kernel_initrd.py %s %s", cmd.getRepo(), copyTo); + + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { + return new Answer(cmd, false, "prepare kickstart at pxe server " + _ip + " failed, command:" + script); + } + + String kernelPath = String.format("%s/vmlinuz", cmd.getTemplateUuid()); + String initrdPath = String.format("%s/initrd.img", cmd.getTemplateUuid()); + script = String.format("python /usr/bin/prepare_kickstart_bootfile.py %s %s %s %s %s %s", _tftpDir, cmd.getMac(), kernelPath, initrdPath, cmd.getKsFile(), cmd.getMac()); + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { + return new Answer(cmd, false, "prepare kickstart at pxe server " + _ip + " failed, command:" + script); + } + + s_logger.debug("Prepare kickstart PXE server successfully"); + return new Answer(cmd, true, "Success"); + } catch (Exception e){ + s_logger.debug("Prepare for kickstart server failed", e); + return new Answer(cmd, false, e.getMessage()); + } finally { + if (sshConnection != null) { + sshConnection.close(); + } + } + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java new file mode 100755 index 00000000000..ba5fb0d0b6c --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalKickStartServiceImpl.java @@ -0,0 +1,243 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import java.net.URI; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.log4j.Logger; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand; +import com.cloud.agent.api.baremetal.IpmISetBootDevCommand.BootDev; +import com.cloud.baremetal.database.BaremetalPxeDao; +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.baremetal.networkservice.BaremetalPxeManager.BaremetalPxeType; +import com.cloud.deploy.DeployDestination; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDetailsDao; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.resource.ResourceManager; +import com.cloud.resource.ServerResource; +import com.cloud.storage.VMTemplateVO; +import com.cloud.storage.dao.VMTemplateDao; +import com.cloud.uservm.UserVm; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachineProfile; + +@Local(value = BaremetalPxeService.class) +public class BaremetalKickStartServiceImpl extends BareMetalPxeServiceBase implements BaremetalPxeService { + private static final Logger s_logger = Logger.getLogger(BaremetalKickStartServiceImpl.class); + @Inject + ResourceManager _resourceMgr; + @Inject + PhysicalNetworkDao _physicalNetworkDao; + @Inject + PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; + @Inject + HostDetailsDao _hostDetailsDao; + @Inject + BaremetalPxeDao _pxeDao; + @Inject + NetworkDao _nwDao; + @Inject + VMTemplateDao _tmpDao; + + @Override + public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context) { + NetworkVO nwVO = _nwDao.findById(nic.getNetworkId()); + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString()); + sc.addAnd(sc.getEntity().getPhysicalNetworkId(), Op.EQ, nwVO.getPhysicalNetworkId()); + BaremetalPxeVO pxeVo = sc.find(); + if (pxeVo == null) { + throw new CloudRuntimeException("No kickstart PXE server found in pod: " + dest.getPod().getId() + ", you need to add it before starting VM"); + } + VMTemplateVO template = _tmpDao.findById(profile.getTemplateId()); + + try { + String tpl = profile.getTemplate().getUrl(); + assert tpl != null : "How can a null template get here!!!"; + String[] tpls = tpl.split(";"); + assert tpls.length == 2 : "Template is not correctly encoded. " + tpl; + PrepareKickstartPxeServerCommand cmd = new PrepareKickstartPxeServerCommand(); + cmd.setKsFile(tpls[0]); + cmd.setRepo(tpls[1]); + cmd.setMac(nic.getMacAddress()); + cmd.setTemplateUuid(template.getUuid()); + Answer aws = _agentMgr.send(pxeVo.getHostId(), cmd); + if (!aws.getResult()) { + s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails()); + return aws.getResult(); + } + + IpmISetBootDevCommand bootCmd = new IpmISetBootDevCommand(BootDev.pxe); + aws = _agentMgr.send(dest.getHost().getId(), bootCmd); + if (!aws.getResult()) { + s_logger.warn("Unable to set host: " + dest.getHost().getId() + " to PXE boot because " + aws.getDetails()); + } + + return aws.getResult(); + } catch (Exception e) { + s_logger.warn("Cannot prepare PXE server", e); + return false; + } + } + + @Override + public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) { + // TODO Auto-generated method stub + return false; + } + + @Override + @DB + public BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd) { + AddBaremetalKickStartPxeCmd kcmd = (AddBaremetalKickStartPxeCmd)cmd; + PhysicalNetworkVO pNetwork = null; + long zoneId; + + if (cmd.getPhysicalNetworkId() == null || cmd.getUrl() == null || cmd.getUsername() == null || cmd.getPassword() == null) { + throw new IllegalArgumentException("At least one of the required parameters(physical network id, url, username, password) is null"); + } + + pNetwork = _physicalNetworkDao.findById(cmd.getPhysicalNetworkId()); + if (pNetwork == null) { + throw new IllegalArgumentException("Could not find phyical network with ID: " + cmd.getPhysicalNetworkId()); + } + zoneId = pNetwork.getDataCenterId(); + + PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao.findByServiceProvider(pNetwork.getId(), BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName()); + if (ntwkSvcProvider == null) { + throw new CloudRuntimeException("Network Service Provider: " + BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER.getName() + + " is not enabled in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device"); + } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { + throw new CloudRuntimeException("Network Service Provider: " + ntwkSvcProvider.getProviderName() + + " is in shutdown state in the physical network: " + cmd.getPhysicalNetworkId() + "to add this device"); + } + + List pxes = _resourceMgr.listAllHostsInOneZoneByType(Host.Type.BaremetalPxe, zoneId); + if (!pxes.isEmpty()) { + throw new IllegalArgumentException("Already had a PXE server zone: " + zoneId); + } + + String tftpDir = kcmd.getTftpDir(); + if (tftpDir == null) { + throw new IllegalArgumentException("No TFTP directory specified"); + } + + URI uri; + try { + uri = new URI(cmd.getUrl()); + } catch (Exception e) { + s_logger.debug(e); + throw new IllegalArgumentException(e.getMessage()); + } + String ipAddress = uri.getHost(); + + String guid = getPxeServerGuid(Long.toString(zoneId), BaremetalPxeType.KICK_START.toString(), ipAddress); + + ServerResource resource = null; + Map params = new HashMap(); + params.put(BaremetalPxeService.PXE_PARAM_ZONE, Long.toString(zoneId)); + params.put(BaremetalPxeService.PXE_PARAM_IP, ipAddress); + params.put(BaremetalPxeService.PXE_PARAM_USERNAME, cmd.getUsername()); + params.put(BaremetalPxeService.PXE_PARAM_PASSWORD, cmd.getPassword()); + params.put(BaremetalPxeService.PXE_PARAM_TFTP_DIR, tftpDir); + params.put(BaremetalPxeService.PXE_PARAM_GUID, guid); + resource = new BaremetalKickStartPxeResource(); + try { + resource.configure("KickStart PXE resource", params); + } catch (Exception e) { + throw new CloudRuntimeException(e.getMessage(), e); + } + + Host pxeServer = _resourceMgr.addHost(zoneId, resource, Host.Type.BaremetalPxe, params); + if (pxeServer == null) { + throw new CloudRuntimeException("Cannot add PXE server as a host"); + } + + BaremetalPxeVO vo = new BaremetalPxeVO(); + Transaction txn = Transaction.currentTxn(); + vo.setHostId(pxeServer.getId()); + vo.setNetworkServiceProviderId(ntwkSvcProvider.getId()); + vo.setPhysicalNetworkId(kcmd.getPhysicalNetworkId()); + vo.setDeviceType(BaremetalPxeType.KICK_START.toString()); + txn.start(); + _pxeDao.persist(vo); + txn.commit(); + return vo; + } + + @Override + public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) { + BaremetalPxeKickStartResponse response = new BaremetalPxeKickStartResponse(); + response.setId(String.valueOf(vo.getId())); + response.setPhysicalNetworkId(String.valueOf(vo.getPhysicalNetworkId())); + response.setPodId(String.valueOf(vo.getPodId())); + Map details = _hostDetailsDao.findDetails(vo.getHostId()); + response.setTftpDir(details.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR)); + return response; + } + + @Override + public List listPxeServers(ListBaremetalPxePingServersCmd cmd) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + sc.addAnd(sc.getEntity().getDeviceType(), Op.EQ, BaremetalPxeType.KICK_START.toString()); + if (cmd.getPodId() != null) { + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, cmd.getPodId()); + if (cmd.getId() != null) { + sc.addAnd(sc.getEntity().getId(), Op.EQ, cmd.getId()); + } + } + List vos = sc.list(); + List responses = new ArrayList(vos.size()); + for (BaremetalPxeVO vo : vos) { + responses.add(getApiResponse(vo)); + } + return responses; + } + + @Override + public String getPxeServiceType() { + return BaremetalPxeManager.BaremetalPxeType.KICK_START.toString(); + } + +} diff --git a/server/src/com/cloud/baremetal/PingPxeServerResource.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java similarity index 68% rename from server/src/com/cloud/baremetal/PingPxeServerResource.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java index 6655fd80efd..2fb54154489 100755 --- a/server/src/com/cloud/baremetal/PingPxeServerResource.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPingPxeResource.java @@ -5,18 +5,25 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.util.HashMap; +import java.util.List; import java.util.Map; import javax.naming.ConfigurationException; @@ -30,13 +37,15 @@ import com.cloud.agent.api.PingRoutingCommand; import com.cloud.agent.api.baremetal.PreparePxeServerAnswer; import com.cloud.agent.api.baremetal.PreparePxeServerCommand; import com.cloud.agent.api.baremetal.prepareCreateTemplateCommand; +import com.cloud.agent.api.routing.VmDataCommand; import com.cloud.utils.script.Script; import com.cloud.utils.ssh.SSHCmdHelper; import com.cloud.vm.VirtualMachine.State; import com.trilead.ssh2.SCPClient; -public class PingPxeServerResource extends PxeServerResourceBase { - private static final Logger s_logger = Logger.getLogger(PingPxeServerResource.class); +public class BaremetalPingPxeResource extends BaremetalPxeResourceBase { + private static final Logger s_logger = Logger.getLogger(BaremetalPingPxeResource.class); + private static final String _name = "BaremetalPingPxeResource"; String _storageServer; String _pingDir; String _share; @@ -48,12 +57,15 @@ public class PingPxeServerResource extends PxeServerResourceBase { @Override public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); + _storageServer = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_IP); + _pingDir = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_ROOT_DIR); + _tftpDir = (String)params.get(BaremetalPxeService.PXE_PARAM_TFTP_DIR); + _cifsUserName = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_USERNAME); + _cifsPassword = (String)params.get(BaremetalPxeService.PXE_PARAM_PING_STORAGE_SERVER_PASSWORD); - _storageServer = (String)params.get("storageServer"); - _pingDir = (String)params.get("pingDir"); - _tftpDir = (String)params.get("tftpDir"); - _cifsUserName = (String)params.get("cifsUserName"); - _cifsPassword = (String)params.get("cifsPassword"); + if (_podId == null) { + throw new ConfigurationException("No Pod specified"); + } if (_storageServer == null) { throw new ConfigurationException("No stroage server specified"); @@ -106,6 +118,13 @@ public class PingPxeServerResource extends PxeServerResourceBase { } scp.put(prepareScriptPath, "/usr/bin/", "0755"); + String userDataScript = "scripts/network/ping/baremetal_user_data.py"; + String userDataScriptPath = Script.findScript("", userDataScript); + if (userDataScriptPath == null) { + throw new ConfigurationException("Can not find baremetal_user_data.py at " + userDataScriptPath); + } + scp.put(userDataScriptPath, "/usr/bin/", "0755"); + return true; } catch (Exception e) { throw new ConfigurationException(e.getMessage()); @@ -139,10 +158,10 @@ public class PingPxeServerResource extends PxeServerResourceBase { String script = String.format("python /usr/bin/prepare_tftp_bootfile.py restore %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s %10$s %11$s", _tftpDir, cmd.getMac(), _storageServer, _share, _dir, cmd.getTemplate(), _cifsUserName, _cifsPassword, cmd.getIp(), cmd.getNetMask(), cmd.getGateWay()); - s_logger.debug("Prepare Ping PXE server successfully"); if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { return new PreparePxeServerAnswer(cmd, "prepare PING at " + _ip + " failed, command:" + script); } + s_logger.debug("Prepare Ping PXE server successfully"); return new PreparePxeServerAnswer(cmd); } catch (Exception e){ @@ -167,10 +186,10 @@ public class PingPxeServerResource extends PxeServerResourceBase { String script = String.format("python /usr/bin/prepare_tftp_bootfile.py backup %1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s %10$s %11$s", _tftpDir, cmd.getMac(), _storageServer, _share, _dir, cmd.getTemplate(), _cifsUserName, _cifsPassword, cmd.getIp(), cmd.getNetMask(), cmd.getGateWay()); - s_logger.debug("Prepare for creating template successfully"); if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { return new Answer(cmd, false, "prepare for creating template failed, command:" + script); } + s_logger.debug("Prepare for creating template successfully"); return new Answer(cmd, true, "Success"); } catch (Exception e){ @@ -189,8 +208,53 @@ public class PingPxeServerResource extends PxeServerResourceBase { return execute((PreparePxeServerCommand) cmd); } else if (cmd instanceof prepareCreateTemplateCommand) { return execute((prepareCreateTemplateCommand)cmd); + } else if (cmd instanceof VmDataCommand) { + return execute((VmDataCommand)cmd); } else { return super.executeRequest(cmd); } } + + private Answer execute(VmDataCommand cmd) { + com.trilead.ssh2.Connection sshConnection = new com.trilead.ssh2.Connection(_ip, 22); + try { + List vmData = cmd.getVmData(); + StringBuilder sb = new StringBuilder(); + for (String[] data : vmData) { + String folder = data[0]; + String file = data[1]; + String contents = (data[2] == null) ? "none" : data[2]; + sb.append(cmd.getVmIpAddress()); + sb.append(","); + sb.append(folder); + sb.append(","); + sb.append(file); + sb.append(","); + sb.append(contents); + sb.append(";"); + } + String arg = org.apache.commons.lang.StringUtils.stripEnd(sb.toString(), ";"); + + sshConnection.connect(null, 60000, 60000); + if (!sshConnection.authenticateWithPassword(_username, _password)) { + s_logger.debug("SSH Failed to authenticate"); + throw new ConfigurationException(String.format("Cannot connect to PING PXE server(IP=%1$s, username=%2$s, password=%3$s", _ip, _username, + _password)); + } + + String script = String.format("python /usr/bin/baremetal_user_data.py '%s'", arg); + if (!SSHCmdHelper.sshExecuteCmd(sshConnection, script)) { + return new Answer(cmd, false, "Failed to add user data, command:" + script); + } + + return new Answer(cmd, true, "Success"); + } catch (Exception e){ + s_logger.debug("Prepare for creating baremetal template failed", e); + return new Answer(cmd, false, e.getMessage()); + } finally { + if (sshConnection != null) { + sshConnection.close(); + } + } + } } diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java new file mode 100755 index 00000000000..7b8d528b4b4 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeElement.java @@ -0,0 +1,176 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +import javax.ejb.Local; +import javax.inject.Inject; + +import org.apache.log4j.Logger; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.Pod; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.element.NetworkElement; +import com.cloud.offering.NetworkOffering; +import com.cloud.utils.component.AdapterBase; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.NicVO; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VMInstanceVO; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachine.Type; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.dao.NicDao; +import com.cloud.vm.dao.VMInstanceDao; + +@Local(value = NetworkElement.class) +public class BaremetalPxeElement extends AdapterBase implements NetworkElement { + private static final Logger s_logger = Logger.getLogger(BaremetalPxeElement.class); + private static final Map> capabilities; + + @Inject BaremetalPxeManager _pxeMgr;; + @Inject VMInstanceDao _vmDao; + @Inject NicDao _nicDao; + + static { + Capability cap = new Capability(BaremetalPxeManager.BAREMETAL_PXE_CAPABILITY); + Map baremetalCaps = new HashMap(); + baremetalCaps.put(cap, null); + capabilities = new HashMap>(); + capabilities.put(BaremetalPxeManager.BAREMETAL_PXE_SERVICE, baremetalCaps); + } + + @Override + public Map> getCapabilities() { + return capabilities; + } + + @Override + public Provider getProvider() { + return BaremetalPxeManager.BAREMETAL_PXE_SERVICE_PROVIDER; + } + + private boolean canHandle(DeployDestination dest, TrafficType trafficType, GuestType networkType) { + Pod pod = dest.getPod(); + if (pod != null && dest.getDataCenter().getNetworkType() == NetworkType.Basic && trafficType == TrafficType.Guest) { + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + sc.addAnd(sc.getEntity().getPodId(), Op.EQ, pod.getId()); + return sc.find() != null; + } + + return false; + } + + @Override + public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + if (offering.isSystemOnly() || !canHandle(dest, offering.getTrafficType(), network.getGuestType())) { + s_logger.debug("BaremetalPxeElement can not handle network offering: " + offering.getName()); + return false; + } + return true; + } + + @Override + @DB + public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, + ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + if (vm.getType() != Type.User || vm.getHypervisorType() != HypervisorType.BareMetal) { + return false; + } + + VMInstanceVO vo = _vmDao.findById(vm.getId()); + if (vo.getLastHostId() == null) { + Transaction txn = Transaction.currentTxn(); + txn.start(); + nic.setMacAddress(dest.getHost().getPrivateMacAddress()); + NicVO nicVo = _nicDao.findById(nic.getId()); + assert vo != null : "Where ths nic " + nic.getId() + " going???"; + nicVo.setMacAddress(nic.getMacAddress()); + _nicDao.update(nicVo.getId(), nicVo); + txn.commit(); + + /*This vm is just being created */ + if (!_pxeMgr.prepare(vm, nic, dest, context)) { + throw new CloudRuntimeException("Cannot prepare pxe server"); + } + } + + return false; + } + + @Override + public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + return true; + } + + @Override + public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException { + return true; + } + + @Override + public boolean isReady(PhysicalNetworkServiceProvider provider) { + return true; + } + + @Override + public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { + return true; + } + + @Override + public boolean canEnableIndividualServices() { + return false; + } + + @Override + public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { + return true; + } + + @Override + public boolean verifyServicesCombination(Set services) { + return true; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeKickStartResponse.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeKickStartResponse.java new file mode 100755 index 00000000000..64f22e0947e --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeKickStartResponse.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.EntityReference; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value=BaremetalPxeVO.class) +public class BaremetalPxeKickStartResponse extends BaremetalPxeResponse { + @SerializedName(ApiConstants.TFTP_DIR) @Param(description="Tftp root directory of PXE server") + private String tftpDir; + + public String getTftpDir() { + return tftpDir; + } + + public void setTftpDir(String tftpDir) { + this.tftpDir = tftpDir; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java new file mode 100755 index 00000000000..e0a51627fc4 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManager.java @@ -0,0 +1,65 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + +import java.util.List; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.deploy.DeployDestination; +import com.cloud.host.HostVO; +import com.cloud.network.Network; +import com.cloud.network.Network.Provider; +import com.cloud.uservm.UserVm; +import com.cloud.utils.component.Manager; +import com.cloud.utils.component.PluggableService; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachineProfile; + +public interface BaremetalPxeManager extends Manager, PluggableService { + public enum BaremetalPxeType { + PING, + KICK_START, + } + + boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context); + + boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl); + + BaremetalPxeType getPxeServerType(HostVO host); + + BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd); + + BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo); + + List listPxeServers(ListBaremetalPxePingServersCmd cmd); + + boolean addUserData(NicProfile nic, VirtualMachineProfile vm); + + public static final Network.Service BAREMETAL_PXE_SERVICE = new Network.Service("BaremetalPxeService"); + public static final String BAREMETAL_PXE_CAPABILITY = "BaremetalPxe"; + public static final String BAREMETAL_PXE_SERVICE_PROPERTIES = "baremetalpxe_commands.properties"; + public static final Provider BAREMETAL_PXE_SERVICE_PROVIDER = new Provider("BaremetalPxeProvider", true);; + public static final Provider BAREMETAL_USERDATA_PROVIDER = new Provider("BaremetaUserdataProvider", true); +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java new file mode 100755 index 00000000000..6288f918567 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeManagerImpl.java @@ -0,0 +1,246 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.StartupPxeServerCommand; +import com.cloud.agent.api.routing.VmDataCommand; +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.configuration.dao.ConfigurationDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.resource.ResourceManager; +import com.cloud.resource.ResourceStateAdapter; +import com.cloud.resource.ServerResource; +import com.cloud.resource.UnableDeleteHostException; +import com.cloud.service.dao.ServiceOfferingDao; +import com.cloud.uservm.UserVm; +import com.cloud.utils.StringUtils; +import com.cloud.utils.component.ManagerBase; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.NicVO; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachineProfile; +import com.cloud.vm.dao.NicDao; +import com.cloud.vm.dao.UserVmDao; + +@Local(value = {BaremetalPxeManager.class}) +public class BaremetalPxeManagerImpl extends ManagerBase implements BaremetalPxeManager, ResourceStateAdapter { + private static final org.apache.log4j.Logger s_logger = Logger.getLogger(BaremetalPxeManagerImpl.class); + protected String _name; + @Inject DataCenterDao _dcDao; + @Inject HostDao _hostDao; + @Inject AgentManager _agentMgr; + @Inject ResourceManager _resourceMgr; + @Inject List _services; + @Inject UserVmDao _vmDao; + @Inject ServiceOfferingDao _serviceOfferingDao; + @Inject NicDao _nicDao; + @Inject ConfigurationDao _configDao; + @Inject PhysicalNetworkDao _phynwDao; + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + _name = name; + _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this); + return true; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); + return true; + } + + @Override + public String getName() { + return _name; + } + + protected BaremetalPxeService getServiceByType(String type) { + for (BaremetalPxeService service : _services) { + if (service.getPxeServiceType().equals(type)) { + return service; + } + } + + throw new CloudRuntimeException("Cannot find PXE service for " + type); + } + + @Override + public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context) { + //TODO: select type from template + BaremetalPxeType type = BaremetalPxeType.KICK_START; + return getServiceByType(type.toString()).prepare(profile, nic, dest, context); + } + + @Override + public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl) { + //TODO: select type from template + BaremetalPxeType type = BaremetalPxeType.PING; + return getServiceByType(type.toString()).prepareCreateTemplate(pxeServerId, vm, templateUrl); + } + + @Override + public BaremetalPxeType getPxeServerType(HostVO host) { + if (host.getResource().equalsIgnoreCase(BaremetalPingPxeResource.class.getName())) { + return BaremetalPxeType.PING; + } else { + throw new CloudRuntimeException("Unkown PXE server resource " + host.getResource()); + } + } + + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) { + // TODO Auto-generated method stub + return null; + } + + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map details, + List hostTags) { + if (!(startup[0] instanceof StartupPxeServerCommand)) { + return null; + } + + host.setType(Host.Type.BaremetalPxe); + return host; + } + + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException { + // TODO Auto-generated method stub + return null; + } + + @Override + public BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd) { + return getServiceByType(cmd.getDeviceType()).addPxeServer(cmd); + } + + @Override + public BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo) { + return getServiceByType(vo.getDeviceType()).getApiResponse(vo); + } + + @Override + public List listPxeServers(ListBaremetalPxePingServersCmd cmd) { + return getServiceByType(BaremetalPxeManager.BaremetalPxeType.PING.toString()).listPxeServers(cmd); + } + + @Override + public boolean addUserData(NicProfile nic, VirtualMachineProfile profile) { + UserVmVO vm = (UserVmVO) profile.getVirtualMachine(); + _vmDao.loadDetails(vm); + + String serviceOffering = _serviceOfferingDao.findByIdIncludingRemoved(vm.getServiceOfferingId()).getDisplayText(); + String zoneName = _dcDao.findById(vm.getDataCenterId()).getName(); + NicVO nvo = _nicDao.findById(nic.getId()); + VmDataCommand cmd = new VmDataCommand(nvo.getIp4Address(), vm.getInstanceName()); + cmd.addVmData("userdata", "user-data", vm.getUserData()); + cmd.addVmData("metadata", "service-offering", StringUtils.unicodeEscape(serviceOffering)); + cmd.addVmData("metadata", "availability-zone", StringUtils.unicodeEscape(zoneName)); + cmd.addVmData("metadata", "local-ipv4", nic.getIp4Address()); + cmd.addVmData("metadata", "local-hostname", StringUtils.unicodeEscape(vm.getInstanceName())); + cmd.addVmData("metadata", "public-ipv4", nic.getIp4Address()); + cmd.addVmData("metadata", "public-hostname", StringUtils.unicodeEscape(vm.getInstanceName())); + cmd.addVmData("metadata", "instance-id", String.valueOf(vm.getId())); + cmd.addVmData("metadata", "vm-id", String.valueOf(vm.getInstanceName())); + cmd.addVmData("metadata", "public-keys", null); + String cloudIdentifier = _configDao.getValue("cloud.identifier"); + if (cloudIdentifier == null) { + cloudIdentifier = ""; + } else { + cloudIdentifier = "CloudStack-{" + cloudIdentifier + "}"; + } + cmd.addVmData("metadata", "cloud-identifier", cloudIdentifier); + + List phys = _phynwDao.listByZone(vm.getDataCenterId()); + if (phys.isEmpty()) { + throw new CloudRuntimeException(String.format("Cannot find physical network in zone %s", vm.getDataCenterId())); + } + if (phys.size() > 1) { + throw new CloudRuntimeException(String.format("Baremetal only supports one physical network in zone, but zone %s has %s physical networks", vm.getDataCenterId(), phys.size())); + } + PhysicalNetworkVO phy = phys.get(0); + + SearchCriteriaService sc = SearchCriteria2.create(BaremetalPxeVO.class); + //TODO: handle both kickstart and PING + //sc.addAnd(sc.getEntity().getPodId(), Op.EQ, vm.getPodIdToDeployIn()); + sc.addAnd(sc.getEntity().getPhysicalNetworkId(), Op.EQ, phy.getId()); + BaremetalPxeVO pxeVo = sc.find(); + if (pxeVo == null) { + throw new CloudRuntimeException("No PXE server found in pod: " + vm.getPodIdToDeployIn() + ", you need to add it before starting VM"); + } + + try { + Answer ans = _agentMgr.send(pxeVo.getHostId(), cmd); + if (!ans.getResult()) { + s_logger.debug(String.format("Add userdata to vm:%s failed because %s", vm.getInstanceName(), ans.getDetails())); + return false; + } else { + return true; + } + } catch (Exception e) { + s_logger.debug(String.format("Add userdata to vm:%s failed", vm.getInstanceName()), e); + return false; + } + } + + @Override + public List> getCommands() { + List> cmds = new ArrayList>(); + cmds.add(AddBaremetalKickStartPxeCmd.class); + cmds.add(AddBaremetalPxePingServerCmd.class); + cmds.add(ListBaremetalPxePingServersCmd.class); + return cmds; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxePingResponse.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxePingResponse.java new file mode 100755 index 00000000000..81bd2511355 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxePingResponse.java @@ -0,0 +1,61 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.EntityReference; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; +@EntityReference(value=BaremetalPxeVO.class) +public class BaremetalPxePingResponse extends BaremetalPxeResponse { + @SerializedName(ApiConstants.PING_STORAGE_SERVER_IP) @Param(description="PING storage server ip") + private String pingStorageServerIp; + + @SerializedName(ApiConstants.PING_DIR) @Param(description="Root directory on PING storage server") + private String pingDir; + + @SerializedName(ApiConstants.TFTP_DIR) @Param(description="Tftp root directory of PXE server") + private String tftpDir; + + public String getPingStorageServerIp() { + return pingStorageServerIp; + } + + public void setPingStorageServerIp(String pingStorageServerIp) { + this.pingStorageServerIp = pingStorageServerIp; + } + + public String getPingDir() { + return pingDir; + } + + public void setPingDir(String pingDir) { + this.pingDir = pingDir; + } + + public String getTftpDir() { + return tftpDir; + } + + public void setTftpDir(String tftpDir) { + this.tftpDir = tftpDir; + } +} diff --git a/server/src/com/cloud/baremetal/PxeServerResourceBase.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java old mode 100644 new mode 100755 similarity index 77% rename from server/src/com/cloud/baremetal/PxeServerResourceBase.java rename to plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java index c307ccfc111..a90a789e9ba --- a/server/src/com/cloud/baremetal/PxeServerResourceBase.java +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResourceBase.java @@ -5,16 +5,22 @@ // 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.baremetal; +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; import java.util.Map; @@ -32,9 +38,10 @@ import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupPxeServerCommand; import com.cloud.host.Host.Type; import com.cloud.resource.ServerResource; +import com.cloud.utils.component.ManagerBase; -public class PxeServerResourceBase implements ServerResource { - private static final Logger s_logger = Logger.getLogger(PxeServerResourceBase.class); +public class BaremetalPxeResourceBase extends ManagerBase implements ServerResource { + private static final Logger s_logger = Logger.getLogger(BaremetalPxeResourceBase.class); String _name; String _guid; String _username; @@ -46,12 +53,12 @@ public class PxeServerResourceBase implements ServerResource { @Override public boolean configure(String name, Map params) throws ConfigurationException { _name = name; - _guid = (String)params.get("guid"); - _ip = (String)params.get("ip"); - _username = (String)params.get("username"); - _password = (String)params.get("password"); - _zoneId = (String)params.get("zone"); - _podId = (String)params.get("pod"); + _guid = (String)params.get(BaremetalPxeService.PXE_PARAM_GUID); + _ip = (String)params.get(BaremetalPxeService.PXE_PARAM_IP); + _username = (String)params.get(BaremetalPxeService.PXE_PARAM_USERNAME); + _password = (String)params.get(BaremetalPxeService.PXE_PARAM_PASSWORD); + _zoneId = (String)params.get(BaremetalPxeService.PXE_PARAM_ZONE); + _podId = (String)params.get(BaremetalPxeService.PXE_PARAM_POD); if (_guid == null) { throw new ConfigurationException("No Guid specified"); @@ -61,10 +68,6 @@ public class PxeServerResourceBase implements ServerResource { throw new ConfigurationException("No Zone specified"); } - if (_podId == null) { - throw new ConfigurationException("No Pod specified"); - } - if (_ip == null) { throw new ConfigurationException("No IP specified"); } @@ -103,7 +106,7 @@ public class PxeServerResourceBase implements ServerResource { @Override public Type getType() { - return Type.PxeServer; + return Type.BaremetalPxe; } @Override diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.java new file mode 100755 index 00000000000..2103020cfef --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeResponse.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class BaremetalPxeResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) @Param(description="device id of ") + private String id; + + @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this external dhcp device belongs to") + private String physicalNetworkId; + + @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider") + private String providerId; + + @SerializedName(ApiConstants.POD_ID) @Param(description="pod id where the device is in") + private String podId; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getPhysicalNetworkId() { + return physicalNetworkId; + } + + public void setPhysicalNetworkId(String physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public String getProviderId() { + return providerId; + } + + public void setProviderId(String providerId) { + this.providerId = providerId; + } + + public String getPodId() { + return podId; + } + + public void setPodId(String podId) { + this.podId = podId; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.java new file mode 100755 index 00000000000..9fd560f2bc5 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalPxeService.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// +// Automatically generated by addcopyright.py at 04/03/2012 +package com.cloud.baremetal.networkservice; + +import java.util.List; + +import com.cloud.baremetal.database.BaremetalPxeVO; +import com.cloud.deploy.DeployDestination; +import com.cloud.host.Host; +import com.cloud.uservm.UserVm; +import com.cloud.utils.component.Adapter; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.UserVmVO; +import com.cloud.vm.VirtualMachineProfile; + +public interface BaremetalPxeService extends Adapter { + + public boolean prepare(VirtualMachineProfile profile, NicProfile nic, DeployDestination dest, ReservationContext context); + + public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl); + + BaremetalPxeVO addPxeServer(AddBaremetalPxeCmd cmd); + + BaremetalPxeResponse getApiResponse(BaremetalPxeVO vo); + + List listPxeServers(ListBaremetalPxePingServersCmd cmd); + + String getPxeServiceType(); + + public static final String PXE_PARAM_TYPE = "type"; + public static final String PXE_PARAM_ZONE = "zone"; + public static final String PXE_PARAM_POD = "pod"; + public static final String PXE_PARAM_IP = "ip"; + public static final String PXE_PARAM_GUID = "guid"; + public static final String PXE_PARAM_TFTP_DIR = "tftpDir"; + public static final String PXE_PARAM_USERNAME = "username"; + public static final String PXE_PARAM_PASSWORD = "password"; + public static final String PXE_PARAM_PING_STORAGE_SERVER_IP = "pingStorageServerIp"; + public static final String PXE_PARAM_PING_ROOT_DIR = "pingDir"; + public static final String PXE_PARAM_PING_STORAGE_SERVER_USERNAME = "pingStorageServerUserName"; + public static final String PXE_PARAM_PING_STORAGE_SERVER_PASSWORD = "pingStorageServerPassword"; +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java new file mode 100755 index 00000000000..3d9f5819582 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/BaremetalUserdataElement.java @@ -0,0 +1,173 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import java.util.HashMap; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.ejb.Local; +import javax.inject.Inject; + +import com.cloud.baremetal.manager.BaremetalManager; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.network.Network; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.Networks.TrafficType; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.element.IpDeployer; +import com.cloud.network.element.NetworkElement; +import com.cloud.network.element.UserDataServiceProvider; +import com.cloud.offering.NetworkOffering; +import com.cloud.uservm.UserVm; +import com.cloud.utils.component.AdapterBase; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; + +@Local(value = NetworkElement.class) +public class BaremetalUserdataElement extends AdapterBase implements NetworkElement, UserDataServiceProvider { + private static Map> capabilities; + + @Inject + private BaremetalPxeManager pxeMgr; + + static { + capabilities = new HashMap>(); + capabilities.put(Service.UserData, null); + } + + private boolean canHandle(DeployDestination dest) { + if (dest.getDataCenter().getNetworkType() == NetworkType.Basic && dest.getHost().getHypervisorType() == HypervisorType.BareMetal) { + return true; + } + return false; + } + + @Override + public boolean addPasswordAndUserdata(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, + ReservationContext context) throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException { + if (!canHandle(dest)) { + return false; + } + + if (vm.getType() != VirtualMachine.Type.User) { + return false; + } + + return pxeMgr.addUserData(nic, (VirtualMachineProfile) vm); + } + + @Override + public boolean savePassword(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public Map> getCapabilities() { + return capabilities; + } + + @Override + public Provider getProvider() { + return BaremetalPxeManager.BAREMETAL_USERDATA_PROVIDER; + } + + @Override + public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, + ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean isReady(PhysicalNetworkServiceProvider provider) { + return true; + } + + @Override + public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean canEnableIndividualServices() { + // TODO Auto-generated method stub + return true; + } + + + @Override + public boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) + throws ResourceUnavailableException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean destroy(Network network, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { + return true; + } + + @Override + public boolean verifyServicesCombination(Set services) { + return true; + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalDhcpCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalDhcpCmd.java new file mode 100755 index 00000000000..1dc46a8f044 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalDhcpCmd.java @@ -0,0 +1,104 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +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.BaseCmd; +import org.apache.cloudstack.api.BaseCmd.CommandType; +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.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="listBaremetalDhcp", description="list baremetal dhcp servers", responseObject = BaremetalDhcpResponse.class) +public class ListBaremetalDhcpCmd extends BaseListCmd { + private static final Logger s_logger = Logger.getLogger(ListBaremetalDhcpCmd.class); + private static final String s_name = "listexternaldhcpresponse"; + @Inject BaremetalDhcpManager _dhcpMgr; + + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "DHCP server device ID") + private Long id; + + @Parameter(name = ApiConstants.POD_ID, type = CommandType.LONG, description = "Pod ID where pxe server is in") + private Long podId; + + @Parameter(name = ApiConstants.DHCP_SERVER_TYPE, type = CommandType.STRING, description = "Type of DHCP device") + private String deviceType; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPodId() { + return podId; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + public String getDeviceType() { + return deviceType; + } + + public void setDeviceType(String deviceType) { + this.deviceType = deviceType; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + ListResponse response = new ListResponse(); + List dhcpResponses = _dhcpMgr.listBaremetalDhcps(this); + response.setResponses(dhcpResponses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (Exception e) { + s_logger.debug("Exception happend while executing ListBaremetalDhcpCmd"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + + } + + @Override + public String getCommandName() { + return s_name; + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalPxePingServersCmd.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalPxePingServersCmd.java new file mode 100755 index 00000000000..0b418f01d7a --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/ListBaremetalPxePingServersCmd.java @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +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.BaseCmd; +import org.apache.cloudstack.api.BaseCmd.CommandType; +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.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="listBaremetalPxePingServer", description="list baremetal ping pxe server", responseObject = BaremetalPxePingResponse.class) +public class ListBaremetalPxePingServersCmd extends BaseListCmd { + private static final Logger s_logger = Logger.getLogger(ListBaremetalPxePingServersCmd.class); + private static final String s_name = "listpingpxeserverresponse"; + + @Inject + BaremetalPxeManager _pxeMgr; + // /////////////////////////////////////////////////// + // ////////////// API parameters ///////////////////// + // /////////////////////////////////////////////////// + + @Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "Ping pxe server device ID") + private Long id; + + @Parameter(name = ApiConstants.POD_ID, type = CommandType.LONG, description = "Pod ID where pxe server is in") + private Long podId; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPodId() { + return podId; + } + + public void setPodId(Long podId) { + this.podId = podId; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + ListResponse response = new ListResponse(); + List pxeResponses = _pxeMgr.listPxeServers(this); + response.setResponses(pxeResponses); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (Exception e) { + s_logger.debug("Exception happend while executing ListPingPxeServersCmd" ,e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/PrepareKickstartPxeServerCommand.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/PrepareKickstartPxeServerCommand.java new file mode 100755 index 00000000000..89515475062 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/PrepareKickstartPxeServerCommand.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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +package com.cloud.baremetal.networkservice; + +import com.cloud.agent.api.Command; + +public class PrepareKickstartPxeServerCommand extends Command { + private String ksFile; + private String repo; + private String templateUuid; + private String mac; + private String ksDevice; + + @Override + public boolean executeInSequence() { + return true; + } + + public String getKsFile() { + return ksFile; + } + + public void setKsFile(String ksFile) { + this.ksFile = ksFile; + } + + public String getRepo() { + return repo; + } + + public void setRepo(String repo) { + this.repo = repo; + } + + public String getTemplateUuid() { + return templateUuid; + } + + public void setTemplateUuid(String templateUuid) { + this.templateUuid = templateUuid; + } + + public String getMac() { + return mac; + } + + public void setMac(String mac) { + this.mac = mac; + } + + public String getKsDevice() { + return ksDevice; + } + + public void setKsDevice(String ksDevice) { + this.ksDevice = ksDevice; + } +} diff --git a/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/SecurityGroupHttpClient.java b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/SecurityGroupHttpClient.java new file mode 100755 index 00000000000..7ad351c2e33 --- /dev/null +++ b/plugins/hypervisors/baremetal/src/com/cloud/baremetal/networkservice/SecurityGroupHttpClient.java @@ -0,0 +1,38 @@ +// 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. +// +// Automatically generated by addcopyright.py at 01/29/2013 +// Apache License, Version 2.0 (the "License"); you may not use this +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +package com.cloud.baremetal.networkservice; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.SecurityGroupRulesCmd; + +public class SecurityGroupHttpClient { + + public Answer call(String guestIp, SecurityGroupRulesCmd cmd) { + // TODO Auto-generated method stub + return null; + } + + public boolean echo(String ip, long millis, long millis2) { + // TODO Auto-generated method stub + return false; + } + +} diff --git a/plugins/hypervisors/kvm/pom.xml b/plugins/hypervisors/kvm/pom.xml index 8fc8f739460..579244014f9 100644 --- a/plugins/hypervisors/kvm/pom.xml +++ b/plugins/hypervisors/kvm/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java index e6f2f7f376a..b897df2ecf3 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/BridgeVifDriver.java @@ -33,6 +33,7 @@ import org.libvirt.LibvirtException; import javax.naming.ConfigurationException; import java.net.URI; import java.util.Map; +import java.io.File; public class BridgeVifDriver extends VifDriverBase { @@ -85,6 +86,9 @@ public class BridgeVifDriver extends VifDriverBase { URI broadcastUri = nic.getBroadcastUri(); vlanId = broadcastUri.getHost(); } + else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) { + throw new InternalErrorException("Nicira NVP Logicalswitches are not supported by the BridgeVifDriver"); + } String trafficLabel = nic.getName(); if (nic.getType() == Networks.TrafficType.Guest) { if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan @@ -172,7 +176,7 @@ public class BridgeVifDriver extends VifDriverBase { createControlNetwork(_bridges.get("linklocal")); } - private void deletExitingLinkLocalRoutTable(String linkLocalBr) { + private void deleteExitingLinkLocalRouteTable(String linkLocalBr) { Script command = new Script("/bin/bash", _timeout); command.add("-c"); command.add("ip route | grep " + NetUtils.getLinkLocalCIDR()); @@ -197,7 +201,7 @@ public class BridgeVifDriver extends VifDriverBase { } private void createControlNetwork(String privBrName) { - deletExitingLinkLocalRoutTable(privBrName); + deleteExitingLinkLocalRouteTable(privBrName); if (!isBridgeExists(privBrName)) { Script.runSimpleBashScript("brctl addbr " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + privBrName + " 169.254.0.1", _timeout); @@ -206,15 +210,11 @@ public class BridgeVifDriver extends VifDriverBase { } private boolean isBridgeExists(String bridgeName) { - Script command = new Script("/bin/sh", _timeout); - command.add("-c"); - command.add("brctl show|grep " + bridgeName); - final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); - String result = command.execute(parser); - if (result != null || parser.getLine() == null) { - return false; - } else { + File f = new File("/sys/devices/virtual/net/" + bridgeName); + if (f.exists()) { return true; + } else { + return false; } } } diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java index 6b5f6df3bff..99b8723c26e 100755 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java @@ -25,9 +25,7 @@ import java.io.FileReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; import java.net.InetAddress; -import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; @@ -44,15 +42,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Properties; -import java.util.regex.Pattern; -import java.util.regex.Matcher; -import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.ejb.Local; import javax.naming.ConfigurationException; @@ -162,12 +159,20 @@ import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; +import com.cloud.agent.api.storage.ResizeVolumeCommand; +import com.cloud.agent.api.storage.ResizeVolumeAnswer; import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.agent.api.to.VolumeTO; +import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource; +import com.cloud.dc.Vlan; +import com.cloud.exception.InternalErrorException; +import com.cloud.host.Host.Type; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.kvm.resource.KVMHABase.NfsStoragePool; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ConsoleDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.CpuTuneDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.DevicesDef; @@ -182,16 +187,10 @@ import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef.hostNicType; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.SerialDef; import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.TermPolicy; -import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.ClockDef; -import com.cloud.agent.resource.virtualnetwork.VirtualRoutingResource; import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk; import com.cloud.hypervisor.kvm.storage.KVMPhysicalDisk.PhysicalDiskFormat; import com.cloud.hypervisor.kvm.storage.KVMStoragePool; import com.cloud.hypervisor.kvm.storage.KVMStoragePoolManager; -import com.cloud.dc.Vlan; -import com.cloud.exception.InternalErrorException; -import com.cloud.host.Host.Type; -import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.IsolationType; import com.cloud.network.Networks.RouterPrivateIpStrategy; @@ -199,6 +198,7 @@ import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetworkSetupInfo; import com.cloud.resource.ServerResource; import com.cloud.resource.ServerResourceBase; +import com.cloud.storage.JavaStorageLayer; import com.cloud.storage.Storage; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.StoragePoolType; @@ -211,8 +211,8 @@ import com.cloud.storage.template.TemplateInfo; import com.cloud.storage.template.TemplateLocation; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; +import com.cloud.utils.FileUtil; import com.cloud.utils.PropertiesUtil; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; import com.cloud.utils.script.OutputInterpreter; @@ -246,7 +246,7 @@ import com.cloud.vm.VirtualMachineName; **/ @Local(value = { ServerResource.class }) public class LibvirtComputingResource extends ServerResourceBase implements - ServerResource { +ServerResource { private static final Logger s_logger = Logger .getLogger(LibvirtComputingResource.class); @@ -255,6 +255,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements private String _patchdomrPath; private String _createvmPath; private String _manageSnapshotPath; + private String _resizeVolumePath; private String _createTmplPath; private String _heartBeatPath; private String _securityGroupPath; @@ -329,8 +330,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements private boolean _can_bridge_firewall; protected String _localStoragePath; protected String _localStorageUUID; - private Map _pifs = new HashMap(); - private Map> hostNetInfo = new HashMap>(); + private final Map _pifs = new HashMap(); + private final Map> hostNetInfo = new HashMap>(); private final Map _vmStats = new ConcurrentHashMap(); protected boolean _disconnected = true; @@ -363,10 +364,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements private int _dom0MinMem; - protected enum defineOps { - UNDEFINE_VM, DEFINE_VM + protected enum BridgeType { + NATIVE, OPENVSWITCH } + protected BridgeType _bridgeType; + private String getEndIpFromStartIp(String startIp, int numIps) { String[] tokens = startIp.split("[.]"); assert (tokens.length == 4); @@ -375,7 +378,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements tokens[3] = Integer.toString(lastbyte); StringBuilder end = new StringBuilder(15); end.append(tokens[0]).append(".").append(tokens[1]).append(".") - .append(tokens[2]).append(".").append(tokens[3]); + .append(tokens[2]).append(".").append(tokens[3]); return end.toString(); } @@ -444,16 +447,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements return false; } - try { - Class clazz = Class - .forName("com.cloud.storage.JavaStorageLayer"); - _storage = (StorageLayer) ComponentLocator.inject(clazz); - _storage.configure("StorageLayer", params); - } catch (ClassNotFoundException e) { - throw new ConfigurationException("Unable to find class " - + "com.cloud.storage.JavaStorageLayer"); - } - + _storage = new JavaStorageLayer(); + _storage.configure("StorageLayer", params); String domrScriptsDir = (String) params.get("domr.scripts.dir"); if (domrScriptsDir == null) { @@ -475,6 +470,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements storageScriptsDir = getDefaultStorageScriptsDir(); } + String bridgeType = (String) params.get("network.bridge.type"); + if (bridgeType == null) { + _bridgeType = BridgeType.NATIVE; + } + else { + _bridgeType = BridgeType.valueOf(bridgeType.toUpperCase()); + } + params.put("domr.scripts.dir", domrScriptsDir); _virtRouterResource = new VirtualRoutingResource(); @@ -534,6 +537,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements "Unable to find the managesnapshot.sh"); } + _resizeVolumePath = Script.findScript(storageScriptsDir, "resizevolume.sh"); + if (_resizeVolumePath == null) { + throw new ConfigurationException( + "Unable to find the resizevolume.sh"); + } + _createTmplPath = Script .findScript(storageScriptsDir, "createtmplt.sh"); if (_createTmplPath == null) { @@ -652,6 +661,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements Connect conn = null; try { conn = LibvirtConnection.getConnection(); + + if (_bridgeType == BridgeType.OPENVSWITCH) { + if (conn.getLibVirVersion() < (9 * 1000 + 11)) { + throw new ConfigurationException("LibVirt version 0.9.11 required for openvswitch support, but version " + + conn.getLibVirVersion() + " detected"); + } + } } catch (LibvirtException e) { throw new CloudRuntimeException(e.getMessage()); } @@ -682,10 +698,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements _sysvmISOPath = (String) params.get("systemvm.iso.path"); if (_sysvmISOPath == null) { - String[] isoPaths = { "/usr/lib64/cloud/agent/vms/systemvm.iso", - "/usr/lib/cloud/agent/vms/systemvm.iso", - "/usr/lib64/cloud/common/vms/systemvm.iso", - "/usr/lib/cloud/common/vms/systemvm.iso" }; + String[] isoPaths = {"/usr/share/cloudstack-common/vms/systemvm.iso"}; for (String isoPath : isoPaths) { if (_storage.exists(isoPath)) { _sysvmISOPath = isoPath; @@ -697,7 +710,16 @@ public class LibvirtComputingResource extends ServerResourceBase implements } } + switch (_bridgeType) { + case OPENVSWITCH: + getOvsPifs(); + break; + case NATIVE: + default: getPifs(); + break; + } + if (_pifs.get("private") == null) { s_logger.debug("Failed to get private nic name"); throw new ConfigurationException("Failed to get private nic name"); @@ -723,7 +745,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements if (_mountPoint == null) { _mountPoint = "/mnt"; } - + value = (String) params.get("vm.migrate.speed"); _migrateSpeed = NumbersUtil.parseInt(value, -1); if (_migrateSpeed == -1) { @@ -736,7 +758,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements try { _migrateSpeed = Integer.parseInt(tokens[0]); } catch (Exception e) { - + } s_logger.debug("device " + _pifs.get("public") + " has speed: " + String.valueOf(_migrateSpeed)); } @@ -750,39 +772,52 @@ public class LibvirtComputingResource extends ServerResourceBase implements bridges.put("private", _privBridgeName); bridges.put("guest", _guestBridgeName); - params.put("libvirt.host.bridges", (Object) bridges); - params.put("libvirt.host.pifs", (Object) _pifs); + params.put("libvirt.host.bridges", bridges); + params.put("libvirt.host.pifs", _pifs); // Load the vif driver String vifDriverName = (String) params.get("libvirt.vif.driver"); if (vifDriverName == null) { - s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver."); - vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver"; + if (_bridgeType == BridgeType.OPENVSWITCH) { + s_logger.info("No libvirt.vif.driver specififed. Defaults to OvsVifDriver."); + vifDriverName = "com.cloud.hypervisor.kvm.resource.OvsVifDriver"; + } else { + s_logger.info("No libvirt.vif.driver specififed. Defaults to BridgeVifDriver."); + vifDriverName = "com.cloud.hypervisor.kvm.resource.BridgeVifDriver"; + } } - params.put("libvirt.computing.resource", (Object) this); + params.put("libvirt.computing.resource", this); try { - Class clazz = Class.forName(vifDriverName); - _vifDriver = (VifDriver) clazz.newInstance(); - _vifDriver.configure(params); + Class clazz = Class.forName(vifDriverName); + _vifDriver = (VifDriver) clazz.newInstance(); + _vifDriver.configure(params); } catch (ClassNotFoundException e) { - throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e); + throw new ConfigurationException("Unable to find class for libvirt.vif.driver " + e); } catch (InstantiationException e) { - throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e); + throw new ConfigurationException("Unable to instantiate class for libvirt.vif.driver " + e); } catch (Exception e) { - throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e); + throw new ConfigurationException("Failed to initialize libvirt.vif.driver " + e); } - return true; } private void getPifs() { - /* gather all available bridges and find their pifs, so that we can match them against traffic labels later */ - String cmdout = Script.runSimpleBashScript("brctl show | tail -n +2 | grep -v \"^\\s\"|awk '{print $1}'|sed '{:q;N;s/\\n/%/g;t q}'"); - s_logger.debug("cmdout was " + cmdout); - List bridges = Arrays.asList(cmdout.split("%")); + File dir = new File("/sys/devices/virtual/net"); + File[] netdevs = dir.listFiles(); + List bridges = new ArrayList(); + for (int i = 0; i < netdevs.length; i++) { + File isbridge = new File(netdevs[i].getAbsolutePath() + "/bridge"); + String netdevName = netdevs[i].getName(); + s_logger.debug("looking in file " + netdevs[i].getAbsolutePath() + "/bridge"); + if (isbridge.exists()) { + s_logger.debug("Found bridge " + netdevName); + bridges.add(netdevName); + } + } + for (String bridge : bridges) { s_logger.debug("looking for pif for bridge " + bridge); String pif = getPif(bridge); @@ -797,31 +832,115 @@ public class LibvirtComputingResource extends ServerResourceBase implements s_logger.debug("done looking for pifs, no more bridges"); } - private String getPif(String bridge) { - String pif = Script.runSimpleBashScript("brctl show | grep " + bridge + " | awk '{print $4}'"); - String vlan = Script.runSimpleBashScript("ls /proc/net/vlan/" + pif); + private void getOvsPifs() { + String cmdout = Script.runSimpleBashScript("ovs-vsctl list-br | sed '{:q;N;s/\\n/%/g;t q}'"); + s_logger.debug("cmdout was " + cmdout); + List bridges = Arrays.asList(cmdout.split("%")); + for (String bridge : bridges) { + s_logger.debug("looking for pif for bridge " + bridge); + // String pif = getOvsPif(bridge); + // Not really interested in the pif name at this point for ovs + // bridges + String pif = bridge; + if (_publicBridgeName != null && bridge.equals(_publicBridgeName)) { + _pifs.put("public", pif); + } + if (_guestBridgeName != null && bridge.equals(_guestBridgeName)) { + _pifs.put("private", pif); + } + _pifs.put(bridge, pif); + } + s_logger.debug("done looking for pifs, no more bridges"); + } - if (vlan != null && !vlan.isEmpty()) { - pif = Script.runSimpleBashScript("grep ^Device\\: /proc/net/vlan/" + pif + " | awk {'print $2'}"); + private String getPif(String bridge) { + String pif = matchPifFileInDirectory(bridge); + File vlanfile = new File("/proc/net/vlan/" + pif); + + if (vlanfile.isFile()) { + pif = Script.runSimpleBashScript("grep ^Device\\: /proc/net/vlan/" + + pif + " | awk {'print $2'}"); } return pif; } + private String getOvsPif(String bridge) { + String pif = Script.runSimpleBashScript("ovs-vsctl list-ports " + bridge); + return pif; + } + + private String matchPifFileInDirectory(String bridgeName){ + File f = new File("/sys/devices/virtual/net/" + bridgeName + "/brif"); + + if (! f.isDirectory()){ + s_logger.debug("failing to get physical interface from bridge" + + bridgeName + ", does " + f.getAbsolutePath() + + "exist?"); + return ""; + } + + File[] interfaces = f.listFiles(); + + for (int i = 0; i < interfaces.length; i++) { + String fname = interfaces[i].getName(); + s_logger.debug("matchPifFileInDirectory: file name '"+fname+"'"); + if (fname.startsWith("eth") || fname.startsWith("bond") + || fname.startsWith("vlan") || fname.startsWith("em")) { + return fname; + } + } + + s_logger.debug("failing to get physical interface from bridge" + + bridgeName + ", did not find an eth*, bond*, or vlan* in " + + f.getAbsolutePath()); + return ""; + } + + private boolean checkNetwork(String networkName) { if (networkName == null) { return true; } - String name = Script.runSimpleBashScript("brctl show | grep " - + networkName + " | awk '{print $4}'"); - if (name == null) { + if (_bridgeType == BridgeType.OPENVSWITCH) { + return checkOvsNetwork(networkName); + } else { + return checkBridgeNetwork(networkName); + } + } + + private boolean checkBridgeNetwork(String networkName) { + if (networkName == null) { + return true; + } + + String name = matchPifFileInDirectory(networkName); + + if (name == null || name.isEmpty()) { return false; } else { return true; } } + private boolean checkOvsNetwork(String networkName) { + s_logger.debug("Checking if network " + networkName + " exists as openvswitch bridge"); + if (networkName == null) { + return true; + } + + Script command = new Script("/bin/sh", _timeout); + command.add("-c"); + command.add("ovs-vsctl br-exists " + networkName); + String result = command.execute(null); + if ("Ok".equals(result)) { + return true; + } else { + return false; + } + } + private String getVnetId(String vnetId) { return vnetId; } @@ -853,77 +972,24 @@ public class LibvirtComputingResource extends ServerResourceBase implements } } - protected String startDomain(Connect conn, String vmName, String domainXML) + protected String startVM(Connect conn, String vmName, String domainXML) throws LibvirtException, InternalErrorException { - /* No duplicated vm, we will success, or failed */ - boolean failed = false; Domain dm = null; try { - dm = conn.domainDefineXML(domainXML); + /* + We create a transient domain here. When this method gets + called we receive a full XML specification of the guest, + so no need to define it persistent. + + This also makes sure we never have any old "garbage" defined + in libvirt which might haunt us. + */ + dm = conn.domainCreateXML(domainXML, 0); } catch (final LibvirtException e) { - /* Duplicated defined vm */ - s_logger.warn("Failed to define domain " + vmName + ": " + s_logger.warn("Failed to start domain " + vmName + ": " + e.getMessage()); - failed = true; - } finally { - try { - if (dm != null) { - dm.free(); - } - } catch (final LibvirtException e) { - - } } - /* If failed, undefine the vm */ - Domain dmOld = null; - Domain dmNew = null; - try { - if (failed) { - dmOld = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName - .getBytes())); - dmOld.undefine(); - dmNew = conn.domainDefineXML(domainXML); - } - } catch (final LibvirtException e) { - s_logger.warn("Failed to define domain (second time) " + vmName - + ": " + e.getMessage()); - throw e; - } catch (Exception e) { - s_logger.warn("Failed to define domain (second time) " + vmName - + ": " + e.getMessage()); - throw new InternalErrorException(e.toString()); - } finally { - try { - if (dmOld != null) { - dmOld.free(); - } - if (dmNew != null) { - dmNew.free(); - } - } catch (final LibvirtException e) { - - } - } - - /* Start the VM */ - try { - dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName - .getBytes())); - dm.create(); - } catch (LibvirtException e) { - s_logger.warn("Failed to start domain: " + vmName + ": " - + e.getMessage()); - throw e; - } finally { - try { - if (dm != null) { - dm.free(); - } - } catch (final LibvirtException e) { - - } - } return null; } @@ -938,28 +1004,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements return true; } - public static void main(String[] args) { - s_logger.addAppender(new org.apache.log4j.ConsoleAppender( - new org.apache.log4j.PatternLayout(), "System.out")); - LibvirtComputingResource test = new LibvirtComputingResource(); - Map params = new HashMap(); - try { - test.configure("test", params); - } catch (ConfigurationException e) { - System.out.println(e.getMessage()); - e.printStackTrace(); - } - String result = null; - // String result = test.startDomainRouter("domr1", - // "/var/lib/images/centos.5-4.x86-64/centos-small.img", 128, "0064", - // "02:00:30:00:01:01", "00:16:3e:77:e2:a1", "02:00:30:00:64:01"); - boolean created = (result == null); - s_logger.info("Domain " + (created ? " " : " not ") + " created"); - - s_logger.info("Rule " + (created ? " " : " not ") + " created"); - test.stop(); - } - @Override public Answer executeRequest(Command cmd) { @@ -1062,6 +1106,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements return execute((CleanupNetworkRulesCmd) cmd); } else if (cmd instanceof CopyVolumeCommand) { return execute((CopyVolumeCommand) cmd); + } else if (cmd instanceof ResizeVolumeCommand) { + return execute((ResizeVolumeCommand) cmd); } else if (cmd instanceof CheckNetworkCommand) { return execute((CheckNetworkCommand) cmd); } else { @@ -1105,8 +1151,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements KVMStoragePool secondaryStoragePool = null; try { KVMStoragePool primaryPool = _storagePoolMgr.getStoragePool( - pool.getType(), - pool.getUuid()); + pool.getType(), + pool.getUuid()); String volumeName = UUID.randomUUID().toString(); if (copyToSecondary) { @@ -1116,20 +1162,20 @@ public class LibvirtComputingResource extends ServerResourceBase implements String volumeDestPath = "/volumes/" + cmd.getVolumeId() + File.separator; secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI( - secondaryStorageUrl); + secondaryStorageUrl); secondaryStoragePool.createFolder(volumeDestPath); secondaryStoragePool.delete(); secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI( - secondaryStorageUrl - + volumeDestPath); + secondaryStorageUrl + + volumeDestPath); _storagePoolMgr.copyPhysicalDisk(volume, destVolumeName,secondaryStoragePool); return new CopyVolumeAnswer(cmd, true, null, null, volumeName); } else { volumePath = "/volumes/" + cmd.getVolumeId() + File.separator; secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI( - secondaryStorageUrl - + volumePath); + secondaryStorageUrl + + volumePath); KVMPhysicalDisk volume = secondaryStoragePool .getPhysicalDisk(cmd.getVolumePath() + ".qcow2"); _storagePoolMgr.copyPhysicalDisk(volume, volumeName, @@ -1148,7 +1194,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements protected Answer execute(DeleteStoragePoolCommand cmd) { try { _storagePoolMgr.deleteStoragePool(cmd.getPool().getType(), - cmd.getPool().getUuid()); + cmd.getPool().getUuid()); return new Answer(cmd); } catch (CloudRuntimeException e) { return new Answer(cmd, false, e.toString()); @@ -1190,7 +1236,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements long disksize; try { primaryPool = _storagePoolMgr.getStoragePool(pool.getType(), - pool.getUuid()); + pool.getUuid()); disksize = dskch.getSize(); if (cmd.getTemplateUrl() != null) { @@ -1199,7 +1245,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements } else { BaseVol = primaryPool.getPhysicalDisk(cmd.getTemplateUrl()); vol = _storagePoolMgr.createDiskFromTemplate(BaseVol, UUID - .randomUUID().toString(), primaryPool); + .randomUUID().toString(), primaryPool); } if (vol == null) { return new Answer(cmd, false, @@ -1268,13 +1314,81 @@ public class LibvirtComputingResource extends ServerResourceBase implements } } + private String getResizeScriptType (KVMStoragePool pool, KVMPhysicalDisk vol) { + StoragePoolType poolType = pool.getType(); + PhysicalDiskFormat volFormat = vol.getFormat(); + + if(pool.getType() == StoragePoolType.CLVM && volFormat == KVMPhysicalDisk.PhysicalDiskFormat.RAW) { + return "CLVM"; + } else if ((poolType == StoragePoolType.NetworkFilesystem + || poolType == StoragePoolType.SharedMountPoint + || poolType == StoragePoolType.Filesystem) + && volFormat == KVMPhysicalDisk.PhysicalDiskFormat.QCOW2 ) { + return "QCOW2"; + } + return null; + } + + /* uses a local script now, eventually support for virStorageVolResize() will maybe work on + qcow2 and lvm and we can do this in libvirt calls */ + public Answer execute(ResizeVolumeCommand cmd) { + String volid = cmd.getPath(); + long newSize = cmd.getNewSize(); + long currentSize = cmd.getCurrentSize(); + String vmInstanceName = cmd.getInstanceName(); + boolean shrinkOk = cmd.getShrinkOk(); + StorageFilerTO spool = cmd.getPool(); + + try { + KVMStoragePool pool = _storagePoolMgr.getStoragePool(spool.getType(), spool.getUuid()); + KVMPhysicalDisk vol = pool.getPhysicalDisk(volid); + String path = vol.getPath(); + String type = getResizeScriptType(pool, vol); + + if (type == null) { + return new ResizeVolumeAnswer(cmd, false, "Unsupported volume format: pool type '" + + pool.getType() + "' and volume format '" + vol.getFormat() + "'"); + } else if (type.equals("QCOW2") && shrinkOk) { + return new ResizeVolumeAnswer(cmd, false, "Unable to shrink volumes of type " + type); + } + + s_logger.debug("got to the stage where we execute the volume resize, params:" + + path + "," + currentSize + "," + newSize + "," + type + "," + vmInstanceName + "," + shrinkOk); + final Script resizecmd = new Script(_resizeVolumePath, + _cmdsTimeout, s_logger); + resizecmd.add("-s",String.valueOf(newSize)); + resizecmd.add("-c",String.valueOf(currentSize)); + resizecmd.add("-p",path); + resizecmd.add("-t",type); + resizecmd.add("-r",String.valueOf(shrinkOk)); + resizecmd.add("-v",vmInstanceName); + String result = resizecmd.execute(); + + if (result == null) { + + /* fetch new size as seen from libvirt, don't want to assume anything */ + pool = _storagePoolMgr.getStoragePool(spool.getType(), spool.getUuid()); + long finalSize = pool.getPhysicalDisk(volid).getVirtualSize(); + s_logger.debug("after resize, size reports as " + finalSize + ", requested " + newSize); + return new ResizeVolumeAnswer(cmd, true, "success", finalSize); + } + + return new ResizeVolumeAnswer(cmd, false, result); + } catch (CloudRuntimeException e) { + String error = "failed to resize volume: " + e; + s_logger.debug(error); + return new ResizeVolumeAnswer(cmd, false, error); + } + + } + public Answer execute(DestroyCommand cmd) { VolumeTO vol = cmd.getVolume(); try { KVMStoragePool pool = _storagePoolMgr.getStoragePool( - vol.getPoolType(), - vol.getPoolUuid()); + vol.getPoolType(), + vol.getPoolUuid()); pool.deletePhysicalDisk(vol.getPath()); String vmName = cmd.getVmName(); String poolPath = pool.getLocalPath(); @@ -1289,7 +1403,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements _storagePoolMgr.deleteVbdByPath(vol.getPoolType(),patchVbd.getAbsolutePath()); } catch(CloudRuntimeException e) { s_logger.warn("unable to destroy patch disk '" + patchVbd.getAbsolutePath() + - "' while removing root disk for " + vmName + " : " + e); + "' while removing root disk for " + vmName + " : " + e); } } else { s_logger.debug("file '" +patchVbd.getAbsolutePath()+ "' not found"); @@ -1304,20 +1418,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements } private String getVlanIdFromBridge(String brName) { - OutputInterpreter.OneLineParser vlanIdParser = new OutputInterpreter.OneLineParser(); - final Script cmd = new Script("/bin/bash", s_logger); - cmd.add("-c"); - cmd.add("vlanid=$(brctl show |grep " + brName - + " |awk '{print $4}' | cut -s -d. -f 2);echo $vlanid"); - String result = cmd.execute(vlanIdParser); - if (result != null) { - return null; - } - String vlanId = vlanIdParser.getLine(); - if (vlanId.equalsIgnoreCase("")) { - return null; + String pif= matchPifFileInDirectory(brName); + String[] pifparts = pif.split("\\."); + + if(pifparts.length == 2) { + return pifparts[1]; } else { - return vlanId; + s_logger.debug("failed to get vlan id from bridge " + brName + + "attached to physical interface" + pif); + return ""; } } @@ -1425,7 +1534,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements String dev = "eth" + nic.getDeviceId(); String netmask = NetUtils.getSubNet(routerGIP, nic.getNetmask()); String result = _virtRouterResource.assignGuestNetwork(dev, routerIP, - routerGIP, gateway, cidr, netmask, dns, domainName ); + routerGIP, gateway, cidr, netmask, dns, domainName ); if (result != null) { return new SetupGuestNetworkAnswer(cmd, false, "Creating guest network failed due to " + result); @@ -1461,7 +1570,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements String rule = sb.toString(); String result = _virtRouterResource.assignNetworkACL(routerIp, - dev, nic.getIp(), netmask, rule); + dev, nic.getIp(), netmask, rule); if (result != null) { for (int i=0; i < results.length; i++) { @@ -1492,21 +1601,21 @@ public class LibvirtComputingResource extends ServerResourceBase implements List pluggedNics = getInterfaces(conn, routerName); for (InterfaceDef pluggedNic : pluggedNics) { - String pluggedVlanBr = pluggedNic.getBrName(); - String pluggedVlanId = getVlanIdFromBridge(pluggedVlanBr); - if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED) - && pluggedVlanBr.equalsIgnoreCase(_publicBridgeName)) { - break; - } else if (pluggedVlanBr.equalsIgnoreCase(_linkLocalBridgeName)){ - /*skip over, no physical bridge device exists*/ - } else if (pluggedVlanId == null) { - /*this should only be true in the case of link local bridge*/ - return new SetSourceNatAnswer(cmd, false, "unable to find the vlan id for bridge "+pluggedVlanBr+ - " when attempting to set up" + pubVlan + " on router " + routerName); - } else if (pluggedVlanId.equals(pubVlan)) { - break; - } - devNum++; + String pluggedVlanBr = pluggedNic.getBrName(); + String pluggedVlanId = getVlanIdFromBridge(pluggedVlanBr); + if (pubVlan.equalsIgnoreCase(Vlan.UNTAGGED) + && pluggedVlanBr.equalsIgnoreCase(_publicBridgeName)) { + break; + } else if (pluggedVlanBr.equalsIgnoreCase(_linkLocalBridgeName)){ + /*skip over, no physical bridge device exists*/ + } else if (pluggedVlanId == null) { + /*this should only be true in the case of link local bridge*/ + return new SetSourceNatAnswer(cmd, false, "unable to find the vlan id for bridge "+pluggedVlanBr+ + " when attempting to set up" + pubVlan + " on router " + routerName); + } else if (pluggedVlanId.equals(pubVlan)) { + break; + } + devNum++; } String dev = "eth" + devNum; @@ -1542,25 +1651,22 @@ public class LibvirtComputingResource extends ServerResourceBase implements String pluggedVlan = pluggedNic.getBrName(); if (pluggedVlan.equalsIgnoreCase(_linkLocalBridgeName)) { vlanToNicNum.put("LinkLocal",devNum); - } - else if (pluggedVlan.equalsIgnoreCase(_publicBridgeName) - || pluggedVlan.equalsIgnoreCase(_privBridgeName) - || pluggedVlan.equalsIgnoreCase(_guestBridgeName)) { + } else if (pluggedVlan.equalsIgnoreCase(_publicBridgeName) + || pluggedVlan.equalsIgnoreCase(_privBridgeName) + || pluggedVlan.equalsIgnoreCase(_guestBridgeName)) { vlanToNicNum.put(Vlan.UNTAGGED,devNum); - } - else { + } else { vlanToNicNum.put(getVlanIdFromBridge(pluggedVlan),devNum); } devNum++; } for (IpAddressTO ip : ips) { - String ipVlan = ip.getVlanId(); String nicName = "eth" + vlanToNicNum.get(ip.getVlanId()); String netmask = Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); String subnet = NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); _virtRouterResource.assignVpcIpToRouter(routerIP, ip.isAdd(), ip.getPublicIp(), - nicName, ip.getVlanGateway(), netmask, subnet); + nicName, ip.getVlanGateway(), netmask, subnet); results[i++] = ip.getPublicIp() + " - success"; } @@ -1587,14 +1693,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements if (nic.getBrName().equalsIgnoreCase(_linkLocalBridgeName)) { vlanAllocatedToVM.put("LinkLocal", nicPos); } else { - if (nic.getBrName().equalsIgnoreCase(_publicBridgeName) - || nic.getBrName().equalsIgnoreCase(_privBridgeName) - || nic.getBrName().equalsIgnoreCase(_guestBridgeName)) { - vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos); - } else { - String vlanId = getVlanIdFromBridge(nic.getBrName()); - vlanAllocatedToVM.put(vlanId, nicPos); - } + if (nic.getBrName().equalsIgnoreCase(_publicBridgeName) + || nic.getBrName().equalsIgnoreCase(_privBridgeName) + || nic.getBrName().equalsIgnoreCase(_guestBridgeName)) { + vlanAllocatedToVM.put(Vlan.UNTAGGED, nicPos); + } else { + String vlanId = getVlanIdFromBridge(nic.getBrName()); + vlanAllocatedToVM.put(vlanId, nicPos); + } } nicPos++; } @@ -1649,13 +1755,13 @@ public class LibvirtComputingResource extends ServerResourceBase implements } KVMStoragePool primaryPool = _storagePoolMgr.getStoragePool( - cmd.getPool().getType(), - cmd.getPool().getUuid()); + cmd.getPool().getType(), + cmd.getPool().getUuid()); if (primaryPool.getType() == StoragePoolType.RBD) { s_logger.debug("Snapshots are not supported on RBD volumes"); return new ManageSnapshotAnswer(cmd, false, - "Snapshots are not supported on RBD volumes"); + "Snapshots are not supported on RBD volumes"); } KVMPhysicalDisk disk = primaryPool.getPhysicalDisk(cmd @@ -1728,7 +1834,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements Connect conn = LibvirtConnection.getConnection(); secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI( - secondaryStoragePoolUrl); + secondaryStoragePoolUrl); String ssPmountPath = secondaryStoragePool.getLocalPath(); snapshotRelPath = File.separator + "snapshots" + File.separator @@ -1739,8 +1845,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements + File.separator + dcId + File.separator + accountId + File.separator + volumeId; KVMStoragePool primaryPool = _storagePoolMgr.getStoragePool( - cmd.getPool().getType(), - cmd.getPrimaryStoragePoolNameLabel()); + cmd.getPool().getType(), + cmd.getPrimaryStoragePoolNameLabel()); KVMPhysicalDisk snapshotDisk = primaryPool.getPhysicalDisk(cmd .getVolumePath()); Script command = new Script(_manageSnapshotPath, _cmdsTimeout, @@ -1768,8 +1874,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements } KVMStoragePool primaryStorage = _storagePoolMgr.getStoragePool( - cmd.getPool().getType(), - cmd.getPool().getUuid()); + cmd.getPool().getType(), + cmd.getPool().getUuid()); if (state == DomainInfo.DomainState.VIR_DOMAIN_RUNNING && !primaryStorage.isExternalSnapshot()) { String vmUuid = vm.getUUIDString(); @@ -1853,7 +1959,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements KVMStoragePool secondaryStoragePool = null; try { secondaryStoragePool = _storagePoolMgr.getStoragePoolByURI(cmd - .getSecondaryStorageUrl()); + .getSecondaryStorageUrl()); String ssPmountPath = secondaryStoragePool.getLocalPath(); String snapshotDestPath = ssPmountPath + File.separator @@ -1884,15 +1990,15 @@ public class LibvirtComputingResource extends ServerResourceBase implements int index = snapshotPath.lastIndexOf("/"); snapshotPath = snapshotPath.substring(0, index); KVMStoragePool secondaryPool = _storagePoolMgr.getStoragePoolByURI( - cmd.getSecondaryStorageUrl() - + snapshotPath); + cmd.getSecondaryStorageUrl() + + snapshotPath); KVMPhysicalDisk snapshot = secondaryPool.getPhysicalDisk(cmd .getSnapshotName()); String primaryUuid = cmd.getPrimaryStoragePoolNameLabel(); KVMStoragePool primaryPool = _storagePoolMgr .getStoragePool(cmd.getPool().getType(), - primaryUuid); + primaryUuid); String volUuid = UUID.randomUUID().toString(); KVMPhysicalDisk disk = _storagePoolMgr.copyPhysicalDisk(snapshot, volUuid, primaryPool); @@ -1928,7 +2034,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements .getSnapshotName()); secondaryPool = _storagePoolMgr.getStoragePoolByURI( - cmd.getSecondaryStorageUrl()); + cmd.getSecondaryStorageUrl()); String templatePath = secondaryPool.getLocalPath() + File.separator + templateInstallFolder; @@ -1978,8 +2084,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements protected GetStorageStatsAnswer execute(final GetStorageStatsCommand cmd) { try { KVMStoragePool sp = _storagePoolMgr.getStoragePool( - cmd.getPooltype(), - cmd.getStorageId()); + cmd.getPooltype(), + cmd.getStorageId()); return new GetStorageStatsAnswer(cmd, sp.getCapacity(), sp.getUsed()); } catch (CloudRuntimeException e) { @@ -1999,11 +2105,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements String templateInstallFolder = "/template/tmpl/" + templateFolder; secondaryStorage = _storagePoolMgr.getStoragePoolByURI( - secondaryStorageURL); + secondaryStorageURL); KVMStoragePool primary = _storagePoolMgr.getStoragePool( - cmd.getPool().getType(), - cmd.getPrimaryStoragePoolNameLabel()); + cmd.getPool().getType(), + cmd.getPrimaryStoragePoolNameLabel()); KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath()); String tmpltPath = secondaryStorage.getLocalPath() + File.separator + templateInstallFolder; @@ -2024,12 +2130,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements } else { s_logger.debug("Converting RBD disk " + disk.getPath() + " into template " + cmd.getUniqueName()); Script.runSimpleBashScript("qemu-img convert" - + " -f raw -O qcow2 " - + KVMPhysicalDisk.RBDStringBuilder(primary.getSourceHost(), - primary.getSourcePort(), - primary.getAuthUserName(), - primary.getAuthSecret(), - disk.getPath()) + + " -f raw -O qcow2 " + + KVMPhysicalDisk.RBDStringBuilder(primary.getSourceHost(), + primary.getSourcePort(), + primary.getAuthUserName(), + primary.getAuthSecret(), + disk.getPath()) + " " + tmpltPath + "/" + cmd.getUniqueName() + ".qcow2"); File templateProp = new File(tmpltPath + "/template.properties"); if (!templateProp.exists()) { @@ -2126,8 +2232,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements /* Copy volume to primary storage */ KVMStoragePool primaryPool = _storagePoolMgr.getStoragePool( - cmd.getPool().getType(), - cmd.getPoolUuid()); + cmd.getPool().getType(), + cmd.getPoolUuid()); KVMPhysicalDisk primaryVol = _storagePoolMgr.copyPhysicalDisk( tmplVol, UUID.randomUUID().toString(), primaryPool); @@ -2233,7 +2339,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements final StringBuffer sb = new StringBuffer(); sb.append("http://").append(proxyManagementIp).append(":" + cmdPort) - .append("/cmd/getstatus"); + .append("/cmd/getstatus"); boolean success = true; try { @@ -2291,8 +2397,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements try { Connect conn = LibvirtConnection.getConnection(); KVMStoragePool primary = _storagePoolMgr.getStoragePool( - cmd.getPooltype(), - cmd.getPoolUuid()); + cmd.getPooltype(), + cmd.getPoolUuid()); KVMPhysicalDisk disk = primary.getPhysicalDisk(cmd.getVolumePath()); attachOrDetachDisk(conn, cmd.getAttach(), cmd.getVmName(), disk, cmd.getDeviceId().intValue()); @@ -2364,10 +2470,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements private Answer execute(PingTestCommand cmd) { String result = null; final String computingHostIp = cmd.getComputingHostIp(); // TODO, split - // the - // command - // into 2 - // types + // the + // command + // into 2 + // types if (computingHostIp != null) { result = doPingTest(computingHostIp); @@ -2507,7 +2613,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements final Script cpuScript = new Script("/bin/bash", s_logger); cpuScript.add("-c"); cpuScript - .add("idle=$(top -b -n 1|grep Cpu\\(s\\):|cut -d% -f4|cut -d, -f2);echo $idle"); + .add("idle=$(top -b -n 1|grep Cpu\\(s\\):|cut -d% -f4|cut -d, -f2);echo $idle"); final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser(); String result = cpuScript.execute(parser); @@ -2521,7 +2627,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements final Script memScript = new Script("/bin/bash", s_logger); memScript.add("-c"); memScript - .add("freeMem=$(free|grep cache:|awk '{print $4}');echo $freeMem"); + .add("freeMem=$(free|grep cache:|awk '{print $4}');echo $freeMem"); final OutputInterpreter.OneLineParser Memparser = new OutputInterpreter.OneLineParser(); result = memScript.execute(Memparser); if (result != null) { @@ -2679,7 +2785,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements List ifaces = getInterfaces(conn, vmName); destroy_network_rules_for_vm(conn, vmName); - String result = stopVM(conn, vmName, defineOps.UNDEFINE_VM); + String result = stopVM(conn, vmName); if (result == null) { for (DiskDef disk : disks) { if (disk.getDeviceType() == DiskDef.deviceType.CDROM @@ -2721,7 +2827,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements script.add("-m","700"); script.add(_SSHKEYSPATH); script.execute(); - + if(!sshKeysDir.exists()) { s_logger.debug("failed to create directory " + _SSHKEYSPATH); } @@ -2815,12 +2921,20 @@ public class LibvirtComputingResource extends ServerResourceBase implements vm.addComp(guest); GuestResourceDef grd = new GuestResourceDef(); - grd.setMemorySize(vmTO.getMinRam() / 1024); + + if (vmTO.getMinRam() != vmTO.getMaxRam()){ + grd.setMemBalloning(true); + grd.setCurrentMem((int)vmTO.getMinRam()/1024); + grd.setMemorySize((int)vmTO.getMaxRam()/1024); + } + else{ + grd.setMemorySize(vmTO.getMaxRam() / 1024); + } grd.setVcpuNum(vmTO.getCpus()); vm.addComp(grd); CpuTuneDef ctd = new CpuTuneDef(); - ctd.setShares(vmTO.getCpus() * vmTO.getSpeed()); + ctd.setShares(vmTO.getCpus() * vmTO.getMinSpeed()); vm.addComp(ctd); FeaturesDef features = new FeaturesDef(); @@ -2897,7 +3011,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements createVifs(vmSpec, vm); s_logger.debug("starting " + vmName + ": " + vm.toString()); - startDomain(conn, vmName, vm.toString()); + startVM(conn, vmName, vm.toString()); NicTO[] nics = vmSpec.getNics(); for (NicTO nic : nics) { @@ -2939,7 +3053,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements String path = isoPath.substring(0, index); String name = isoPath.substring(index + 1); KVMStoragePool secondaryPool = _storagePoolMgr.getStoragePoolByURI( - path); + path); KVMPhysicalDisk isoVol = secondaryPool.getPhysicalDisk(name); return isoVol.getPath(); } else { @@ -2957,7 +3071,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements return arg0.getDeviceId() > arg1.getDeviceId() ? 1 : -1; } }); - + for (VolumeTO volume : disks) { KVMPhysicalDisk physicalDisk = null; KVMStoragePool pool = null; @@ -2967,12 +3081,12 @@ public class LibvirtComputingResource extends ServerResourceBase implements String volDir = volPath.substring(0, index); String volName = volPath.substring(index + 1); KVMStoragePool secondaryStorage = _storagePoolMgr. - getStoragePoolByURI(volDir); + getStoragePoolByURI(volDir); physicalDisk = secondaryStorage.getPhysicalDisk(volName); } else if (volume.getType() != Volume.Type.ISO) { pool = _storagePoolMgr.getStoragePool( - volume.getPoolType(), - volume.getPoolUuid()); + volume.getPoolType(), + volume.getPoolUuid()); physicalDisk = pool.getPhysicalDisk(volume.getPath()); } @@ -2998,23 +3112,23 @@ public class LibvirtComputingResource extends ServerResourceBase implements For RBD pools we use the secret mechanism in libvirt. We store the secret under the UUID of the pool, that's why we pass the pool's UUID as the authSecret - */ + */ disk.defNetworkBasedDisk(physicalDisk.getPath().replace("rbd:", ""), pool.getSourceHost(), pool.getSourcePort(), - pool.getAuthUserName(), pool.getUuid(), - devId, diskBusType, diskProtocol.RBD); + pool.getAuthUserName(), pool.getUuid(), + devId, diskBusType, diskProtocol.RBD); } else if (pool.getType() == StoragePoolType.CLVM) { disk.defBlockBasedDisk(physicalDisk.getPath(), devId, - diskBusType); + diskBusType); } else { if (volume.getType() == Volume.Type.DATADISK) { - disk.defFileBasedDisk(physicalDisk.getPath(), devId, - DiskDef.diskBus.VIRTIO, - DiskDef.diskFmtType.QCOW2); - } else { - disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2); - } + disk.defFileBasedDisk(physicalDisk.getPath(), devId, + DiskDef.diskBus.VIRTIO, + DiskDef.diskFmtType.QCOW2); + } else { + disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusType, DiskDef.diskFmtType.QCOW2); + } - } + } } @@ -3051,8 +3165,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements VolumeTO rootVol = getVolume(vmSpec, Volume.Type.ROOT); String patchName = vmName + "-patchdisk"; KVMStoragePool pool = _storagePoolMgr.getStoragePool( - rootVol.getPoolType(), - rootVol.getPoolUuid()); + rootVol.getPoolType(), + rootVol.getPoolUuid()); String patchDiskPath = pool.getLocalPath() + "/" + patchName; List phyDisks = pool.listPhysicalDisks(); @@ -3068,7 +3182,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements if (!foundDisk) { s_logger.debug("generating new patch disk for " + vmName + " since none was found"); KVMPhysicalDisk disk = pool.createPhysicalDisk(patchName, KVMPhysicalDisk.PhysicalDiskFormat.RAW, - 10L * 1024 * 1024); + 10L * 1024 * 1024); } else { s_logger.debug("found existing patch disk at " + patchDiskPath + " using it for " + vmName); } @@ -3090,9 +3204,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements patchDisk.defBlockBasedDisk(patchDiskPath, 1, rootDisk.getBusType()); } else { patchDisk.defFileBasedDisk(patchDiskPath, 1, rootDisk.getBusType(), - DiskDef.diskFmtType.RAW); + DiskDef.diskFmtType.RAW); } - + disks.add(patchDisk); String bootArgs = vmSpec.getBootArgs(); @@ -3148,8 +3262,11 @@ public class LibvirtComputingResource extends ServerResourceBase implements } try { - //we use libvirt since we passed a libvirt connection to cleanupDisk - KVMStoragePool pool = _storagePoolMgr.getStoragePool(null, poolUuid); + // we use libvirt as storage adaptor since we passed a libvirt + // connection to cleanupDisk. We pass a storage type that maps + // to libvirt adaptor. + KVMStoragePool pool = _storagePoolMgr.getStoragePool( + StoragePoolType.Filesystem, poolUuid); if (pool != null) { pool.delete(); } @@ -3161,14 +3278,14 @@ public class LibvirtComputingResource extends ServerResourceBase implements protected synchronized String attachOrDetachISO(Connect conn, String vmName, String isoPath, boolean isAttach) - throws LibvirtException, URISyntaxException, InternalErrorException { + throws LibvirtException, URISyntaxException, InternalErrorException { String isoXml = null; if (isoPath != null && isAttach) { int index = isoPath.lastIndexOf("/"); String path = isoPath.substring(0, index); String name = isoPath.substring(index + 1); KVMStoragePool secondaryPool = _storagePoolMgr.getStoragePoolByURI( - path); + path); KVMPhysicalDisk isoVol = secondaryPool.getPhysicalDisk(name); isoPath = isoVol.getPath(); @@ -3690,9 +3807,9 @@ public class LibvirtComputingResource extends ServerResourceBase implements info.add(ram); info.add(cap); long dom0ram = Math.min(ram / 10, 768 * 1024 * 1024L);// save a maximum - // of 10% of - // system ram or - // 768M + // of 10% of + // system ram or + // 768M dom0ram = Math.max(dom0ram, _dom0MinMem); info.add(dom0ram); s_logger.debug("cpus=" + cpus + ", speed=" + speed + ", ram=" + ram @@ -3719,8 +3836,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements .getBytes())); String vmDef = dm.getXMLDesc(0); s_logger.debug(vmDef); - msg = stopVM(conn, vmName, defineOps.UNDEFINE_VM); - msg = startDomain(conn, vmName, vmDef); + msg = stopVM(conn, vmName); + msg = startVM(conn, vmName, vmDef); return null; } catch (LibvirtException e) { s_logger.warn("Failed to create vm", e); @@ -3741,7 +3858,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements return msg; } - protected String stopVM(Connect conn, String vmName, defineOps df) { + protected String stopVM(Connect conn, String vmName) { DomainInfo.DomainState state = null; Domain dm = null; @@ -3791,23 +3908,6 @@ public class LibvirtComputingResource extends ServerResourceBase implements } } - if (df == defineOps.UNDEFINE_VM) { - try { - dm = conn.domainLookupByUUID(UUID.nameUUIDFromBytes(vmName - .getBytes())); - dm.undefine(); - } catch (LibvirtException e) { - - } finally { - try { - if (dm != null) { - dm.free(); - } - } catch (LibvirtException l) { - - } - } - } return null; } @@ -4161,7 +4261,7 @@ public class LibvirtComputingResource extends ServerResourceBase implements NodeInfo node = conn.nodeInfo(); utilization = utilization / node.cpus; if(utilization > 0){ - stats.setCPUUtilization(utilization * 100); + stats.setCPUUtilization(utilization * 100); } } @@ -4404,20 +4504,20 @@ public class LibvirtComputingResource extends ServerResourceBase implements private Pair getNicStats(String nicName) { double rx = 0.0; - OutputInterpreter.OneLineParser rxParser = new OutputInterpreter.OneLineParser(); - String result = executeBashScript("cat /sys/class/net/" + nicName - + "/statistics/rx_bytes", rxParser); - if (result == null && rxParser.getLine() != null) { - rx = Double.parseDouble(rxParser.getLine()); + String rxFile = "/sys/class/net/" + nicName + "/statistics/rx_bytes"; + String rxContent = FileUtil.readFileAsString(rxFile); + if (rxContent == null) { + s_logger.warn("Failed to read the rx_bytes for " + nicName + " from " + rxFile); } + rx = Double.parseDouble(rxContent); double tx = 0.0; - OutputInterpreter.OneLineParser txParser = new OutputInterpreter.OneLineParser(); - result = executeBashScript("cat /sys/class/net/" + nicName - + "/statistics/tx_bytes", txParser); - if (result == null && txParser.getLine() != null) { - tx = Double.parseDouble(txParser.getLine()); + String txFile = "/sys/class/net/" + nicName + "/statistics/tx_bytes"; + String txContent = FileUtil.readFileAsString(txFile); + if (txContent == null) { + s_logger.warn("Failed to read the tx_bytes for " + nicName + " from " + txFile); } + tx = Double.parseDouble(txContent); return new Pair(rx, tx); } @@ -4436,4 +4536,34 @@ public class LibvirtComputingResource extends ServerResourceBase implements return new Answer(cmd, success, ""); } + @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/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java index ba6c715e455..5ab37702ed6 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/LibvirtVMDef.java @@ -116,6 +116,7 @@ public class LibvirtVMDef { private int _currentMem = -1; private String _memBacking; private int _vcpu = -1; + private boolean _memBalloning= false; public void setMemorySize(long mem) { _mem = mem; @@ -133,6 +134,10 @@ public class LibvirtVMDef { _vcpu = vcpu; } + public void setMemBalloning(boolean turnon){ + _memBalloning = turnon; + } + @Override public String toString() { StringBuilder resBuidler = new StringBuilder(); @@ -145,6 +150,9 @@ public class LibvirtVMDef { resBuidler.append("" + "<" + _memBacking + "/>" + "\n"); } + if (_memBalloning){ + resBuidler.append("\n" + "\n" + "\n"); + } if (_vcpu != -1) { resBuidler.append("" + _vcpu + "\n"); } @@ -646,6 +654,9 @@ public class LibvirtVMDef { private String _ipAddr; private String _scriptPath; private nicModel _model; + private String _virtualPortType; + private String _virtualPortInterfaceId; + private int _vlanTag = -1; public void defBridgeNet(String brName, String targetBrName, String macAddr, nicModel model) { @@ -695,7 +706,31 @@ public class LibvirtVMDef { public String getMacAddress() { return _macAddr; } + + public void setVirtualPortType(String virtualPortType) { + _virtualPortType = virtualPortType; + } + public String getVirtualPortType() { + return _virtualPortType; + } + + public void setVirtualPortInterfaceId(String virtualPortInterfaceId) { + _virtualPortInterfaceId = virtualPortInterfaceId; + } + + public String getVirtualPortInterfaceId() { + return _virtualPortInterfaceId; + } + + public void setVlanTag(int vlanTag) { + _vlanTag = vlanTag; + } + + public int getVlanTag() { + return _vlanTag; + } + @Override public String toString() { StringBuilder netBuilder = new StringBuilder(); @@ -714,6 +749,16 @@ public class LibvirtVMDef { if (_model != null) { netBuilder.append("\n"); } + if (_virtualPortType != null) { + netBuilder.append("\n"); + if (_virtualPortInterfaceId != null) { + netBuilder.append("\n"); + } + netBuilder.append("\n"); + } + if (_vlanTag > 0 && _vlanTag < 4095) { + netBuilder.append("\n\n"); + } netBuilder.append("\n"); return netBuilder.toString(); } diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java new file mode 100644 index 00000000000..37761aa5555 --- /dev/null +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/OvsVifDriver.java @@ -0,0 +1,189 @@ +/* + * 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.hypervisor.kvm.resource; + +import java.net.URI; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; +import org.libvirt.LibvirtException; + +import com.cloud.agent.api.to.NicTO; +import com.cloud.exception.InternalErrorException; +import com.cloud.hypervisor.kvm.resource.LibvirtVMDef.InterfaceDef; +import com.cloud.network.Networks; +import com.cloud.utils.NumbersUtil; +import com.cloud.utils.net.NetUtils; +import com.cloud.utils.script.OutputInterpreter; +import com.cloud.utils.script.Script; + +public class OvsVifDriver extends VifDriverBase { + private static final Logger s_logger = Logger.getLogger(OvsVifDriver.class); + private int _timeout; + private String _modifyVlanPath; + + @Override + public void configure(Map params) throws ConfigurationException { + super.configure(params); + + String networkScriptsDir = (String) params.get("network.scripts.dir"); + if (networkScriptsDir == null) { + networkScriptsDir = "scripts/vm/network/vnet"; + } + + String value = (String) params.get("scripts.timeout"); + _timeout = NumbersUtil.parseInt(value, 30 * 60) * 1000; + + _modifyVlanPath = Script.findScript(networkScriptsDir, "modifyvlan.sh"); + if (_modifyVlanPath == null) { + throw new ConfigurationException("Unable to find modifyvlan.sh"); + } + + createControlNetwork(_bridges.get("linklocal")); + } + + @Override + public InterfaceDef plug(NicTO nic, String guestOsType) + throws InternalErrorException, LibvirtException { + s_logger.debug("plugging nic=" + nic); + + LibvirtVMDef.InterfaceDef intf = new LibvirtVMDef.InterfaceDef(); + intf.setVirtualPortType("openvswitch"); + + String vlanId = null; + String logicalSwitchUuid = null; + if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan) { + URI broadcastUri = nic.getBroadcastUri(); + vlanId = broadcastUri.getHost(); + } + else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) { + logicalSwitchUuid = nic.getBroadcastUri().getSchemeSpecificPart(); + } + String trafficLabel = nic.getName(); + if (nic.getType() == Networks.TrafficType.Guest) { + if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan + && !vlanId.equalsIgnoreCase("untagged")) { + if(trafficLabel != null && !trafficLabel.isEmpty()) { + s_logger.debug("creating a vlan dev and bridge for guest traffic per traffic label " + trafficLabel); + intf.defBridgeNet(_pifs.get(trafficLabel), null, nic.getMac(), getGuestNicModel(guestOsType)); + intf.setVlanTag(Integer.parseInt(vlanId)); + } else { + intf.defBridgeNet(_pifs.get("private"), null, nic.getMac(), getGuestNicModel(guestOsType)); + intf.setVlanTag(Integer.parseInt(vlanId)); + } + } else if (nic.getBroadcastType() == Networks.BroadcastDomainType.Lswitch) { + s_logger.debug("nic " + nic + " needs to be connected to LogicalSwitch " + logicalSwitchUuid); + intf.setVirtualPortInterfaceId(nic.getUuid()); + String brName = (trafficLabel != null && !trafficLabel.isEmpty()) ? _pifs.get(trafficLabel) : _pifs.get("private"); + intf.defBridgeNet(brName, null, nic.getMac(), getGuestNicModel(guestOsType)); + } + else { + intf.defBridgeNet(_bridges.get("guest"), null, nic.getMac(), getGuestNicModel(guestOsType)); + } + } else if (nic.getType() == Networks.TrafficType.Control) { + /* Make sure the network is still there */ + createControlNetwork(_bridges.get("linklocal")); + intf.defBridgeNet(_bridges.get("linklocal"), null, nic.getMac(), getGuestNicModel(guestOsType)); + } else if (nic.getType() == Networks.TrafficType.Public) { + if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vlan + && !vlanId.equalsIgnoreCase("untagged")) { + if(trafficLabel != null && !trafficLabel.isEmpty()){ + s_logger.debug("creating a vlan dev and bridge for public traffic per traffic label " + trafficLabel); + intf.defBridgeNet(_pifs.get(trafficLabel), null, nic.getMac(), getGuestNicModel(guestOsType)); + intf.setVlanTag(Integer.parseInt(vlanId)); + } else { + intf.defBridgeNet(_pifs.get("public"), null, nic.getMac(), getGuestNicModel(guestOsType)); + intf.setVlanTag(Integer.parseInt(vlanId)); + } + } else { + intf.defBridgeNet(_bridges.get("public"), null, nic.getMac(), getGuestNicModel(guestOsType)); + } + } else if (nic.getType() == Networks.TrafficType.Management) { + intf.defBridgeNet(_bridges.get("private"), null, nic.getMac(), getGuestNicModel(guestOsType)); + } else if (nic.getType() == Networks.TrafficType.Storage) { + String storageBrName = nic.getName() == null ? _bridges.get("private") + : nic.getName(); + intf.defBridgeNet(storageBrName, null, nic.getMac(), getGuestNicModel(guestOsType)); + } + return intf; + } + + @Override + public void unplug(InterfaceDef iface) { + // Libvirt apparently takes care of this, see BridgeVifDriver unplug + } + + private String setVnetBrName(String pifName, String vnetId) { + String brName = "br" + pifName + "-"+ vnetId; + String oldStyleBrName = "cloudVirBr" + vnetId; + + if (isBridgeExists(oldStyleBrName)) { + s_logger.info("Using old style bridge name for vlan " + vnetId + " because existing bridge " + oldStyleBrName + " was found"); + brName = oldStyleBrName; + } + + return brName; + } + + private void deleteExitingLinkLocalRouteTable(String linkLocalBr) { + Script command = new Script("/bin/bash", _timeout); + command.add("-c"); + command.add("ip route | grep " + NetUtils.getLinkLocalCIDR()); + OutputInterpreter.AllLinesParser parser = new OutputInterpreter.AllLinesParser(); + String result = command.execute(parser); + boolean foundLinkLocalBr = false; + if (result == null && parser.getLines() != null) { + String[] lines = parser.getLines().split("\\n"); + for (String line : lines) { + String[] tokens = line.split(" "); + if (!tokens[2].equalsIgnoreCase(linkLocalBr)) { + Script.runSimpleBashScript("ip route del " + NetUtils.getLinkLocalCIDR()); + } else { + foundLinkLocalBr = true; + } + } + } + if (!foundLinkLocalBr) { + Script.runSimpleBashScript("ifconfig " + linkLocalBr + " 169.254.0.1;" + "ip route add " + + NetUtils.getLinkLocalCIDR() + " dev " + linkLocalBr + " src " + NetUtils.getLinkLocalGateway()); + } + } + + private void createControlNetwork(String privBrName) { + deleteExitingLinkLocalRouteTable(privBrName); + if (!isBridgeExists(privBrName)) { + Script.runSimpleBashScript("ovs-vsctl add-br " + privBrName + "; ifconfig " + privBrName + " up; ifconfig " + + privBrName + " 169.254.0.1", _timeout); + } + } + + private boolean isBridgeExists(String bridgeName) { + Script command = new Script("/bin/sh", _timeout); + command.add("-c"); + command.add("ovs-vsctl br-exists " + bridgeName); + String result = command.execute(null); + if ("Ok".equals(result)) { + return true; + } else { + return false; + } + } +} diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java index ac611275e5a..c2bfad9feef 100644 --- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java +++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStoragePoolManager.java @@ -38,6 +38,10 @@ public class KVMStoragePoolManager { private final Map _storageMapper = new HashMap(); private StorageAdaptor getStorageAdaptor(StoragePoolType type) { + // type can be null: LibVirtComputingResource:3238 + if (type == null) { + return _storageMapper.get("libvirt"); + } StorageAdaptor adaptor = _storageMapper.get(type.toString()); if (adaptor == null) { // LibvirtStorageAdaptor is selected by default diff --git a/plugins/hypervisors/ovm/pom.xml b/plugins/hypervisors/ovm/pom.xml index 5700c14d4eb..84beff0d4eb 100644 --- a/plugins/hypervisors/ovm/pom.xml +++ b/plugins/hypervisors/ovm/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java index cd15d8fbd63..1d8f4f06c56 100755 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -47,7 +48,6 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria2; import com.cloud.utils.exception.CloudRuntimeException; diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java index cceb7fe969b..7aefcaa6f12 100755 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmFencer.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -32,31 +33,22 @@ import com.cloud.exception.OperationTimedoutException; import com.cloud.ha.FenceBuilder; import com.cloud.host.HostVO; import com.cloud.host.Status; -import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VMInstanceVO; import com.cloud.resource.ResourceManager; @Local(value=FenceBuilder.class) -public class OvmFencer implements FenceBuilder { +public class OvmFencer extends AdapterBase implements FenceBuilder { private static final Logger s_logger = Logger.getLogger(OvmFencer.class); - String _name; @Inject AgentManager _agentMgr; @Inject ResourceManager _resourceMgr; @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; return true; } - @Override - public String getName() { - // TODO Auto-generated method stub - return _name; - } - @Override public boolean start() { // TODO Auto-generated method stub diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java index 20221c3d335..cb2cb13f915 100755 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmGuru.java @@ -17,6 +17,7 @@ package com.cloud.ovm.hypervisor; import javax.ejb.Local; +import javax.inject.Inject; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.hypervisor.HypervisorGuru; @@ -24,7 +25,6 @@ import com.cloud.hypervisor.HypervisorGuruBase; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.GuestOSVO; import com.cloud.storage.dao.GuestOSDao; -import com.cloud.utils.component.Inject; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; diff --git a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java index c5cb586e528..a626e31f458 100755 --- a/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java +++ b/plugins/hypervisors/ovm/src/com/cloud/ovm/hypervisor/OvmResourceBase.java @@ -1382,4 +1382,34 @@ public class OvmResourceBase implements ServerResource, HypervisorResource { } + @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/plugins/hypervisors/simulator/pom.xml b/plugins/hypervisors/simulator/pom.xml index a1ab9c08639..ff1664ad85f 100644 --- a/plugins/hypervisors/simulator/pom.xml +++ b/plugins/hypervisors/simulator/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml org.apache.cloudstack diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java index 2bb1205b115..fa02873dd75 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManager.java @@ -27,7 +27,6 @@ import com.cloud.agent.api.GetHostStatsAnswer; import com.cloud.agent.api.GetHostStatsCommand; import com.cloud.agent.api.MaintainCommand; import com.cloud.agent.api.PingTestCommand; -import com.cloud.agent.api.PrepareForMigrationCommand; import com.cloud.resource.AgentResourceBase; import com.cloud.simulator.MockHost; import com.cloud.utils.component.Manager; diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java index f6bc8fc7fee..8542de3bd9f 100755 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockAgentManagerImpl.java @@ -29,6 +29,7 @@ import java.util.concurrent.TimeUnit; import java.util.regex.PatternSyntaxException; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -43,9 +44,6 @@ import com.cloud.agent.api.GetHostStatsCommand; import com.cloud.agent.api.HostStatsEntry; import com.cloud.agent.api.MaintainAnswer; import com.cloud.agent.api.PingTestCommand; -import com.cloud.agent.api.PrepareForMigrationAnswer; -import com.cloud.agent.api.PrepareForMigrationCommand; -import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.dc.dao.HostPodDao; import com.cloud.host.Host; import com.cloud.resource.AgentResourceBase; @@ -58,402 +56,404 @@ import com.cloud.simulator.MockVMVO; import com.cloud.simulator.dao.MockHostDao; import com.cloud.simulator.dao.MockVMDao; import com.cloud.utils.Pair; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; +import org.springframework.stereotype.Component; +@Component @Local(value = { MockAgentManager.class }) -public class MockAgentManagerImpl implements MockAgentManager { - private static final Logger s_logger = Logger.getLogger(MockAgentManagerImpl.class); - @Inject - HostPodDao _podDao = null; - @Inject - MockHostDao _mockHostDao = null; - @Inject - MockVMDao _mockVmDao = null; - @Inject - SimulatorManager _simulatorMgr = null; - @Inject - AgentManager _agentMgr = null; - @Inject - MockStorageManager _storageMgr = null; - @Inject - ResourceManager _resourceMgr; - private SecureRandom random; - private Map _resources = new ConcurrentHashMap(); - private ThreadPoolExecutor _executor; +public class MockAgentManagerImpl extends ManagerBase implements MockAgentManager { + private static final Logger s_logger = Logger.getLogger(MockAgentManagerImpl.class); + @Inject + HostPodDao _podDao = null; + @Inject + MockHostDao _mockHostDao = null; + @Inject + MockVMDao _mockVmDao = null; + @Inject + SimulatorManager _simulatorMgr = null; + @Inject + AgentManager _agentMgr = null; + @Inject + MockStorageManager _storageMgr = null; + @Inject + ResourceManager _resourceMgr; + private SecureRandom random; + private final Map _resources = new ConcurrentHashMap(); + private ThreadPoolExecutor _executor; - private Pair getPodCidr(long podId, long dcId) { - try { + private Pair getPodCidr(long podId, long dcId) { + try { - HashMap> podMap = _podDao.getCurrentPodCidrSubnets(dcId, 0); - List cidrPair = podMap.get(podId); - String cidrAddress = (String) cidrPair.get(0); - Long cidrSize = (Long) cidrPair.get(1); - return new Pair(cidrAddress, cidrSize); - } catch (PatternSyntaxException e) { - s_logger.error("Exception while splitting pod cidr"); - return null; - } catch (IndexOutOfBoundsException e) { - s_logger.error("Invalid pod cidr. Please check"); - return null; - } - } + HashMap> podMap = _podDao.getCurrentPodCidrSubnets(dcId, 0); + List cidrPair = podMap.get(podId); + String cidrAddress = (String) cidrPair.get(0); + Long cidrSize = (Long) cidrPair.get(1); + return new Pair(cidrAddress, cidrSize); + } catch (PatternSyntaxException e) { + s_logger.error("Exception while splitting pod cidr"); + return null; + } catch (IndexOutOfBoundsException e) { + s_logger.error("Invalid pod cidr. Please check"); + return null; + } + } - private String getIpAddress(long instanceId, long dcId, long podId) { - Pair cidr = this.getPodCidr(podId, dcId); - return NetUtils.long2Ip(NetUtils.ip2Long(cidr.first()) + instanceId); - } + private String getIpAddress(long instanceId, long dcId, long podId) { + Pair cidr = this.getPodCidr(podId, dcId); + return NetUtils.long2Ip(NetUtils.ip2Long(cidr.first()) + instanceId); + } - private String getMacAddress(long dcId, long podId, long clusterId, int instanceId) { - return NetUtils.long2Mac((dcId << 40 + podId << 32 + clusterId << 24 + instanceId)); - } + private String getMacAddress(long dcId, long podId, long clusterId, int instanceId) { + return NetUtils.long2Mac((dcId << 40 + podId << 32 + clusterId << 24 + instanceId)); + } - public synchronized int getNextAgentId(long cidrSize) { - return random.nextInt((int) cidrSize); - } + public synchronized int getNextAgentId(long cidrSize) { + return random.nextInt((int) cidrSize); + } - @Override - @DB - public Map> createServerResources(Map params) { + @Override + @DB + public Map> createServerResources(Map params) { - Map args = new HashMap(); - Map> newResources = new HashMap>(); - AgentResourceBase agentResource; - long cpuCore = Long.parseLong((String) params.get("cpucore")); - long cpuSpeed = Long.parseLong((String) params.get("cpuspeed")); - long memory = Long.parseLong((String) params.get("memory")); - long localStorageSize = Long.parseLong((String) params.get("localstorage")); - synchronized (this) { - long dataCenterId = Long.parseLong((String) params.get("zone")); - long podId = Long.parseLong((String) params.get("pod")); - long clusterId = Long.parseLong((String) params.get("cluster")); - long cidrSize = getPodCidr(podId, dataCenterId).second(); + Map args = new HashMap(); + Map> newResources = new HashMap>(); + AgentResourceBase agentResource; + long cpuCore = Long.parseLong((String) params.get("cpucore")); + long cpuSpeed = Long.parseLong((String) params.get("cpuspeed")); + long memory = Long.parseLong((String) params.get("memory")); + long localStorageSize = Long.parseLong((String) params.get("localstorage")); + synchronized (this) { + long dataCenterId = Long.parseLong((String) params.get("zone")); + long podId = Long.parseLong((String) params.get("pod")); + long clusterId = Long.parseLong((String) params.get("cluster")); + long cidrSize = getPodCidr(podId, dataCenterId).second(); - int agentId = getNextAgentId(cidrSize); - String ipAddress = getIpAddress(agentId, dataCenterId, podId); - String macAddress = getMacAddress(dataCenterId, podId, clusterId, agentId); - MockHostVO mockHost = new MockHostVO(); - mockHost.setDataCenterId(dataCenterId); - mockHost.setPodId(podId); - mockHost.setClusterId(clusterId); - mockHost.setCapabilities("hvm"); - mockHost.setCpuCount(cpuCore); - mockHost.setCpuSpeed(cpuSpeed); - mockHost.setMemorySize(memory); - String guid = UUID.randomUUID().toString(); - mockHost.setGuid(guid); - mockHost.setName("SimulatedAgent." + guid); - mockHost.setPrivateIpAddress(ipAddress); - mockHost.setPublicIpAddress(ipAddress); - mockHost.setStorageIpAddress(ipAddress); - mockHost.setPrivateMacAddress(macAddress); - mockHost.setPublicMacAddress(macAddress); - mockHost.setStorageMacAddress(macAddress); - mockHost.setVersion(this.getClass().getPackage().getImplementationVersion()); - mockHost.setResource("com.cloud.agent.AgentRoutingResource"); + int agentId = getNextAgentId(cidrSize); + String ipAddress = getIpAddress(agentId, dataCenterId, podId); + String macAddress = getMacAddress(dataCenterId, podId, clusterId, agentId); + MockHostVO mockHost = new MockHostVO(); + mockHost.setDataCenterId(dataCenterId); + mockHost.setPodId(podId); + mockHost.setClusterId(clusterId); + mockHost.setCapabilities("hvm"); + mockHost.setCpuCount(cpuCore); + mockHost.setCpuSpeed(cpuSpeed); + mockHost.setMemorySize(memory); + String guid = UUID.randomUUID().toString(); + mockHost.setGuid(guid); + mockHost.setName("SimulatedAgent." + guid); + mockHost.setPrivateIpAddress(ipAddress); + mockHost.setPublicIpAddress(ipAddress); + mockHost.setStorageIpAddress(ipAddress); + mockHost.setPrivateMacAddress(macAddress); + mockHost.setPublicMacAddress(macAddress); + mockHost.setStorageMacAddress(macAddress); + mockHost.setVersion(this.getClass().getPackage().getImplementationVersion()); + mockHost.setResource("com.cloud.agent.AgentRoutingResource"); - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - mockHost = _mockHostDao.persist(mockHost); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - s_logger.error("Error while configuring mock agent " + ex.getMessage()); - throw new CloudRuntimeException("Error configuring agent", ex); - } finally { - txn.close(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + mockHost = _mockHostDao.persist(mockHost); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + s_logger.error("Error while configuring mock agent " + ex.getMessage()); + throw new CloudRuntimeException("Error configuring agent", ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - _storageMgr.getLocalStorage(guid, localStorageSize); + _storageMgr.getLocalStorage(guid, localStorageSize); - agentResource = new AgentRoutingResource(); - if (agentResource != null) { - try { - params.put("guid", mockHost.getGuid()); - agentResource.start(); - agentResource.configure(mockHost.getName(), params); + agentResource = new AgentRoutingResource(); + if (agentResource != null) { + try { + params.put("guid", mockHost.getGuid()); + agentResource.start(); + agentResource.configure(mockHost.getName(), params); - newResources.put(agentResource, args); - } catch (ConfigurationException e) { - s_logger.error("error while configuring server resource" + e.getMessage()); - } - } - } - return newResources; - } + newResources.put(agentResource, args); + } catch (ConfigurationException e) { + s_logger.error("error while configuring server resource" + e.getMessage()); + } + } + } + return newResources; + } - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - try { - random = SecureRandom.getInstance("SHA1PRNG"); - _executor = new ThreadPoolExecutor(1, 5, 1, TimeUnit.DAYS, new LinkedBlockingQueue(), - new NamedThreadFactory("Simulator-Agent-Mgr")); - // ComponentLocator locator = ComponentLocator.getCurrentLocator(); - // _simulatorMgr = (SimulatorManager) - // locator.getComponent(SimulatorManager.Name); - } catch (NoSuchAlgorithmException e) { - s_logger.debug("Failed to initialize random:" + e.toString()); - return false; - } - return true; - } + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + try { + random = SecureRandom.getInstance("SHA1PRNG"); + _executor = new ThreadPoolExecutor(1, 5, 1, TimeUnit.DAYS, new LinkedBlockingQueue(), + new NamedThreadFactory("Simulator-Agent-Mgr")); + // ComponentLocator locator = ComponentLocator.getCurrentLocator(); + // _simulatorMgr = (SimulatorManager) + // locator.getComponent(SimulatorManager.Name); + } catch (NoSuchAlgorithmException e) { + s_logger.debug("Failed to initialize random:" + e.toString()); + return false; + } + return true; + } - @Override - public boolean handleSystemVMStart(long vmId, String privateIpAddress, String privateMacAddress, - String privateNetMask, long dcId, long podId, String name, String vmType, String url) { - _executor.execute(new SystemVMHandler(vmId, privateIpAddress, privateMacAddress, privateNetMask, dcId, podId, - name, vmType, _simulatorMgr, url)); - return true; - } + @Override + public boolean handleSystemVMStart(long vmId, String privateIpAddress, String privateMacAddress, + String privateNetMask, long dcId, long podId, String name, String vmType, String url) { + _executor.execute(new SystemVMHandler(vmId, privateIpAddress, privateMacAddress, privateNetMask, dcId, podId, + name, vmType, _simulatorMgr, url)); + return true; + } - @Override - public boolean handleSystemVMStop(long vmId) { - _executor.execute(new SystemVMHandler(vmId)); - return true; - } + @Override + public boolean handleSystemVMStop(long vmId) { + _executor.execute(new SystemVMHandler(vmId)); + return true; + } - private class SystemVMHandler implements Runnable { - private long vmId; - private String privateIpAddress; - private String privateMacAddress; - private String privateNetMask; - private long dcId; - private long podId; - private String guid; - private String name; - private String vmType; - private SimulatorManager mgr; - private String mode; - private String url; + private class SystemVMHandler implements Runnable { + private final long vmId; + private String privateIpAddress; + private String privateMacAddress; + private String privateNetMask; + private long dcId; + private long podId; + private String guid; + private String name; + private String vmType; + private SimulatorManager mgr; + private final String mode; + private String url; - public SystemVMHandler(long vmId, String privateIpAddress, String privateMacAddress, String privateNetMask, - long dcId, long podId, String name, String vmType, SimulatorManager mgr, String url) { - this.vmId = vmId; - this.privateIpAddress = privateIpAddress; - this.privateMacAddress = privateMacAddress; - this.privateNetMask = privateNetMask; - this.dcId = dcId; - this.guid = "SystemVM-" + UUID.randomUUID().toString(); - this.name = name; - this.vmType = vmType; - this.mgr = mgr; - this.mode = "Start"; - this.url = url; - this.podId = podId; - } + public SystemVMHandler(long vmId, String privateIpAddress, String privateMacAddress, String privateNetMask, + long dcId, long podId, String name, String vmType, SimulatorManager mgr, String url) { + this.vmId = vmId; + this.privateIpAddress = privateIpAddress; + this.privateMacAddress = privateMacAddress; + this.privateNetMask = privateNetMask; + this.dcId = dcId; + this.guid = "SystemVM-" + UUID.randomUUID().toString(); + this.name = name; + this.vmType = vmType; + this.mgr = mgr; + this.mode = "Start"; + this.url = url; + this.podId = podId; + } - public SystemVMHandler(long vmId) { - this.vmId = vmId; - this.mode = "Stop"; - } + public SystemVMHandler(long vmId) { + this.vmId = vmId; + this.mode = "Stop"; + } - @Override - @DB - public void run() { + @Override + @DB + public void run() { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - if (this.mode.equalsIgnoreCase("Stop")) { - txn.start(); - MockHost host = _mockHostDao.findByVmId(this.vmId); - if (host != null) { - String guid = host.getGuid(); - if (guid != null) { - AgentResourceBase res = _resources.get(guid); - if (res != null) { - res.stop(); - _resources.remove(guid); - } - } - } - txn.commit(); - return; - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to get host " + guid + " due to " + ex.getMessage(), ex); - } finally { - txn.close(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + if (this.mode.equalsIgnoreCase("Stop")) { + txn.start(); + MockHost host = _mockHostDao.findByVmId(this.vmId); + if (host != null) { + String guid = host.getGuid(); + if (guid != null) { + AgentResourceBase res = _resources.get(guid); + if (res != null) { + res.stop(); + _resources.remove(guid); + } + } + } + txn.commit(); + return; + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to get host " + guid + " due to " + ex.getMessage(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - String resource = null; - if (vmType.equalsIgnoreCase("secstorage")) { - resource = "com.cloud.agent.AgentStorageResource"; - } - MockHostVO mockHost = new MockHostVO(); - mockHost.setDataCenterId(this.dcId); - mockHost.setPodId(this.podId); - mockHost.setCpuCount(DEFAULT_HOST_CPU_CORES); - mockHost.setCpuSpeed(DEFAULT_HOST_SPEED_MHZ); - mockHost.setMemorySize(DEFAULT_HOST_MEM_SIZE); - mockHost.setGuid(this.guid); - mockHost.setName(name); - mockHost.setPrivateIpAddress(this.privateIpAddress); - mockHost.setPublicIpAddress(this.privateIpAddress); - mockHost.setStorageIpAddress(this.privateIpAddress); - mockHost.setPrivateMacAddress(this.privateMacAddress); - mockHost.setPublicMacAddress(this.privateMacAddress); - mockHost.setStorageMacAddress(this.privateMacAddress); - mockHost.setVersion(this.getClass().getPackage().getImplementationVersion()); - mockHost.setResource(resource); - mockHost.setVmId(vmId); - Transaction simtxn = Transaction.open(Transaction.SIMULATOR_DB); - try { - simtxn.start(); - mockHost = _mockHostDao.persist(mockHost); - simtxn.commit(); - } catch (Exception ex) { - simtxn.rollback(); - throw new CloudRuntimeException("Unable to persist host " + mockHost.getGuid() + " due to " - + ex.getMessage(), ex); - } finally { - simtxn.close(); + String resource = null; + if (vmType.equalsIgnoreCase("secstorage")) { + resource = "com.cloud.agent.AgentStorageResource"; + } + MockHostVO mockHost = new MockHostVO(); + mockHost.setDataCenterId(this.dcId); + mockHost.setPodId(this.podId); + mockHost.setCpuCount(DEFAULT_HOST_CPU_CORES); + mockHost.setCpuSpeed(DEFAULT_HOST_SPEED_MHZ); + mockHost.setMemorySize(DEFAULT_HOST_MEM_SIZE); + mockHost.setGuid(this.guid); + mockHost.setName(name); + mockHost.setPrivateIpAddress(this.privateIpAddress); + mockHost.setPublicIpAddress(this.privateIpAddress); + mockHost.setStorageIpAddress(this.privateIpAddress); + mockHost.setPrivateMacAddress(this.privateMacAddress); + mockHost.setPublicMacAddress(this.privateMacAddress); + mockHost.setStorageMacAddress(this.privateMacAddress); + mockHost.setVersion(this.getClass().getPackage().getImplementationVersion()); + mockHost.setResource(resource); + mockHost.setVmId(vmId); + Transaction simtxn = Transaction.open(Transaction.SIMULATOR_DB); + try { + simtxn.start(); + mockHost = _mockHostDao.persist(mockHost); + simtxn.commit(); + } catch (Exception ex) { + simtxn.rollback(); + throw new CloudRuntimeException("Unable to persist host " + mockHost.getGuid() + " due to " + + ex.getMessage(), ex); + } finally { + simtxn.close(); simtxn = Transaction.open(Transaction.CLOUD_DB); simtxn.close(); - } + } - if (vmType.equalsIgnoreCase("secstorage")) { - AgentStorageResource storageResource = new AgentStorageResource(); - try { - Map params = new HashMap(); - Map details = new HashMap(); - params.put("guid", this.guid); - details.put("guid", this.guid); - storageResource.configure("secondaryStorage", params); - storageResource.start(); - // on the simulator the ssvm is as good as a direct - // agent - _resourceMgr.addHost(mockHost.getDataCenterId(), storageResource, Host.Type.SecondaryStorageVM, - details); - _resources.put(this.guid, storageResource); - } catch (ConfigurationException e) { - s_logger.debug("Failed to load secondary storage resource: " + e.toString()); - return; - } - } - } - } + if (vmType.equalsIgnoreCase("secstorage")) { + AgentStorageResource storageResource = new AgentStorageResource(); + try { + Map params = new HashMap(); + Map details = new HashMap(); + params.put("guid", this.guid); + details.put("guid", this.guid); + storageResource.configure("secondaryStorage", params); + storageResource.start(); + // on the simulator the ssvm is as good as a direct + // agent + _resourceMgr.addHost(mockHost.getDataCenterId(), storageResource, Host.Type.SecondaryStorageVM, + details); + _resources.put(this.guid, storageResource); + } catch (ConfigurationException e) { + s_logger.debug("Failed to load secondary storage resource: " + e.toString()); + return; + } + } + } + } - @Override - public MockHost getHost(String guid) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockHost _host = _mockHostDao.findByGuid(guid); - txn.commit(); - if (_host != null) { - return _host; - } else { - s_logger.error("Host with guid " + guid + " was not found"); - return null; - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to get host " + guid + " due to " + ex.getMessage(), ex); - } finally { - txn.close(); + @Override + public MockHost getHost(String guid) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockHost _host = _mockHostDao.findByGuid(guid); + txn.commit(); + if (_host != null) { + return _host; + } else { + s_logger.error("Host with guid " + guid + " was not found"); + return null; + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to get host " + guid + " due to " + ex.getMessage(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } - @Override - public GetHostStatsAnswer getHostStatistic(GetHostStatsCommand cmd) { - String hostGuid = cmd.getHostGuid(); - MockHost host = null; - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - host = _mockHostDao.findByGuid(hostGuid); - txn.commit(); - if (host == null) { - return null; - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to get host " + hostGuid + " due to " + ex.getMessage(), ex); - } finally { - txn.close(); + @Override + public GetHostStatsAnswer getHostStatistic(GetHostStatsCommand cmd) { + String hostGuid = cmd.getHostGuid(); + MockHost host = null; + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + host = _mockHostDao.findByGuid(hostGuid); + txn.commit(); + if (host == null) { + return null; + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to get host " + hostGuid + " due to " + ex.getMessage(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - Transaction vmtxn = Transaction.open(Transaction.SIMULATOR_DB); - try { - vmtxn.start(); - List vms = _mockVmDao.findByHostId(host.getId()); - vmtxn.commit(); - double usedMem = 0.0; - double usedCpu = 0.0; - for (MockVMVO vm : vms) { - usedMem += vm.getMemory(); - usedCpu += vm.getCpu(); - } + Transaction vmtxn = Transaction.open(Transaction.SIMULATOR_DB); + try { + vmtxn.start(); + List vms = _mockVmDao.findByHostId(host.getId()); + vmtxn.commit(); + double usedMem = 0.0; + double usedCpu = 0.0; + for (MockVMVO vm : vms) { + usedMem += vm.getMemory(); + usedCpu += vm.getCpu(); + } - HostStatsEntry hostStats = new HostStatsEntry(); - hostStats.setTotalMemoryKBs(host.getMemorySize()); - hostStats.setFreeMemoryKBs(host.getMemorySize() - usedMem); - hostStats.setNetworkReadKBs(32768); - hostStats.setNetworkWriteKBs(16384); - hostStats.setCpuUtilization(usedCpu / (host.getCpuCount() * host.getCpuSpeed())); - hostStats.setEntityType("simulator-host"); - hostStats.setHostId(cmd.getHostId()); - return new GetHostStatsAnswer(cmd, hostStats); - } catch (Exception ex) { - vmtxn.rollback(); - throw new CloudRuntimeException("Unable to get Vms on host " + host.getGuid() + " due to " - + ex.getMessage(), ex); - } finally { - vmtxn.close(); + HostStatsEntry hostStats = new HostStatsEntry(); + hostStats.setTotalMemoryKBs(host.getMemorySize()); + hostStats.setFreeMemoryKBs(host.getMemorySize() - usedMem); + hostStats.setNetworkReadKBs(32768); + hostStats.setNetworkWriteKBs(16384); + hostStats.setCpuUtilization(usedCpu / (host.getCpuCount() * host.getCpuSpeed())); + hostStats.setEntityType("simulator-host"); + hostStats.setHostId(cmd.getHostId()); + return new GetHostStatsAnswer(cmd, hostStats); + } catch (Exception ex) { + vmtxn.rollback(); + throw new CloudRuntimeException("Unable to get Vms on host " + host.getGuid() + " due to " + + ex.getMessage(), ex); + } finally { + vmtxn.close(); vmtxn = Transaction.open(Transaction.CLOUD_DB); vmtxn.close(); - } - } + } + } - @Override - public Answer checkHealth(CheckHealthCommand cmd) { - return new Answer(cmd); - } + @Override + public Answer checkHealth(CheckHealthCommand cmd) { + return new Answer(cmd); + } - @Override - public Answer pingTest(PingTestCommand cmd) { - return new Answer(cmd); - } + @Override + public Answer pingTest(PingTestCommand cmd) { + return new Answer(cmd); + } - @Override - public boolean start() { - return true; - } + @Override + public boolean start() { + return true; + } - @Override - public boolean stop() { - return true; - } + @Override + public boolean stop() { + return true; + } - @Override - public String getName() { - return this.getClass().getSimpleName(); - } + @Override + public String getName() { + return this.getClass().getSimpleName(); + } - @Override - public MaintainAnswer maintain(com.cloud.agent.api.MaintainCommand cmd) { - return new MaintainAnswer(cmd); - } + @Override + public MaintainAnswer maintain(com.cloud.agent.api.MaintainCommand cmd) { + return new MaintainAnswer(cmd); + } - @Override - public Answer checkNetworkCommand(CheckNetworkCommand cmd) { - if (s_logger.isDebugEnabled()) { - s_logger.debug("Checking if network name setup is done on the resource"); - } - return new CheckNetworkAnswer(cmd, true, "Network Setup check by names is done"); - } + @Override + public Answer checkNetworkCommand(CheckNetworkCommand cmd) { + if (s_logger.isDebugEnabled()) { + s_logger.debug("Checking if network name setup is done on the resource"); + } + return new CheckNetworkAnswer(cmd, true, "Network Setup check by names is done"); + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java index ff26d185d76..a90ea9e10eb 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManager.java @@ -35,7 +35,18 @@ import com.cloud.agent.api.ModifyStoragePoolCommand; import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.SecStorageVMSetupCommand; import com.cloud.agent.api.StoragePoolInfo; -import com.cloud.agent.api.storage.*; +import com.cloud.agent.api.storage.CopyVolumeAnswer; +import com.cloud.agent.api.storage.CopyVolumeCommand; +import com.cloud.agent.api.storage.CreateAnswer; +import com.cloud.agent.api.storage.CreateCommand; +import com.cloud.agent.api.storage.DeleteTemplateCommand; +import com.cloud.agent.api.storage.DestroyCommand; +import com.cloud.agent.api.storage.DownloadCommand; +import com.cloud.agent.api.storage.DownloadProgressCommand; +import com.cloud.agent.api.storage.ListTemplateCommand; +import com.cloud.agent.api.storage.ListVolumeCommand; +import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; +import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.utils.component.Manager; public interface MockStorageManager extends Manager { diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java index 1076089dcd6..859acc85958 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockStorageManagerImpl.java @@ -28,9 +28,9 @@ import java.util.Map; import java.util.UUID; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.agent.api.storage.*; import org.apache.log4j.Logger; import com.cloud.agent.api.Answer; @@ -57,6 +57,22 @@ import com.cloud.agent.api.SecStorageSetupAnswer; import com.cloud.agent.api.SecStorageSetupCommand; import com.cloud.agent.api.SecStorageVMSetupCommand; import com.cloud.agent.api.StoragePoolInfo; +import com.cloud.agent.api.storage.CopyVolumeAnswer; +import com.cloud.agent.api.storage.CopyVolumeCommand; +import com.cloud.agent.api.storage.CreateAnswer; +import com.cloud.agent.api.storage.CreateCommand; +import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; +import com.cloud.agent.api.storage.DeleteTemplateCommand; +import com.cloud.agent.api.storage.DestroyCommand; +import com.cloud.agent.api.storage.DownloadAnswer; +import com.cloud.agent.api.storage.DownloadCommand; +import com.cloud.agent.api.storage.DownloadProgressCommand; +import com.cloud.agent.api.storage.ListTemplateAnswer; +import com.cloud.agent.api.storage.ListTemplateCommand; +import com.cloud.agent.api.storage.ListVolumeAnswer; +import com.cloud.agent.api.storage.ListVolumeCommand; +import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; +import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.to.StorageFilerTO; import com.cloud.agent.api.to.VolumeTO; import com.cloud.simulator.MockHost; @@ -71,1258 +87,1259 @@ import com.cloud.simulator.dao.MockSecStorageDao; import com.cloud.simulator.dao.MockStoragePoolDao; import com.cloud.simulator.dao.MockVMDao; import com.cloud.simulator.dao.MockVolumeDao; -import com.cloud.storage.Storage; -import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.StoragePoolType; +import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; import com.cloud.storage.template.TemplateInfo; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine.State; +import org.springframework.stereotype.Component; +@Component @Local(value = { MockStorageManager.class }) -public class MockStorageManagerImpl implements MockStorageManager { - private static final Logger s_logger = Logger.getLogger(MockStorageManagerImpl.class); - @Inject - MockStoragePoolDao _mockStoragePoolDao = null; - @Inject - MockSecStorageDao _mockSecStorageDao = null; - @Inject - MockVolumeDao _mockVolumeDao = null; - @Inject - MockVMDao _mockVMDao = null; - @Inject - MockHostDao _mockHostDao = null; +public class MockStorageManagerImpl extends ManagerBase implements MockStorageManager { + private static final Logger s_logger = Logger.getLogger(MockStorageManagerImpl.class); + @Inject + MockStoragePoolDao _mockStoragePoolDao = null; + @Inject + MockSecStorageDao _mockSecStorageDao = null; + @Inject + MockVolumeDao _mockVolumeDao = null; + @Inject + MockVMDao _mockVMDao = null; + @Inject + MockHostDao _mockHostDao = null; - private MockVolumeVO findVolumeFromSecondary(String path, String ssUrl, MockVolumeType type) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - String volumePath = path.replaceAll(ssUrl, ""); - MockSecStorageVO secStorage = _mockSecStorageDao.findByUrl(ssUrl); - if (secStorage == null) { - return null; - } - volumePath = secStorage.getMountPoint() + volumePath; - volumePath = volumePath.replaceAll("//", "/"); - MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(volumePath); - txn.commit(); - if (volume == null) { - return null; - } - return volume; - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to find volume " + path + " on secondary " + ssUrl, ex); - } finally { - txn.close(); + private MockVolumeVO findVolumeFromSecondary(String path, String ssUrl, MockVolumeType type) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + String volumePath = path.replaceAll(ssUrl, ""); + MockSecStorageVO secStorage = _mockSecStorageDao.findByUrl(ssUrl); + if (secStorage == null) { + return null; + } + volumePath = secStorage.getMountPoint() + volumePath; + volumePath = volumePath.replaceAll("//", "/"); + MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(volumePath); + txn.commit(); + if (volume == null) { + return null; + } + return volume; + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to find volume " + path + " on secondary " + ssUrl, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } - - @Override - public PrimaryStorageDownloadAnswer primaryStorageDownload(PrimaryStorageDownloadCommand cmd) { - MockVolumeVO template = findVolumeFromSecondary(cmd.getUrl(), cmd.getSecondaryStorageUrl(), - MockVolumeType.TEMPLATE); - if (template == null) { - return new PrimaryStorageDownloadAnswer("Can't find primary storage"); - } - - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockStoragePoolVO primaryStorage = null; - try { - txn.start(); - primaryStorage = _mockStoragePoolDao.findByUuid(cmd.getPoolUuid()); - txn.commit(); - if (primaryStorage == null) { - return new PrimaryStorageDownloadAnswer("Can't find primary storage"); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding primary storagee " + cmd.getPoolUuid(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - - String volumeName = UUID.randomUUID().toString(); - MockVolumeVO newVolume = new MockVolumeVO(); - newVolume.setName(volumeName); - newVolume.setPath(primaryStorage.getMountPoint() + volumeName); - newVolume.setPoolId(primaryStorage.getId()); - newVolume.setSize(template.getSize()); - newVolume.setType(MockVolumeType.VOLUME); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - _mockVolumeDao.persist(newVolume); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving volume " + newVolume, ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - return new PrimaryStorageDownloadAnswer(newVolume.getPath(), newVolume.getSize()); - } - - @Override - public CreateAnswer createVolume(CreateCommand cmd) { - StorageFilerTO sf = cmd.getPool(); - DiskProfile dskch = cmd.getDiskCharacteristics(); - MockStoragePoolVO storagePool = null; - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); - txn.commit(); - if (storagePool == null) { - return new CreateAnswer(cmd, "Failed to find storage pool: " + sf.getUuid()); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding storage " + sf.getUuid(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - - String volumeName = UUID.randomUUID().toString(); - MockVolumeVO volume = new MockVolumeVO(); - volume.setPoolId(storagePool.getId()); - volume.setName(volumeName); - volume.setPath(storagePool.getMountPoint() + volumeName); - volume.setSize(dskch.getSize()); - volume.setType(MockVolumeType.VOLUME); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - volume = _mockVolumeDao.persist(volume); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving volume " + volume, ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - - VolumeTO volumeTo = new VolumeTO(cmd.getVolumeId(), dskch.getType(), sf.getType(), sf.getUuid(), - volume.getName(), storagePool.getMountPoint(), volume.getPath(), volume.getSize(), null); - - return new CreateAnswer(cmd, volumeTo); - } - - @Override - public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - String poolid = cmd.getPoolUuid(); - String volumeName = cmd.getVolumeName(); - MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); - if (volume == null) { - return new AttachVolumeAnswer(cmd, "Can't find volume:" + volumeName + "on pool:" + poolid); - } - - String vmName = cmd.getVmName(); - MockVMVO vm = _mockVMDao.findByVmName(vmName); - if (vm == null) { - return new AttachVolumeAnswer(cmd, "can't vm :" + vmName); - } - txn.commit(); - - return new AttachVolumeAnswer(cmd, cmd.getDeviceId()); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when attaching volume " + cmd.getVolumeName() + " to VM " - + cmd.getVmName(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - } - - @Override - public Answer AttachIso(AttachIsoCommand cmd) { - MockVolumeVO iso = findVolumeFromSecondary(cmd.getIsoPath(), cmd.getStoreUrl(), MockVolumeType.ISO); - if (iso == null) { - return new Answer(cmd, false, "Failed to find the iso: " + cmd.getIsoPath() + "on secondary storage " - + cmd.getStoreUrl()); - } - - String vmName = cmd.getVmName(); - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockVMVO vm = null; - try { - txn.start(); - vm = _mockVMDao.findByVmName(vmName); - txn.commit(); - if (vm == null) { - return new Answer(cmd, false, "can't vm :" + vmName); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when attaching iso to vm " + vm.getName(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - return new Answer(cmd); - } - - @Override - public Answer DeleteStoragePool(DeleteStoragePoolCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockStoragePoolVO storage = _mockStoragePoolDao.findByUuid(cmd.getPool().getUuid()); - if (storage == null) { - return new Answer(cmd, false, "can't find storage pool:" + cmd.getPool().getUuid()); - } - _mockStoragePoolDao.remove(storage.getId()); - txn.commit(); - return new Answer(cmd); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when deleting storage pool " + cmd.getPool().getPath(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - } - - @Override - public ModifyStoragePoolAnswer ModifyStoragePool(ModifyStoragePoolCommand cmd) { - StorageFilerTO sf = cmd.getPool(); - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockStoragePoolVO storagePool = null; - try { - txn.start(); - storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); - if (storagePool == null) { - storagePool = new MockStoragePoolVO(); - storagePool.setUuid(sf.getUuid()); - storagePool.setMountPoint("/mnt/" + sf.getUuid() + File.separator); - - Long size = DEFAULT_HOST_STORAGE_SIZE; - String path = sf.getPath(); - int index = path.lastIndexOf("/"); - if (index != -1) { - path = path.substring(index + 1); - if (path != null) { - String values[] = path.split("="); - if (values.length > 1 && values[0].equalsIgnoreCase("size")) { - size = Long.parseLong(values[1]); - } - } - } - storagePool.setCapacity(size); - storagePool.setStorageType(sf.getType()); - storagePool = _mockStoragePoolDao.persist(storagePool); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when modifying storage pool " + cmd.getPool().getPath(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, new HashMap()); - } - - @Override - public Answer CreateStoragePool(CreateStoragePoolCommand cmd) { - StorageFilerTO sf = cmd.getPool(); - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockStoragePoolVO storagePool = null; - try { - txn.start(); - storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); - if (storagePool == null) { - storagePool = new MockStoragePoolVO(); - storagePool.setUuid(sf.getUuid()); - storagePool.setMountPoint("/mnt/" + sf.getUuid() + File.separator); - - Long size = DEFAULT_HOST_STORAGE_SIZE; - String path = sf.getPath(); - int index = path.lastIndexOf("/"); - if (index != -1) { - path = path.substring(index + 1); - if (path != null) { - String values[] = path.split("="); - if (values.length > 1 && values[0].equalsIgnoreCase("size")) { - size = Long.parseLong(values[1]); - } - } - } - storagePool.setCapacity(size); - storagePool.setStorageType(sf.getType()); - storagePool = _mockStoragePoolDao.persist(storagePool); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when creating storage pool " + cmd.getPool().getPath(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, new HashMap()); - } - - @Override - public Answer SecStorageSetup(SecStorageSetupCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockSecStorageVO storage = null; - try { - txn.start(); - storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); - if (storage == null) { - return new Answer(cmd, false, "can't find the storage"); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when setting up sec storage" + cmd.getSecUrl(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - return new SecStorageSetupAnswer(storage.getMountPoint()); - } + } + } @Override - public Answer ListVolumes(ListVolumeCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockSecStorageVO storage = null; - try { - txn.start(); - storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); - if (storage == null) { - return new Answer(cmd, false, "Failed to get secondary storage"); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex); - } finally { - txn.close(); + public PrimaryStorageDownloadAnswer primaryStorageDownload(PrimaryStorageDownloadCommand cmd) { + MockVolumeVO template = findVolumeFromSecondary(cmd.getUrl(), cmd.getSecondaryStorageUrl(), + MockVolumeType.TEMPLATE); + if (template == null) { + return new PrimaryStorageDownloadAnswer("Can't find primary storage"); + } + + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockStoragePoolVO primaryStorage = null; + try { + txn.start(); + primaryStorage = _mockStoragePoolDao.findByUuid(cmd.getPoolUuid()); + txn.commit(); + if (primaryStorage == null) { + return new PrimaryStorageDownloadAnswer("Can't find primary storage"); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding primary storagee " + cmd.getPoolUuid(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - List volumes = _mockVolumeDao.findByStorageIdAndType(storage.getId(), - MockVolumeType.VOLUME); - - Map templateInfos = new HashMap(); - for (MockVolumeVO volume : volumes) { - templateInfos.put(volume.getId(), new TemplateInfo(volume.getName(), volume.getPath() - .replaceAll(storage.getMountPoint(), ""), volume.getSize(), volume.getSize(), true, false)); - } - txn.commit(); - return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex); - } finally { - txn.close(); + String volumeName = UUID.randomUUID().toString(); + MockVolumeVO newVolume = new MockVolumeVO(); + newVolume.setName(volumeName); + newVolume.setPath(primaryStorage.getMountPoint() + volumeName); + newVolume.setPoolId(primaryStorage.getId()); + newVolume.setSize(template.getSize()); + newVolume.setType(MockVolumeType.VOLUME); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + _mockVolumeDao.persist(newVolume); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving volume " + newVolume, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + return new PrimaryStorageDownloadAnswer(newVolume.getPath(), newVolume.getSize()); + } - @Override - public Answer ListTemplates(ListTemplateCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockSecStorageVO storage = null; - try { - txn.start(); - storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); - if (storage == null) { - return new Answer(cmd, false, "Failed to get secondary storage"); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex); - } finally { - txn.close(); + @Override + public CreateAnswer createVolume(CreateCommand cmd) { + StorageFilerTO sf = cmd.getPool(); + DiskProfile dskch = cmd.getDiskCharacteristics(); + MockStoragePoolVO storagePool = null; + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); + txn.commit(); + if (storagePool == null) { + return new CreateAnswer(cmd, "Failed to find storage pool: " + sf.getUuid()); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding storage " + sf.getUuid(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - List templates = _mockVolumeDao.findByStorageIdAndType(storage.getId(), - MockVolumeType.TEMPLATE); - - Map templateInfos = new HashMap(); - for (MockVolumeVO template : templates) { - templateInfos.put(template.getName(), new TemplateInfo(template.getName(), template.getPath() - .replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false)); - } - txn.commit(); - return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex); - } finally { - txn.close(); + String volumeName = UUID.randomUUID().toString(); + MockVolumeVO volume = new MockVolumeVO(); + volume.setPoolId(storagePool.getId()); + volume.setName(volumeName); + volume.setPath(storagePool.getMountPoint() + volumeName); + volume.setSize(dskch.getSize()); + volume.setType(MockVolumeType.VOLUME); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + volume = _mockVolumeDao.persist(volume); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving volume " + volume, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } - @Override - public Answer Destroy(DestroyCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolume().getPath()); - if (volume != null) { - _mockVolumeDao.remove(volume.getId()); - } + VolumeTO volumeTo = new VolumeTO(cmd.getVolumeId(), dskch.getType(), sf.getType(), sf.getUuid(), + volume.getName(), storagePool.getMountPoint(), volume.getPath(), volume.getSize(), null); - if (cmd.getVmName() != null) { - MockVm vm = _mockVMDao.findByVmName(cmd.getVmName()); - vm.setState(State.Expunging); - if (vm != null) { - MockVMVO vmVo = _mockVMDao.createForUpdate(vm.getId()); - _mockVMDao.update(vm.getId(), vmVo); - } - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when destroying volume " + cmd.getVolume().getPath(), ex); - } finally { - txn.close(); + return new CreateAnswer(cmd, volumeTo); + } + + @Override + public AttachVolumeAnswer AttachVolume(AttachVolumeCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + String poolid = cmd.getPoolUuid(); + String volumeName = cmd.getVolumeName(); + MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); + if (volume == null) { + return new AttachVolumeAnswer(cmd, "Can't find volume:" + volumeName + "on pool:" + poolid); + } + + String vmName = cmd.getVmName(); + MockVMVO vm = _mockVMDao.findByVmName(vmName); + if (vm == null) { + return new AttachVolumeAnswer(cmd, "can't vm :" + vmName); + } + txn.commit(); + + return new AttachVolumeAnswer(cmd, cmd.getDeviceId()); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when attaching volume " + cmd.getVolumeName() + " to VM " + + cmd.getVmName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new Answer(cmd); - } + } + } - @Override - public DownloadAnswer Download(DownloadCommand cmd) { - MockSecStorageVO ssvo = null; - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - ssvo = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); - if (ssvo == null) { - return new DownloadAnswer("can't find secondary storage", - VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error accessing secondary storage " + cmd.getSecUrl(), ex); - } finally { - txn.close(); + @Override + public Answer AttachIso(AttachIsoCommand cmd) { + MockVolumeVO iso = findVolumeFromSecondary(cmd.getIsoPath(), cmd.getStoreUrl(), MockVolumeType.ISO); + if (iso == null) { + return new Answer(cmd, false, "Failed to find the iso: " + cmd.getIsoPath() + "on secondary storage " + + cmd.getStoreUrl()); + } + + String vmName = cmd.getVmName(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockVMVO vm = null; + try { + txn.start(); + vm = _mockVMDao.findByVmName(vmName); + txn.commit(); + if (vm == null) { + return new Answer(cmd, false, "can't vm :" + vmName); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when attaching iso to vm " + vm.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } + return new Answer(cmd); + } - MockVolumeVO volume = new MockVolumeVO(); - volume.setPoolId(ssvo.getId()); - volume.setName(cmd.getName()); - volume.setPath(ssvo.getMountPoint() + cmd.getName()); - volume.setSize(0); - volume.setType(MockVolumeType.TEMPLATE); - volume.setStatus(Status.DOWNLOAD_IN_PROGRESS); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - volume = _mockVolumeDao.persist(volume); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving volume " + volume, ex); - } finally { - txn.close(); + @Override + public Answer DeleteStoragePool(DeleteStoragePoolCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockStoragePoolVO storage = _mockStoragePoolDao.findByUuid(cmd.getPool().getUuid()); + if (storage == null) { + return new Answer(cmd, false, "can't find storage pool:" + cmd.getPool().getUuid()); + } + _mockStoragePoolDao.remove(storage.getId()); + txn.commit(); + return new Answer(cmd); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when deleting storage pool " + cmd.getPool().getPath(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new DownloadAnswer(String.valueOf(volume.getId()), 0, "Downloading", Status.DOWNLOAD_IN_PROGRESS, - cmd.getName(), cmd.getName(), volume.getSize(), volume.getSize(), null); - } + } + } - @Override - public DownloadAnswer DownloadProcess(DownloadProgressCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - String volumeId = cmd.getJobId(); - MockVolumeVO volume = _mockVolumeDao.findById(Long.parseLong(volumeId)); - if (volume == null) { - return new DownloadAnswer("Can't find the downloading volume", Status.ABANDONED); - } + @Override + public ModifyStoragePoolAnswer ModifyStoragePool(ModifyStoragePoolCommand cmd) { + StorageFilerTO sf = cmd.getPool(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockStoragePoolVO storagePool = null; + try { + txn.start(); + storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); + if (storagePool == null) { + storagePool = new MockStoragePoolVO(); + storagePool.setUuid(sf.getUuid()); + storagePool.setMountPoint("/mnt/" + sf.getUuid() + File.separator); - long size = Math.min(volume.getSize() + DEFAULT_TEMPLATE_SIZE / 5, DEFAULT_TEMPLATE_SIZE); - volume.setSize(size); - - double volumeSize = volume.getSize(); - double pct = volumeSize / DEFAULT_TEMPLATE_SIZE; - if (pct >= 1.0) { - volume.setStatus(Status.DOWNLOADED); - _mockVolumeDao.update(volume.getId(), volume); - txn.commit(); - return new DownloadAnswer(cmd.getJobId(), 100, cmd, - com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED, volume.getPath(), - volume.getName()); - } else { - _mockVolumeDao.update(volume.getId(), volume); - txn.commit(); - return new DownloadAnswer(cmd.getJobId(), (int) (pct * 100.0), cmd, - com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS, volume.getPath(), - volume.getName()); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error during download job " + cmd.getJobId(), ex); - } finally { - txn.close(); + Long size = DEFAULT_HOST_STORAGE_SIZE; + String path = sf.getPath(); + int index = path.lastIndexOf("/"); + if (index != -1) { + path = path.substring(index + 1); + if (path != null) { + String values[] = path.split("="); + if (values.length > 1 && values[0].equalsIgnoreCase("size")) { + size = Long.parseLong(values[1]); + } + } + } + storagePool.setCapacity(size); + storagePool.setStorageType(sf.getType()); + storagePool = _mockStoragePoolDao.persist(storagePool); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when modifying storage pool " + cmd.getPool().getPath(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, new HashMap()); + } - @Override - public GetStorageStatsAnswer GetStorageStats(GetStorageStatsCommand cmd) { - String uuid = cmd.getStorageId(); - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - if (uuid == null) { - String secUrl = cmd.getSecUrl(); - MockSecStorageVO secondary = _mockSecStorageDao.findByUrl(secUrl); - if (secondary == null) { - return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl); - } - Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId()); - txn.commit(); - return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed); - } else { - MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid); - if (pool == null) { - return new GetStorageStatsAnswer(cmd, "Can't find the pool"); - } - Long totalUsed = _mockVolumeDao.findTotalStorageId(pool.getId()); - if (totalUsed == null) { - totalUsed = 0L; - } - txn.commit(); - return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("DBException during storage stats collection for pool " + uuid, ex); - } finally { - txn.close(); + @Override + public Answer CreateStoragePool(CreateStoragePoolCommand cmd) { + StorageFilerTO sf = cmd.getPool(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockStoragePoolVO storagePool = null; + try { + txn.start(); + storagePool = _mockStoragePoolDao.findByUuid(sf.getUuid()); + if (storagePool == null) { + storagePool = new MockStoragePoolVO(); + storagePool.setUuid(sf.getUuid()); + storagePool.setMountPoint("/mnt/" + sf.getUuid() + File.separator); + + Long size = DEFAULT_HOST_STORAGE_SIZE; + String path = sf.getPath(); + int index = path.lastIndexOf("/"); + if (index != -1) { + path = path.substring(index + 1); + if (path != null) { + String values[] = path.split("="); + if (values.length > 1 && values[0].equalsIgnoreCase("size")) { + size = Long.parseLong(values[1]); + } + } + } + storagePool.setCapacity(size); + storagePool.setStorageType(sf.getType()); + storagePool = _mockStoragePoolDao.persist(storagePool); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when creating storage pool " + cmd.getPool().getPath(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + return new ModifyStoragePoolAnswer(cmd, storagePool.getCapacity(), 0, new HashMap()); + } - @Override - public ManageSnapshotAnswer ManageSnapshot(ManageSnapshotCommand cmd) { - String volPath = cmd.getVolumePath(); - MockVolumeVO volume = null; - MockStoragePoolVO storagePool = null; - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - volume = _mockVolumeDao.findByStoragePathAndType(volPath); - if (volume == null) { - return new ManageSnapshotAnswer(cmd, false, "Can't find the volume"); - } - storagePool = _mockStoragePoolDao.findById(volume.getPoolId()); - if (storagePool == null) { - return new ManageSnapshotAnswer(cmd, false, "Can't find the storage pooll"); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to perform snapshot", ex); - } finally { - txn.close(); + @Override + public Answer SecStorageSetup(SecStorageSetupCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockSecStorageVO storage = null; + try { + txn.start(); + storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); + if (storage == null) { + return new Answer(cmd, false, "can't find the storage"); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when setting up sec storage" + cmd.getSecUrl(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } + return new SecStorageSetupAnswer(storage.getMountPoint()); + } - String mountPoint = storagePool.getMountPoint(); - MockVolumeVO snapshot = new MockVolumeVO(); - - snapshot.setName(cmd.getSnapshotName()); - snapshot.setPath(mountPoint + cmd.getSnapshotName()); - snapshot.setSize(volume.getSize()); - snapshot.setPoolId(storagePool.getId()); - snapshot.setType(MockVolumeType.SNAPSHOT); - snapshot.setStatus(Status.DOWNLOADED); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - snapshot = _mockVolumeDao.persist(snapshot); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving snapshot " + snapshot, ex); - } finally { - txn.close(); + @Override + public Answer ListVolumes(ListVolumeCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockSecStorageVO storage = null; + try { + txn.start(); + storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); + if (storage == null) { + return new Answer(cmd, false, "Failed to get secondary storage"); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - return new ManageSnapshotAnswer(cmd, snapshot.getId(), snapshot.getPath(), true, ""); - } + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + List volumes = _mockVolumeDao.findByStorageIdAndType(storage.getId(), + MockVolumeType.VOLUME); - @Override - public BackupSnapshotAnswer BackupSnapshot(BackupSnapshotCommand cmd, SimulatorInfo info) { - // emulate xenserver backupsnapshot, if the base volume is deleted, then - // backupsnapshot failed - MockVolumeVO volume = null; - MockVolumeVO snapshot = null; - MockSecStorageVO secStorage = null; - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); - if (volume == null) { - return new BackupSnapshotAnswer(cmd, false, "Can't find base volume: " + cmd.getVolumePath(), null, - true); - } - String snapshotPath = cmd.getSnapshotUuid(); - snapshot = _mockVolumeDao.findByStoragePathAndType(snapshotPath); - if (snapshot == null) { - return new BackupSnapshotAnswer(cmd, false, "can't find snapshot" + snapshotPath, null, true); - } - - String secStorageUrl = cmd.getSecondaryStorageUrl(); - secStorage = _mockSecStorageDao.findByUrl(secStorageUrl); - if (secStorage == null) { - return new BackupSnapshotAnswer(cmd, false, "can't find sec storage" + snapshotPath, null, true); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when backing up snapshot"); - } finally { - txn.close(); + Map templateInfos = new HashMap(); + for (MockVolumeVO volume : volumes) { + templateInfos.put(volume.getId(), new TemplateInfo(volume.getName(), volume.getPath() + .replaceAll(storage.getMountPoint(), ""), volume.getSize(), volume.getSize(), true, false)); + } + txn.commit(); + return new ListVolumeAnswer(cmd.getSecUrl(), templateInfos); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } + } - MockVolumeVO newsnapshot = new MockVolumeVO(); - String name = UUID.randomUUID().toString(); - newsnapshot.setName(name); - newsnapshot.setPath(secStorage.getMountPoint() + name); - newsnapshot.setPoolId(secStorage.getId()); - newsnapshot.setSize(snapshot.getSize()); - newsnapshot.setStatus(Status.DOWNLOADED); - newsnapshot.setType(MockVolumeType.SNAPSHOT); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - snapshot = _mockVolumeDao.persist(snapshot); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when backing up snapshot " + newsnapshot, ex); - } finally { - txn.close(); + @Override + public Answer ListTemplates(ListTemplateCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockSecStorageVO storage = null; + try { + txn.start(); + storage = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); + if (storage == null) { + return new Answer(cmd, false, "Failed to get secondary storage"); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding sec storage " + cmd.getSecUrl(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - return new BackupSnapshotAnswer(cmd, true, null, newsnapshot.getName(), true); - } + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + List templates = _mockVolumeDao.findByStorageIdAndType(storage.getId(), + MockVolumeType.TEMPLATE); - @Override - public Answer DeleteSnapshotBackup(DeleteSnapshotBackupCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVolumeVO backSnapshot = _mockVolumeDao.findByName(cmd.getSnapshotUuid()); - if (backSnapshot == null) { - return new Answer(cmd, false, "can't find the backupsnapshot: " + cmd.getSnapshotUuid()); - } - _mockVolumeDao.remove(backSnapshot.getId()); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when deleting snapshot"); - } finally { - txn.close(); + Map templateInfos = new HashMap(); + for (MockVolumeVO template : templates) { + templateInfos.put(template.getName(), new TemplateInfo(template.getName(), template.getPath() + .replaceAll(storage.getMountPoint(), ""), template.getSize(), template.getSize(), true, false)); + } + txn.commit(); + return new ListTemplateAnswer(cmd.getSecUrl(), templateInfos); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding template on sec storage " + storage.getId(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new Answer(cmd); - } + } + } - @Override - public CreateVolumeFromSnapshotAnswer CreateVolumeFromSnapshot(CreateVolumeFromSnapshotCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockVolumeVO backSnapshot = null; - MockStoragePoolVO primary = null; - try { - txn.start(); - backSnapshot = _mockVolumeDao.findByName(cmd.getSnapshotUuid()); - if (backSnapshot == null) { - return new CreateVolumeFromSnapshotAnswer(cmd, false, "can't find the backupsnapshot: " - + cmd.getSnapshotUuid(), null); - } + @Override + public Answer Destroy(DestroyCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVolumeVO volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolume().getPath()); + if (volume != null) { + _mockVolumeDao.remove(volume.getId()); + } - primary = _mockStoragePoolDao.findByUuid(cmd.getPrimaryStoragePoolNameLabel()); - if (primary == null) { - return new CreateVolumeFromSnapshotAnswer(cmd, false, "can't find the primary storage: " - + cmd.getPrimaryStoragePoolNameLabel(), null); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when creating volume from snapshot", ex); - } finally { - txn.close(); + if (cmd.getVmName() != null) { + MockVm vm = _mockVMDao.findByVmName(cmd.getVmName()); + vm.setState(State.Expunging); + if (vm != null) { + MockVMVO vmVo = _mockVMDao.createForUpdate(vm.getId()); + _mockVMDao.update(vm.getId(), vmVo); + } + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when destroying volume " + cmd.getVolume().getPath(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } + return new Answer(cmd); + } - String uuid = UUID.randomUUID().toString(); - MockVolumeVO volume = new MockVolumeVO(); - - volume.setName(uuid); - volume.setPath(primary.getMountPoint() + uuid); - volume.setPoolId(primary.getId()); - volume.setSize(backSnapshot.getSize()); - volume.setStatus(Status.DOWNLOADED); - volume.setType(MockVolumeType.VOLUME); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - _mockVolumeDao.persist(volume); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when creating volume from snapshot " + volume, ex); - } finally { - txn.close(); + @Override + public DownloadAnswer Download(DownloadCommand cmd) { + MockSecStorageVO ssvo = null; + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + ssvo = _mockSecStorageDao.findByUrl(cmd.getSecUrl()); + if (ssvo == null) { + return new DownloadAnswer("can't find secondary storage", + VMTemplateStorageResourceAssoc.Status.DOWNLOAD_ERROR); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error accessing secondary storage " + cmd.getSecUrl(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - return new CreateVolumeFromSnapshotAnswer(cmd, true, null, volume.getPath()); - } - - @Override - public Answer DeleteTemplate(DeleteTemplateCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVolumeVO template = _mockVolumeDao.findByStoragePathAndType(cmd.getTemplatePath()); - if (template == null) { - return new Answer(cmd, false, "can't find template:" + cmd.getTemplatePath()); - } - _mockVolumeDao.remove(template.getId()); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when deleting template"); - } finally { - txn.close(); + MockVolumeVO volume = new MockVolumeVO(); + volume.setPoolId(ssvo.getId()); + volume.setName(cmd.getName()); + volume.setPath(ssvo.getMountPoint() + cmd.getName()); + volume.setSize(0); + volume.setType(MockVolumeType.TEMPLATE); + volume.setStatus(Status.DOWNLOAD_IN_PROGRESS); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + volume = _mockVolumeDao.persist(volume); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving volume " + volume, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new Answer(cmd); - } + } + return new DownloadAnswer(String.valueOf(volume.getId()), 0, "Downloading", Status.DOWNLOAD_IN_PROGRESS, + cmd.getName(), cmd.getName(), volume.getSize(), volume.getSize(), null); + } - @Override - public Answer SecStorageVMSetup(SecStorageVMSetupCommand cmd) { - return new Answer(cmd); - } + @Override + public DownloadAnswer DownloadProcess(DownloadProgressCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + String volumeId = cmd.getJobId(); + MockVolumeVO volume = _mockVolumeDao.findById(Long.parseLong(volumeId)); + if (volume == null) { + return new DownloadAnswer("Can't find the downloading volume", Status.ABANDONED); + } - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - // TODO Auto-generated method stub - return true; - } + long size = Math.min(volume.getSize() + DEFAULT_TEMPLATE_SIZE / 5, DEFAULT_TEMPLATE_SIZE); + volume.setSize(size); - @Override - public boolean start() { - // TODO Auto-generated method stub - return true; - } - - @Override - public boolean stop() { - // TODO Auto-generated method stub - return true; - } - - @Override - public String getName() { - return this.getClass().getSimpleName(); - } - - @Override - public void preinstallTemplates(String url, long zoneId) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockSecStorageVO storage = null; - try { - txn.start(); - storage = _mockSecStorageDao.findByUrl(url); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to find sec storage at " + url, ex); - } finally { - txn.close(); + double volumeSize = volume.getSize(); + double pct = volumeSize / DEFAULT_TEMPLATE_SIZE; + if (pct >= 1.0) { + volume.setStatus(Status.DOWNLOADED); + _mockVolumeDao.update(volume.getId(), volume); + txn.commit(); + return new DownloadAnswer(cmd.getJobId(), 100, cmd, + com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOADED, volume.getPath(), + volume.getName()); + } else { + _mockVolumeDao.update(volume.getId(), volume); + txn.commit(); + return new DownloadAnswer(cmd.getJobId(), (int) (pct * 100.0), cmd, + com.cloud.storage.VMTemplateStorageResourceAssoc.Status.DOWNLOAD_IN_PROGRESS, volume.getPath(), + volume.getName()); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error during download job " + cmd.getJobId(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - if (storage == null) { - storage = new MockSecStorageVO(); - URI uri; - try { - uri = new URI(url); - } catch (URISyntaxException e) { - return; - } + } + } - String nfsHost = uri.getHost(); - String nfsPath = uri.getPath(); - String path = nfsHost + ":" + nfsPath; - String dir = "/mnt/" + UUID.nameUUIDFromBytes(path.getBytes()).toString() + File.separator; + @Override + public GetStorageStatsAnswer GetStorageStats(GetStorageStatsCommand cmd) { + String uuid = cmd.getStorageId(); + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + if (uuid == null) { + String secUrl = cmd.getSecUrl(); + MockSecStorageVO secondary = _mockSecStorageDao.findByUrl(secUrl); + if (secondary == null) { + return new GetStorageStatsAnswer(cmd, "Can't find the secondary storage:" + secUrl); + } + Long totalUsed = _mockVolumeDao.findTotalStorageId(secondary.getId()); + txn.commit(); + return new GetStorageStatsAnswer(cmd, secondary.getCapacity(), totalUsed); + } else { + MockStoragePoolVO pool = _mockStoragePoolDao.findByUuid(uuid); + if (pool == null) { + return new GetStorageStatsAnswer(cmd, "Can't find the pool"); + } + Long totalUsed = _mockVolumeDao.findTotalStorageId(pool.getId()); + if (totalUsed == null) { + totalUsed = 0L; + } + txn.commit(); + return new GetStorageStatsAnswer(cmd, pool.getCapacity(), totalUsed); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("DBException during storage stats collection for pool " + uuid, ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + } - storage.setUrl(url); - storage.setCapacity(DEFAULT_HOST_STORAGE_SIZE); + @Override + public ManageSnapshotAnswer ManageSnapshot(ManageSnapshotCommand cmd) { + String volPath = cmd.getVolumePath(); + MockVolumeVO volume = null; + MockStoragePoolVO storagePool = null; + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + volume = _mockVolumeDao.findByStoragePathAndType(volPath); + if (volume == null) { + return new ManageSnapshotAnswer(cmd, false, "Can't find the volume"); + } + storagePool = _mockStoragePoolDao.findById(volume.getPoolId()); + if (storagePool == null) { + return new ManageSnapshotAnswer(cmd, false, "Can't find the storage pooll"); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to perform snapshot", ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } - storage.setMountPoint(dir); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - storage = _mockSecStorageDao.persist(storage); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving storage " + storage, ex); - } finally { - txn.close(); + String mountPoint = storagePool.getMountPoint(); + MockVolumeVO snapshot = new MockVolumeVO(); + + snapshot.setName(cmd.getSnapshotName()); + snapshot.setPath(mountPoint + cmd.getSnapshotName()); + snapshot.setSize(volume.getSize()); + snapshot.setPoolId(storagePool.getId()); + snapshot.setType(MockVolumeType.SNAPSHOT); + snapshot.setStatus(Status.DOWNLOADED); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + snapshot = _mockVolumeDao.persist(snapshot); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving snapshot " + snapshot, ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + + return new ManageSnapshotAnswer(cmd, snapshot.getId(), snapshot.getPath(), true, ""); + } + + @Override + public BackupSnapshotAnswer BackupSnapshot(BackupSnapshotCommand cmd, SimulatorInfo info) { + // emulate xenserver backupsnapshot, if the base volume is deleted, then + // backupsnapshot failed + MockVolumeVO volume = null; + MockVolumeVO snapshot = null; + MockSecStorageVO secStorage = null; + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); + if (volume == null) { + return new BackupSnapshotAnswer(cmd, false, "Can't find base volume: " + cmd.getVolumePath(), null, + true); + } + String snapshotPath = cmd.getSnapshotUuid(); + snapshot = _mockVolumeDao.findByStoragePathAndType(snapshotPath); + if (snapshot == null) { + return new BackupSnapshotAnswer(cmd, false, "can't find snapshot" + snapshotPath, null, true); + } + + String secStorageUrl = cmd.getSecondaryStorageUrl(); + secStorage = _mockSecStorageDao.findByUrl(secStorageUrl); + if (secStorage == null) { + return new BackupSnapshotAnswer(cmd, false, "can't find sec storage" + snapshotPath, null, true); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when backing up snapshot"); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + + MockVolumeVO newsnapshot = new MockVolumeVO(); + String name = UUID.randomUUID().toString(); + newsnapshot.setName(name); + newsnapshot.setPath(secStorage.getMountPoint() + name); + newsnapshot.setPoolId(secStorage.getId()); + newsnapshot.setSize(snapshot.getSize()); + newsnapshot.setStatus(Status.DOWNLOADED); + newsnapshot.setType(MockVolumeType.SNAPSHOT); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + snapshot = _mockVolumeDao.persist(snapshot); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when backing up snapshot " + newsnapshot, ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + + return new BackupSnapshotAnswer(cmd, true, null, newsnapshot.getName(), true); + } + + @Override + public Answer DeleteSnapshotBackup(DeleteSnapshotBackupCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVolumeVO backSnapshot = _mockVolumeDao.findByName(cmd.getSnapshotUuid()); + if (backSnapshot == null) { + return new Answer(cmd, false, "can't find the backupsnapshot: " + cmd.getSnapshotUuid()); + } + _mockVolumeDao.remove(backSnapshot.getId()); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when deleting snapshot"); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + return new Answer(cmd); + } + + @Override + public CreateVolumeFromSnapshotAnswer CreateVolumeFromSnapshot(CreateVolumeFromSnapshotCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockVolumeVO backSnapshot = null; + MockStoragePoolVO primary = null; + try { + txn.start(); + backSnapshot = _mockVolumeDao.findByName(cmd.getSnapshotUuid()); + if (backSnapshot == null) { + return new CreateVolumeFromSnapshotAnswer(cmd, false, "can't find the backupsnapshot: " + + cmd.getSnapshotUuid(), null); + } + + primary = _mockStoragePoolDao.findByUuid(cmd.getPrimaryStoragePoolNameLabel()); + if (primary == null) { + return new CreateVolumeFromSnapshotAnswer(cmd, false, "can't find the primary storage: " + + cmd.getPrimaryStoragePoolNameLabel(), null); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when creating volume from snapshot", ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + + String uuid = UUID.randomUUID().toString(); + MockVolumeVO volume = new MockVolumeVO(); + + volume.setName(uuid); + volume.setPath(primary.getMountPoint() + uuid); + volume.setPoolId(primary.getId()); + volume.setSize(backSnapshot.getSize()); + volume.setStatus(Status.DOWNLOADED); + volume.setType(MockVolumeType.VOLUME); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + _mockVolumeDao.persist(volume); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when creating volume from snapshot " + volume, ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + + return new CreateVolumeFromSnapshotAnswer(cmd, true, null, volume.getPath()); + } + + @Override + public Answer DeleteTemplate(DeleteTemplateCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVolumeVO template = _mockVolumeDao.findByStoragePathAndType(cmd.getTemplatePath()); + if (template == null) { + return new Answer(cmd, false, "can't find template:" + cmd.getTemplatePath()); + } + _mockVolumeDao.remove(template.getId()); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when deleting template"); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + return new Answer(cmd); + } + + @Override + public Answer SecStorageVMSetup(SecStorageVMSetupCommand cmd) { + return new Answer(cmd); + } + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean start() { + // TODO Auto-generated method stub + return true; + } + + @Override + public boolean stop() { + // TODO Auto-generated method stub + return true; + } + + @Override + public String getName() { + return this.getClass().getSimpleName(); + } + + @Override + public void preinstallTemplates(String url, long zoneId) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockSecStorageVO storage = null; + try { + txn.start(); + storage = _mockSecStorageDao.findByUrl(url); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to find sec storage at " + url, ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + if (storage == null) { + storage = new MockSecStorageVO(); + URI uri; + try { + uri = new URI(url); + } catch (URISyntaxException e) { + return; + } + + String nfsHost = uri.getHost(); + String nfsPath = uri.getPath(); + String path = nfsHost + ":" + nfsPath; + String dir = "/mnt/" + UUID.nameUUIDFromBytes(path.getBytes()).toString() + File.separator; + + storage.setUrl(url); + storage.setCapacity(DEFAULT_HOST_STORAGE_SIZE); + + storage.setMountPoint(dir); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + storage = _mockSecStorageDao.persist(storage); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving storage " + storage, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - // preinstall default templates into secondary storage - long defaultTemplateSize = 2 * 1024 * 1024 * 1024L; - MockVolumeVO template = new MockVolumeVO(); - template.setName("simulator-domR"); - template.setPath(storage.getMountPoint() + "template/tmpl/1/10/" + UUID.randomUUID().toString()); - template.setPoolId(storage.getId()); - template.setSize(defaultTemplateSize); - template.setType(MockVolumeType.TEMPLATE); - template.setStatus(Status.DOWNLOADED); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - template = _mockVolumeDao.persist(template); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving template " + template, ex); - } finally { - txn.close(); + // preinstall default templates into secondary storage + long defaultTemplateSize = 2 * 1024 * 1024 * 1024L; + MockVolumeVO template = new MockVolumeVO(); + template.setName("simulator-domR"); + template.setPath(storage.getMountPoint() + "template/tmpl/1/10/" + UUID.randomUUID().toString()); + template.setPoolId(storage.getId()); + template.setSize(defaultTemplateSize); + template.setType(MockVolumeType.TEMPLATE); + template.setStatus(Status.DOWNLOADED); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + template = _mockVolumeDao.persist(template); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving template " + template, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - template = new MockVolumeVO(); - template.setName("simulator-Centos"); - template.setPath(storage.getMountPoint() + "template/tmpl/1/11/" + UUID.randomUUID().toString()); - template.setPoolId(storage.getId()); - template.setSize(defaultTemplateSize); - template.setType(MockVolumeType.TEMPLATE); - template.setStatus(Status.DOWNLOADED); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - template = _mockVolumeDao.persist(template); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving template " + template, ex); - } finally { - txn.close(); + template = new MockVolumeVO(); + template.setName("simulator-Centos"); + template.setPath(storage.getMountPoint() + "template/tmpl/1/11/" + UUID.randomUUID().toString()); + template.setPoolId(storage.getId()); + template.setSize(defaultTemplateSize); + template.setType(MockVolumeType.TEMPLATE); + template.setStatus(Status.DOWNLOADED); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + template = _mockVolumeDao.persist(template); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving template " + template, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } - } + } - @Override - public StoragePoolInfo getLocalStorage(String hostGuid) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockHost host = null; - MockStoragePoolVO storagePool = null; - try { - txn.start(); - host = _mockHostDao.findByGuid(hostGuid); - storagePool = _mockStoragePoolDao.findByHost(hostGuid); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to find host " + hostGuid, ex); - } finally { - txn.close(); + @Override + public StoragePoolInfo getLocalStorage(String hostGuid) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockHost host = null; + MockStoragePoolVO storagePool = null; + try { + txn.start(); + host = _mockHostDao.findByGuid(hostGuid); + storagePool = _mockStoragePoolDao.findByHost(hostGuid); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to find host " + hostGuid, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - if (storagePool == null) { - String uuid = UUID.randomUUID().toString(); - storagePool = new MockStoragePoolVO(); - storagePool.setUuid(uuid); - storagePool.setMountPoint("/mnt/" + uuid + File.separator); - storagePool.setCapacity(DEFAULT_HOST_STORAGE_SIZE); - storagePool.setHostGuid(hostGuid); - storagePool.setStorageType(StoragePoolType.Filesystem); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - storagePool = _mockStoragePoolDao.persist(storagePool); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex); - } finally { - txn.close(); + if (storagePool == null) { + String uuid = UUID.randomUUID().toString(); + storagePool = new MockStoragePoolVO(); + storagePool.setUuid(uuid); + storagePool.setMountPoint("/mnt/" + uuid + File.separator); + storagePool.setCapacity(DEFAULT_HOST_STORAGE_SIZE); + storagePool.setHostGuid(hostGuid); + storagePool.setStorageType(StoragePoolType.Filesystem); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + storagePool = _mockStoragePoolDao.persist(storagePool); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } - return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(), - storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0); - } + } + } + return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(), + storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0); + } - @Override - public StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockHost host = null; - try { - txn.start(); - host = _mockHostDao.findByGuid(hostGuid); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to find host " + hostGuid, ex); - } finally { - txn.close(); + @Override + public StoragePoolInfo getLocalStorage(String hostGuid, Long storageSize) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockHost host = null; + try { + txn.start(); + host = _mockHostDao.findByGuid(hostGuid); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to find host " + hostGuid, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - if (storageSize == null) { - storageSize = DEFAULT_HOST_STORAGE_SIZE; - } - txn = Transaction.open(Transaction.SIMULATOR_DB); - MockStoragePoolVO storagePool = null; - try { - txn.start(); - storagePool = _mockStoragePoolDao.findByHost(hostGuid); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when finding storagePool " + storagePool, ex); - } finally { - txn.close(); + } + if (storageSize == null) { + storageSize = DEFAULT_HOST_STORAGE_SIZE; + } + txn = Transaction.open(Transaction.SIMULATOR_DB); + MockStoragePoolVO storagePool = null; + try { + txn.start(); + storagePool = _mockStoragePoolDao.findByHost(hostGuid); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when finding storagePool " + storagePool, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - if (storagePool == null) { - String uuid = UUID.randomUUID().toString(); - storagePool = new MockStoragePoolVO(); - storagePool.setUuid(uuid); - storagePool.setMountPoint("/mnt/" + uuid + File.separator); - storagePool.setCapacity(storageSize); - storagePool.setHostGuid(hostGuid); - storagePool.setStorageType(StoragePoolType.Filesystem); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - storagePool = _mockStoragePoolDao.persist(storagePool); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex); - } finally { - txn.close(); + } + if (storagePool == null) { + String uuid = UUID.randomUUID().toString(); + storagePool = new MockStoragePoolVO(); + storagePool.setUuid(uuid); + storagePool.setMountPoint("/mnt/" + uuid + File.separator); + storagePool.setCapacity(storageSize); + storagePool.setHostGuid(hostGuid); + storagePool.setStorageType(StoragePoolType.Filesystem); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + storagePool = _mockStoragePoolDao.persist(storagePool); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving storagePool " + storagePool, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } - return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(), - storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0); - } + } + } + return new StoragePoolInfo(storagePool.getUuid(), host.getPrivateIpAddress(), storagePool.getMountPoint(), + storagePool.getMountPoint(), storagePool.getPoolType(), storagePool.getCapacity(), 0); + } - @Override - public CreatePrivateTemplateAnswer CreatePrivateTemplateFromSnapshot(CreatePrivateTemplateFromSnapshotCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockVolumeVO snapshot = null; - MockSecStorageVO sec = null; - try { - txn.start(); - String snapshotUUId = cmd.getSnapshotUuid(); - snapshot = _mockVolumeDao.findByName(snapshotUUId); - if (snapshot == null) { - snapshotUUId = cmd.getSnapshotName(); - snapshot = _mockVolumeDao.findByName(snapshotUUId); - if (snapshot == null) { - return new CreatePrivateTemplateAnswer(cmd, false, "can't find snapshot:" + snapshotUUId); - } - } + @Override + public CreatePrivateTemplateAnswer CreatePrivateTemplateFromSnapshot(CreatePrivateTemplateFromSnapshotCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockVolumeVO snapshot = null; + MockSecStorageVO sec = null; + try { + txn.start(); + String snapshotUUId = cmd.getSnapshotUuid(); + snapshot = _mockVolumeDao.findByName(snapshotUUId); + if (snapshot == null) { + snapshotUUId = cmd.getSnapshotName(); + snapshot = _mockVolumeDao.findByName(snapshotUUId); + if (snapshot == null) { + return new CreatePrivateTemplateAnswer(cmd, false, "can't find snapshot:" + snapshotUUId); + } + } - sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageUrl()); - if (sec == null) { - return new CreatePrivateTemplateAnswer(cmd, false, "can't find secondary storage"); - } - txn.commit(); - } finally { - txn.close(); + sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageUrl()); + if (sec == null) { + return new CreatePrivateTemplateAnswer(cmd, false, "can't find secondary storage"); + } + txn.commit(); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - MockVolumeVO template = new MockVolumeVO(); - String uuid = UUID.randomUUID().toString(); - template.setName(uuid); - template.setPath(sec.getMountPoint() + uuid); - template.setPoolId(sec.getId()); - template.setSize(snapshot.getSize()); - template.setStatus(Status.DOWNLOADED); - template.setType(MockVolumeType.TEMPLATE); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - template = _mockVolumeDao.persist(template); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when saving template " + template, ex); - } finally { - txn.close(); + MockVolumeVO template = new MockVolumeVO(); + String uuid = UUID.randomUUID().toString(); + template.setName(uuid); + template.setPath(sec.getMountPoint() + uuid); + template.setPoolId(sec.getId()); + template.setSize(snapshot.getSize()); + template.setStatus(Status.DOWNLOADED); + template.setType(MockVolumeType.TEMPLATE); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + template = _mockVolumeDao.persist(template); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when saving template " + template, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - return new CreatePrivateTemplateAnswer(cmd, true, "", template.getName(), template.getSize(), - template.getSize(), template.getName(), ImageFormat.QCOW2); - } + return new CreatePrivateTemplateAnswer(cmd, true, "", template.getName(), template.getSize(), + template.getSize(), template.getName(), ImageFormat.QCOW2); + } - @Override - public Answer ComputeChecksum(ComputeChecksumCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVolumeVO volume = _mockVolumeDao.findByName(cmd.getTemplatePath()); - if (volume == null) { - return new Answer(cmd, false, "cant' find volume:" + cmd.getTemplatePath()); - } - String md5 = null; - try { - MessageDigest md = MessageDigest.getInstance("md5"); - md5 = String.format("%032x", new BigInteger(1, md.digest(cmd.getTemplatePath().getBytes()))); - } catch (NoSuchAlgorithmException e) { - s_logger.debug("failed to gernerate md5:" + e.toString()); - } - txn.commit(); - return new Answer(cmd, true, md5); - } finally { - txn.close(); + @Override + public Answer ComputeChecksum(ComputeChecksumCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVolumeVO volume = _mockVolumeDao.findByName(cmd.getTemplatePath()); + if (volume == null) { + return new Answer(cmd, false, "cant' find volume:" + cmd.getTemplatePath()); + } + String md5 = null; + try { + MessageDigest md = MessageDigest.getInstance("md5"); + md5 = String.format("%032x", new BigInteger(1, md.digest(cmd.getTemplatePath().getBytes()))); + } catch (NoSuchAlgorithmException e) { + s_logger.debug("failed to gernerate md5:" + e.toString()); + } + txn.commit(); + return new Answer(cmd, true, md5); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } - @Override - public CreatePrivateTemplateAnswer CreatePrivateTemplateFromVolume(CreatePrivateTemplateFromVolumeCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockVolumeVO volume = null; - MockSecStorageVO sec = null; - try { - txn.start(); - volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); - if (volume == null) { - return new CreatePrivateTemplateAnswer(cmd, false, "cant' find volume" + cmd.getVolumePath()); - } + @Override + public CreatePrivateTemplateAnswer CreatePrivateTemplateFromVolume(CreatePrivateTemplateFromVolumeCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockVolumeVO volume = null; + MockSecStorageVO sec = null; + try { + txn.start(); + volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); + if (volume == null) { + return new CreatePrivateTemplateAnswer(cmd, false, "cant' find volume" + cmd.getVolumePath()); + } - sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageUrl()); - if (sec == null) { - return new CreatePrivateTemplateAnswer(cmd, false, "can't find secondary storage"); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Error when creating private template from volume"); - } finally { - txn.close(); + sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageUrl()); + if (sec == null) { + return new CreatePrivateTemplateAnswer(cmd, false, "can't find secondary storage"); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Error when creating private template from volume"); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - MockVolumeVO template = new MockVolumeVO(); - String uuid = UUID.randomUUID().toString(); - template.setName(uuid); - template.setPath(sec.getMountPoint() + uuid); - template.setPoolId(sec.getId()); - template.setSize(volume.getSize()); - template.setStatus(Status.DOWNLOADED); - template.setType(MockVolumeType.TEMPLATE); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - template = _mockVolumeDao.persist(template); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting template " - + template.getName(), ex); - } finally { - txn.close(); + MockVolumeVO template = new MockVolumeVO(); + String uuid = UUID.randomUUID().toString(); + template.setName(uuid); + template.setPath(sec.getMountPoint() + uuid); + template.setPoolId(sec.getId()); + template.setSize(volume.getSize()); + template.setStatus(Status.DOWNLOADED); + template.setType(MockVolumeType.TEMPLATE); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + template = _mockVolumeDao.persist(template); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting template " + + template.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - return new CreatePrivateTemplateAnswer(cmd, true, "", template.getName(), template.getSize(), - template.getSize(), template.getName(), ImageFormat.QCOW2); - } + return new CreatePrivateTemplateAnswer(cmd, true, "", template.getName(), template.getSize(), + template.getSize(), template.getName(), ImageFormat.QCOW2); + } - @Override - public CopyVolumeAnswer CopyVolume(CopyVolumeCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - boolean toSecondaryStorage = cmd.toSecondaryStorage(); - MockSecStorageVO sec = null; - MockStoragePoolVO primaryStorage = null; - try { - txn.start(); - sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageURL()); - if (sec == null) { - return new CopyVolumeAnswer(cmd, false, "can't find secondary storage", null, null); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing secondary at " - + cmd.getSecondaryStorageURL(), ex); - } finally { - txn.close(); + @Override + public CopyVolumeAnswer CopyVolume(CopyVolumeCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + boolean toSecondaryStorage = cmd.toSecondaryStorage(); + MockSecStorageVO sec = null; + MockStoragePoolVO primaryStorage = null; + try { + txn.start(); + sec = _mockSecStorageDao.findByUrl(cmd.getSecondaryStorageURL()); + if (sec == null) { + return new CopyVolumeAnswer(cmd, false, "can't find secondary storage", null, null); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing secondary at " + + cmd.getSecondaryStorageURL(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - primaryStorage = _mockStoragePoolDao.findByUuid(cmd.getPool().getUuid()); - if (primaryStorage == null) { - return new CopyVolumeAnswer(cmd, false, "Can't find primary storage", null, null); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing primary at " - + cmd.getPool(), ex); - } finally { - txn.close(); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + primaryStorage = _mockStoragePoolDao.findByUuid(cmd.getPool().getUuid()); + if (primaryStorage == null) { + return new CopyVolumeAnswer(cmd, false, "Can't find primary storage", null, null); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing primary at " + + cmd.getPool(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - MockVolumeVO volume = null; - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); - if (volume == null) { - return new CopyVolumeAnswer(cmd, false, "cant' find volume" + cmd.getVolumePath(), null, null); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing volume at " - + cmd.getVolumePath(), ex); - } finally { - txn.close(); + MockVolumeVO volume = null; + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + volume = _mockVolumeDao.findByStoragePathAndType(cmd.getVolumePath()); + if (volume == null) { + return new CopyVolumeAnswer(cmd, false, "cant' find volume" + cmd.getVolumePath(), null, null); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when accessing volume at " + + cmd.getVolumePath(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } - String name = UUID.randomUUID().toString(); - if (toSecondaryStorage) { - MockVolumeVO vol = new MockVolumeVO(); - vol.setName(name); - vol.setPath(sec.getMountPoint() + name); - vol.setPoolId(sec.getId()); - vol.setSize(volume.getSize()); - vol.setStatus(Status.DOWNLOADED); - vol.setType(MockVolumeType.VOLUME); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - vol = _mockVolumeDao.persist(vol); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting volume " - + vol.getName(), ex); - } finally { - txn.close(); + String name = UUID.randomUUID().toString(); + if (toSecondaryStorage) { + MockVolumeVO vol = new MockVolumeVO(); + vol.setName(name); + vol.setPath(sec.getMountPoint() + name); + vol.setPoolId(sec.getId()); + vol.setSize(volume.getSize()); + vol.setStatus(Status.DOWNLOADED); + vol.setType(MockVolumeType.VOLUME); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + vol = _mockVolumeDao.persist(vol); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting volume " + + vol.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new CopyVolumeAnswer(cmd, true, null, sec.getMountPoint(), vol.getPath()); - } else { - MockVolumeVO vol = new MockVolumeVO(); - vol.setName(name); - vol.setPath(primaryStorage.getMountPoint() + name); - vol.setPoolId(primaryStorage.getId()); - vol.setSize(volume.getSize()); - vol.setStatus(Status.DOWNLOADED); - vol.setType(MockVolumeType.VOLUME); - txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - vol = _mockVolumeDao.persist(vol); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting volume " - + vol.getName(), ex); - } finally { - txn.close(); + } + return new CopyVolumeAnswer(cmd, true, null, sec.getMountPoint(), vol.getPath()); + } else { + MockVolumeVO vol = new MockVolumeVO(); + vol.setName(name); + vol.setPath(primaryStorage.getMountPoint() + name); + vol.setPoolId(primaryStorage.getId()); + vol.setSize(volume.getSize()); + vol.setStatus(Status.DOWNLOADED); + vol.setType(MockVolumeType.VOLUME); + txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + vol = _mockVolumeDao.persist(vol); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Encountered " + ex.getMessage() + " when persisting volume " + + vol.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return new CopyVolumeAnswer(cmd, true, null, primaryStorage.getMountPoint(), vol.getPath()); - } - } + } + return new CopyVolumeAnswer(cmd, true, null, primaryStorage.getMountPoint(), vol.getPath()); + } + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java index 117e2f6374f..c5f93b75645 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManager.java @@ -19,7 +19,26 @@ package com.cloud.agent.manager; import java.util.HashMap; import java.util.Map; -import com.cloud.agent.api.*; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.BumpUpPriorityCommand; +import com.cloud.agent.api.CheckRouterAnswer; +import com.cloud.agent.api.CheckRouterCommand; +import com.cloud.agent.api.CheckVirtualMachineCommand; +import com.cloud.agent.api.CleanupNetworkRulesCmd; +import com.cloud.agent.api.GetDomRVersionAnswer; +import com.cloud.agent.api.GetDomRVersionCmd; +import com.cloud.agent.api.GetVmStatsCommand; +import com.cloud.agent.api.GetVncPortCommand; +import com.cloud.agent.api.MigrateAnswer; +import com.cloud.agent.api.MigrateCommand; +import com.cloud.agent.api.NetworkUsageCommand; +import com.cloud.agent.api.PrepareForMigrationAnswer; +import com.cloud.agent.api.PrepareForMigrationCommand; +import com.cloud.agent.api.RebootCommand; +import com.cloud.agent.api.SecurityGroupRuleAnswer; +import com.cloud.agent.api.SecurityGroupRulesCmd; +import com.cloud.agent.api.StartCommand; +import com.cloud.agent.api.StopCommand; import com.cloud.agent.api.check.CheckSshAnswer; import com.cloud.agent.api.check.CheckSshCommand; import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand; diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java index 40cd80acf8e..c0ccbe43978 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/MockVmManagerImpl.java @@ -17,26 +17,16 @@ package com.cloud.agent.manager; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - import com.cloud.agent.api.*; -import com.cloud.agent.api.routing.*; -import com.cloud.network.router.VirtualRouter; -import org.apache.log4j.Logger; - import com.cloud.agent.api.check.CheckSshAnswer; import com.cloud.agent.api.check.CheckSshCommand; import com.cloud.agent.api.proxy.CheckConsoleProxyLoadCommand; import com.cloud.agent.api.proxy.WatchConsoleProxyLoadCommand; +import com.cloud.agent.api.routing.*; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.network.Networks.TrafficType; +import com.cloud.network.router.VirtualRouter; import com.cloud.simulator.MockHost; import com.cloud.simulator.MockSecurityRulesVO; import com.cloud.simulator.MockVMVO; @@ -46,55 +36,66 @@ import com.cloud.simulator.dao.MockSecurityRulesDao; import com.cloud.simulator.dao.MockVMDao; import com.cloud.utils.Pair; import com.cloud.utils.Ternary; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine.State; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@Component @Local(value = { MockVmManager.class }) -public class MockVmManagerImpl implements MockVmManager { +public class MockVmManagerImpl extends ManagerBase implements MockVmManager { private static final Logger s_logger = Logger.getLogger(MockVmManagerImpl.class); - @Inject MockVMDao _mockVmDao = null; - @Inject MockAgentManager _mockAgentMgr = null; - @Inject MockHostDao _mockHostDao = null; - @Inject MockSecurityRulesDao _mockSecurityDao = null; - private Map>> _securityRules = new ConcurrentHashMap>>(); + @Inject MockVMDao _mockVmDao = null; + @Inject MockAgentManager _mockAgentMgr = null; + @Inject MockHostDao _mockHostDao = null; + @Inject MockSecurityRulesDao _mockSecurityDao = null; + private final Map>> _securityRules = new ConcurrentHashMap>>(); - public MockVmManagerImpl() { - } + public MockVmManagerImpl() { + } - @Override + @Override public boolean configure(String name, Map params) throws ConfigurationException { - return true; - } + return true; + } public String startVM(String vmName, NicTO[] nics, - int cpuHz, long ramSize, - String bootArgs, String hostGuid) { + int cpuHz, long ramSize, + String bootArgs, String hostGuid) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - MockHost host = null; - MockVm vm = null; - try { - txn.start(); - host = _mockHostDao.findByGuid(hostGuid); - if (host == null) { - return "can't find host"; - } + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + MockHost host = null; + MockVm vm = null; + try { + txn.start(); + host = _mockHostDao.findByGuid(hostGuid); + if (host == null) { + return "can't find host"; + } - vm = _mockVmDao.findByVmName(vmName); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to start VM " + vmName, ex); - } finally { - txn.close(); + vm = _mockVmDao.findByVmName(vmName); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to start VM " + vmName, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } if(vm == null) { int vncPort = 0; @@ -109,43 +110,43 @@ public class MockVmManagerImpl implements MockVmManager { vm.setHostId(host.getId()); vm.setBootargs(bootArgs); if(vmName.startsWith("s-")) { - vm.setType("SecondaryStorageVm"); + vm.setType("SecondaryStorageVm"); } else if (vmName.startsWith("v-")) { - vm.setType("ConsoleProxy"); + vm.setType("ConsoleProxy"); } else if (vmName.startsWith("r-")) { - vm.setType("DomainRouter"); + vm.setType("DomainRouter"); } else if (vmName.startsWith("i-")) { - vm.setType("User"); + vm.setType("User"); } txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - vm = _mockVmDao.persist((MockVMVO) vm); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to save vm to db " + vm.getName(), ex); - } finally { - txn.close(); + try { + txn.start(); + vm = _mockVmDao.persist((MockVMVO) vm); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to save vm to db " + vm.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } } else { if(vm.getState() == State.Stopped) { vm.setState(State.Running); txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - _mockVmDao.update(vm.getId(), (MockVMVO)vm); - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex); - } finally { - txn.close(); + try { + txn.start(); + _mockVmDao.update(vm.getId(), (MockVMVO)vm); + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to update vm " + vm.getName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } + } } } @@ -192,49 +193,49 @@ public class MockVmManagerImpl implements MockVmManager { return null; } - public boolean rebootVM(String vmName) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVm vm = _mockVmDao.findByVmName(vmName); - if (vm != null) { - vm.setState(State.Running); - _mockVmDao.update(vm.getId(), (MockVMVO) vm); + public boolean rebootVM(String vmName) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVm vm = _mockVmDao.findByVmName(vmName); + if (vm != null) { + vm.setState(State.Running); + _mockVmDao.update(vm.getId(), (MockVMVO) vm); - } - txn.commit(); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to reboot vm " + vmName, ex); - } finally { - txn.close(); + } + txn.commit(); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to reboot vm " + vmName, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - return true; - } + } + return true; + } - @Override - public Map getVms(String hostGuid) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - List vms = _mockVmDao.findByHostGuid(hostGuid); - Map vmMap = new HashMap(); - for (MockVMVO vm : vms) { - vmMap.put(vm.getName(), vm); - } - txn.commit(); - return vmMap; - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to fetch vms from host " + hostGuid, ex); - } finally { - txn.close(); + @Override + public Map getVms(String hostGuid) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + List vms = _mockVmDao.findByHostGuid(hostGuid); + Map vmMap = new HashMap(); + for (MockVMVO vm : vms) { + vmMap.put(vm.getName(), vm); + } + txn.commit(); + return vmMap; + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to fetch vms from host " + hostGuid, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override public CheckRouterAnswer checkRouter(CheckRouterCommand cmd) { @@ -267,30 +268,30 @@ public class MockVmManagerImpl implements MockVmManager { } @Override - public Map getVmStates(String hostGuid) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - Map states = new HashMap(); - List vms = _mockVmDao.findByHostGuid(hostGuid); - if (vms.isEmpty()) { - txn.commit(); - return states; - } - for (MockVm vm : vms) { - states.put(vm.getName(), vm.getState()); - } - txn.commit(); - return states; - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to fetch vms from host " + hostGuid, ex); - } finally { - txn.close(); + public Map getVmStates(String hostGuid) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + Map states = new HashMap(); + List vms = _mockVmDao.findByHostGuid(hostGuid); + if (vms.isEmpty()) { + txn.commit(); + return states; + } + for (MockVm vm : vms) { + states.put(vm.getName(), vm.getState()); + } + txn.commit(); + return states; + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to fetch vms from host " + hostGuid, ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override public boolean start() { @@ -323,31 +324,31 @@ public class MockVmManagerImpl implements MockVmManager { } @Override - public CheckVirtualMachineAnswer checkVmState(CheckVirtualMachineCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName()); - if (vm == null) { - return new CheckVirtualMachineAnswer(cmd, "can't find vm:" + cmd.getVmName()); - } + public CheckVirtualMachineAnswer checkVmState(CheckVirtualMachineCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVMVO vm = _mockVmDao.findByVmName(cmd.getVmName()); + if (vm == null) { + return new CheckVirtualMachineAnswer(cmd, "can't find vm:" + cmd.getVmName()); + } - txn.commit(); - return new CheckVirtualMachineAnswer(cmd, vm.getState(), vm.getVncPort()); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to fetch vm state " + cmd.getVmName(), ex); - } finally { - txn.close(); + txn.commit(); + return new CheckVirtualMachineAnswer(cmd, vm.getState(), vm.getVncPort()); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to fetch vm state " + cmd.getVmName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override public Answer startVM(StartCommand cmd, SimulatorInfo info) { VirtualMachineTO vm = cmd.getVirtualMachine(); - String result = startVM(vm.getName(), vm.getNics(), vm.getCpus()* vm.getSpeed(), vm.getMaxRam(), vm.getBootArgs(), info.getHostUuid()); + String result = startVM(vm.getName(), vm.getNics(), vm.getCpus()* vm.getMaxSpeed(), vm.getMaxRam(), vm.getBootArgs(), info.getHostUuid()); if (result != null) { return new StartAnswer(cmd, result); } else { @@ -372,7 +373,7 @@ public class MockVmManagerImpl implements MockVmManager { @Override public Answer SetFirewallRules(SetFirewallRulesCommand cmd) { - return new Answer(cmd); + return new Answer(cmd); } @@ -382,38 +383,38 @@ public class MockVmManagerImpl implements MockVmManager { } @Override - public MigrateAnswer Migrate(MigrateCommand cmd, SimulatorInfo info) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - String vmName = cmd.getVmName(); - String destGuid = cmd.getHostGuid(); - MockVMVO vm = _mockVmDao.findByVmNameAndHost(vmName, info.getHostUuid()); - if (vm == null) { - return new MigrateAnswer(cmd, false, "can't find vm:" + vmName + " on host:" + info.getHostUuid(), null); - } else { + public MigrateAnswer Migrate(MigrateCommand cmd, SimulatorInfo info) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + String vmName = cmd.getVmName(); + String destGuid = cmd.getHostGuid(); + MockVMVO vm = _mockVmDao.findByVmNameAndHost(vmName, info.getHostUuid()); + if (vm == null) { + return new MigrateAnswer(cmd, false, "can't find vm:" + vmName + " on host:" + info.getHostUuid(), null); + } else { if (vm.getState() == State.Migrating) { vm.setState(State.Running); } } - MockHost destHost = _mockHostDao.findByGuid(destGuid); - if (destHost == null) { - return new MigrateAnswer(cmd, false, "can;t find host:" + info.getHostUuid(), null); - } - vm.setHostId(destHost.getId()); - _mockVmDao.update(vm.getId(), vm); - txn.commit(); - return new MigrateAnswer(cmd, true, null, 0); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to migrate vm " + cmd.getVmName(), ex); - } finally { - txn.close(); + MockHost destHost = _mockHostDao.findByGuid(destGuid); + if (destHost == null) { + return new MigrateAnswer(cmd, false, "can;t find host:" + info.getHostUuid(), null); + } + vm.setHostId(destHost.getId()); + _mockVmDao.update(vm.getId(), vm); + txn.commit(); + return new MigrateAnswer(cmd, true, null, 0); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to migrate vm " + cmd.getVmName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override public PrepareForMigrationAnswer prepareForMigrate(PrepareForMigrationCommand cmd) { @@ -457,81 +458,81 @@ public class MockVmManagerImpl implements MockVmManager { } @Override - public Answer CleanupNetworkRules(CleanupNetworkRulesCmd cmd, SimulatorInfo info) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - List rules = _mockSecurityDao.findByHost(info.getHostUuid()); - for (MockSecurityRulesVO rule : rules) { - MockVMVO vm = _mockVmDao.findByVmNameAndHost(rule.getVmName(), info.getHostUuid()); - if (vm == null) { - _mockSecurityDao.remove(rule.getId()); - } - } - txn.commit(); - return new Answer(cmd); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to clean up rules", ex); - } finally { - txn.close(); + public Answer CleanupNetworkRules(CleanupNetworkRulesCmd cmd, SimulatorInfo info) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + List rules = _mockSecurityDao.findByHost(info.getHostUuid()); + for (MockSecurityRulesVO rule : rules) { + MockVMVO vm = _mockVmDao.findByVmNameAndHost(rule.getVmName(), info.getHostUuid()); + if (vm == null) { + _mockSecurityDao.remove(rule.getId()); + } + } + txn.commit(); + return new Answer(cmd); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to clean up rules", ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override - public Answer stopVM(StopCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - String vmName = cmd.getVmName(); - MockVm vm = _mockVmDao.findByVmName(vmName); - if (vm != null) { - vm.setState(State.Stopped); - _mockVmDao.update(vm.getId(), (MockVMVO) vm); - } + public Answer stopVM(StopCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + String vmName = cmd.getVmName(); + MockVm vm = _mockVmDao.findByVmName(vmName); + if (vm != null) { + vm.setState(State.Stopped); + _mockVmDao.update(vm.getId(), (MockVMVO) vm); + } - if (vmName.startsWith("s-")) { - _mockAgentMgr.handleSystemVMStop(vm.getId()); - } - txn.commit(); - return new StopAnswer(cmd, null, new Integer(0), true); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex); - } finally { - txn.close(); + if (vmName.startsWith("s-")) { + _mockAgentMgr.handleSystemVMStop(vm.getId()); + } + txn.commit(); + return new StopAnswer(cmd, null, new Integer(0), true); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex); + } finally { + txn.close(); txn = Transaction.open(Transaction.CLOUD_DB); txn.close(); - } - } + } + } @Override - public Answer rebootVM(RebootCommand cmd) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockVm vm = _mockVmDao.findByVmName(cmd.getVmName()); - if (vm != null) { - vm.setState(State.Running); - _mockVmDao.update(vm.getId(), (MockVMVO) vm); - } - txn.commit(); - return new RebootAnswer(cmd, "Rebooted " + cmd.getVmName(), true); - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex); - } finally { - txn.close(); - txn = Transaction.open(Transaction.CLOUD_DB); - txn.close(); - } - } + public Answer rebootVM(RebootCommand cmd) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockVm vm = _mockVmDao.findByVmName(cmd.getVmName()); + if (vm != null) { + vm.setState(State.Running); + _mockVmDao.update(vm.getId(), (MockVMVO) vm); + } + txn.commit(); + return new RebootAnswer(cmd, "Rebooted " + cmd.getVmName(), true); + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("unable to stop vm " + cmd.getVmName(), ex); + } finally { + txn.close(); + txn = Transaction.open(Transaction.CLOUD_DB); + txn.close(); + } + } @Override public Answer getVncPort(GetVncPortCommand cmd) { - return new GetVncPortAnswer(cmd, 0); + return new GetVncPortAnswer(cmd, 0); } @Override @@ -546,13 +547,13 @@ public class MockVmManagerImpl implements MockVmManager { @Override public GetDomRVersionAnswer getDomRVersion(GetDomRVersionCmd cmd) { - return new GetDomRVersionAnswer(cmd, null, null, null); + return new GetDomRVersionAnswer(cmd, null, null, null); } @Override public SecurityGroupRuleAnswer AddSecurityGroupRules(SecurityGroupRulesCmd cmd, SimulatorInfo info) { if (!info.isEnabled()) { - return new SecurityGroupRuleAnswer(cmd, false, "Disabled", SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL); + return new SecurityGroupRuleAnswer(cmd, false, "Disabled", SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL); } Map> rules = _securityRules.get(info.getHostUuid()); diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java index ff8c32ce185..91a95eb4874 100755 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManager.java @@ -17,7 +17,6 @@ package com.cloud.agent.manager; import java.util.HashMap; -import java.util.List; import java.util.Map; import com.cloud.agent.api.Answer; diff --git a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java index 2bed2efec6a..c234cc5cb2e 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/agent/manager/SimulatorManagerImpl.java @@ -28,21 +28,24 @@ import com.cloud.simulator.MockVMVO; import com.cloud.simulator.dao.MockConfigurationDao; import com.cloud.simulator.dao.MockHostDao; import com.cloud.utils.Pair; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.db.ConnectionConcierge; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.VirtualMachine.State; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import java.util.HashMap; import java.util.Map; +@Component @Local(value = { SimulatorManager.class }) -public class SimulatorManagerImpl implements SimulatorManager { +public class SimulatorManagerImpl extends ManagerBase implements SimulatorManager { private static final Logger s_logger = Logger.getLogger(SimulatorManagerImpl.class); @Inject MockVmManager _mockVmMgr = null; @@ -57,7 +60,7 @@ public class SimulatorManagerImpl implements SimulatorManager { private ConnectionConcierge _concierge; @Override public boolean configure(String name, Map params) throws ConfigurationException { - /* + /* try { Connection conn = Transaction.getStandaloneSimulatorConnection(); conn.setAutoCommit(true); @@ -65,7 +68,7 @@ public class SimulatorManagerImpl implements SimulatorManager { } catch (SQLException e) { throw new CloudRuntimeException("Unable to get a db connection to simulator", e); } - */ + */ return true; } @@ -146,7 +149,7 @@ public class SimulatorManagerImpl implements SimulatorManager { } else if (cmd instanceof PingTestCommand) { return _mockAgentMgr.pingTest((PingTestCommand) cmd); } else if (cmd instanceof PrepareForMigrationCommand) { - return _mockVmMgr.prepareForMigrate((PrepareForMigrationCommand) cmd); + return _mockVmMgr.prepareForMigrate((PrepareForMigrationCommand) cmd); } else if (cmd instanceof MigrateCommand) { return _mockVmMgr.Migrate((MigrateCommand) cmd, info); } else if (cmd instanceof StartCommand) { @@ -154,11 +157,11 @@ public class SimulatorManagerImpl implements SimulatorManager { } else if (cmd instanceof CheckSshCommand) { return _mockVmMgr.checkSshCommand((CheckSshCommand) cmd); } else if (cmd instanceof CheckVirtualMachineCommand) { - return _mockVmMgr.checkVmState((CheckVirtualMachineCommand) cmd); + return _mockVmMgr.checkVmState((CheckVirtualMachineCommand) cmd); } else if (cmd instanceof SetStaticNatRulesCommand) { return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand) cmd); } else if (cmd instanceof SetFirewallRulesCommand) { - return _mockVmMgr.SetFirewallRules((SetFirewallRulesCommand) cmd); + return _mockVmMgr.SetFirewallRules((SetFirewallRulesCommand) cmd); } else if (cmd instanceof SetPortForwardingRulesCommand) { return _mockVmMgr.SetPortForwardingRules((SetPortForwardingRulesCommand) cmd); } else if (cmd instanceof NetworkUsageCommand) { @@ -174,7 +177,7 @@ public class SimulatorManagerImpl implements SimulatorManager { } else if (cmd instanceof CleanupNetworkRulesCmd) { return _mockVmMgr.CleanupNetworkRules((CleanupNetworkRulesCmd) cmd, info); } else if (cmd instanceof CheckNetworkCommand) { - return _mockAgentMgr.checkNetworkCommand((CheckNetworkCommand) cmd); + return _mockAgentMgr.checkNetworkCommand((CheckNetworkCommand) cmd); }else if (cmd instanceof StopCommand) { return _mockVmMgr.stopVM((StopCommand)cmd); } else if (cmd instanceof RebootCommand) { @@ -244,11 +247,11 @@ public class SimulatorManagerImpl implements SimulatorManager { } else if (cmd instanceof BumpUpPriorityCommand) { return _mockVmMgr.bumpPriority((BumpUpPriorityCommand) cmd); } else if (cmd instanceof GetDomRVersionCmd) { - return _mockVmMgr.getDomRVersion((GetDomRVersionCmd) cmd); + return _mockVmMgr.getDomRVersion((GetDomRVersionCmd) cmd); } else if (cmd instanceof ClusterSyncCommand) { - return new Answer(cmd); + return new Answer(cmd); } else if (cmd instanceof CopyVolumeCommand) { - return _mockStorageMgr.CopyVolume((CopyVolumeCommand) cmd); + return _mockStorageMgr.CopyVolume((CopyVolumeCommand) cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } @@ -270,49 +273,49 @@ public class SimulatorManagerImpl implements SimulatorManager { @Override public Map getVmStates(String hostGuid) { - return _mockVmMgr.getVmStates(hostGuid); + return _mockVmMgr.getVmStates(hostGuid); } @Override public Map getVms(String hostGuid) { - return _mockVmMgr.getVms(hostGuid); + return _mockVmMgr.getVms(hostGuid); } @Override public HashMap> syncNetworkGroups(String hostGuid) { - SimulatorInfo info = new SimulatorInfo(); - info.setHostUuid(hostGuid); - return _mockVmMgr.syncNetworkGroups(info); + SimulatorInfo info = new SimulatorInfo(); + info.setHostUuid(hostGuid); + return _mockVmMgr.syncNetworkGroups(info); } @Override - public boolean configureSimulator(Long zoneId, Long podId, Long clusterId, Long hostId, String command, - String values) { - Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); - try { - txn.start(); - MockConfigurationVO config = _mockConfigDao.findByCommand(zoneId, podId, clusterId, hostId, command); - if (config == null) { - config = new MockConfigurationVO(); - config.setClusterId(clusterId); - config.setDataCenterId(zoneId); - config.setPodId(podId); - config.setHostId(hostId); - config.setName(command); - config.setValues(values); - _mockConfigDao.persist(config); - txn.commit(); - } else { - config.setValues(values); - _mockConfigDao.update(config.getId(), config); - txn.commit(); - } - } catch (Exception ex) { - txn.rollback(); - throw new CloudRuntimeException("Unable to configure simulator because of " + ex.getMessage(), ex); - } finally { - txn.close(); - } - return true; - } + public boolean configureSimulator(Long zoneId, Long podId, Long clusterId, Long hostId, String command, + String values) { + Transaction txn = Transaction.open(Transaction.SIMULATOR_DB); + try { + txn.start(); + MockConfigurationVO config = _mockConfigDao.findByCommand(zoneId, podId, clusterId, hostId, command); + if (config == null) { + config = new MockConfigurationVO(); + config.setClusterId(clusterId); + config.setDataCenterId(zoneId); + config.setPodId(podId); + config.setHostId(hostId); + config.setName(command); + config.setValues(values); + _mockConfigDao.persist(config); + txn.commit(); + } else { + config.setValues(values); + _mockConfigDao.update(config.getId(), config); + txn.commit(); + } + } catch (Exception ex) { + txn.rollback(); + throw new CloudRuntimeException("Unable to configure simulator because of " + ex.getMessage(), ex); + } finally { + txn.close(); + } + return true; + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java index df81249538d..e982665965c 100755 --- a/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java +++ b/plugins/hypervisors/simulator/src/com/cloud/api/commands/ConfigureSimulator.java @@ -16,28 +16,32 @@ // under the License. package com.cloud.api.commands; -import org.apache.log4j.Logger; +import javax.inject.Inject; -import com.cloud.agent.manager.SimulatorManager; -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; +import org.apache.log4j.Logger; + +import com.cloud.agent.manager.SimulatorManager; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.server.ManagementService; import com.cloud.user.Account; -import com.cloud.utils.component.ComponentLocator; + @APICommand(name = "configureSimulator", description="configure simulator", responseObject=SuccessResponse.class) public class ConfigureSimulator extends BaseCmd { public static final Logger s_logger = Logger.getLogger(ConfigureSimulator.class.getName()); private static final String s_name = "configuresimulatorresponse"; + @Inject SimulatorManager _simMgr; + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="configure range: in a zone") private Long zoneId; @@ -58,11 +62,9 @@ public class ConfigureSimulator extends BaseCmd { @Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { - ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name); - SimulatorManager _simMgr = locator.getManager(SimulatorManager.class); boolean result = _simMgr.configureSimulator(zoneId, podId, clusterId, hostId, command, values); if (!result) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure simulator"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure simulator"); } SuccessResponse response = new SuccessResponse(getCommandName()); diff --git a/plugins/hypervisors/simulator/src/com/cloud/configuration/SimulatorComponentLibrary.java b/plugins/hypervisors/simulator/src/com/cloud/configuration/SimulatorComponentLibrary.java index 9fd525873b7..373cae1367e 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/configuration/SimulatorComponentLibrary.java +++ b/plugins/hypervisors/simulator/src/com/cloud/configuration/SimulatorComponentLibrary.java @@ -16,35 +16,25 @@ // under the License. package com.cloud.configuration; -import com.cloud.agent.manager.MockAgentManagerImpl; -import com.cloud.agent.manager.MockStorageManagerImpl; -import com.cloud.agent.manager.MockVmManagerImpl; -import com.cloud.agent.manager.SimulatorManagerImpl; -import com.cloud.simulator.dao.MockConfigurationDaoImpl; -import com.cloud.simulator.dao.MockHostDaoImpl; -import com.cloud.simulator.dao.MockSecStorageDaoImpl; -import com.cloud.simulator.dao.MockSecurityRulesDaoImpl; -import com.cloud.simulator.dao.MockStoragePoolDaoImpl; -import com.cloud.simulator.dao.MockVMDaoImpl; -import com.cloud.simulator.dao.MockVolumeDaoImpl; -public class SimulatorComponentLibrary extends PremiumComponentLibrary { - @Override - protected void populateManagers() { - addManager("VM Manager", MockVmManagerImpl.class); - addManager("agent manager", MockAgentManagerImpl.class); - addManager("storage manager", MockStorageManagerImpl.class); - addManager("SimulatorManager", SimulatorManagerImpl.class); - } - - @Override - protected void populateDaos() { - addDao("mock Host", MockHostDaoImpl.class); - addDao("mock secondary storage", MockSecStorageDaoImpl.class); - addDao("mock storage pool", MockStoragePoolDaoImpl.class); - addDao("mock vm", MockVMDaoImpl.class); - addDao("mock volume", MockVolumeDaoImpl.class); - addDao("mock config", MockConfigurationDaoImpl.class); - addDao("mock security rules", MockSecurityRulesDaoImpl.class); - } +//TODO: Remove this class after the managers are figured out. +public class SimulatorComponentLibrary { +// @Override +// protected void populateManagers() { +// addManager("VM Manager", MockVmManagerImpl.class); +// addManager("agent manager", MockAgentManagerImpl.class); +// addManager("storage manager", MockStorageManagerImpl.class); +// addManager("SimulatorManager", SimulatorManagerImpl.class); +// } +// +// @Override +// protected void populateDaos() { +// addDao("mock Host", MockHostDaoImpl.class); +// addDao("mock secondary storage", MockSecStorageDaoImpl.class); +// addDao("mock storage pool", MockStoragePoolDaoImpl.class); +// addDao("mock vm", MockVMDaoImpl.class); +// addDao("mock volume", MockVolumeDaoImpl.class); +// addDao("mock config", MockConfigurationDaoImpl.class); +// addDao("mock security rules", MockSecurityRulesDaoImpl.class); +// } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentResourceBase.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentResourceBase.java index 808ca070d4d..27f158ca9f6 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentResourceBase.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentResourceBase.java @@ -26,6 +26,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -40,245 +41,269 @@ import com.cloud.agent.manager.MockStorageManager; import com.cloud.agent.manager.MockVmManager; import com.cloud.agent.manager.SimulatorManager; import com.cloud.agent.manager.SimulatorManager.AgentType; +import com.cloud.agent.manager.SimulatorManagerImpl; import com.cloud.host.Host; import com.cloud.host.Host.Type; import com.cloud.simulator.MockHost; -import com.cloud.utils.component.ComponentLocator; +import com.cloud.utils.component.ComponentContext; + public class AgentResourceBase implements ServerResource { - private static final Logger s_logger = Logger - .getLogger(AgentResourceBase.class); + private static final Logger s_logger = Logger.getLogger(AgentResourceBase.class); - protected String _name; - private List _warnings = new LinkedList(); - private List _errors = new LinkedList(); + protected String _name; + private List _warnings = new LinkedList(); + private List _errors = new LinkedList(); - private transient IAgentControl _agentControl; + private transient IAgentControl _agentControl; - protected long _instanceId; + protected long _instanceId; - private Type _type; + private Type _type; - private transient ComponentLocator _locator = null; - protected transient SimulatorManager _simMgr; - protected MockHost agentHost = null; - protected boolean stopped = false; - protected String hostGuid = null; + @Inject protected SimulatorManager _simMgr; + protected MockHost agentHost = null; + protected boolean stopped = false; + protected String hostGuid = null; - public AgentResourceBase(long instanceId, AgentType agentType, SimulatorManager simMgr, String hostGuid) { - _instanceId = instanceId; + public AgentResourceBase(long instanceId, AgentType agentType, SimulatorManager simMgr, String hostGuid) { + _instanceId = instanceId; - if(s_logger.isDebugEnabled()) { - s_logger.info("New Routing host instantiated with guid:" + hostGuid); - } + if(s_logger.isDebugEnabled()) { + s_logger.info("New Routing host instantiated with guid:" + hostGuid); + } - if (agentType == AgentType.Routing) { - _type = Host.Type.Routing; - } else { - _type = Host.Type.Storage; - } + if (agentType == AgentType.Routing) { + _type = Host.Type.Routing; + } else { + _type = Host.Type.Storage; + } - this.hostGuid = hostGuid; - } + this.hostGuid = hostGuid; + } - protected MockVmManager getVmMgr() { - return _simMgr.getVmMgr(); - } + protected MockVmManager getVmMgr() { + return _simMgr.getVmMgr(); + } - protected MockStorageManager getStorageMgr() { - return _simMgr.getStorageMgr(); - } + protected MockStorageManager getStorageMgr() { + return _simMgr.getStorageMgr(); + } - protected MockAgentManager getAgentMgr() { - return _simMgr.getAgentMgr(); - } + protected MockAgentManager getAgentMgr() { + return _simMgr.getAgentMgr(); + } - protected long getInstanceId() { - return _instanceId; - } + protected long getInstanceId() { + return _instanceId; + } - public AgentResourceBase() { - if(s_logger.isDebugEnabled()) { - s_logger.debug("Deserializing simulated agent on reconnect"); - } + public AgentResourceBase() { + if(s_logger.isDebugEnabled()) { + s_logger.debug("Deserializing simulated agent on reconnect"); + } + } + + @Override + public String getName() { + return _name; + } + + public void setName(String name) { + _name = name; + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + hostGuid = (String)params.get("guid"); + + _simMgr = ComponentContext.inject(SimulatorManagerImpl.class); + + agentHost = getAgentMgr().getHost(hostGuid); + return true; + } + + + private void reconnect(MockHost host) { + if(s_logger.isDebugEnabled()) { + s_logger.debug("Reconfiguring existing simulated host w/ name: " + host.getName() + " and guid: " + host.getGuid()); + } + this.agentHost = host; + } + + + @Override + public void disconnected() { + this.stopped = true; + } + + protected void recordWarning(String msg, Throwable th) { + String str = getLogStr(msg, th); + synchronized (_warnings) { + _warnings.add(str); + } + } + + protected void recordWarning(String msg) { + recordWarning(msg, null); + } + + protected List getWarnings() { + synchronized (this) { + List results = _warnings; + _warnings = new ArrayList(); + return results; + } + } + + protected List getErrors() { + synchronized (this) { + List result = _errors; + _errors = new ArrayList(); + return result; + } + } + + protected void recordError(String msg, Throwable th) { + String str = getLogStr(msg, th); + synchronized (_errors) { + _errors.add(str); + } + } + + protected void recordError(String msg) { + recordError(msg, null); + } + + protected Answer createErrorAnswer(Command cmd, String msg, Throwable th) { + StringWriter writer = new StringWriter(); + if (msg != null) { + writer.append(msg); + } + writer.append("===>Stack<==="); + th.printStackTrace(new PrintWriter(writer)); + return new Answer(cmd, false, writer.toString()); + } + + protected String createErrorDetail(String msg, Throwable th) { + StringWriter writer = new StringWriter(); + if (msg != null) { + writer.append(msg); + } + writer.append("===>Stack<==="); + th.printStackTrace(new PrintWriter(writer)); + return writer.toString(); + } + + protected String getLogStr(String msg, Throwable th) { + StringWriter writer = new StringWriter(); + writer.append(new Date().toString()).append(": ").append(msg); + if (th != null) { + writer.append("\n Exception: "); + th.printStackTrace(new PrintWriter(writer)); + } + return writer.toString(); + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + this.stopped = true; + return true; + } + + @Override + public IAgentControl getAgentControl() { + return _agentControl; + } + + @Override + public void setAgentControl(IAgentControl agentControl) { + _agentControl = agentControl; + } + + protected String findScript(String script) { + s_logger.debug("Looking for " + script + " in the classpath"); + URL url = ClassLoader.getSystemResource(script); + File file = null; + if (url == null) { + file = new File("./" + script); + s_logger.debug("Looking for " + script + " in " + + file.getAbsolutePath()); + if (!file.exists()) { + return null; + } + } else { + file = new File(url.getFile()); + } + return file.getAbsolutePath(); + } + + + @Override + public Answer executeRequest(Command cmd) { + return null; + } + + @Override + public PingCommand getCurrentStatus(long id) { + return null; + } + + @Override + public Type getType() { + return _type; + } + + public void setType(Host.Type _type) { + this._type = _type; + } + + @Override + public StartupCommand[] initialize() { + return null; + } + + public SimulatorManager getSimulatorManager() { + return _simMgr; + } + + public void setSimulatorManager(SimulatorManager simMgr) { + _simMgr = simMgr; + } + + public boolean isStopped() { + return this.stopped; + } + + @Override + public void setConfigParams(Map params) { + // TODO Auto-generated method stub + } @Override - public String getName() { - return _name; - } - - public void setName(String name) { - _name = name; - } - - @Override - public boolean configure(String name, Map params) - throws ConfigurationException { - hostGuid = (String)params.get("guid"); - _locator = ComponentLocator.getLocator("management-server"); - _simMgr = _locator.getManager(SimulatorManager.class); - - agentHost = getAgentMgr().getHost(hostGuid); - return true; - } - - - private void reconnect(MockHost host) { - if(s_logger.isDebugEnabled()) { - s_logger.debug("Reconfiguring existing simulated host w/ name: " + host.getName() + " and guid: " + host.getGuid()); - } - this.agentHost = host; - } - - - @Override - public void disconnected() { - this.stopped = true; - } - - protected void recordWarning(String msg, Throwable th) { - String str = getLogStr(msg, th); - synchronized (_warnings) { - _warnings.add(str); - } - } - - protected void recordWarning(String msg) { - recordWarning(msg, null); - } - - protected List getWarnings() { - synchronized (this) { - List results = _warnings; - _warnings = new ArrayList(); - return results; - } - } - - protected List getErrors() { - synchronized (this) { - List result = _errors; - _errors = new ArrayList(); - return result; - } - } - - protected void recordError(String msg, Throwable th) { - String str = getLogStr(msg, th); - synchronized (_errors) { - _errors.add(str); - } - } - - protected void recordError(String msg) { - recordError(msg, null); - } - - protected Answer createErrorAnswer(Command cmd, String msg, Throwable th) { - StringWriter writer = new StringWriter(); - if (msg != null) { - writer.append(msg); - } - writer.append("===>Stack<==="); - th.printStackTrace(new PrintWriter(writer)); - return new Answer(cmd, false, writer.toString()); - } - - protected String createErrorDetail(String msg, Throwable th) { - StringWriter writer = new StringWriter(); - if (msg != null) { - writer.append(msg); - } - writer.append("===>Stack<==="); - th.printStackTrace(new PrintWriter(writer)); - return writer.toString(); - } - - protected String getLogStr(String msg, Throwable th) { - StringWriter writer = new StringWriter(); - writer.append(new Date().toString()).append(": ").append(msg); - if (th != null) { - writer.append("\n Exception: "); - th.printStackTrace(new PrintWriter(writer)); - } - return writer.toString(); - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - this.stopped = true; - return true; - } - - @Override - public IAgentControl getAgentControl() { - return _agentControl; - } - - @Override - public void setAgentControl(IAgentControl agentControl) { - _agentControl = agentControl; - } - - protected String findScript(String script) { - s_logger.debug("Looking for " + script + " in the classpath"); - URL url = ClassLoader.getSystemResource(script); - File file = null; - if (url == null) { - file = new File("./" + script); - s_logger.debug("Looking for " + script + " in " - + file.getAbsolutePath()); - if (!file.exists()) { - return null; - } - } else { - file = new File(url.getFile()); - } - return file.getAbsolutePath(); - } - - - @Override - public Answer executeRequest(Command cmd) { + public Map getConfigParams() { + // TODO Auto-generated method stub return null; } @Override - public PingCommand getCurrentStatus(long id) { - return null; + public int getRunLevel() { + // TODO Auto-generated method stub + return 0; } @Override - public Type getType() { - return _type; - } - - public void setType(Host.Type _type) { - this._type = _type; - } - - @Override - public StartupCommand[] initialize() { - return null; - } - - public SimulatorManager getSimulatorManager() { - return _simMgr; - } - - public void setSimulatorManager(SimulatorManager simMgr) { - _simMgr = simMgr; - } - - public boolean isStopped() { - return this.stopped; + public void setRunLevel(int level) { + // TODO Auto-generated method stub + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java index f35e4325b38..46df50c2133 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentRoutingResource.java @@ -20,8 +20,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import javax.naming.ConfigurationException; @@ -33,8 +31,6 @@ import com.cloud.agent.api.CheckVirtualMachineCommand; import com.cloud.agent.api.Command; import com.cloud.agent.api.PingCommand; import com.cloud.agent.api.PingRoutingWithNwGroupsCommand; -import com.cloud.agent.api.PrepareForMigrationAnswer; -import com.cloud.agent.api.PrepareForMigrationCommand; import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.ShutdownCommand; @@ -188,7 +184,7 @@ public class AgentRoutingResource extends AgentStorageResource { throws IllegalArgumentException { VirtualMachineTO vmSpec = cmd.getVirtualMachine(); String vmName = vmSpec.getName(); - if (this.totalCpu < (vmSpec.getCpus() * vmSpec.getSpeed() + this.usedCpu) || + if (this.totalCpu < (vmSpec.getCpus() * vmSpec.getMaxSpeed() + this.usedCpu) || this.totalMem < (vmSpec.getMaxRam() + this.usedMem)) { return new StartAnswer(cmd, "Not enough resource to start the vm"); } @@ -203,9 +199,9 @@ public class AgentRoutingResource extends AgentStorageResource { return new StartAnswer(cmd, result.getDetails()); } - this.usedCpu += vmSpec.getCpus() * vmSpec.getSpeed(); + this.usedCpu += vmSpec.getCpus() * vmSpec.getMaxSpeed(); this.usedMem += vmSpec.getMaxRam(); - _runningVms.put(vmName, new Pair(Long.valueOf(vmSpec.getCpus() * vmSpec.getSpeed()), vmSpec.getMaxRam())); + _runningVms.put(vmName, new Pair(Long.valueOf(vmSpec.getCpus() * vmSpec.getMaxSpeed()), vmSpec.getMaxRam())); state = State.Running; } finally { diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java index 1125eeb7847..2d81c2ab705 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/AgentStorageResource.java @@ -30,7 +30,6 @@ import com.cloud.agent.api.ReadyAnswer; import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupSecondaryStorageCommand; -import com.cloud.agent.api.StartupStorageCommand; import com.cloud.agent.api.storage.ssCommand; import com.cloud.agent.manager.SimulatorManager; import com.cloud.agent.manager.SimulatorManager.AgentType; diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorDiscoverer.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorDiscoverer.java index b6d40d49589..00fe356103b 100755 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorDiscoverer.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorDiscoverer.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -43,26 +44,24 @@ import com.cloud.dc.ClusterVO; import com.cloud.dc.dao.ClusterDao; import com.cloud.exception.ConnectionException; import com.cloud.exception.DiscoveryException; -import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; -import com.cloud.storage.VMTemplateHostVO; import com.cloud.storage.VMTemplateVO; import com.cloud.storage.VMTemplateZoneVO; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VMTemplateHostDao; import com.cloud.storage.dao.VMTemplateZoneDao; -import com.cloud.utils.component.Inject; +import org.springframework.stereotype.Component; @Local(value = Discoverer.class) public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, Listener, ResourceStateAdapter { - private static final Logger s_logger = Logger - .getLogger(SimulatorDiscoverer.class); + private static final Logger s_logger = Logger + .getLogger(SimulatorDiscoverer.class); - @Inject HostDao _hostDao; - @Inject VMTemplateDao _vmTemplateDao; + @Inject HostDao _hostDao; + @Inject VMTemplateDao _vmTemplateDao; @Inject VMTemplateHostDao _vmTemplateHostDao; @Inject VMTemplateZoneDao _vmTemplateZoneDao; @Inject ClusterDao _clusterDao; @@ -71,166 +70,166 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L @Inject MockStorageManager _mockStorageMgr = null; @Inject ResourceManager _resourceMgr; - /** - * Finds ServerResources of an in-process simulator - * - * @see com.cloud.resource.Discoverer#find(long, java.lang.Long, - * java.lang.Long, java.net.URI, java.lang.String, java.lang.String) - */ - @Override - public Map> find(long dcId, - Long podId, Long clusterId, URI uri, String username, - String password, List hostTags) throws DiscoveryException { - Map> resources; + /** + * Finds ServerResources of an in-process simulator + * + * @see com.cloud.resource.Discoverer#find(long, java.lang.Long, + * java.lang.Long, java.net.URI, java.lang.String, java.lang.String) + */ + @Override + public Map> find(long dcId, + Long podId, Long clusterId, URI uri, String username, + String password, List hostTags) throws DiscoveryException { + Map> resources; - try { - //http://sim/count=$count, it will add $count number of hosts into the cluster - String scheme = uri.getScheme(); - String host = uri.getAuthority(); - String commands = URLDecoder.decode(uri.getPath()); + try { + //http://sim/count=$count, it will add $count number of hosts into the cluster + String scheme = uri.getScheme(); + String host = uri.getAuthority(); + String commands = URLDecoder.decode(uri.getPath()); - long cpuSpeed = _mockAgentMgr.DEFAULT_HOST_SPEED_MHZ; - long cpuCores = _mockAgentMgr.DEFAULT_HOST_CPU_CORES; - long memory = _mockAgentMgr.DEFAULT_HOST_MEM_SIZE; - long localstorageSize = _mockStorageMgr.DEFAULT_HOST_STORAGE_SIZE; - if (scheme.equals("http")) { - if (host == null || !host.startsWith("sim")) { - String msg = "uri is not of simulator type so we're not taking care of the discovery for this: " - + uri; - if(s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - return null; - } - if (commands != null) { - int index = commands.lastIndexOf("/"); - if (index != -1) { - commands = commands.substring(index+1); + long cpuSpeed = _mockAgentMgr.DEFAULT_HOST_SPEED_MHZ; + long cpuCores = _mockAgentMgr.DEFAULT_HOST_CPU_CORES; + long memory = _mockAgentMgr.DEFAULT_HOST_MEM_SIZE; + long localstorageSize = _mockStorageMgr.DEFAULT_HOST_STORAGE_SIZE; + if (scheme.equals("http")) { + if (host == null || !host.startsWith("sim")) { + String msg = "uri is not of simulator type so we're not taking care of the discovery for this: " + + uri; + if(s_logger.isDebugEnabled()) { + s_logger.debug(msg); + } + return null; + } + if (commands != null) { + int index = commands.lastIndexOf("/"); + if (index != -1) { + commands = commands.substring(index+1); - String[] cmds = commands.split("&"); - for (String cmd : cmds) { - String[] parameter = cmd.split("="); - if (parameter[0].equalsIgnoreCase("cpuspeed") && parameter[1] != null) { - cpuSpeed = Long.parseLong(parameter[1]); - } else if (parameter[0].equalsIgnoreCase("cpucore") && parameter[1] != null) { - cpuCores = Long.parseLong(parameter[1]); - } else if (parameter[0].equalsIgnoreCase("memory") && parameter[1] != null) { - memory = Long.parseLong(parameter[1]); - } else if (parameter[0].equalsIgnoreCase("localstorage") && parameter[1] != null) { - localstorageSize = Long.parseLong(parameter[1]); - } - } - } - } - } else { - String msg = "uriString is not http so we're not taking care of the discovery for this: " - + uri; - if(s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - return null; - } + String[] cmds = commands.split("&"); + for (String cmd : cmds) { + String[] parameter = cmd.split("="); + if (parameter[0].equalsIgnoreCase("cpuspeed") && parameter[1] != null) { + cpuSpeed = Long.parseLong(parameter[1]); + } else if (parameter[0].equalsIgnoreCase("cpucore") && parameter[1] != null) { + cpuCores = Long.parseLong(parameter[1]); + } else if (parameter[0].equalsIgnoreCase("memory") && parameter[1] != null) { + memory = Long.parseLong(parameter[1]); + } else if (parameter[0].equalsIgnoreCase("localstorage") && parameter[1] != null) { + localstorageSize = Long.parseLong(parameter[1]); + } + } + } + } + } else { + String msg = "uriString is not http so we're not taking care of the discovery for this: " + + uri; + if(s_logger.isDebugEnabled()) { + s_logger.debug(msg); + } + return null; + } - String cluster = null; - if (clusterId == null) { - String msg = "must specify cluster Id when adding host"; - if(s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new RuntimeException(msg); - } else { - ClusterVO clu = _clusterDao.findById(clusterId); - if (clu == null - || (clu.getHypervisorType() != HypervisorType.Simulator)) { - if (s_logger.isInfoEnabled()) - s_logger.info("invalid cluster id or cluster is not for Simulator hypervisors"); - return null; - } - cluster = Long.toString(clusterId); - if(clu.getGuid() == null) { - clu.setGuid(UUID.randomUUID().toString()); - } - _clusterDao.update(clusterId, clu); - } + String cluster = null; + if (clusterId == null) { + String msg = "must specify cluster Id when adding host"; + if(s_logger.isDebugEnabled()) { + s_logger.debug(msg); + } + throw new RuntimeException(msg); + } else { + ClusterVO clu = _clusterDao.findById(clusterId); + if (clu == null + || (clu.getHypervisorType() != HypervisorType.Simulator)) { + if (s_logger.isInfoEnabled()) + s_logger.info("invalid cluster id or cluster is not for Simulator hypervisors"); + return null; + } + cluster = Long.toString(clusterId); + if(clu.getGuid() == null) { + clu.setGuid(UUID.randomUUID().toString()); + } + _clusterDao.update(clusterId, clu); + } - String pod; - if (podId == null) { - String msg = "must specify pod Id when adding host"; - if(s_logger.isDebugEnabled()) { - s_logger.debug(msg); - } - throw new RuntimeException(msg); - } else { - pod = Long.toString(podId); - } + String pod; + if (podId == null) { + String msg = "must specify pod Id when adding host"; + if(s_logger.isDebugEnabled()) { + s_logger.debug(msg); + } + throw new RuntimeException(msg); + } else { + pod = Long.toString(podId); + } - Map details = new HashMap(); - Map params = new HashMap(); - details.put("username", username); - params.put("username", username); - details.put("password", password); - params.put("password", password); - params.put("zone", Long.toString(dcId)); - params.put("pod", pod); - params.put("cluster", cluster); - params.put("cpuspeed", Long.toString(cpuSpeed)); - params.put("cpucore", Long.toString(cpuCores)); - params.put("memory", Long.toString(memory)); - params.put("localstorage", Long.toString(localstorageSize)); + Map details = new HashMap(); + Map params = new HashMap(); + details.put("username", username); + params.put("username", username); + details.put("password", password); + params.put("password", password); + params.put("zone", Long.toString(dcId)); + params.put("pod", pod); + params.put("cluster", cluster); + params.put("cpuspeed", Long.toString(cpuSpeed)); + params.put("cpucore", Long.toString(cpuCores)); + params.put("memory", Long.toString(memory)); + params.put("localstorage", Long.toString(localstorageSize)); - resources = createAgentResources(params); - return resources; - } catch (Exception ex) { - s_logger.error("Exception when discovering simulator hosts: " - + ex.getMessage()); - } - return null; - } - - private Map> createAgentResources( - Map params) { - try { - s_logger.info("Creating Simulator Resources"); - return _mockAgentMgr.createServerResources(params); - } catch (Exception ex) { - s_logger.warn("Caught exception at agent resource creation: " - + ex.getMessage(), ex); - } - return null; - } - - @Override - public void postDiscovery(List hosts, long msId) { - - for (HostVO h : hosts) { - associateTemplatesToZone(h.getId(), h.getDataCenterId()); - } - } - - private void associateTemplatesToZone(long hostId, long dcId){ - VMTemplateZoneVO tmpltZone; - - List allTemplates = _vmTemplateDao.listAll(); - for (VMTemplateVO vt: allTemplates){ - if (vt.isCrossZones()) { - tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId()); - if (tmpltZone == null) { - VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date()); - _vmTemplateZoneDao.persist(vmTemplateZone); - } - } - } + resources = createAgentResources(params); + return resources; + } catch (Exception ex) { + s_logger.error("Exception when discovering simulator hosts: " + + ex.getMessage()); + } + return null; } - @Override - public HypervisorType getHypervisorType() { - return HypervisorType.Simulator; - } + private Map> createAgentResources( + Map params) { + try { + s_logger.info("Creating Simulator Resources"); + return _mockAgentMgr.createServerResources(params); + } catch (Exception ex) { + s_logger.warn("Caught exception at agent resource creation: " + + ex.getMessage(), ex); + } + return null; + } - @Override - public boolean matchHypervisor(String hypervisor) { - return hypervisor.equalsIgnoreCase(HypervisorType.Simulator.toString()); - } + @Override + public void postDiscovery(List hosts, long msId) { + + for (HostVO h : hosts) { + associateTemplatesToZone(h.getId(), h.getDataCenterId()); + } + } + + private void associateTemplatesToZone(long hostId, long dcId){ + VMTemplateZoneVO tmpltZone; + + List allTemplates = _vmTemplateDao.listAll(); + for (VMTemplateVO vt: allTemplates){ + if (vt.isCrossZones()) { + tmpltZone = _vmTemplateZoneDao.findByZoneTemplate(dcId, vt.getId()); + if (tmpltZone == null) { + VMTemplateZoneVO vmTemplateZone = new VMTemplateZoneVO(dcId, vt.getId(), new Date()); + _vmTemplateZoneDao.persist(vmTemplateZone); + } + } + } + } + + @Override + public HypervisorType getHypervisorType() { + return HypervisorType.Simulator; + } + + @Override + public boolean matchHypervisor(String hypervisor) { + return hypervisor.equalsIgnoreCase(HypervisorType.Simulator.toString()); + } @Override public boolean configure(String name, Map params) throws ConfigurationException { @@ -298,38 +297,38 @@ public class SimulatorDiscoverer extends DiscovererBase implements Discoverer, L return false; } - @Override - public HostVO createHostVOForConnectedAgent(HostVO host, - StartupCommand[] cmd) { - return null; - } + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, + StartupCommand[] cmd) { + return null; + } - @Override - public HostVO createHostVOForDirectConnectAgent(HostVO host, - StartupCommand[] startup, ServerResource resource, - Map details, List hostTags) { - StartupCommand firstCmd = startup[0]; - if (!(firstCmd instanceof StartupRoutingCommand)) { - return null; - } + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { + StartupCommand firstCmd = startup[0]; + if (!(firstCmd instanceof StartupRoutingCommand)) { + return null; + } - StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd); - if (ssCmd.getHypervisorType() != HypervisorType.Simulator) { - return null; - } + StartupRoutingCommand ssCmd = ((StartupRoutingCommand) firstCmd); + if (ssCmd.getHypervisorType() != HypervisorType.Simulator) { + return null; + } - return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Simulator, details, hostTags); - } + return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.Simulator, details, hostTags); + } - @Override - public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, - boolean isForceDeleteStorage) throws UnableDeleteHostException { - return null; - } + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, + boolean isForceDeleteStorage) throws UnableDeleteHostException { + return null; + } @Override public boolean stop() { - _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); + _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); return super.stop(); } diff --git a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java index 3f7cea5b6b1..1dd71c5c27f 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java +++ b/plugins/hypervisors/simulator/src/com/cloud/resource/SimulatorSecondaryDiscoverer.java @@ -21,8 +21,11 @@ import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; +import org.apache.log4j.Logger; + import com.cloud.agent.AgentManager; import com.cloud.agent.Listener; import com.cloud.agent.api.AgentControlAnswer; @@ -38,10 +41,10 @@ import com.cloud.host.Status; import com.cloud.storage.SnapshotVO; import com.cloud.storage.dao.SnapshotDao; import com.cloud.storage.secondary.SecondaryStorageDiscoverer; -import com.cloud.utils.component.Inject; import com.cloud.utils.exception.CloudRuntimeException; -import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; +@Component @Local(value=Discoverer.class) public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer implements ResourceStateAdapter, Listener { private static final Logger s_logger = Logger.getLogger(SimulatorSecondaryDiscoverer.class); @@ -52,7 +55,7 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp @Override public boolean configure(String name, Map params) throws ConfigurationException { - _agentMgr.registerForHostEvents(this, true, false, false); + _agentMgr.registerForHostEvents(this, true, false, false); _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this); return super.configure(name, params); } @@ -88,40 +91,40 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp } } - @Override - public HostVO createHostVOForConnectedAgent(HostVO host, - StartupCommand[] cmd) { - return null; - } + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, + StartupCommand[] cmd) { + return null; + } - @Override - public HostVO createHostVOForDirectConnectAgent(HostVO host, - StartupCommand[] startup, ServerResource resource, - Map details, List hostTags) { - //for detecting SSVM dispatch - StartupCommand firstCmd = startup[0]; - if (!(firstCmd instanceof StartupSecondaryStorageCommand)) { - return null; - } + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { + //for detecting SSVM dispatch + StartupCommand firstCmd = startup[0]; + if (!(firstCmd instanceof StartupSecondaryStorageCommand)) { + return null; + } - host.setType(com.cloud.host.Host.Type.SecondaryStorageVM); - return host; - } + host.setType(com.cloud.host.Host.Type.SecondaryStorageVM); + return host; + } - @Override - public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, - boolean isForceDeleteStorage) throws UnableDeleteHostException { - long hostId = host.getId(); - List snapshots = _snapshotDao.listByHostId(hostId); - if (snapshots != null && !snapshots.isEmpty()) { - throw new CloudRuntimeException("Cannot delete this secondary storage because there are still snapshots on it "); - } - _vmTemplateHostDao.deleteByHost(hostId); - host.setGuid(null); - _hostDao.update(hostId, host); - _hostDao.remove(hostId); - return new DeleteHostAnswer(true); - } + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, + boolean isForceDeleteStorage) throws UnableDeleteHostException { + long hostId = host.getId(); + List snapshots = _snapshotDao.listByHostId(hostId); + if (snapshots != null && !snapshots.isEmpty()) { + throw new CloudRuntimeException("Cannot delete this secondary storage because there are still snapshots on it "); + } + _vmTemplateHostDao.deleteByHost(hostId); + host.setGuid(null); + _hostDao.update(hostId, host); + _hostDao.remove(hostId); + return new DeleteHostAnswer(true); + } @Override public boolean start() { @@ -130,49 +133,49 @@ public class SimulatorSecondaryDiscoverer extends SecondaryStorageDiscoverer imp @Override public boolean stop() { - _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); + _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); return true; } - @Override - public int getTimeout() { - return 0; - } + @Override + public int getTimeout() { + return 0; + } - @Override - public boolean isRecurring() { - return false; - } + @Override + public boolean isRecurring() { + return false; + } - @Override - public boolean processAnswers(long agentId, long seq, Answer[] answers) { - return false; - } + @Override + public boolean processAnswers(long agentId, long seq, Answer[] answers) { + return false; + } - @Override - public boolean processCommands(long agentId, long seq, Command[] commands) { - return false; - } + @Override + public boolean processCommands(long agentId, long seq, Command[] commands) { + return false; + } - @Override - public void processConnect(HostVO host, StartupCommand cmd, - boolean forRebalance) throws ConnectionException { + @Override + public void processConnect(HostVO host, StartupCommand cmd, + boolean forRebalance) throws ConnectionException { - } + } - @Override - public AgentControlAnswer processControlCommand(long agentId, - AgentControlCommand cmd) { - return null; - } + @Override + public AgentControlAnswer processControlCommand(long agentId, + AgentControlCommand cmd) { + return null; + } - @Override - public boolean processDisconnect(long agentId, Status state) { - return false; - } + @Override + public boolean processDisconnect(long agentId, Status state) { + return false; + } - @Override - public boolean processTimeout(long agentId, long seq) { - return false; - } + @Override + public boolean processTimeout(long agentId, long seq) { + return false; + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java index c639a556cb7..728271c41f0 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/server/ManagementServerSimulatorImpl.java @@ -17,13 +17,11 @@ package com.cloud.server; -import com.cloud.api.commands.ConfigureSimulator; -import com.cloud.utils.PropertiesUtil; - import java.util.List; -import java.util.Map; -public class ManagementServerSimulatorImpl extends ManagementServerExtImpl { +import com.cloud.api.commands.ConfigureSimulator; + +public class ManagementServerSimulatorImpl extends ManagementServerImpl { @Override public List> getCommands() { List> cmdList = super.getCommands(); diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java index 5959347e6dd..f971dec03a9 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockConfigurationVO.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.simulator; -import org.apache.cloudstack.api.InternalIdentity; - import java.util.HashMap; import java.util.Map; @@ -28,6 +26,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + @Entity @Table(name="mockconfiguration") public class MockConfigurationVO implements InternalIdentity { diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java index 0242135abbc..b475b2d0db6 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockHostVO.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.simulator; -import org.apache.cloudstack.api.InternalIdentity; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -25,6 +23,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + @Entity @Table(name="mockhost") diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java index 2352687ba9f..532d2a7ff56 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecStorageVO.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.simulator; -import org.apache.cloudstack.api.InternalIdentity; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -25,6 +23,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + @Entity @Table(name="mocksecstorage") diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java index d0d77c969ac..d7fec2157a0 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockSecurityRulesVO.java @@ -16,8 +16,6 @@ // under the License. package com.cloud.simulator; -import org.apache.cloudstack.api.InternalIdentity; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -25,6 +23,8 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + @Entity @Table(name="mocksecurityrules") diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java index c8f068a9e29..06aa169a62a 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockStoragePoolVO.java @@ -25,9 +25,10 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.storage.Storage.StoragePoolType; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.storage.Storage.StoragePoolType; + @Entity @Table(name="mockstoragepool") diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java index 292f20031c3..a65a98ca182 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVMVO.java @@ -23,9 +23,10 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; -import com.cloud.vm.VirtualMachine.State; import org.apache.cloudstack.api.InternalIdentity; +import com.cloud.vm.VirtualMachine.State; + @Entity @Table(name="mockvm") diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java index fe337e793f2..6dd59e8507c 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/MockVolumeVO.java @@ -25,9 +25,10 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; +import org.apache.cloudstack.api.InternalIdentity; + import com.cloud.storage.VMTemplateStorageResourceAssoc; import com.cloud.storage.VMTemplateStorageResourceAssoc.Status; -import org.apache.cloudstack.api.InternalIdentity; @Entity diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java index b9c404b66a1..57a38f1d3d8 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/SimulatorGuru.java @@ -16,18 +16,19 @@ // under the License. package com.cloud.simulator; -import javax.ejb.Local; - import com.cloud.agent.api.to.VirtualMachineTO; +import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuru; import com.cloud.hypervisor.HypervisorGuruBase; -import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.GuestOSVO; import com.cloud.storage.dao.GuestOSDao; -import com.cloud.utils.component.Inject; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; +import javax.ejb.Local; +import javax.inject.Inject; + + @Local(value=HypervisorGuru.class) public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru { @Inject GuestOSDao _guestOsDao; @@ -52,8 +53,8 @@ public class SimulatorGuru extends HypervisorGuruBase implements HypervisorGuru return to; } - @Override - public boolean trackVmHostChange() { - return false; - } + @Override + public boolean trackVmHostChange() { + return false; + } } diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockConfigurationDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockConfigurationDaoImpl.java index bd1b48dfde8..fd825b751ed 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockConfigurationDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockConfigurationDaoImpl.java @@ -16,18 +16,19 @@ // under the License. package com.cloud.simulator.dao; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.Formatter; - -import javax.ejb.Local; - import com.cloud.simulator.MockConfigurationVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.Transaction; +import org.springframework.stereotype.Component; +import javax.ejb.Local; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.Formatter; + +@Component @Local(value={MockConfigurationDao.class}) public class MockConfigurationDaoImpl extends GenericDaoBase implements MockConfigurationDao { private SearchBuilder _searchByDcIdName; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockHostDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockHostDaoImpl.java index 8a566d79ed2..4b60bc02d47 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockHostDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockHostDaoImpl.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.simulator.dao; -import javax.ejb.Local; - import com.cloud.simulator.MockHost; import com.cloud.simulator.MockHostVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; +import javax.ejb.Local; + +@Component @Local(value={MockHostDao.class}) public class MockHostDaoImpl extends GenericDaoBase implements MockHostDao { protected final SearchBuilder GuidSearch; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecStorageDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecStorageDaoImpl.java index 65a375f5843..d4903244179 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecStorageDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecStorageDaoImpl.java @@ -16,13 +16,15 @@ // under the License. package com.cloud.simulator.dao; -import javax.ejb.Local; - import com.cloud.simulator.MockSecStorageVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; +import javax.ejb.Local; + +@Component @Local(value={MockSecStorageDao.class}) public class MockSecStorageDaoImpl extends GenericDaoBase implements MockSecStorageDao { protected final SearchBuilder urlSearch; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecurityRulesDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecurityRulesDaoImpl.java index 8831efef2ec..d35607e0ebc 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecurityRulesDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockSecurityRulesDaoImpl.java @@ -16,16 +16,18 @@ // under the License. package com.cloud.simulator.dao; -import java.util.List; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - import com.cloud.simulator.MockSecurityRulesVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; + +import javax.ejb.Local; +import javax.naming.ConfigurationException; +import java.util.List; +import java.util.Map; + +@Component @Local(value={MockSecurityRulesDao.class}) public class MockSecurityRulesDaoImpl extends GenericDaoBase implements MockSecurityRulesDao { protected SearchBuilder vmIdSearch; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockStoragePoolDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockStoragePoolDaoImpl.java index 3a64d27e30d..0fc41abdc4c 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockStoragePoolDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockStoragePoolDaoImpl.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.simulator.dao; -import javax.ejb.Local; - import com.cloud.simulator.MockStoragePoolVO; import com.cloud.storage.Storage.StoragePoolType; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; +import org.springframework.stereotype.Component; +import javax.ejb.Local; + +@Component @Local(value={MockStoragePoolDao.class}) public class MockStoragePoolDaoImpl extends GenericDaoBase implements MockStoragePoolDao { protected final SearchBuilder uuidSearch; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVMDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVMDaoImpl.java index 86264f2c039..5a8c66d69ef 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVMDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVMDaoImpl.java @@ -16,22 +16,23 @@ // under the License. package com.cloud.simulator.dao; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import javax.ejb.Local; -import javax.naming.ConfigurationException; - import com.cloud.simulator.MockHostVO; import com.cloud.simulator.MockVMVO; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.JoinBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.vm.VirtualMachine; +import org.springframework.stereotype.Component; +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component @Local(value={MockVMDao.class}) public class MockVMDaoImpl extends GenericDaoBase implements MockVMDao { protected SearchBuilder GuidSearch; diff --git a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVolumeDaoImpl.java b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVolumeDaoImpl.java index a3a35179337..5d64a9fa246 100644 --- a/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVolumeDaoImpl.java +++ b/plugins/hypervisors/simulator/src/com/cloud/simulator/dao/MockVolumeDaoImpl.java @@ -16,10 +16,6 @@ // under the License. package com.cloud.simulator.dao; -import java.util.List; - -import javax.ejb.Local; - import com.cloud.simulator.MockVolumeVO; import com.cloud.simulator.MockVolumeVO.MockVolumeType; import com.cloud.utils.db.GenericDaoBase; @@ -27,7 +23,12 @@ import com.cloud.utils.db.GenericSearchBuilder; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Func; +import org.springframework.stereotype.Component; +import javax.ejb.Local; +import java.util.List; + +@Component @Local(value={MockVolumeDao.class}) public class MockVolumeDaoImpl extends GenericDaoBase implements MockVolumeDao { protected final SearchBuilder idTypeSearch; diff --git a/plugins/hypervisors/ucs/pom.xml b/plugins/hypervisors/ucs/pom.xml new file mode 100755 index 00000000000..24bdc948e73 --- /dev/null +++ b/plugins/hypervisors/ucs/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + org.apache.cloudstack + cloud-plugin-hypervisor-ucs + 4.2.0-SNAPSHOT + Apache CloudStack Plugin - Hypervisor UCS + http://maven.apache.org + + UTF-8 + + + + junit + junit + 3.8.1 + test + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-api + ${project.version} + + + diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java new file mode 100644 index 00000000000..ce42fe0eee2 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDao.java @@ -0,0 +1,23 @@ +// 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.ucs.database; + +import com.cloud.utils.db.GenericDao; + +public interface UcsBladeDao extends GenericDao { + +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java new file mode 100644 index 00000000000..570d1a39d1c --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeDaoImpl.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.database; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; +@Local(value = { UcsBladeDao.class }) +@DB(txn = false) +@Component +public class UcsBladeDaoImpl extends GenericDaoBase implements UcsBladeDao { + +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java new file mode 100644 index 00000000000..527bc2706fd --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsBladeVO.java @@ -0,0 +1,85 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.database; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="ucs_blade") +public class UcsBladeVO { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name="ucs_manager_id") + private long ucsManagerId; + + @Column(name="host_id") + private Long hostId; + + @Column(name="dn") + private String dn; + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getUcsManagerId() { + return ucsManagerId; + } + + public void setUcsManagerId(long ucsManagerId) { + this.ucsManagerId = ucsManagerId; + } + + public Long getHostId() { + return hostId; + } + + public void setHostId(Long hostId) { + this.hostId = hostId; + } + + public String getDn() { + return dn; + } + + public void setDn(String dn) { + this.dn = dn; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.java new file mode 100644 index 00000000000..fd6d762f1b7 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDao.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.ucs.database; + +import java.util.List; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import com.cloud.utils.db.Filter; +import com.cloud.utils.db.GenericDao; +import com.cloud.utils.db.GenericSearchBuilder; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria2; + +public interface UcsManagerDao extends GenericDao { +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.java new file mode 100644 index 00000000000..8a4c73e8e3e --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerDaoImpl.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 com.cloud.ucs.database; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.utils.db.DB; +import com.cloud.utils.db.GenericDaoBase; + +@Local(value = { UcsManagerDao.class }) +@DB(txn = false) +@Component +public class UcsManagerDaoImpl extends GenericDaoBase implements UcsManagerDao { +} + diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java new file mode 100644 index 00000000000..281d6a54de6 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/database/UcsManagerVO.java @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.database; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="ucs_manager") +public class UcsManagerVO { + @Id + @GeneratedValue(strategy=GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="zone_id") + private long zoneId; + + @Column(name="uuid") + private String uuid; + + @Column(name="name") + private String name; + + @Column(name="url") + private String url; + + @Column(name="username") + private String username; + + @Column(name="password") + private String password; + + public long getId() { + return id; + } + public void setId(long id) { + this.id = id; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getUsername() { + return username; + } + public void setUsername(String username) { + this.username = username; + } + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + public long getZoneId() { + return zoneId; + } + public void setZoneId(long zoneId) { + this.zoneId = zoneId; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java new file mode 100644 index 00000000000..078add9bdd5 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerCmd.java @@ -0,0 +1,124 @@ +// 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.ucs.manager; + +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.BaseCmd.CommandType; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +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; +import com.cloud.server.ManagementService; +import com.cloud.user.Account; + +@APICommand(description="Adds a Ucs manager", responseObject=AddUcsManagerResponse.class) +public class AddUcsManagerCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(AddUcsManagerCmd.class); + + @Inject + private UcsManager mgr; + + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the Zone id for the ucs manager", required=true) + private Long zoneId; + + @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of UCS manager") + private String name; + + @Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the name of UCS url") + private String url; + + @Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, description="the username of UCS") + private String username; + + @Parameter(name=ApiConstants.PASSWORD, type=CommandType.STRING, description="the password of UCS") + private String password; + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + AddUcsManagerResponse rsp = mgr.addUcsManager(this); + rsp.setObjectName("ucsmanager"); + rsp.setResponseName(getCommandName()); + this.setResponseObject(rsp); + } catch (Exception e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return "addUcsManagerResponse"; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + public Long getZoneId() { + return zoneId; + } + + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java new file mode 100644 index 00000000000..98dfd0455a2 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AddUcsManagerResponse.java @@ -0,0 +1,69 @@ +// 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.ucs.manager; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class AddUcsManagerResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) @Param(description="the ID of the ucs manager") + private String id; + + @SerializedName(ApiConstants.NAME) @Param(description="the name of ucs manager") + private String name; + + @SerializedName(ApiConstants.URL) @Param(description="the url of ucs manager") + private String url; + + @SerializedName(ApiConstants.ZONE_ID) @Param(description="the zone ID of ucs manager") + private String zoneId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.java new file mode 100644 index 00000000000..cc59e4212a0 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladeCmd.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 com.cloud.ucs.manager; + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.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; +import com.cloud.user.Account; +@APICommand(description="associate a profile to a blade", responseObject=AssociateUcsProfileToBladesInClusterResponse.class) +public class AssociateUcsProfileToBladeCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(AssociateUcsProfileToBladeCmd.class); + + @Inject + private UcsManager mgr; + + private Long ucsManagerId; + private String profileDn; + private Long bladeId; + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + mgr.associateProfileToBlade(this); + AssociateUcsProfileToBladesInClusterResponse rsp = new AssociateUcsProfileToBladesInClusterResponse(); + rsp.setResponseName(getCommandName()); + rsp.setObjectName("associateucsprofiletobalde"); + this.setResponseObject(rsp); + } catch (Exception e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return "associateucsprofiletobladeresponse"; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + public Long getUcsManagerId() { + return ucsManagerId; + } + + public void setUcsManagerId(Long ucsManagerId) { + this.ucsManagerId = ucsManagerId; + } + + public String getProfileDn() { + return profileDn; + } + + public void setProfileDn(String profileDn) { + this.profileDn = profileDn; + } + + public Long getBladeId() { + return bladeId; + } + + public void setBladeId(Long bladeId) { + this.bladeId = bladeId; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java new file mode 100644 index 00000000000..f6cb0a6e34c --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/AssociateUcsProfileToBladesInClusterResponse.java @@ -0,0 +1,22 @@ +// 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.ucs.manager; + +import org.apache.cloudstack.api.BaseResponse; + +public class AssociateUcsProfileToBladesInClusterResponse extends BaseResponse { +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java new file mode 100644 index 00000000000..31662d951f8 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerCmd.java @@ -0,0 +1,78 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.manager; + +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.ListResponse; +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; +import com.cloud.server.ManagementService; +import com.cloud.user.Account; +@APICommand(description="List ucs manager", responseObject=ListUcsManagerResponse.class) +public class ListUcsManagerCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(ListUcsManagerCmd.class); + + @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.LONG, description="the zone id", required=true) + private Long zoneId; + + @Inject + private UcsManager mgr; + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + ListResponse response = mgr.listUcsManager(this); + response.setResponseName(getCommandName()); + response.setObjectName("ucsmanager"); + this.setResponseObject(response); + } catch (Exception e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return "listucsmanagerreponse"; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + + public Long getZoneId() { + return zoneId; + } + + public void setZoneId(Long zoneId) { + this.zoneId = zoneId; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java new file mode 100644 index 00000000000..450d59c7c18 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsManagerResponse.java @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.manager; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class ListUcsManagerResponse extends BaseResponse { + @SerializedName(ApiConstants.ID) @Param(description="id of ucs manager") + private String id; + + @SerializedName(ApiConstants.NAME) @Param(description="name of ucs manager") + private String name; + + @SerializedName(ApiConstants.ZONE_ID) @Param(description="zone id the ucs manager belongs to") + private String zoneId; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getZoneId() { + return zoneId; + } + + public void setZoneId(String zoneId) { + this.zoneId = zoneId; + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java new file mode 100644 index 00000000000..7cbbe14612e --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileCmd.java @@ -0,0 +1,79 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.ucs.manager; + +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.BaseCmd.CommandType; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ListResponse; +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; +import com.cloud.server.ManagementService; +import com.cloud.user.Account; +@APICommand(description="List profile in ucs manager", responseObject=ListUcsProfileResponse.class) +public class ListUcsProfileCmd extends BaseCmd { + public static final Logger s_logger = Logger.getLogger(ListUcsProfileCmd.class); + + @Inject UcsManager mgr; + + @Parameter(name=ApiConstants.ID, type=CommandType.LONG, description="the id for the ucs manager", required=true) + private Long ucsManagerId; + + public Long getUcsManagerId() { + return ucsManagerId; + } + + public void setUcsManagerId(Long ucsManagerId) { + this.ucsManagerId = ucsManagerId; + } + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, + ResourceAllocationException, NetworkRuleConflictException { + try { + ListResponse response = mgr.listUcsProfiles(this); + response.setResponseName(getCommandName()); + response.setObjectName("ucsprofile"); + this.setResponseObject(response); + } catch (Exception e) { + s_logger.warn("Exception: ", e); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); + } + } + + @Override + public String getCommandName() { + return "listucsprofileresponse"; + } + + @Override + public long getEntityOwnerId() { + return Account.ACCOUNT_ID_SYSTEM; + } + +} diff --git a/server/src/com/cloud/baremetal/DhcpServerResponse.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java similarity index 75% rename from server/src/com/cloud/baremetal/DhcpServerResponse.java rename to plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java index db46ccd1a1d..c29d1d078d0 100644 --- a/server/src/com/cloud/baremetal/DhcpServerResponse.java +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/ListUcsProfileResponse.java @@ -14,22 +14,23 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.baremetal; - -import org.apache.cloudstack.api.ApiConstants; -import org.apache.cloudstack.api.BaseResponse; -import com.cloud.serializer.Param; -import com.google.gson.annotations.SerializedName; - -public class DhcpServerResponse extends BaseResponse { - @SerializedName(ApiConstants.ID) @Param(description="the ID of the Dhcp server") - private String id; - - public String getId() { - return id; +package com.cloud.ucs.manager; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; + +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +public class ListUcsProfileResponse extends BaseResponse { + @SerializedName(ApiConstants.UCS_DN) @Param(description="the dn of ucs profile") + private String dn; + + public String getDn() { + return dn; + } + + public void setDn(String dn) { + this.dn = dn; } - - public void setId(String id) { - this.id = id; - } -} +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java new file mode 100644 index 00000000000..5e5ceb98d5a --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/StringTemplate.java @@ -0,0 +1,38 @@ +// 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.ucs.manager; + +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class StringTemplate { + public static String replaceTokens(String text, Map replacements) { + Pattern pattern = Pattern.compile("\\[(.+?)\\]"); + Matcher matcher = pattern.matcher(text); + StringBuffer buffer = new StringBuffer(); + while (matcher.find()) { + String replacement = replacements.get(matcher.group(1)); + if (replacement != null) { + matcher.appendReplacement(buffer, ""); + buffer.append(replacement); + } + } + matcher.appendTail(buffer); + return buffer.toString(); + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.java new file mode 100644 index 00000000000..2dc4daacba0 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsCommands.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 com.cloud.ucs.manager; + +import com.cloud.utils.xmlobject.XmlObject; + +public class UcsCommands { + public static String loginCmd(String username, String password) { + XmlObject cmd = new XmlObject("aaaLogin"); + cmd.putElement("inName", username); + cmd.putElement("inPassword", password); + return cmd.dump(); + } + + public static String listComputeBlades(String cookie) { + XmlObject cmd = new XmlObject("configResolveClass"); + cmd.putElement("classId", "computeBlade"); + cmd.putElement("cookie", cookie); + cmd.putElement("inHierarchical", "false"); + return cmd.dump(); + } + + public static String listProfiles(String cookie) { + XmlObject cmd = new XmlObject("configFindDnsByClassId"); + cmd.putElement("classId", "lsServer"); + cmd.putElement("cookie", cookie); + return cmd.dump(); + } + + public static String cloneProfile(String cookie, String srcDn, String newProfileName) { + XmlObject cmd = new XmlObject("lsClone"); + cmd.putElement("cookie", cookie); + cmd.putElement("dn", srcDn); + cmd.putElement("inTargetOrg", "org-root"); + cmd.putElement("inServerName", newProfileName); + cmd.putElement("inHierarchical", "false"); + return cmd.dump(); + } + + public static String configResolveDn(String cookie, String dn) { + XmlObject cmd = new XmlObject("configResolveDn"); + cmd.putElement("cookie", cookie); + cmd.putElement("dn", dn); + return cmd.toString(); + } + + public static String associateProfileToBlade(String cookie, String profileDn, String bladeDn) { + XmlObject cmd = new XmlObject("configConfMos").putElement("inHierarchical", "true").putElement( + "inConfigs", new XmlObject("inConfigs").putElement( + "pair", new XmlObject("pair").putElement("key", profileDn).putElement( + "lsServer", new XmlObject("lsServer") + .putElement("agentPolicyName", "") + .putElement("biosProfileName", "") + .putElement("bootPolicyName", "") + .putElement("descr", "") + .putElement("dn", profileDn) + .putElement("dynamicConPolicyName", "") + .putElement("extIPState", "none") + .putElement("hostFwPolicyName", "") + .putElement("identPoolName", "") + .putElement("localDiskPolicyName", "") + .putElement("maintPolicyName", "") + .putElement("mgmtAccessPolicyName", "") + .putElement("mgmtFwPolicyName", "") + .putElement("powerPolicyName", "") + .putElement("scrubPolicyName", "") + .putElement("solPolicyName", "") + .putElement("srcTemplName", "") + .putElement("statsPolicyName", "default") + .putElement("status", "") + .putElement("usrLbl", "") + .putElement("", "") + .putElement("vconProfileName", "") + .putElement("lsBinding", new XmlObject("lsBinding") + .putElement("pnDn", bladeDn) + .putElement("restrictMigration", "no") + .putElement("rn", "pn") + ) + ) + ) + ); + + return cmd.dump(); + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.java new file mode 100644 index 00000000000..d887650580a --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsHttpClient.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.ucs.manager; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; + +import com.cloud.utils.exception.CloudRuntimeException; + +public class UcsHttpClient { + private static HttpClient client = new HttpClient(); + private String url; + + public UcsHttpClient(String ip) { + this.url = String.format("http://%s/nuova", ip); + } + + public String call(String xml) { + PostMethod post = new PostMethod(url); + post.setRequestEntity(new StringRequestEntity(xml)); + post.setRequestHeader("Content-type", "text/xml"); + try { + int result = client.executeMethod(post); + if (result != 200) { + throw new CloudRuntimeException("Call failed: " + post.getResponseBodyAsString()); + } + return post.getResponseBodyAsString(); + } catch (Exception e) { + throw new CloudRuntimeException(e.getMessage(), e); + } finally { + post.releaseConnection(); + } + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.java new file mode 100644 index 00000000000..2e8040a0473 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManager.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 com.cloud.ucs.manager; + +import org.apache.cloudstack.api.response.ListResponse; + +import com.cloud.utils.component.Manager; + +public interface UcsManager extends Manager { + AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd); + + ListResponse listUcsProfiles(ListUcsProfileCmd cmd); + + ListResponse listUcsManager(ListUcsManagerCmd cmd); + + void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd); +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java new file mode 100644 index 00000000000..356113d498e --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/manager/UcsManagerImpl.java @@ -0,0 +1,304 @@ +// 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.ucs.manager; + +import java.io.File; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.TimeUnit; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseCmd; +import org.apache.cloudstack.api.ResponseGenerator; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ClusterResponse; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cxf.helpers.FileUtils; +import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; + +import com.cloud.dc.ClusterDetailsDao; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.host.HostVO; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster; +import com.cloud.resource.ResourceService; +import com.cloud.ucs.database.UcsBladeDao; +import com.cloud.ucs.database.UcsBladeVO; +import com.cloud.ucs.database.UcsManagerDao; +import com.cloud.ucs.database.UcsManagerVO; +import com.cloud.ucs.structure.ComputeBlade; +import com.cloud.ucs.structure.UcsProfile; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.SearchCriteria.Op; +import com.cloud.utils.db.SearchCriteria2; +import com.cloud.utils.db.SearchCriteriaService; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.script.Script; +import com.cloud.utils.xmlobject.XmlObject; +import com.cloud.utils.xmlobject.XmlObjectParser; + +@Local(value = { UcsManager.class }) +@Component +public class UcsManagerImpl implements UcsManager { + public static final Logger s_logger = Logger.getLogger(UcsManagerImpl.class); + + @Inject + private UcsManagerDao ucsDao; + @Inject + private ResourceService resourceService; + @Inject + private ClusterDao clusterDao; + @Inject + private ClusterDetailsDao clusterDetailsDao; + @Inject + private UcsBladeDao bladeDao; + + private Map cookies = new HashMap(); + + @Override + public boolean configure(String name, Map params) throws ConfigurationException { + return true; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + return true; + } + + @Override + public String getName() { + return "UcsManager"; + } + + private void discoverBlades(UcsManagerVO ucsMgrVo) { + List blades = listBlades(ucsMgrVo.getId()); + for (ComputeBlade b : blades) { + UcsBladeVO vo = new UcsBladeVO(); + vo.setDn(b.getDn()); + vo.setUcsManagerId(ucsMgrVo.getId()); + vo.setUuid(UUID.randomUUID().toString()); + bladeDao.persist(vo); + } + } + + @Override + @DB + public AddUcsManagerResponse addUcsManager(AddUcsManagerCmd cmd) { + UcsManagerVO vo = new UcsManagerVO(); + vo.setUuid(UUID.randomUUID().toString()); + vo.setPassword(cmd.getPassword()); + vo.setUrl(cmd.getUrl()); + vo.setUsername(cmd.getUsername()); + vo.setZoneId(cmd.getZoneId()); + vo.setName(cmd.getName()); + + Transaction txn = Transaction.currentTxn(); + txn.start(); + ucsDao.persist(vo); + txn.commit(); + AddUcsManagerResponse rsp = new AddUcsManagerResponse(); + rsp.setId(String.valueOf(vo.getId())); + rsp.setName(vo.getName()); + rsp.setUrl(vo.getUrl()); + rsp.setZoneId(String.valueOf(vo.getZoneId())); + + discoverBlades(vo); + + return rsp; + } + + private String getCookie(Long ucsMgrId) { + try { + String cookie = cookies.get(ucsMgrId); + if (cookie == null) { + UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String login = UcsCommands.loginCmd(mgrvo.getUsername(), mgrvo.getPassword()); + cookie = client.call(login); + cookies.put(ucsMgrId, cookie); + } + + return cookie; + } catch (Exception e) { + throw new CloudRuntimeException("Cannot get cookie", e); + } + } + + private List listBlades(Long ucsMgrId) { + String cookie = getCookie(ucsMgrId); + UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String cmd = UcsCommands.listComputeBlades(cookie); + String ret = client.call(cmd); + return ComputeBlade.fromXmString(ret); + } + + private List getUcsProfiles(Long ucsMgrId) { + String cookie = getCookie(ucsMgrId); + UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); + String cmd = UcsCommands.listProfiles(cookie); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String res = client.call(cmd); + List profiles = UcsProfile.fromXmlString(res); + return profiles; + } + + @Override + public ListResponse listUcsProfiles(ListUcsProfileCmd cmd) { + List profiles = getUcsProfiles(cmd.getUcsManagerId()); + ListResponse response = new ListResponse(); + List rs = new ArrayList(); + for (UcsProfile p : profiles) { + ListUcsProfileResponse r = new ListUcsProfileResponse(); + r.setObjectName("ucsprofile"); + r.setDn(p.getDn()); + rs.add(r); + } + response.setResponses(rs); + return response; + } + + private String cloneProfile(Long ucsMgrId, String srcDn, String newProfileName) { + UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String cookie = getCookie(ucsMgrId); + String cmd = UcsCommands.cloneProfile(cookie, srcDn, newProfileName); + String res = client.call(cmd); + XmlObject xo = XmlObjectParser.parseFromString(res); + return xo.get("lsClone.outConfig.lsServer.dn"); + } + + private boolean isProfileAssociated(Long ucsMgrId, String dn) { + UcsManagerVO mgrvo = ucsDao.findById(ucsMgrId); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String cookie = getCookie(ucsMgrId); + String cmd = UcsCommands.configResolveDn(cookie, dn); + String res = client.call(cmd); + XmlObject xo = XmlObjectParser.parseFromString(res); + return xo.get("outConfig.lsServer.assocState").equals("associated"); + } + + @Override + public void associateProfileToBlade(AssociateUcsProfileToBladeCmd cmd) { + SearchCriteriaService q = SearchCriteria2.create(UcsBladeVO.class); + q.addAnd(q.getEntity().getUcsManagerId(), Op.EQ, cmd.getUcsManagerId()); + q.addAnd(q.getEntity().getId(), Op.EQ, cmd.getBladeId()); + UcsBladeVO bvo = q.find(); + if (bvo == null) { + throw new IllegalArgumentException(String.format("cannot find UCS blade[id:%s, ucs manager id:%s]", cmd.getBladeId(), cmd.getUcsManagerId())); + } + + if (bvo.getHostId() != null) { + throw new CloudRuntimeException(String.format("blade[id:%s, dn:%s] has been associated with host[id:%s]", bvo.getId(), bvo.getDn(), bvo.getHostId())); + } + + UcsManagerVO mgrvo = ucsDao.findById(cmd.getUcsManagerId()); + String cookie = getCookie(cmd.getUcsManagerId()); + String pdn = cloneProfile(mgrvo.getId(), cmd.getProfileDn(), "profile-for-blade-" + bvo.getId()); + String ucscmd = UcsCommands.associateProfileToBlade(cookie, pdn, bvo.getDn()); + UcsHttpClient client = new UcsHttpClient(mgrvo.getUrl()); + String res = client.call(ucscmd); + int count = 0; + int timeout = 600; + while (count < timeout) { + if (isProfileAssociated(mgrvo.getId(), bvo.getDn())) { + break; + } + + try { + TimeUnit.SECONDS.sleep(2); + } catch (InterruptedException e) { + throw new CloudRuntimeException(e); + } + + count += 2; + } + + if (count >= timeout) { + throw new CloudRuntimeException(String.format("associating profile[%s] to balde[%s] timeout after 600 seconds", pdn, bvo.getDn())); + } + + s_logger.debug(String.format("successfully associated profile[%s] to blade[%s]", pdn, bvo.getDn())); + } + + @Override + public ListResponse listUcsManager(ListUcsManagerCmd cmd) { + SearchCriteriaService serv = SearchCriteria2.create(UcsManagerVO.class); + serv.addAnd(serv.getEntity().getZoneId(), Op.EQ, cmd.getZoneId()); + List vos = serv.list(); + + List rsps = new ArrayList(vos.size()); + for (UcsManagerVO vo : vos) { + ListUcsManagerResponse rsp = new ListUcsManagerResponse(); + rsp.setObjectName("ucsmanager"); + rsp.setId(String.valueOf(vo.getId())); + rsp.setName(vo.getName()); + rsp.setZoneId(String.valueOf(vo.getZoneId())); + rsps.add(rsp); + } + ListResponse response = new ListResponse(); + response.setResponses(rsps); + return response; + } + + @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/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java new file mode 100644 index 00000000000..468561187f0 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/ComputeBlade.java @@ -0,0 +1,181 @@ +// 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.ucs.structure; + +import java.util.ArrayList; +import java.util.List; + +import com.cloud.utils.xmlobject.XmlObject; +import com.cloud.utils.xmlobject.XmlObjectParser; + +public class ComputeBlade { + String adminPower; + String adminState; + String assignedToDn; + String association; + String availability; + String availableMemory; + String chassisId; + String dn; + String name; + String numOfAdaptors; + String numOfCores; + String numOfCoresEnabled; + String numOfCpus; + String numOfEthHostIfs; + String numOfFcHostIfs; + String numOfThreads; + String operPower; + String totalMemory; + String uuid; + + public static List fromXmString(String xmlstr) { + XmlObject root = XmlObjectParser.parseFromString(xmlstr); + List lst = root.getAsList("configResolveClass.outConfigs.computeBlade"); + List blades = new ArrayList(); + if (lst == null) { + return blades; + } + for (XmlObject xo : lst) { + blades.add(fromXmlObject(xo)); + } + return blades; + } + + public static ComputeBlade fromXmlObject(XmlObject obj) { + ComputeBlade ret = new ComputeBlade(); + return obj.evaluateObject(ret); + } + + public String getAdminPower() { + return adminPower; + } + public void setAdminPower(String adminPower) { + this.adminPower = adminPower; + } + public String getAdminState() { + return adminState; + } + public void setAdminState(String adminState) { + this.adminState = adminState; + } + public String getAssignedToDn() { + return assignedToDn; + } + public void setAssignedToDn(String assignedToDn) { + this.assignedToDn = assignedToDn; + } + public String getAssociation() { + return association; + } + public void setAssociation(String association) { + this.association = association; + } + public String getAvailability() { + return availability; + } + public void setAvailability(String availability) { + this.availability = availability; + } + public String getAvailableMemory() { + return availableMemory; + } + public void setAvailableMemory(String availableMemory) { + this.availableMemory = availableMemory; + } + public String getChassisId() { + return chassisId; + } + public void setChassisId(String chassisId) { + this.chassisId = chassisId; + } + public String getDn() { + return dn; + } + public void setDn(String dn) { + this.dn = dn; + } + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; + } + public String getNumOfAdaptors() { + return numOfAdaptors; + } + public void setNumOfAdaptors(String numOfAdaptors) { + this.numOfAdaptors = numOfAdaptors; + } + public String getNumOfCores() { + return numOfCores; + } + public void setNumOfCores(String numOfCores) { + this.numOfCores = numOfCores; + } + public String getNumOfCoresEnabled() { + return numOfCoresEnabled; + } + public void setNumOfCoresEnabled(String numOfCoresEnabled) { + this.numOfCoresEnabled = numOfCoresEnabled; + } + public String getNumOfCpus() { + return numOfCpus; + } + public void setNumOfCpus(String numOfCpus) { + this.numOfCpus = numOfCpus; + } + public String getNumOfEthHostIfs() { + return numOfEthHostIfs; + } + public void setNumOfEthHostIfs(String numOfEthHostIfs) { + this.numOfEthHostIfs = numOfEthHostIfs; + } + public String getNumOfFcHostIfs() { + return numOfFcHostIfs; + } + public void setNumOfFcHostIfs(String numOfFcHostIfs) { + this.numOfFcHostIfs = numOfFcHostIfs; + } + public String getNumOfThreads() { + return numOfThreads; + } + public void setNumOfThreads(String numOfThreads) { + this.numOfThreads = numOfThreads; + } + public String getOperPower() { + return operPower; + } + public void setOperPower(String operPower) { + this.operPower = operPower; + } + public String getTotalMemory() { + return totalMemory; + } + public void setTotalMemory(String totalMemory) { + this.totalMemory = totalMemory; + } + public String getUuid() { + return uuid; + } + public void setUuid(String uuid) { + this.uuid = uuid; + } + public boolean isAssociated() { + return this.assignedToDn.equals(""); + } +} diff --git a/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java new file mode 100644 index 00000000000..5cb8c39eef5 --- /dev/null +++ b/plugins/hypervisors/ucs/src/com/cloud/ucs/structure/UcsProfile.java @@ -0,0 +1,53 @@ +// 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.ucs.structure; + +import java.util.ArrayList; +import java.util.List; + +import com.cloud.utils.xmlobject.XmlObject; +import com.cloud.utils.xmlobject.XmlObjectParser; + +public class UcsProfile { + private String dn; + + public static UcsProfile fromXmlObject(XmlObject xo) { + UcsProfile p = new UcsProfile(); + return xo.evaluateObject(p); + } + + public static List fromXmlString(String xmlstr) { + List ps = new ArrayList(); + XmlObject xo = XmlObjectParser.parseFromString(xmlstr); + List xos = xo.getAsList("outDns.dn"); + if (xos != null) { + for (XmlObject x : xos) { + UcsProfile p = UcsProfile.fromXmlObject(x); + ps.add(p); + } + } + return ps; + } + + public String getDn() { + return dn; + } + + public void setDn(String dn) { + this.dn = dn; + } +} diff --git a/plugins/hypervisors/vmware/pom.xml b/plugins/hypervisors/vmware/pom.xml index d990e89b388..5d954f331e6 100644 --- a/plugins/hypervisors/vmware/pom.xml +++ b/plugins/hypervisors/vmware/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java index 3e45ce2a084..8cbe75d7f6a 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DeleteCiscoNexusVSMCmd.java @@ -17,13 +17,15 @@ package com.cloud.api.commands; +import javax.inject.Inject; + 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.api.response.CiscoNexusVSMResponse; @@ -40,7 +42,7 @@ public class DeleteCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteCiscoNexusVSMCmd.class.getName()); private static final String s_name = "deletecisconexusvsmresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; + @Inject CiscoNexusVSMElementService _ciscoNexusVSMService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -70,7 +72,7 @@ public class DeleteCiscoNexusVSMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to delete Cisco Nexus VSM device"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Cisco Nexus VSM device"); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java index 9a7f6ada97c..830f22e95a1 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/DisableCiscoNexusVSMCmd.java @@ -17,13 +17,15 @@ package com.cloud.api.commands; +import javax.inject.Inject; + 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.InsufficientCapacityException; @@ -40,7 +42,7 @@ public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DisableCiscoNexusVSMCmd.class.getName()); private static final String s_name = "disablecisconexusvsmresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; + @Inject CiscoNexusVSMElementService _ciscoNexusVSMService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -70,7 +72,7 @@ public class DisableCiscoNexusVSMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to disable Cisco Nexus VSM device"); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java index 5dc67212fd3..2034aa35ad6 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/EnableCiscoNexusVSMCmd.java @@ -17,6 +17,8 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -36,7 +38,7 @@ public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(EnableCiscoNexusVSMCmd.class.getName()); private static final String s_name = "enablecisconexusvsmresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; + @Inject CiscoNexusVSMElementService _ciscoNexusVSMService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -66,7 +68,7 @@ public class EnableCiscoNexusVSMCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Cisco Nexus VSM device"); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java index ee6a01bdb8a..1eb197f0a76 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java +++ b/plugins/hypervisors/vmware/src/com/cloud/api/commands/ListCiscoNexusVSMsCmd.java @@ -21,10 +21,10 @@ import org.apache.cloudstack.api.response.ClusterResponse; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; 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 com.cloud.api.response.CiscoNexusVSMResponse; import org.apache.cloudstack.api.response.ListResponse; @@ -39,6 +39,8 @@ import com.cloud.user.Account; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + @APICommand(name = "listCiscoNexusVSMs", responseObject=CiscoNexusVSMResponse.class, description="Retrieves a Cisco Nexus 1000v Virtual Switch Manager device associated with a Cluster") public class ListCiscoNexusVSMsCmd extends BaseListCmd { @@ -51,7 +53,7 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd { */ public static final Logger s_logger = Logger.getLogger(ListCiscoNexusVSMsCmd.class.getName()); private static final String s_name = "listcisconexusvsmscmdresponse"; - @PlugService CiscoNexusVSMElementService _ciscoNexusVSMService; + @Inject CiscoNexusVSMElementService _ciscoNexusVSMService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -101,7 +103,7 @@ public class ListCiscoNexusVSMsCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseListCmd.INTERNAL_ERROR, "No VSM found."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "No VSM found."); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java b/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java index c732b94f707..2ed5cafb8e4 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/ha/VmwareFencer.java @@ -22,11 +22,11 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import com.cloud.host.HostVO; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VMInstanceVO; @Local(value=FenceBuilder.class) -public class VmwareFencer implements FenceBuilder { - String _name; +public class VmwareFencer extends AdapterBase implements FenceBuilder { @Override public Boolean fenceOff(VMInstanceVO vm, HostVO host) { @@ -36,25 +36,4 @@ public class VmwareFencer implements FenceBuilder { public VmwareFencer() { super(); } - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; - return true; - } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java index 546df5f2389..bb7c29745d9 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java @@ -1,3 +1,4 @@ + // 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 @@ -24,8 +25,10 @@ import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.api.BackupSnapshotCommand; import com.cloud.agent.api.Command; @@ -36,7 +39,6 @@ import com.cloud.agent.api.storage.CopyVolumeCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.VirtualMachineTO; -import com.cloud.cluster.CheckPointManager; import com.cloud.cluster.ClusterManager; import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.host.HostVO; @@ -45,13 +47,12 @@ import com.cloud.host.dao.HostDetailsDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.HypervisorGuru; import com.cloud.hypervisor.HypervisorGuruBase; -import com.cloud.hypervisor.vmware.VmwareCleanupMaid; import com.cloud.hypervisor.vmware.manager.VmwareManager; import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType; -import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.secstorage.CommandExecLogDao; import com.cloud.secstorage.CommandExecLogVO; import com.cloud.storage.GuestOSVO; @@ -59,7 +60,6 @@ import com.cloud.storage.dao.GuestOSDao; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.template.VirtualMachineTemplate.BootloaderType; import com.cloud.utils.Pair; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.net.NetUtils; @@ -73,23 +73,22 @@ import com.cloud.vm.VmDetailConstants; @Local(value=HypervisorGuru.class) public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { - private static final Logger s_logger = Logger.getLogger(VMwareGuru.class); + private static final Logger s_logger = Logger.getLogger(VMwareGuru.class); - @Inject NetworkDao _networkDao; - @Inject GuestOSDao _guestOsDao; + @Inject NetworkDao _networkDao; + @Inject GuestOSDao _guestOsDao; @Inject HostDao _hostDao; @Inject HostDetailsDao _hostDetailsDao; @Inject CommandExecLogDao _cmdExecLogDao; @Inject ClusterManager _clusterMgr; @Inject VmwareManager _vmwareMgr; @Inject SecondaryStorageVmManager _secStorageMgr; - @Inject CheckPointManager _checkPointMgr; - @Inject NetworkManager _networkMgr; + @Inject NetworkModel _networkMgr; protected VMwareGuru() { - super(); + super(); } - + @Override public HypervisorType getHypervisorType() { return HypervisorType.VMware; @@ -100,117 +99,128 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { VirtualMachineTO to = toVirtualMachineTO(vm); to.setBootloader(BootloaderType.HVM); - Map details = to.getDetails(); - if(details == null) - details = new HashMap(); - - String nicDeviceType = details.get(VmDetailConstants.NIC_ADAPTER); + Map details = to.getDetails(); + if(details == null) + details = new HashMap(); + + String nicDeviceType = details.get(VmDetailConstants.NIC_ADAPTER); if(vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof ConsoleProxyVO - || vm.getVirtualMachine() instanceof SecondaryStorageVmVO) { - - if(nicDeviceType == null) { - details.put(VmDetailConstants.NIC_ADAPTER, _vmwareMgr.getSystemVMDefaultNicAdapterType()); - } else { - try { - VirtualEthernetCardType.valueOf(nicDeviceType); - } catch (Exception e) { - s_logger.warn("Invalid NIC device type " + nicDeviceType + " is specified in VM details, switch to default E1000"); - details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); - } - } + || vm.getVirtualMachine() instanceof SecondaryStorageVmVO) { + + if(nicDeviceType == null) { + details.put(VmDetailConstants.NIC_ADAPTER, _vmwareMgr.getSystemVMDefaultNicAdapterType()); + } else { + try { + VirtualEthernetCardType.valueOf(nicDeviceType); + } catch (Exception e) { + s_logger.warn("Invalid NIC device type " + nicDeviceType + " is specified in VM details, switch to default E1000"); + details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); + } + } } else { - // for user-VM, use E1000 as default - if(nicDeviceType == null) { - details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); - } else { - try { - VirtualEthernetCardType.valueOf(nicDeviceType); - } catch (Exception e) { - s_logger.warn("Invalid NIC device type " + nicDeviceType + " is specified in VM details, switch to default E1000"); - details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); - } - } + // for user-VM, use E1000 as default + if(nicDeviceType == null) { + details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); + } else { + try { + VirtualEthernetCardType.valueOf(nicDeviceType); + } catch (Exception e) { + s_logger.warn("Invalid NIC device type " + nicDeviceType + " is specified in VM details, switch to default E1000"); + details.put(VmDetailConstants.NIC_ADAPTER, VirtualEthernetCardType.E1000.toString()); + } + } } - to.setDetails(details); + + String diskDeviceType = details.get(VmDetailConstants.ROOK_DISK_CONTROLLER); + if (!(vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof ConsoleProxyVO + || vm.getVirtualMachine() instanceof SecondaryStorageVmVO)){ + // user vm + if (diskDeviceType != null){ + details.remove(VmDetailConstants.ROOK_DISK_CONTROLLER); + } + details.put(VmDetailConstants.ROOK_DISK_CONTROLLER, _vmwareMgr.getRootDiskController()); + } + + to.setDetails(details); - if(vm.getVirtualMachine() instanceof DomainRouterVO) { - List nicProfiles = vm.getNics(); - NicProfile publicNicProfile = null; - - for(NicProfile nicProfile : nicProfiles) { - if(nicProfile.getTrafficType() == TrafficType.Public) { - publicNicProfile = nicProfile; - break; - } - } - - if(publicNicProfile != null) { - NicTO[] nics = to.getNics(); + if(vm.getVirtualMachine() instanceof DomainRouterVO) { + List nicProfiles = vm.getNics(); + NicProfile publicNicProfile = null; - // reserve extra NICs - NicTO[] expandedNics = new NicTO[nics.length + _vmwareMgr.getRouterExtraPublicNics()]; - int i = 0; - int deviceId = -1; - for(i = 0; i < nics.length; i++) { - expandedNics[i] = nics[i]; - if(nics[i].getDeviceId() > deviceId) - deviceId = nics[i].getDeviceId(); - } - deviceId++; - - long networkId = publicNicProfile.getNetworkId(); - NetworkVO network = _networkDao.findById(networkId); - - for(; i < nics.length + _vmwareMgr.getRouterExtraPublicNics(); i++) { - NicTO nicTo = new NicTO(); - - nicTo.setDeviceId(deviceId++); - nicTo.setBroadcastType(publicNicProfile.getBroadcastType()); - nicTo.setType(publicNicProfile.getTrafficType()); - nicTo.setIp("0.0.0.0"); - nicTo.setNetmask("255.255.255.255"); - - try { - String mac = _networkMgr.getNextAvailableMacAddressInNetwork(networkId); - nicTo.setMac(mac); - } catch (InsufficientAddressCapacityException e) { - throw new CloudRuntimeException("unable to allocate mac address on network: " + networkId); - } - nicTo.setDns1(publicNicProfile.getDns1()); - nicTo.setDns2(publicNicProfile.getDns2()); - if (publicNicProfile.getGateway() != null) { - nicTo.setGateway(publicNicProfile.getGateway()); - } else { - nicTo.setGateway(network.getGateway()); - } - nicTo.setDefaultNic(false); - nicTo.setBroadcastUri(publicNicProfile.getBroadCastUri()); - nicTo.setIsolationuri(publicNicProfile.getIsolationUri()); + for(NicProfile nicProfile : nicProfiles) { + if(nicProfile.getTrafficType() == TrafficType.Public) { + publicNicProfile = nicProfile; + break; + } + } - Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null); - nicTo.setNetworkRateMbps(networkRate); - - expandedNics[i] = nicTo; - } - - to.setNics(expandedNics); - } - - StringBuffer sbMacSequence = new StringBuffer(); - for(NicTO nicTo : sortNicsByDeviceId(to.getNics())) { - sbMacSequence.append(nicTo.getMac()).append("|"); - } - sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); - String bootArgs = to.getBootArgs(); - to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); - } + if(publicNicProfile != null) { + NicTO[] nics = to.getNics(); + + // reserve extra NICs + NicTO[] expandedNics = new NicTO[nics.length + _vmwareMgr.getRouterExtraPublicNics()]; + int i = 0; + int deviceId = -1; + for(i = 0; i < nics.length; i++) { + expandedNics[i] = nics[i]; + if(nics[i].getDeviceId() > deviceId) + deviceId = nics[i].getDeviceId(); + } + deviceId++; + + long networkId = publicNicProfile.getNetworkId(); + NetworkVO network = _networkDao.findById(networkId); + + for(; i < nics.length + _vmwareMgr.getRouterExtraPublicNics(); i++) { + NicTO nicTo = new NicTO(); + + nicTo.setDeviceId(deviceId++); + nicTo.setBroadcastType(publicNicProfile.getBroadcastType()); + nicTo.setType(publicNicProfile.getTrafficType()); + nicTo.setIp("0.0.0.0"); + nicTo.setNetmask("255.255.255.255"); + + try { + String mac = _networkMgr.getNextAvailableMacAddressInNetwork(networkId); + nicTo.setMac(mac); + } catch (InsufficientAddressCapacityException e) { + throw new CloudRuntimeException("unable to allocate mac address on network: " + networkId); + } + nicTo.setDns1(publicNicProfile.getDns1()); + nicTo.setDns2(publicNicProfile.getDns2()); + if (publicNicProfile.getGateway() != null) { + nicTo.setGateway(publicNicProfile.getGateway()); + } else { + nicTo.setGateway(network.getGateway()); + } + nicTo.setDefaultNic(false); + nicTo.setBroadcastUri(publicNicProfile.getBroadCastUri()); + nicTo.setIsolationuri(publicNicProfile.getIsolationUri()); + + Integer networkRate = _networkMgr.getNetworkRate(network.getId(), null); + nicTo.setNetworkRateMbps(networkRate); + + expandedNics[i] = nicTo; + } + + to.setNics(expandedNics); + } + + StringBuffer sbMacSequence = new StringBuffer(); + for(NicTO nicTo : sortNicsByDeviceId(to.getNics())) { + sbMacSequence.append(nicTo.getMac()).append("|"); + } + sbMacSequence.deleteCharAt(sbMacSequence.length() - 1); + String bootArgs = to.getBootArgs(); + to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString()); + } // Determine the VM's OS description GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId()); to.setOs(guestOS.getDisplayName()); return to; } - + private NicTO[] sortNicsByDeviceId(NicTO[] nics) { List listForSort = new ArrayList(); @@ -233,83 +243,86 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru { return listForSort.toArray(new NicTO[0]); } - + @Override @DB public long getCommandHostDelegation(long hostId, Command cmd) { - boolean needDelegation = false; - - if(cmd instanceof PrimaryStorageDownloadCommand || - cmd instanceof BackupSnapshotCommand || - cmd instanceof CreatePrivateTemplateFromVolumeCommand || - cmd instanceof CreatePrivateTemplateFromSnapshotCommand || - cmd instanceof CopyVolumeCommand || - cmd instanceof CreateVolumeFromSnapshotCommand) { - needDelegation = true; - } + boolean needDelegation = false; - if(needDelegation) { - HostVO host = _hostDao.findById(hostId); - assert(host != null); - assert(host.getHypervisorType() == HypervisorType.VMware); - long dcId = host.getDataCenterId(); - - Pair cmdTarget = _secStorageMgr.assignSecStorageVm(dcId, cmd); - if(cmdTarget != null) { - // TODO, we need to make sure agent is actually connected too - cmd.setContextParam("hypervisor", HypervisorType.VMware.toString()); - Map hostDetails = _hostDetailsDao.findDetails(hostId); - cmd.setContextParam("guid", resolveNameInGuid(hostDetails.get("guid"))); - cmd.setContextParam("username", hostDetails.get("username")); - cmd.setContextParam("password", hostDetails.get("password")); - cmd.setContextParam("serviceconsole", _vmwareMgr.getServiceConsolePortGroupName()); - cmd.setContextParam("manageportgroup", _vmwareMgr.getManagementPortGroupName()); - - CommandExecLogVO execLog = new CommandExecLogVO(cmdTarget.first().getId(), cmdTarget.second().getId(), cmd.getClass().getSimpleName(), 1); - _cmdExecLogDao.persist(execLog); - cmd.setContextParam("execid", String.valueOf(execLog.getId())); - - if(cmd instanceof BackupSnapshotCommand || - cmd instanceof CreatePrivateTemplateFromVolumeCommand || - cmd instanceof CreatePrivateTemplateFromSnapshotCommand || - cmd instanceof CopyVolumeCommand || - cmd instanceof CreateVolumeFromSnapshotCommand) { - - String workerName = _vmwareMgr.composeWorkerName(); - long checkPointId = _checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(hostDetails.get("guid"), workerName)); - cmd.setContextParam("worker", workerName); - cmd.setContextParam("checkpoint", String.valueOf(checkPointId)); + if(cmd instanceof PrimaryStorageDownloadCommand || + cmd instanceof BackupSnapshotCommand || + cmd instanceof CreatePrivateTemplateFromVolumeCommand || + cmd instanceof CreatePrivateTemplateFromSnapshotCommand || + cmd instanceof CopyVolumeCommand || + cmd instanceof CreateVolumeFromSnapshotCommand) { + needDelegation = true; + } - // some commands use 2 workers + if(needDelegation) { + HostVO host = _hostDao.findById(hostId); + assert(host != null); + assert(host.getHypervisorType() == HypervisorType.VMware); + long dcId = host.getDataCenterId(); + + Pair cmdTarget = _secStorageMgr.assignSecStorageVm(dcId, cmd); + if(cmdTarget != null) { + // TODO, we need to make sure agent is actually connected too + cmd.setContextParam("hypervisor", HypervisorType.VMware.toString()); + Map hostDetails = _hostDetailsDao.findDetails(hostId); + cmd.setContextParam("guid", resolveNameInGuid(hostDetails.get("guid"))); + cmd.setContextParam("username", hostDetails.get("username")); + cmd.setContextParam("password", hostDetails.get("password")); + cmd.setContextParam("serviceconsole", _vmwareMgr.getServiceConsolePortGroupName()); + cmd.setContextParam("manageportgroup", _vmwareMgr.getManagementPortGroupName()); + + CommandExecLogVO execLog = new CommandExecLogVO(cmdTarget.first().getId(), cmdTarget.second().getId(), cmd.getClass().getSimpleName(), 1); + _cmdExecLogDao.persist(execLog); + cmd.setContextParam("execid", String.valueOf(execLog.getId())); + + if(cmd instanceof BackupSnapshotCommand || + cmd instanceof CreatePrivateTemplateFromVolumeCommand || + cmd instanceof CreatePrivateTemplateFromSnapshotCommand || + cmd instanceof CopyVolumeCommand || + cmd instanceof CreateVolumeFromSnapshotCommand) { + + String workerName = _vmwareMgr.composeWorkerName(); + long checkPointId = 1; +// FIXME: Fix long checkPointId = _checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(hostDetails.get("guid"), workerName)); + cmd.setContextParam("worker", workerName); + cmd.setContextParam("checkpoint", String.valueOf(checkPointId)); + + // some commands use 2 workers String workerName2 = _vmwareMgr.composeWorkerName(); - long checkPointId2 = _checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(hostDetails.get("guid"), workerName2)); + long checkPointId2 = 1; +// FIXME: Fix long checkPointId2 = _checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(hostDetails.get("guid"), workerName2)); cmd.setContextParam("worker2", workerName2); cmd.setContextParam("checkpoint2", String.valueOf(checkPointId2)); - } - - return cmdTarget.first().getId(); - } - } - - return hostId; - } - - public boolean trackVmHostChange() { - return true; - } - - private static String resolveNameInGuid(String guid) { - String tokens[] = guid.split("@"); - assert(tokens.length == 2); + } - String vCenterIp = NetUtils.resolveToIp(tokens[1]); - if(vCenterIp == null) { - s_logger.error("Fatal : unable to resolve vCenter address " + tokens[1] + ", please check your DNS configuration"); - return guid; - } - - if(vCenterIp.equals(tokens[1])) - return guid; - - return tokens[0] + "@" + vCenterIp; + return cmdTarget.first().getId(); + } + } + + return hostId; + } + + @Override + public boolean trackVmHostChange() { + return true; + } + + private static String resolveNameInGuid(String guid) { + String tokens[] = guid.split("@"); + assert(tokens.length == 2); + + String vCenterIp = NetUtils.resolveToIp(tokens[1]); + if(vCenterIp == null) { + s_logger.error("Fatal : unable to resolve vCenter address " + tokens[1] + ", please check your DNS configuration"); + return guid; + } + + if(vCenterIp.equals(tokens[1])) + return guid; + + return tokens[0] + "@" + vCenterIp; } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java index a3e2fca16bd..bae8857e1ef 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareCleanupMaid.java @@ -23,8 +23,6 @@ import java.util.Map; import org.apache.log4j.Logger; -import com.cloud.cluster.CheckPointManager; -import com.cloud.cluster.CleanupMaid; import com.cloud.hypervisor.vmware.manager.VmwareManager; import com.cloud.hypervisor.vmware.mo.ClusterMO; import com.cloud.hypervisor.vmware.mo.DatacenterMO; @@ -32,7 +30,7 @@ import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.VirtualMachineMO; import com.cloud.hypervisor.vmware.util.VmwareContext; -public class VmwareCleanupMaid implements CleanupMaid { +public class VmwareCleanupMaid { private static final Logger s_logger = Logger.getLogger(VmwareCleanupMaid.class); private static Map> s_leftoverDummyVMs = new HashMap>(); @@ -67,16 +65,15 @@ public class VmwareCleanupMaid implements CleanupMaid { _vmName = vmName; } - @Override - public int cleanup(CheckPointManager checkPointMgr) { - - // save a check-point in case we crash at current run so that we won't lose it - _checkPoint = checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(_vCenterAddress, _dcMorValue, _vmName)); - addLeftOverVM(this); - return 0; - } +// @Override +// public int cleanup(CheckPointManager checkPointMgr) { +// +// // save a check-point in case we crash at current run so that we won't lose it +// _checkPoint = checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(_vCenterAddress, _dcMorValue, _vmName)); +// addLeftOverVM(this); +// return 0; +// } - @Override public String getCleanupProcedure() { return null; } @@ -137,7 +134,7 @@ public class VmwareCleanupMaid implements CleanupMaid { } catch(Throwable e) { s_logger.warn("Unable to destroy left over dummy VM " + cleanupMaid.getVmName()); } finally { - mgr.popCleanupCheckpoint(cleanupMaid.getCheckPoint()); +// FIXME mgr.popCleanupCheckpoint(cleanupMaid.getCheckPoint()); } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java index a75640bedfe..5d7edce12ef 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/VmwareServerDiscoverer.java @@ -23,7 +23,9 @@ import java.util.List; import java.util.Map; import java.util.UUID; +import javax.annotation.PostConstruct; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -31,7 +33,6 @@ import org.apache.log4j.Logger; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; import com.cloud.alert.AlertManager; -import com.cloud.configuration.dao.ConfigurationDao; import com.cloud.dc.ClusterDetailsDao; import com.cloud.dc.ClusterVO; import com.cloud.dc.DataCenter.NetworkType; @@ -44,13 +45,14 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; import com.cloud.hypervisor.vmware.manager.VmwareManager; import com.cloud.hypervisor.vmware.mo.ClusterMO; import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.resource.VmwareContextFactory; import com.cloud.hypervisor.vmware.resource.VmwareResource; import com.cloud.hypervisor.vmware.util.VmwareContext; -import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.dao.CiscoNexusVSMDeviceDao; import com.cloud.resource.Discoverer; import com.cloud.resource.DiscovererBase; @@ -58,34 +60,49 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.TemplateType; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.user.Account; import com.cloud.utils.UriUtils; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.component.Inject; + import com.vmware.vim25.ClusterDasConfigInfo; import com.vmware.vim25.ManagedObjectReference; -@Local(value=Discoverer.class) -public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer, ResourceStateAdapter { - private static final Logger s_logger = Logger.getLogger(VmwareServerDiscoverer.class); - - @Inject ClusterDao _clusterDao; - @Inject VmwareManager _vmwareMgr; - @Inject AlertManager _alertMgr; - @Inject VMTemplateDao _tmpltDao; - @Inject ClusterDetailsDao _clusterDetailsDao; - @Inject HostDao _hostDao; +@Local(value = Discoverer.class) +public class VmwareServerDiscoverer extends DiscovererBase implements + Discoverer, ResourceStateAdapter { + private static final Logger s_logger = Logger + .getLogger(VmwareServerDiscoverer.class); + + @Inject + ClusterDao _clusterDao; + @Inject + VmwareManager _vmwareMgr; + @Inject + AlertManager _alertMgr; + @Inject + VMTemplateDao _tmpltDao; + @Inject + ClusterDetailsDao _clusterDetailsDao; + @Inject + HostDao _hostDao; + @Inject + DataCenterDao _dcDao; + @Inject + ResourceManager _resourceMgr; + @Inject + CiscoNexusVSMDeviceDao _nexusDao; + @Inject + NetworkModel _netmgr; @Inject - DataCenterDao _dcDao; - @Inject ResourceManager _resourceMgr; - @Inject CiscoNexusVSMDeviceDao _nexusDao; - @Inject - NetworkManager _netmgr; - + HypervisorCapabilitiesDao _hvCapabilitiesDao; + + public VmwareServerDiscoverer() { + s_logger.info("VmwareServerDiscoverer is constructed"); + } + @Override public Map> find(long dcId, Long podId, Long clusterId, URI url, String username, String password, List hostTags) throws DiscoveryException { @@ -107,10 +124,13 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer } List hosts = _resourceMgr.listAllHostsInCluster(clusterId); - if(hosts.size() >= _vmwareMgr.getMaxHostsPerCluster()) { - String msg = "VMware cluster " + cluster.getName() + " is too big to add new host now. (current configured cluster size: " + _vmwareMgr.getMaxHostsPerCluster() + ")"; - s_logger.error(msg); - throw new DiscoveredWithErrorException(msg); + if (hosts != null && hosts.size() > 0) { + int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(hosts.get(0).getHypervisorType(), hosts.get(0).getHypervisorVersion()); + if (hosts.size() > maxHostsPerCluster) { + String msg = "VMware cluster " + cluster.getName() + " is too big to add new host now. (current configured cluster size: " + maxHostsPerCluster + ")"; + s_logger.error(msg); + throw new DiscoveredWithErrorException(msg); + } } String privateTrafficLabel = null; @@ -142,200 +162,227 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer VmwareContext context = null; try { - context = VmwareContextFactory.create(url.getHost(), username, password); - if (privateTrafficLabel != null) - context.registerStockObject("privateTrafficLabel", privateTrafficLabel); - - if (_vmwareMgr.getNexusVSwitchGlobalParameter()) { - if (vsmCredentials != null) { - s_logger.info("Stocking credentials of Nexus VSM"); - context.registerStockObject("vsmcredentials", vsmCredentials); - } - } - List morHosts = _vmwareMgr.addHostToPodCluster(context, dcId, podId, clusterId, - URLDecoder.decode(url.getPath())); - if (morHosts == null) - s_logger.info("Found 0 hosts."); - if (privateTrafficLabel != null) - context.uregisterStockObject("privateTrafficLabel"); + context = VmwareContextFactory.create(url.getHost(), username, + password); + if (privateTrafficLabel != null) + context.registerStockObject("privateTrafficLabel", + privateTrafficLabel); - if(morHosts == null) { - s_logger.error("Unable to find host or cluster based on url: " + URLDecoder.decode(url.getPath())); + if (_vmwareMgr.getNexusVSwitchGlobalParameter()) { + if (vsmCredentials != null) { + s_logger.info("Stocking credentials of Nexus VSM"); + context.registerStockObject("vsmcredentials", + vsmCredentials); + } + } + List morHosts = _vmwareMgr + .addHostToPodCluster(context, dcId, podId, clusterId, + URLDecoder.decode(url.getPath())); + if (morHosts == null) + s_logger.info("Found 0 hosts."); + if (privateTrafficLabel != null) + context.uregisterStockObject("privateTrafficLabel"); + + if (morHosts == null) { + s_logger.error("Unable to find host or cluster based on url: " + + URLDecoder.decode(url.getPath())); return null; } - + ManagedObjectReference morCluster = null; - Map clusterDetails = _clusterDetailsDao.findDetails(clusterId); - if(clusterDetails.get("url") != null) { - URI uriFromCluster = new URI(UriUtils.encodeURIComponent(clusterDetails.get("url"))); - morCluster = context.getHostMorByPath(URLDecoder.decode(uriFromCluster.getPath())); - - if(morCluster == null || !morCluster.getType().equalsIgnoreCase("ClusterComputeResource")) { - s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + clusterDetails.get("url")); + Map clusterDetails = _clusterDetailsDao + .findDetails(clusterId); + if (clusterDetails.get("url") != null) { + URI uriFromCluster = new URI( + UriUtils.encodeURIComponent(clusterDetails.get("url"))); + morCluster = context.getHostMorByPath(URLDecoder + .decode(uriFromCluster.getPath())); + + if (morCluster == null + || !morCluster.getType().equalsIgnoreCase( + "ClusterComputeResource")) { + s_logger.warn("Cluster url does not point to a valid vSphere cluster, url: " + + clusterDetails.get("url")); return null; } else { ClusterMO clusterMo = new ClusterMO(context, morCluster); ClusterDasConfigInfo dasConfig = clusterMo.getDasConfig(); - if(dasConfig != null && dasConfig.getEnabled() != null && dasConfig.getEnabled().booleanValue()) { + if (dasConfig != null && dasConfig.getEnabled() != null + && dasConfig.getEnabled().booleanValue()) { clusterDetails.put("NativeHA", "true"); _clusterDetailsDao.persist(clusterId, clusterDetails); } } } - - if(!validateDiscoveredHosts(context, morCluster, morHosts)) { - if(morCluster == null) + + if (!validateDiscoveredHosts(context, morCluster, morHosts)) { + if (morCluster == null) s_logger.warn("The discovered host is not standalone host, can not be added to a standalone cluster"); else s_logger.warn("The discovered host does not belong to the cluster"); return null; } - Map> resources = new HashMap>(); - for(ManagedObjectReference morHost : morHosts) { - Map details = new HashMap(); - Map params = new HashMap(); - - HostMO hostMo = new HostMO(context, morHost); - details.put("url", hostMo.getHostName()); - details.put("username", username); - details.put("password", password); - String guid = morHost.getType() + ":" + morHost.get_value() + "@"+ url.getHost(); - details.put("guid", guid); - - params.put("url", hostMo.getHostName()); - params.put("username", username); - params.put("password", password); - params.put("zone", Long.toString(dcId)); - params.put("pod", Long.toString(podId)); - params.put("cluster", Long.toString(clusterId)); - params.put("guid", guid); - if (privateTrafficLabel != null) { - params.put("private.network.vswitch.name", privateTrafficLabel); - } - if (publicTrafficLabel != null) { - params.put("public.network.vswitch.name", publicTrafficLabel); - } - if (guestTrafficLabel != null) { - params.put("guest.network.vswitch.name", guestTrafficLabel); - } - - VmwareResource resource = new VmwareResource(); - try { - resource.configure("VMware", params); - } catch (ConfigurationException e) { - _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, "Unable to add " + url.getHost(), "Error is " + e.getMessage()); - s_logger.warn("Unable to instantiate " + url.getHost(), e); - } - resource.start(); - - resources.put(resource, details); + Map> resources = new HashMap>(); + for (ManagedObjectReference morHost : morHosts) { + Map details = new HashMap(); + Map params = new HashMap(); + + HostMO hostMo = new HostMO(context, morHost); + details.put("url", hostMo.getHostName()); + details.put("username", username); + details.put("password", password); + String guid = morHost.getType() + ":" + morHost.get_value() + + "@" + url.getHost(); + details.put("guid", guid); + + params.put("url", hostMo.getHostName()); + params.put("username", username); + params.put("password", password); + params.put("zone", Long.toString(dcId)); + params.put("pod", Long.toString(podId)); + params.put("cluster", Long.toString(clusterId)); + params.put("guid", guid); + if (privateTrafficLabel != null) { + params.put("private.network.vswitch.name", + privateTrafficLabel); + } + if (publicTrafficLabel != null) { + params.put("public.network.vswitch.name", + publicTrafficLabel); + } + if (guestTrafficLabel != null) { + params.put("guest.network.vswitch.name", guestTrafficLabel); + } + + VmwareResource resource = new VmwareResource(); + try { + resource.configure("VMware", params); + } catch (ConfigurationException e) { + _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, + podId, "Unable to add " + url.getHost(), + "Error is " + e.getMessage()); + s_logger.warn("Unable to instantiate " + url.getHost(), e); + } + resource.start(); + + resources.put(resource, details); } - - // place a place holder guid derived from cluster ID - cluster.setGuid(UUID.nameUUIDFromBytes(String.valueOf(clusterId).getBytes()).toString()); - _clusterDao.update(clusterId, cluster); - - return resources; + + // place a place holder guid derived from cluster ID + cluster.setGuid(UUID.nameUUIDFromBytes( + String.valueOf(clusterId).getBytes()).toString()); + _clusterDao.update(clusterId, cluster); + + return resources; } catch (DiscoveredWithErrorException e) { throw e; } catch (Exception e) { - s_logger.warn("Unable to connect to Vmware vSphere server. service address: " + url.getHost()); + s_logger.warn("Unable to connect to Vmware vSphere server. service address: " + + url.getHost()); return null; } finally { - if(context != null) + if (context != null) context.close(); } - } - - private boolean validateDiscoveredHosts(VmwareContext context, ManagedObjectReference morCluster, List morHosts) throws Exception { - if(morCluster == null) { - for(ManagedObjectReference morHost : morHosts) { - ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost, "parent"); - if(morParent.getType().equalsIgnoreCase("ClusterComputeResource")) - return false; - } - } else { - for(ManagedObjectReference morHost : morHosts) { - ManagedObjectReference morParent = (ManagedObjectReference)context.getServiceUtil().getDynamicProperty(morHost, "parent"); - if(!morParent.getType().equalsIgnoreCase("ClusterComputeResource")) - return false; - - if(!morParent.get_value().equals(morCluster.get_value())) - return false; - } - } - - return true; - } - - @Override - public void postDiscovery(List hosts, long msId) { - // do nothing - } - - @Override - public boolean matchHypervisor(String hypervisor) { - if(hypervisor == null) - return true; - - return Hypervisor.HypervisorType.VMware.toString().equalsIgnoreCase(hypervisor); - } - - @Override - public Hypervisor.HypervisorType getHypervisorType() { - return Hypervisor.HypervisorType.VMware; - } - - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - if(s_logger.isInfoEnabled()) - s_logger.info("Configure VmwareServerDiscoverer, discover name: " + name); - - super.configure(name, params); - - ComponentLocator locator = ComponentLocator.getCurrentLocator(); - ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); - if (configDao == null) { - throw new ConfigurationException("Unable to get the configuration dao."); - } - - createVmwareToolsIso(); + } - if(s_logger.isInfoEnabled()) { + private boolean validateDiscoveredHosts(VmwareContext context, + ManagedObjectReference morCluster, + List morHosts) throws Exception { + if (morCluster == null) { + for (ManagedObjectReference morHost : morHosts) { + ManagedObjectReference morParent = (ManagedObjectReference) context + .getServiceUtil().getDynamicProperty(morHost, "parent"); + if (morParent.getType().equalsIgnoreCase( + "ClusterComputeResource")) + return false; + } + } else { + for (ManagedObjectReference morHost : morHosts) { + ManagedObjectReference morParent = (ManagedObjectReference) context + .getServiceUtil().getDynamicProperty(morHost, "parent"); + if (!morParent.getType().equalsIgnoreCase( + "ClusterComputeResource")) + return false; + + if (!morParent.get_value().equals(morCluster.get_value())) + return false; + } + } + + return true; + } + + @Override + public void postDiscovery(List hosts, long msId) { + // do nothing + } + + @Override + public boolean matchHypervisor(String hypervisor) { + if (hypervisor == null) + return true; + + return Hypervisor.HypervisorType.VMware.toString().equalsIgnoreCase( + hypervisor); + } + + @Override + public Hypervisor.HypervisorType getHypervisorType() { + return Hypervisor.HypervisorType.VMware; + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + if (s_logger.isInfoEnabled()) + s_logger.info("Configure VmwareServerDiscoverer, discover name: " + + name); + + super.configure(name, params); + + createVmwareToolsIso(); + + if (s_logger.isInfoEnabled()) { s_logger.info("VmwareServerDiscoverer has been successfully configured"); } - _resourceMgr.registerResourceStateAdapter(this.getClass().getSimpleName(), this); - return true; - } - - private void createVmwareToolsIso() { - String isoName = "vmware-tools.iso"; - VMTemplateVO tmplt = _tmpltDao.findByTemplateName(isoName); - Long id; - if (tmplt == null) { - id = _tmpltDao.getNextInSequence(Long.class, "id"); - VMTemplateVO template = new VMTemplateVO(id, isoName, isoName, ImageFormat.ISO, true, true, - TemplateType.PERHOST, null, null, true, 64, - Account.ACCOUNT_ID_SYSTEM, null, "VMware Tools Installer ISO", false, 1, false, HypervisorType.VMware); - _tmpltDao.persist(template); - } else { - id = tmplt.getId(); - tmplt.setTemplateType(TemplateType.PERHOST); - tmplt.setUrl(null); - _tmpltDao.update(id, tmplt); - } - } + _resourceMgr.registerResourceStateAdapter(this.getClass() + .getSimpleName(), this); + return true; + } + + private void createVmwareToolsIso() { + String isoName = "vmware-tools.iso"; + VMTemplateVO tmplt = _tmpltDao.findByTemplateName(isoName); + Long id; + if (tmplt == null) { + id = _tmpltDao.getNextInSequence(Long.class, "id"); + VMTemplateVO template = new VMTemplateVO(id, isoName, isoName, + ImageFormat.ISO, true, true, TemplateType.PERHOST, null, + null, true, 64, Account.ACCOUNT_ID_SYSTEM, null, + "VMware Tools Installer ISO", false, 1, false, + HypervisorType.VMware); + _tmpltDao.persist(template); + } else { + id = tmplt.getId(); + tmplt.setTemplateType(TemplateType.PERHOST); + tmplt.setUrl(null); + _tmpltDao.update(id, tmplt); + } + } @Override - public HostVO createHostVOForConnectedAgent(HostVO host, StartupCommand[] cmd) { - // TODO Auto-generated method stub - return null; - } + public HostVO createHostVOForConnectedAgent(HostVO host, + StartupCommand[] cmd) { + // TODO Auto-generated method stub + return null; + } @Override - public HostVO createHostVOForDirectConnectAgent(HostVO host, StartupCommand[] startup, ServerResource resource, Map details, - List hostTags) { + public HostVO createHostVOForDirectConnectAgent(HostVO host, + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { StartupCommand firstCmd = startup[0]; if (!(firstCmd instanceof StartupRoutingCommand)) { return null; @@ -346,23 +393,26 @@ public class VmwareServerDiscoverer extends DiscovererBase implements Discoverer return null; } - return _resourceMgr.fillRoutingHostVO(host, ssCmd, HypervisorType.VMware, details, hostTags); - } + return _resourceMgr.fillRoutingHostVO(host, ssCmd, + HypervisorType.VMware, details, hostTags); + } @Override - public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, boolean isForceDeleteStorage) throws UnableDeleteHostException { - if (host.getType() != com.cloud.host.Host.Type.Routing || host.getHypervisorType() != HypervisorType.VMware) { + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, + boolean isForceDeleteStorage) throws UnableDeleteHostException { + if (host.getType() != com.cloud.host.Host.Type.Routing + || host.getHypervisorType() != HypervisorType.VMware) { return null; } - + _resourceMgr.deleteRoutingHost(host, isForced, isForceDeleteStorage); return new DeleteHostAnswer(true); - } - - @Override - public boolean stop() { - _resourceMgr.unregisterResourceStateAdapter(this.getClass().getSimpleName()); - return super.stop(); - } -} + } + @Override + public boolean stop() { + _resourceMgr.unregisterResourceStateAdapter(this.getClass() + .getSimpleName()); + return super.stop(); + } +} diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java index be3fe9f465b..36fa0f338b1 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManager.java @@ -21,52 +21,48 @@ import java.util.List; import java.util.Map; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.vmware.manager.VmwareStorageManager; import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.utils.Pair; import com.vmware.vim25.ManagedObjectReference; public interface VmwareManager { - public final String CONTEXT_STOCK_NAME = "vmwareMgr"; - - // this limitation comes from the fact that we are using linked clone on shared VMFS storage, - // we need to limit the size of vCenter cluster, http://en.wikipedia.org/wiki/VMware_VMFS - public final int MAX_HOSTS_PER_CLUSTER = 8; + public final String CONTEXT_STOCK_NAME = "vmwareMgr"; + + String composeWorkerName(); - String composeWorkerName(); - String getSystemVMIsoFileNameOnDatastore(); String getSystemVMDefaultNicAdapterType(); - - void prepareSecondaryStorageStore(String strStorageUrl); - - void setupResourceStartupParams(Map params); - List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, - String hostInventoryPath) throws Exception; - String getManagementPortGroupByHost(HostMO hostMo) throws Exception; - String getServiceConsolePortGroupName(); - String getManagementPortGroupName(); - - String getSecondaryStorageStoreUrl(long dcId); - - File getSystemVMKeyFile(); - - VmwareStorageManager getStorageManager(); - long pushCleanupCheckpoint(String hostGuid, String vmName); - void popCleanupCheckpoint(long checkpiont); - void gcLeftOverVMs(VmwareContext context); - - Pair getAddiionalVncPortRange(); - - int getMaxHostsPerCluster(); - int getRouterExtraPublicNics(); - - boolean beginExclusiveOperation(int timeOutSeconds); - void endExclusiveOperation(); + void prepareSecondaryStorageStore(String strStorageUrl); + + void setupResourceStartupParams(Map params); + List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, + String hostInventoryPath) throws Exception; + + String getManagementPortGroupByHost(HostMO hostMo) throws Exception; + String getServiceConsolePortGroupName(); + String getManagementPortGroupName(); + + String getSecondaryStorageStoreUrl(long dcId); + + File getSystemVMKeyFile(); + + VmwareStorageManager getStorageManager(); + void gcLeftOverVMs(VmwareContext context); + + Pair getAddiionalVncPortRange(); + + int getRouterExtraPublicNics(); + + boolean beginExclusiveOperation(int timeOutSeconds); + void endExclusiveOperation(); boolean getNexusVSwitchGlobalParameter(); + boolean getFullCloneFlag(); + Map getNexusVSMCredentialsByClusterId(Long clusterId); String getPrivateVSwitchName(long dcId, HypervisorType hypervisorType); @@ -74,4 +70,6 @@ public interface VmwareManager { String getPublicVSwitchName(long dcId, HypervisorType hypervisorType); String getGuestVSwitchName(long dcId, HypervisorType hypervisorType); + + public String getRootDiskController(); } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java index 64ded51b453..a0d9943b535 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareManagerImpl.java @@ -32,6 +32,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -44,7 +45,6 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.Command; import com.cloud.agent.api.StartupCommand; import com.cloud.agent.api.StartupRoutingCommand; -import com.cloud.cluster.CheckPointManager; import com.cloud.cluster.ClusterManager; import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; @@ -58,11 +58,8 @@ import com.cloud.host.HostVO; import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.hypervisor.dao.HypervisorCapabilitiesDao; import com.cloud.hypervisor.vmware.VmwareCleanupMaid; -import com.cloud.hypervisor.vmware.manager.VmwareManager; -import com.cloud.hypervisor.vmware.manager.VmwareStorageManager; -import com.cloud.hypervisor.vmware.manager.VmwareStorageManagerImpl; -import com.cloud.hypervisor.vmware.manager.VmwareStorageMount; import com.cloud.hypervisor.vmware.mo.DiskControllerType; import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO; import com.cloud.hypervisor.vmware.mo.HostMO; @@ -70,36 +67,38 @@ import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper; import com.cloud.hypervisor.vmware.mo.TaskMO; import com.cloud.hypervisor.vmware.mo.VirtualEthernetCardType; import com.cloud.hypervisor.vmware.mo.VmwareHostType; -import com.cloud.utils.ssh.SshHelper; import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.network.CiscoNexusVSMDeviceVO; -import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.dao.CiscoNexusVSMDeviceDao; import com.cloud.org.Cluster.ClusterType; import com.cloud.secstorage.CommandExecLogDao; import com.cloud.serializer.GsonHelper; import com.cloud.server.ConfigurationServer; +import com.cloud.storage.JavaStorageLayer; import com.cloud.storage.StorageLayer; import com.cloud.storage.secondary.SecondaryStorageVmManager; import com.cloud.utils.FileUtil; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.component.Inject; import com.cloud.utils.component.Manager; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.DB; import com.cloud.utils.db.GlobalLock; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.script.Script; +import com.cloud.utils.ssh.SshHelper; import com.cloud.vm.DomainRouterVO; import com.google.gson.Gson; import com.vmware.apputils.vim25.ServiceUtil; +import com.vmware.vim25.AboutInfo; import com.vmware.vim25.HostConnectSpec; import com.vmware.vim25.ManagedObjectReference; + @Local(value = {VmwareManager.class}) -public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Listener, Manager { +public class VmwareManagerImpl extends ManagerBase implements VmwareManager, VmwareStorageMount, Listener { private static final Logger s_logger = Logger.getLogger(VmwareManagerImpl.class); private static final int STARTUP_DELAY = 60000; // 60 seconds @@ -108,23 +107,22 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis private long _hostScanInterval = DEFAULT_HOST_SCAN_INTERVAL; int _timeout; - private String _name; private String _instance; @Inject AgentManager _agentMgr; @Inject - protected NetworkManager _netMgr; + protected NetworkModel _netMgr; @Inject HostDao _hostDao; @Inject ClusterDao _clusterDao; @Inject ClusterDetailsDao _clusterDetailsDao; @Inject CommandExecLogDao _cmdExecLogDao; @Inject ClusterManager _clusterMgr; - @Inject CheckPointManager _checkPointMgr; @Inject SecondaryStorageVmManager _ssvmMgr; @Inject CiscoNexusVSMDeviceDao _nexusDao; @Inject ClusterVSMMapDao _vsmMapDao; - - ConfigurationServer _configServer; + @Inject ConfigurationDao _configDao; + @Inject ConfigurationServer _configServer; + @Inject HypervisorCapabilitiesDao _hvCapabilitiesDao; String _mountParent; StorageLayer _storage; @@ -133,23 +131,21 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis String _publicNetworkVSwitchName; String _guestNetworkVSwitchName; boolean _nexusVSwitchActive; + boolean _fullCloneFlag; String _serviceConsoleName; String _managemetPortGroupName; String _defaultSystemVmNicAdapterType = VirtualEthernetCardType.E1000.toString(); String _recycleHungWorker = "false"; int _additionalPortRangeStart; int _additionalPortRangeSize; - int _maxHostsPerCluster; int _routerExtraPublicNics = 2; - - String _cpuOverprovisioningFactor = "1"; + String _reserveCpu = "false"; - - String _memOverprovisioningFactor = "1"; + String _reserveMem = "false"; - + String _rootDiskController = DiskControllerType.ide.toString(); - + Map _storageMounts = new HashMap(); Random _rand = new Random(System.currentTimeMillis()); @@ -170,26 +166,18 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis public boolean configure(String name, Map params) throws ConfigurationException { s_logger.info("Configure VmwareManagerImpl, manager name: " + name); - _name = name; - - ComponentLocator locator = ComponentLocator.getCurrentLocator(); - ConfigurationDao configDao = locator.getDao(ConfigurationDao.class); - if (configDao == null) { - throw new ConfigurationException("Unable to get the configuration dao."); - } - - if(!configDao.isPremium()) { + if(!_configDao.isPremium()) { s_logger.error("Vmware component can only run under premium distribution"); throw new ConfigurationException("Vmware component can only run under premium distribution"); } - _instance = configDao.getValue(Config.InstanceName.key()); + _instance = _configDao.getValue(Config.InstanceName.key()); if (_instance == null) { _instance = "DEFAULT"; } s_logger.info("VmwareManagerImpl config - instance.name: " + _instance); - _mountParent = configDao.getValue(Config.MountParent.key()); + _mountParent = _configDao.getValue(Config.MountParent.key()); if (_mountParent == null) { _mountParent = File.separator + "mnt"; } @@ -204,30 +192,25 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis _storage = (StorageLayer)params.get(StorageLayer.InstanceConfigKey); if (_storage == null) { - value = (String)params.get(StorageLayer.ClassConfigKey); - if (value == null) { - value = "com.cloud.storage.JavaStorageLayer"; - } - - try { - Class clazz = Class.forName(value); - _storage = (StorageLayer)ComponentLocator.inject(clazz); - _storage.configure("StorageLayer", params); - } catch (ClassNotFoundException e) { - throw new ConfigurationException("Unable to find class " + value); - } + _storage = new JavaStorageLayer(); + _storage.configure("StorageLayer", params); } - - value = configDao.getValue(Config.VmwareUseNexusVSwitch.key()); + value = _configDao.getValue(Config.VmwareUseNexusVSwitch.key()); if(value == null) { - _nexusVSwitchActive = false; + _nexusVSwitchActive = false; } - else - { - _nexusVSwitchActive = Boolean.parseBoolean(value); + else { + _nexusVSwitchActive = Boolean.parseBoolean(value); } - _privateNetworkVSwitchName = configDao.getValue(Config.VmwarePrivateNetworkVSwitch.key()); + value = _configDao.getValue(Config.VmwareCreateFullClone.key()); + if (value == null) { + _fullCloneFlag = false; + } else { + _fullCloneFlag = Boolean.parseBoolean(value); + } + + _privateNetworkVSwitchName = _configDao.getValue(Config.VmwarePrivateNetworkVSwitch.key()); if (_privateNetworkVSwitchName == null) { if (_nexusVSwitchActive) { @@ -237,7 +220,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } } - _publicNetworkVSwitchName = configDao.getValue(Config.VmwarePublicNetworkVSwitch.key()); + _publicNetworkVSwitchName = _configDao.getValue(Config.VmwarePublicNetworkVSwitch.key()); if (_publicNetworkVSwitchName == null) { if (_nexusVSwitchActive) { @@ -247,7 +230,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } } - _guestNetworkVSwitchName = configDao.getValue(Config.VmwareGuestNetworkVSwitch.key()); + _guestNetworkVSwitchName = _configDao.getValue(Config.VmwareGuestNetworkVSwitch.key()); if (_guestNetworkVSwitchName == null) { if (_nexusVSwitchActive) { @@ -257,69 +240,57 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } } - _serviceConsoleName = configDao.getValue(Config.VmwareServiceConsole.key()); + _serviceConsoleName = _configDao.getValue(Config.VmwareServiceConsole.key()); if(_serviceConsoleName == null) { _serviceConsoleName = "Service Console"; } - - _managemetPortGroupName = configDao.getValue(Config.VmwareManagementPortGroup.key()); + + _managemetPortGroupName = _configDao.getValue(Config.VmwareManagementPortGroup.key()); if(_managemetPortGroupName == null) { - _managemetPortGroupName = "Management Network"; + _managemetPortGroupName = "Management Network"; } - - _defaultSystemVmNicAdapterType = configDao.getValue(Config.VmwareSystemVmNicDeviceType.key()); + + _defaultSystemVmNicAdapterType = _configDao.getValue(Config.VmwareSystemVmNicDeviceType.key()); if(_defaultSystemVmNicAdapterType == null) _defaultSystemVmNicAdapterType = VirtualEthernetCardType.E1000.toString(); - - _additionalPortRangeStart = NumbersUtil.parseInt(configDao.getValue(Config.VmwareAdditionalVncPortRangeStart.key()), 59000); - if(_additionalPortRangeStart > 65535) { - s_logger.warn("Invalid port range start port (" + _additionalPortRangeStart + ") for additional VNC port allocation, reset it to default start port 59000"); - _additionalPortRangeStart = 59000; - } - - _additionalPortRangeSize = NumbersUtil.parseInt(configDao.getValue(Config.VmwareAdditionalVncPortRangeSize.key()), 1000); - if(_additionalPortRangeSize < 0 || _additionalPortRangeStart + _additionalPortRangeSize > 65535) { - s_logger.warn("Invalid port range size (" + _additionalPortRangeSize + " for range starts at " + _additionalPortRangeStart); - _additionalPortRangeSize = Math.min(1000, 65535 - _additionalPortRangeStart); - } - - _routerExtraPublicNics = NumbersUtil.parseInt(configDao.getValue(Config.RouterExtraPublicNics.key()), 2); - - _maxHostsPerCluster = NumbersUtil.parseInt(configDao.getValue(Config.VmwarePerClusterHostMax.key()), VmwareManager.MAX_HOSTS_PER_CLUSTER); - _cpuOverprovisioningFactor = configDao.getValue(Config.CPUOverprovisioningFactor.key()); - if(_cpuOverprovisioningFactor == null || _cpuOverprovisioningFactor.isEmpty()) - _cpuOverprovisioningFactor = "1"; - _memOverprovisioningFactor = configDao.getValue(Config.MemOverprovisioningFactor.key()); - if(_memOverprovisioningFactor == null || _memOverprovisioningFactor.isEmpty()) - _memOverprovisioningFactor = "1"; - - _reserveCpu = configDao.getValue(Config.VmwareReserveCpu.key()); + _additionalPortRangeStart = NumbersUtil.parseInt(_configDao.getValue(Config.VmwareAdditionalVncPortRangeStart.key()), 59000); + if(_additionalPortRangeStart > 65535) { + s_logger.warn("Invalid port range start port (" + _additionalPortRangeStart + ") for additional VNC port allocation, reset it to default start port 59000"); + _additionalPortRangeStart = 59000; + } + + _additionalPortRangeSize = NumbersUtil.parseInt(_configDao.getValue(Config.VmwareAdditionalVncPortRangeSize.key()), 1000); + if(_additionalPortRangeSize < 0 || _additionalPortRangeStart + _additionalPortRangeSize > 65535) { + s_logger.warn("Invalid port range size (" + _additionalPortRangeSize + " for range starts at " + _additionalPortRangeStart); + _additionalPortRangeSize = Math.min(1000, 65535 - _additionalPortRangeStart); + } + + _routerExtraPublicNics = NumbersUtil.parseInt(_configDao.getValue(Config.RouterExtraPublicNics.key()), 2); + + _reserveCpu = _configDao.getValue(Config.VmwareReserveCpu.key()); if(_reserveCpu == null || _reserveCpu.isEmpty()) - _reserveCpu = "false"; - _reserveMem = configDao.getValue(Config.VmwareReserveMem.key()); + _reserveCpu = "false"; + _reserveMem = _configDao.getValue(Config.VmwareReserveMem.key()); if(_reserveMem == null || _reserveMem.isEmpty()) - _reserveMem = "false"; - - _recycleHungWorker = configDao.getValue(Config.VmwareRecycleHungWorker.key()); + _reserveMem = "false"; + + _recycleHungWorker = _configDao.getValue(Config.VmwareRecycleHungWorker.key()); if(_recycleHungWorker == null || _recycleHungWorker.isEmpty()) _recycleHungWorker = "false"; - - _rootDiskController = configDao.getValue(Config.VmwareRootDiskControllerType.key()); - if(_rootDiskController == null || _rootDiskController.isEmpty()) - _rootDiskController = DiskControllerType.ide.toString(); - - s_logger.info("Additional VNC port allocation range is settled at " + _additionalPortRangeStart + " to " + (_additionalPortRangeStart + _additionalPortRangeSize)); - value = configDao.getValue("vmware.host.scan.interval"); + _rootDiskController = _configDao.getValue(Config.VmwareRootDiskControllerType.key()); + if(_rootDiskController == null || _rootDiskController.isEmpty()) + _rootDiskController = DiskControllerType.ide.toString(); + + s_logger.info("Additional VNC port allocation range is settled at " + _additionalPortRangeStart + " to " + (_additionalPortRangeStart + _additionalPortRangeSize)); + + value = _configDao.getValue("vmware.host.scan.interval"); _hostScanInterval = NumbersUtil.parseLong(value, DEFAULT_HOST_SCAN_INTERVAL); s_logger.info("VmwareManagerImpl config - vmware.host.scan.interval: " + _hostScanInterval); ((VmwareStorageManagerImpl)_storageMgr).configure(params); - if(_configServer == null) - _configServer = (ConfigurationServer)ComponentLocator.getComponent(ConfigurationServer.Name); - _agentMgr.registerForHostEvents(this, true, true, true); s_logger.info("VmwareManagerImpl has been successfully configured"); @@ -348,33 +319,62 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } @Override - public String getName() { - return _name; - } - public boolean getNexusVSwitchGlobalParameter() { return _nexusVSwitchActive; } + @Override + public boolean getFullCloneFlag() { + return _fullCloneFlag; + } + @Override public String composeWorkerName() { return UUID.randomUUID().toString().replace("-", ""); } - + @Override public String getPrivateVSwitchName(long dcId, HypervisorType hypervisorType) { return _netMgr.getDefaultManagementTrafficLabel(dcId, hypervisorType); } - + @Override public String getPublicVSwitchName(long dcId, HypervisorType hypervisorType) { return _netMgr.getDefaultPublicTrafficLabel(dcId, hypervisorType); } - + @Override public String getGuestVSwitchName(long dcId, HypervisorType hypervisorType) { return _netMgr.getDefaultGuestTrafficLabel(dcId, hypervisorType); } + + private void prepareHost(HostMO hostMo, String privateTrafficLabel) throws Exception { + // For ESX host, we need to enable host firewall to allow VNC access + HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO(); + if(firewallMo != null) { + if(hostMo.getHostType() == VmwareHostType.ESX) { + firewallMo.enableRuleset("vncServer"); + firewallMo.refreshFirewall(); + } + } + + // prepare at least one network on the vswitch to enable OVF importing + String vSwitchName = privateTrafficLabel; + String vlanId = null; + String[] tokens = privateTrafficLabel.split(","); + if(tokens.length == 2) { + vSwitchName = tokens[0].trim(); + vlanId = tokens[1].trim(); + } + + s_logger.info("Preparing network on host " + hostMo.getContext().toString() + " for " + privateTrafficLabel); + if(!_nexusVSwitchActive) { + HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); + } + else { + HypervisorHostHelper.prepareNetwork(vSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000); + } + } @Override public List addHostToPodCluster(VmwareContext serviceContext, long dcId, Long podId, Long clusterId, @@ -397,99 +397,35 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis // For ESX host, we need to enable host firewall to allow VNC access HostMO hostMo = new HostMO(serviceContext, hosts[0]); - HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO(); - if(firewallMo != null) { - if(hostMo.getHostType() == VmwareHostType.ESX) { - - firewallMo.enableRuleset("vncServer"); - firewallMo.refreshFirewall(); - } - } - - // prepare at least one network on the vswitch to enable OVF importing - String vlanId = null; - if(privateTrafficLabel != null) { - String[] tokens = privateTrafficLabel.split(","); - if(tokens.length == 2) - vlanId = tokens[1]; - } - - if(!_nexusVSwitchActive) { - HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); - } - else { - s_logger.info("Preparing Network on " + privateTrafficLabel); - HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); - } + prepareHost(hostMo, privateTrafficLabel); returnedHostList.add(hosts[0]); return returnedHostList; } else if(mor.getType().equals("ClusterComputeResource")) { ManagedObjectReference[] hosts = (ManagedObjectReference[])serviceContext.getServiceUtil().getDynamicProperty(mor, "host"); assert(hosts != null); - - if(hosts.length > _maxHostsPerCluster) { - String msg = "vCenter cluster size is too big (current configured cluster size: " + _maxHostsPerCluster + ")"; - s_logger.error(msg); - throw new DiscoveredWithErrorException(msg); + + if (hosts.length > 0) { + AboutInfo about = (AboutInfo)(serviceContext.getServiceUtil().getDynamicProperty(hosts[0], "config.product")); + String version = about.getApiVersion(); + int maxHostsPerCluster = _hvCapabilitiesDao.getMaxHostsPerCluster(HypervisorType.VMware, version); + if (hosts.length > maxHostsPerCluster) { + String msg = "vCenter cluster size is too big (current configured cluster size: " + maxHostsPerCluster + ")"; + s_logger.error(msg); + throw new DiscoveredWithErrorException(msg); + } } - + for(ManagedObjectReference morHost: hosts) { // For ESX host, we need to enable host firewall to allow VNC access HostMO hostMo = new HostMO(serviceContext, morHost); - HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO(); - if(firewallMo != null) { - if(hostMo.getHostType() == VmwareHostType.ESX) { - firewallMo.enableRuleset("vncServer"); - firewallMo.refreshFirewall(); - } - } - - String vlanId = null; - if(privateTrafficLabel != null) { - String[] tokens = privateTrafficLabel.split(","); - if(tokens.length == 2) - vlanId = tokens[1]; - } - - - s_logger.info("Calling prepareNetwork : " + hostMo.getContext().toString()); - // prepare at least one network on the vswitch to enable OVF importing - if(!_nexusVSwitchActive) { - HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); - } - else { - s_logger.info("Preparing Network on " + privateTrafficLabel); - HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); - } + prepareHost(hostMo, privateTrafficLabel); returnedHostList.add(morHost); } return returnedHostList; } else if(mor.getType().equals("HostSystem")) { // For ESX host, we need to enable host firewall to allow VNC access HostMO hostMo = new HostMO(serviceContext, mor); - HostFirewallSystemMO firewallMo = hostMo.getHostFirewallSystemMO(); - if(firewallMo != null) { - if(hostMo.getHostType() == VmwareHostType.ESX) { - firewallMo.enableRuleset("vncServer"); - firewallMo.refreshFirewall(); - } - } - - String vlanId = null; - if(privateTrafficLabel != null) { - String[] tokens = privateTrafficLabel.split(","); - if(tokens.length == 2) - vlanId = tokens[1]; - } - - // prepare at least one network on the vswitch to enable OVF importing - if(!_nexusVSwitchActive) { - HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private", hostMo, vlanId, null, null, 180000, false); - } - else { - s_logger.info("Preparing Network on " + privateTrafficLabel); - HypervisorHostHelper.prepareNetwork(privateTrafficLabel, "cloud.private", hostMo, vlanId, null, null, 180000); - } + prepareHost(hostMo, privateTrafficLabel); returnedHostList.add(mor); return returnedHostList; } else { @@ -542,39 +478,40 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis @Override public String getSecondaryStorageStoreUrl(long dcId) { - List secStorageHosts = _ssvmMgr.listSecondaryStorageHostsInOneZone(dcId); - if(secStorageHosts.size() > 0) - return secStorageHosts.get(0).getStorageUrl(); - + List secStorageHosts = _ssvmMgr.listSecondaryStorageHostsInOneZone(dcId); + if(secStorageHosts.size() > 0) + return secStorageHosts.get(0).getStorageUrl(); + return null; } - public String getServiceConsolePortGroupName() { - return _serviceConsoleName; - } - - public String getManagementPortGroupName() { - return _managemetPortGroupName; - } - + @Override + public String getServiceConsolePortGroupName() { + return _serviceConsoleName; + } + + @Override + public String getManagementPortGroupName() { + return _managemetPortGroupName; + } + @Override public String getManagementPortGroupByHost(HostMO hostMo) throws Exception { - if(hostMo.getHostType() == VmwareHostType.ESXi) - return this._managemetPortGroupName; + if(hostMo.getHostType() == VmwareHostType.ESXi) + return this._managemetPortGroupName; return this._serviceConsoleName; } - + @Override public void setupResourceStartupParams(Map params) { params.put("private.network.vswitch.name", _privateNetworkVSwitchName); params.put("public.network.vswitch.name", _publicNetworkVSwitchName); params.put("guest.network.vswitch.name", _guestNetworkVSwitchName); params.put("vmware.use.nexus.vswitch", _nexusVSwitchActive); + params.put("vmware.create.full.clone", _fullCloneFlag); params.put("service.console.name", _serviceConsoleName); params.put("management.portgroup.name", _managemetPortGroupName); - params.put("cpu.overprovisioning.factor", _cpuOverprovisioningFactor); params.put("vmware.reserve.cpu", _reserveCpu); - params.put("mem.overprovisioning.factor", _memOverprovisioningFactor); params.put("vmware.reserve.mem", _reserveMem); params.put("vmware.root.disk.controller", _rootDiskController); params.put("vmware.recycle.hung.wokervm", _recycleHungWorker); @@ -585,20 +522,10 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis return _storageMgr; } - + @Override - public long pushCleanupCheckpoint(String hostGuid, String vmName) { - return _checkPointMgr.pushCheckPoint(new VmwareCleanupMaid(hostGuid, vmName)); - } - - @Override - public void popCleanupCheckpoint(long checkpoint) { - _checkPointMgr.popCheckPoint(checkpoint); - } - - @Override - public void gcLeftOverVMs(VmwareContext context) { - VmwareCleanupMaid.gcLeftOverVMs(context); + public void gcLeftOverVMs(VmwareContext context) { + VmwareCleanupMaid.gcLeftOverVMs(context); } @Override @@ -623,19 +550,19 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis if(!destIso.exists()) { s_logger.info("Inject SSH key pairs before copying systemvm.iso into secondary storage"); _configServer.updateKeyPairs(); - - try { - FileUtil.copyfile(srcIso, destIso); - } catch(IOException e) { - s_logger.error("Unexpected exception ", e); - - String msg = "Unable to copy systemvm ISO on secondary storage. src location: " + srcIso.toString() + ", dest location: " + destIso; - s_logger.error(msg); - throw new CloudRuntimeException(msg); - } + + try { + FileUtil.copyfile(srcIso, destIso); + } catch(IOException e) { + s_logger.error("Unexpected exception ", e); + + String msg = "Unable to copy systemvm ISO on secondary storage. src location: " + srcIso.toString() + ", dest location: " + destIso; + s_logger.error(msg); + throw new CloudRuntimeException(msg); + } } else { - if(s_logger.isTraceEnabled()) - s_logger.trace("SystemVM ISO file " + destIso.getPath() + " already exists"); + if(s_logger.isTraceEnabled()) + s_logger.trace("SystemVM ISO file " + destIso.getPath() + " already exists"); } } finally { lock.unlock(); @@ -645,22 +572,22 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis lock.releaseRef(); } } - + @Override public String getSystemVMIsoFileNameOnDatastore() { - String version = ComponentLocator.class.getPackage().getImplementationVersion(); + String version = this.getClass().getPackage().getImplementationVersion(); String fileName = "systemvm-" + version + ".iso"; return fileName.replace(':', '-'); } - + @Override public String getSystemVMDefaultNicAdapterType() { return this._defaultSystemVmNicAdapterType; } - + private File getSystemVMPatchIsoFile() { // locate systemvm.iso - URL url = ComponentLocator.class.getProtectionDomain().getCodeSource().getLocation(); + URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); File file = new File(url.getFile()); File isoFile = new File(file.getParent() + "/vms/systemvm.iso"); if (!isoFile.exists()) { @@ -674,7 +601,7 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis @Override public File getSystemVMKeyFile() { - URL url = ComponentLocator.class.getProtectionDomain().getCodeSource().getLocation(); + URL url = this.getClass().getProtectionDomain().getCodeSource().getLocation(); File file = new File(url.getFile()); File keyFile = new File(file.getParent(), "/scripts/vm/systemvm/id_rsa.cloud"); @@ -861,16 +788,6 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis _cmdExecLogDao.expunge(execId); } - - String checkPointIdStr = answer.getContextParam("checkpoint"); - if(checkPointIdStr != null) { - _checkPointMgr.popCheckPoint(Long.parseLong(checkPointIdStr)); - } - - checkPointIdStr = answer.getContextParam("checkpoint2"); - if(checkPointIdStr != null) { - _checkPointMgr.popCheckPoint(Long.parseLong(checkPointIdStr)); - } } } @@ -897,9 +814,9 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } } } - + protected final int DEFAULT_DOMR_SSHPORT = 3922; - + protected boolean shutdownRouterVM(DomainRouterVO router) { if (s_logger.isDebugEnabled()) { s_logger.debug("Try to shutdown router VM " + router.getInstanceName() + " directly."); @@ -943,31 +860,26 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis public boolean processTimeout(long agentId, long seq) { return false; } - + @Override public boolean beginExclusiveOperation(int timeOutSeconds) { return _exclusiveOpLock.lock(timeOutSeconds); } - + @Override public void endExclusiveOperation() { _exclusiveOpLock.unlock(); } - + @Override - public Pair getAddiionalVncPortRange() { - return new Pair(_additionalPortRangeStart, _additionalPortRangeSize); + public Pair getAddiionalVncPortRange() { + return new Pair(_additionalPortRangeStart, _additionalPortRangeSize); } - + @Override - public int getMaxHostsPerCluster() { - return this._maxHostsPerCluster; + public int getRouterExtraPublicNics() { + return this._routerExtraPublicNics; } - - @Override - public int getRouterExtraPublicNics() { - return this._routerExtraPublicNics; - } @Override public Map getNexusVSMCredentialsByClusterId(Long clusterId) { @@ -996,4 +908,9 @@ public class VmwareManagerImpl implements VmwareManager, VmwareStorageMount, Lis } return nexusVSMCredentials; } + + @Override + public String getRootDiskController() { + return _rootDiskController; + } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManager.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManager.java index f27e0269a64..a2e517d1fdb 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManager.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManager.java @@ -20,15 +20,21 @@ import com.cloud.agent.api.Answer; import com.cloud.agent.api.BackupSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; +import com.cloud.agent.api.CreateVMSnapshotCommand; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; +import com.cloud.agent.api.DeleteVMSnapshotCommand; +import com.cloud.agent.api.RevertToVMSnapshotCommand; import com.cloud.agent.api.storage.CopyVolumeCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; public interface VmwareStorageManager { Answer execute(VmwareHostService hostService, PrimaryStorageDownloadCommand cmd); - Answer execute(VmwareHostService hostService, BackupSnapshotCommand cmd); - Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromVolumeCommand cmd); - Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromSnapshotCommand cmd); - Answer execute(VmwareHostService hostService, CopyVolumeCommand cmd); - Answer execute(VmwareHostService hostService, CreateVolumeFromSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, BackupSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromVolumeCommand cmd); + Answer execute(VmwareHostService hostService, CreatePrivateTemplateFromSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, CopyVolumeCommand cmd); + Answer execute(VmwareHostService hostService, CreateVolumeFromSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, CreateVMSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, DeleteVMSnapshotCommand cmd); + Answer execute(VmwareHostService hostService, RevertToVMSnapshotCommand cmd); } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java index 8650274719e..c7b7cd3bcba 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java @@ -22,6 +22,7 @@ import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.rmi.RemoteException; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; @@ -32,18 +33,27 @@ import com.cloud.agent.api.BackupSnapshotAnswer; import com.cloud.agent.api.BackupSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; +import com.cloud.agent.api.CreateVMSnapshotAnswer; +import com.cloud.agent.api.CreateVMSnapshotCommand; import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; +import com.cloud.agent.api.DeleteVMSnapshotAnswer; +import com.cloud.agent.api.DeleteVMSnapshotCommand; +import com.cloud.agent.api.RevertToVMSnapshotAnswer; +import com.cloud.agent.api.RevertToVMSnapshotCommand; import com.cloud.agent.api.storage.CopyVolumeAnswer; import com.cloud.agent.api.storage.CopyVolumeCommand; import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; import com.cloud.agent.api.to.StorageFilerTO; +import com.cloud.agent.api.to.VolumeTO; import com.cloud.hypervisor.vmware.mo.CustomFieldConstants; import com.cloud.hypervisor.vmware.mo.DatacenterMO; import com.cloud.hypervisor.vmware.mo.DatastoreMO; +import com.cloud.hypervisor.vmware.mo.HostMO; import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper; +import com.cloud.hypervisor.vmware.mo.TaskMO; import com.cloud.hypervisor.vmware.mo.VirtualMachineMO; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.util.VmwareContext; @@ -57,7 +67,11 @@ import com.cloud.utils.Pair; import com.cloud.utils.StringUtils; import com.cloud.utils.Ternary; import com.cloud.utils.script.Script; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.snapshot.VMSnapshot; import com.vmware.vim25.ManagedObjectReference; +import com.vmware.vim25.TaskEvent; +import com.vmware.vim25.TaskInfo; import com.vmware.vim25.VirtualDeviceConfigSpec; import com.vmware.vim25.VirtualDeviceConfigSpecOperation; import com.vmware.vim25.VirtualDisk; @@ -222,8 +236,12 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } } finally { - if(vmMo != null) - vmMo.removeAllSnapshots(); + if(vmMo != null){ + ManagedObjectReference snapshotMor = vmMo.getSnapshotMor(snapshotUuid); + if (snapshotMor != null){ + vmMo.removeSnapshot(snapshotUuid, false); + } + } try { if (workerVm != null) { @@ -377,47 +395,47 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { } @Override - public Answer execute(VmwareHostService hostService, CreateVolumeFromSnapshotCommand cmd) { + public Answer execute(VmwareHostService hostService, CreateVolumeFromSnapshotCommand cmd) { - String primaryStorageNameLabel = cmd.getPrimaryStoragePoolNameLabel(); - Long accountId = cmd.getAccountId(); - Long volumeId = cmd.getVolumeId(); - String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); - String backedUpSnapshotUuid = cmd.getSnapshotUuid(); + String primaryStorageNameLabel = cmd.getPrimaryStoragePoolNameLabel(); + Long accountId = cmd.getAccountId(); + Long volumeId = cmd.getVolumeId(); + String secondaryStorageUrl = cmd.getSecondaryStorageUrl(); + String backedUpSnapshotUuid = cmd.getSnapshotUuid(); - String details = null; - boolean success = false; - String newVolumeName = UUID.randomUUID().toString().replaceAll("-", ""); + String details = null; + boolean success = false; + String newVolumeName = UUID.randomUUID().toString().replaceAll("-", ""); - VmwareContext context = hostService.getServiceContext(cmd); - try { - VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); - - ManagedObjectReference morPrimaryDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, primaryStorageNameLabel); - if (morPrimaryDs == null) { - String msg = "Unable to find datastore: " + primaryStorageNameLabel; - s_logger.error(msg); - throw new Exception(msg); - } + VmwareContext context = hostService.getServiceContext(cmd); + try { + VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); + ManagedObjectReference morPrimaryDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, + primaryStorageNameLabel); + if (morPrimaryDs == null) { + String msg = "Unable to find datastore: " + primaryStorageNameLabel; + s_logger.error(msg); + throw new Exception(msg); + } - DatastoreMO primaryDsMo = new DatastoreMO(hyperHost.getContext(), morPrimaryDs); - details = createVolumeFromSnapshot(hyperHost, primaryDsMo, - newVolumeName, accountId, volumeId, secondaryStorageUrl, backedUpSnapshotUuid); - if (details == null) { - success = true; - } - } catch (Throwable e) { - if (e instanceof RemoteException) { - hostService.invalidateServiceContext(context); - } + DatastoreMO primaryDsMo = new DatastoreMO(hyperHost.getContext(), morPrimaryDs); + details = createVolumeFromSnapshot(hyperHost, primaryDsMo, + newVolumeName, accountId, volumeId, secondaryStorageUrl, backedUpSnapshotUuid); + if (details == null) { + success = true; + } + } catch (Throwable e) { + if (e instanceof RemoteException) { + hostService.invalidateServiceContext(context); + } + + s_logger.error("Unexpecpted exception ", e); + details = "CreateVolumeFromSnapshotCommand exception: " + StringUtils.getExceptionStackInfo(e); + } - s_logger.error("Unexpecpted exception ", e); - details = "CreateVolumeFromSnapshotCommand exception: " + StringUtils.getExceptionStackInfo(e); - } + return new CreateVolumeFromSnapshotAnswer(cmd, success, details, newVolumeName); + } - return new CreateVolumeFromSnapshotAnswer(cmd, success, details, newVolumeName); - } - // templateName: name in secondary storage // templateUuid: will be used at hypervisor layer private void copyTemplateFromSecondaryToPrimary(VmwareHypervisorHost hyperHost, DatastoreMO datastoreMo, String secondaryStorageUrl, @@ -881,4 +899,244 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager { private static String getSnapshotRelativeDirInSecStorage(long accountId, long volumeId) { return "snapshots/" + accountId + "/" + volumeId; } + + @Override + public CreateVMSnapshotAnswer execute(VmwareHostService hostService, CreateVMSnapshotCommand cmd) { + List volumeTOs = cmd.getVolumeTOs(); + String vmName = cmd.getVmName(); + String vmSnapshotName = cmd.getTarget().getSnapshotName(); + String vmSnapshotDesc = cmd.getTarget().getDescription(); + boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory; + VirtualMachineMO vmMo = null; + VmwareContext context = hostService.getServiceContext(cmd); + Map mapNewDisk = new HashMap(); + try { + VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); + + // wait if there are already VM snapshot task running + ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); + ManagedObjectReference[] tasks = (ManagedObjectReference[]) context.getServiceUtil().getDynamicProperty(taskmgr, "recentTask"); + for (ManagedObjectReference taskMor : tasks) { + TaskInfo info = (TaskInfo) (context.getServiceUtil().getDynamicProperty(taskMor, "info")); + if(info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("CreateSnapshot_Task")){ + s_logger.debug("There is already a VM snapshot task running, wait for it"); + context.getServiceUtil().waitForTask(taskMor); + } + } + + vmMo = hyperHost.findVmOnHyperHost(vmName); + if(vmMo == null) + vmMo = hyperHost.findVmOnPeerHyperHost(vmName); + if (vmMo == null) { + String msg = "Unable to find VM for CreateVMSnapshotCommand"; + s_logger.debug(msg); + return new CreateVMSnapshotAnswer(cmd, false, msg); + } else { + if (vmMo.getSnapshotMor(vmSnapshotName) != null){ + s_logger.debug("VM snapshot " + vmSnapshotName + " already exists"); + }else if (!vmMo.createSnapshot(vmSnapshotName, vmSnapshotDesc, snapshotMemory, true)) { + return new CreateVMSnapshotAnswer(cmd, false, + "Unable to create snapshot due to esxi internal failed"); + } + // find VM disk file path after creating snapshot + VirtualDisk[] vdisks = vmMo.getAllDiskDevice(); + for (int i = 0; i < vdisks.length; i ++){ + @SuppressWarnings("deprecation") + List> vmdkFiles = vmMo.getDiskDatastorePathChain(vdisks[i], false); + for(Pair fileItem : vmdkFiles) { + String vmdkName = fileItem.first().split(" ")[1]; + if ( vmdkName.endsWith(".vmdk")){ + vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length()); + } + String[] s = vmdkName.split("-"); + mapNewDisk.put(s[0], vmdkName); + } + } + + // update volume path using maps + for (VolumeTO volumeTO : volumeTOs) { + String parentUUID = volumeTO.getPath(); + String[] s = parentUUID.split("-"); + String key = s[0]; + volumeTO.setPath(mapNewDisk.get(key)); + } + return new CreateVMSnapshotAnswer(cmd, cmd.getTarget(), volumeTOs); + } + } catch (Exception e) { + String msg = e.getMessage(); + s_logger.error("failed to create snapshot for vm:" + vmName + " due to " + msg); + try { + if (vmMo.getSnapshotMor(vmSnapshotName) != null) { + vmMo.removeSnapshot(vmSnapshotName, false); + } + } catch (Exception e1) { + } + return new CreateVMSnapshotAnswer(cmd, false, e.getMessage()); + } + } + + @Override + public DeleteVMSnapshotAnswer execute(VmwareHostService hostService, DeleteVMSnapshotCommand cmd) { + List listVolumeTo = cmd.getVolumeTOs(); + VirtualMachineMO vmMo = null; + VmwareContext context = hostService.getServiceContext(cmd); + Map mapNewDisk = new HashMap(); + String vmName = cmd.getVmName(); + String vmSnapshotName = cmd.getTarget().getSnapshotName(); + try { + VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); + vmMo = hyperHost.findVmOnHyperHost(vmName); + if(vmMo == null) + vmMo = hyperHost.findVmOnPeerHyperHost(vmName); + if (vmMo == null) { + String msg = "Unable to find VM for RevertToVMSnapshotCommand"; + s_logger.debug(msg); + return new DeleteVMSnapshotAnswer(cmd, false, msg); + } else { + if (vmMo.getSnapshotMor(vmSnapshotName) == null) { + s_logger.debug("can not find the snapshot " + vmSnapshotName + ", assume it is already removed"); + } else { + if (!vmMo.removeSnapshot(vmSnapshotName, false)) { + String msg = "delete vm snapshot " + vmSnapshotName + " due to error occured in vmware"; + s_logger.error(msg); + return new DeleteVMSnapshotAnswer(cmd, false, msg); + } + } + s_logger.debug("snapshot: " + vmSnapshotName + " is removed"); + // after removed snapshot, the volumes' paths have been changed for the VM, needs to report new paths to manager + VirtualDisk[] vdisks = vmMo.getAllDiskDevice(); + for (int i = 0; i < vdisks.length; i++) { + @SuppressWarnings("deprecation") + List> vmdkFiles = vmMo.getDiskDatastorePathChain(vdisks[i], false); + for (Pair fileItem : vmdkFiles) { + String vmdkName = fileItem.first().split(" ")[1]; + if (vmdkName.endsWith(".vmdk")) { + vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length()); + } + String[] s = vmdkName.split("-"); + mapNewDisk.put(s[0], vmdkName); + } + } + for (VolumeTO volumeTo : listVolumeTo) { + String key = null; + String parentUUID = volumeTo.getPath(); + String[] s = parentUUID.split("-"); + key = s[0]; + volumeTo.setPath(mapNewDisk.get(key)); + } + return new DeleteVMSnapshotAnswer(cmd, listVolumeTo); + } + } catch (Exception e) { + String msg = e.getMessage(); + s_logger.error("failed to delete vm snapshot " + vmSnapshotName + " of vm " + vmName + " due to " + msg); + return new DeleteVMSnapshotAnswer(cmd, false, msg); + } + } + + @Override + public RevertToVMSnapshotAnswer execute(VmwareHostService hostService, RevertToVMSnapshotCommand cmd) { + String snapshotName = cmd.getTarget().getSnapshotName(); + String vmName = cmd.getVmName(); + Boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory; + List listVolumeTo = cmd.getVolumeTOs(); + VirtualMachine.State vmState = VirtualMachine.State.Running; + VirtualMachineMO vmMo = null; + VmwareContext context = hostService.getServiceContext(cmd); + Map mapNewDisk = new HashMap(); + try { + VmwareHypervisorHost hyperHost = hostService.getHyperHost(context, cmd); + + // wait if there are already VM revert task running + ManagedObjectReference taskmgr = context.getServiceContent().getTaskManager(); + ManagedObjectReference[] tasks = (ManagedObjectReference[]) context.getServiceUtil().getDynamicProperty(taskmgr, "recentTask"); + for (ManagedObjectReference taskMor : tasks) { + TaskInfo info = (TaskInfo) (context.getServiceUtil().getDynamicProperty(taskMor, "info")); + if(info.getEntityName().equals(cmd.getVmName()) && info.getName().equalsIgnoreCase("RevertToSnapshot_Task")){ + s_logger.debug("There is already a VM snapshot task running, wait for it"); + context.getServiceUtil().waitForTask(taskMor); + } + } + + HostMO hostMo = (HostMO) hyperHost; + vmMo = hyperHost.findVmOnHyperHost(vmName); + if(vmMo == null) + vmMo = hyperHost.findVmOnPeerHyperHost(vmName); + if (vmMo == null) { + String msg = "Unable to find VM for RevertToVMSnapshotCommand"; + s_logger.debug(msg); + return new RevertToVMSnapshotAnswer(cmd, false, msg); + } else { + boolean result = false; + if (snapshotName != null) { + ManagedObjectReference morSnapshot = vmMo.getSnapshotMor(snapshotName); + result = hostMo.revertToSnapshot(morSnapshot); + } else { + return new RevertToVMSnapshotAnswer(cmd, false, "Unable to find the snapshot by name " + snapshotName); + } + + if (result) { + VirtualDisk[] vdisks = vmMo.getAllDiskDevice(); + // build a map + for (int i = 0; i < vdisks.length; i++) { + @SuppressWarnings("deprecation") + List> vmdkFiles = vmMo.getDiskDatastorePathChain( + vdisks[i], false); + for (Pair fileItem : vmdkFiles) { + String vmdkName = fileItem.first().split(" ")[1]; + if (vmdkName.endsWith(".vmdk")) { + vmdkName = vmdkName.substring(0, vmdkName.length() - (".vmdk").length()); + } + String[] s = vmdkName.split("-"); + mapNewDisk.put(s[0], vmdkName); + } + } + String key = null; + for (VolumeTO volumeTo : listVolumeTo) { + String parentUUID = volumeTo.getPath(); + String[] s = parentUUID.split("-"); + key = s[0]; + volumeTo.setPath(mapNewDisk.get(key)); + } + if (!snapshotMemory) { + vmState = VirtualMachine.State.Stopped; + } + return new RevertToVMSnapshotAnswer(cmd, listVolumeTo, vmState); + } else { + return new RevertToVMSnapshotAnswer(cmd, false, + "Error while reverting to snapshot due to execute in esxi"); + } + } + } catch (Exception e) { + String msg = "revert vm " + vmName + " to snapshot " + snapshotName + " failed due to " + e.getMessage(); + s_logger.error(msg); + return new RevertToVMSnapshotAnswer(cmd, false, msg); + } + } + + + private VirtualMachineMO createWorkingVM(DatastoreMO dsMo, VmwareHypervisorHost hyperHost) throws Exception { + String uniqueName = UUID.randomUUID().toString(); + VirtualMachineMO workingVM = null; + VirtualMachineConfigSpec vmConfig = new VirtualMachineConfigSpec(); + vmConfig.setName(uniqueName); + vmConfig.setMemoryMB((long) 4); + vmConfig.setNumCPUs(1); + vmConfig.setGuestId(VirtualMachineGuestOsIdentifier._otherGuest.toString()); + VirtualMachineFileInfo fileInfo = new VirtualMachineFileInfo(); + fileInfo.setVmPathName(String.format("[%s]", dsMo.getName())); + vmConfig.setFiles(fileInfo); + + VirtualLsiLogicController scsiController = new VirtualLsiLogicController(); + scsiController.setSharedBus(VirtualSCSISharing.noSharing); + scsiController.setBusNumber(0); + scsiController.setKey(1); + VirtualDeviceConfigSpec scsiControllerSpec = new VirtualDeviceConfigSpec(); + scsiControllerSpec.setDevice(scsiController); + scsiControllerSpec.setOperation(VirtualDeviceConfigSpecOperation.add); + + vmConfig.setDeviceChange(new VirtualDeviceConfigSpec[] { scsiControllerSpec }); + hyperHost.createVm(vmConfig); + workingVM = hyperHost.findVmOnHyperHost(uniqueName); + return workingVM; + } } diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java index 053ed6eaf46..8324bcf0d30 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareContextFactory.java @@ -11,32 +11,43 @@ // 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.hypervisor.vmware.resource; +import javax.annotation.PostConstruct; +import javax.inject.Inject; + import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.hypervisor.vmware.manager.VmwareManager; +import com.cloud.hypervisor.vmware.manager.VmwareManagerImpl; import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.utils.StringUtils; -import com.cloud.utils.component.ComponentLocator; -import com.vmware.apputils.version.ExtendedAppUtil; +import com.cloud.utils.component.ComponentContext; +import com.vmware.apputils.version.ExtendedAppUtil; +@Component public class VmwareContextFactory { - + private static final Logger s_logger = Logger.getLogger(VmwareContextFactory.class); - + private static volatile int s_seq = 1; private static VmwareManager s_vmwareMgr; - + + @Inject VmwareManager _vmwareMgr; + static { // skip certificate check System.setProperty("axis.socketSecureFactory", "org.apache.axis.components.net.SunFakeTrustSocketFactory"); - - ComponentLocator locator = ComponentLocator.getLocator("management-server"); - s_vmwareMgr = locator.getManager(VmwareManager.class); + //s_vmwareMgr = ComponentContext.inject(VmwareManagerImpl.class); + } + + @PostConstruct + void init() { + s_vmwareMgr = _vmwareMgr; } public static VmwareContext create(String vCenterAddress, String vCenterUserName, String vCenterPassword) throws Exception { @@ -49,13 +60,13 @@ public class VmwareContextFactory { if(s_logger.isDebugEnabled()) s_logger.debug("initialize VmwareContext. url: " + serviceUrl + ", username: " + vCenterUserName + ", password: " + StringUtils.getMaskedPasswordForDisplay(vCenterPassword)); - + ExtendedAppUtil appUtil = ExtendedAppUtil.initialize(vCenterAddress + "-" + s_seq++, params); - + appUtil.connect(); VmwareContext context = new VmwareContext(appUtil, vCenterAddress); context.registerStockObject(VmwareManager.CONTEXT_STOCK_NAME, s_vmwareMgr); - + context.registerStockObject("serviceconsole", s_vmwareMgr.getServiceConsolePortGroupName()); context.registerStockObject("manageportgroup", s_vmwareMgr.getManagementPortGroupName()); diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java index a444cfec197..4839b35b91e 100755 --- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java +++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java @@ -65,9 +65,13 @@ import com.cloud.agent.api.Command; import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; import com.cloud.agent.api.CreateStoragePoolCommand; +import com.cloud.agent.api.CreateVMSnapshotAnswer; +import com.cloud.agent.api.CreateVMSnapshotCommand; import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; import com.cloud.agent.api.DeleteStoragePoolCommand; +import com.cloud.agent.api.DeleteVMSnapshotAnswer; +import com.cloud.agent.api.DeleteVMSnapshotCommand; import com.cloud.agent.api.GetDomRVersionAnswer; import com.cloud.agent.api.GetDomRVersionCmd; import com.cloud.agent.api.GetHostStatsAnswer; @@ -103,6 +107,8 @@ import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; import com.cloud.agent.api.RebootRouterCommand; +import com.cloud.agent.api.RevertToVMSnapshotAnswer; +import com.cloud.agent.api.RevertToVMSnapshotCommand; import com.cloud.agent.api.SetupAnswer; import com.cloud.agent.api.SetupCommand; import com.cloud.agent.api.SetupGuestNetworkAnswer; @@ -138,8 +144,8 @@ import com.cloud.agent.api.routing.SetNetworkACLCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesAnswer; import com.cloud.agent.api.routing.SetPortForwardingRulesCommand; import com.cloud.agent.api.routing.SetPortForwardingRulesVpcCommand; -import com.cloud.agent.api.routing.SetSourceNatCommand; import com.cloud.agent.api.routing.SetSourceNatAnswer; +import com.cloud.agent.api.routing.SetSourceNatCommand; import com.cloud.agent.api.routing.SetStaticNatRulesAnswer; import com.cloud.agent.api.routing.SetStaticNatRulesCommand; import com.cloud.agent.api.routing.Site2SiteVpnCfgCommand; @@ -153,6 +159,9 @@ import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; +import com.cloud.agent.api.storage.ResizeVolumeAnswer; +import com.cloud.agent.api.storage.ResizeVolumeCommand; +import com.cloud.agent.api.to.FirewallRuleTO; import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.PortForwardingRuleTO; @@ -183,6 +192,7 @@ import com.cloud.hypervisor.vmware.mo.VirtualSwitchType; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHost; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostNetworkSummary; import com.cloud.hypervisor.vmware.mo.VmwareHypervisorHostResourceSummary; +import com.cloud.hypervisor.vmware.resource.VmwareContextFactory; import com.cloud.hypervisor.vmware.util.VmwareContext; import com.cloud.hypervisor.vmware.util.VmwareGuestOsMapper; import com.cloud.hypervisor.vmware.util.VmwareHelper; @@ -190,6 +200,7 @@ import com.cloud.network.HAProxyConfigurator; import com.cloud.network.LoadBalancerConfigurator; import com.cloud.network.Networks; import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.rules.FirewallRule; import com.cloud.resource.ServerResource; import com.cloud.serializer.GsonHelper; import com.cloud.storage.Storage; @@ -200,7 +211,6 @@ import com.cloud.storage.template.TemplateInfo; import com.cloud.utils.DateUtil; import com.cloud.utils.Pair; import com.cloud.utils.StringUtils; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.ExceptionUtil; @@ -251,6 +261,7 @@ import com.vmware.vim25.VirtualMachinePowerState; import com.vmware.vim25.VirtualMachineRuntimeInfo; import com.vmware.vim25.VirtualSCSISharing; + public class VmwareResource implements StoragePoolResource, ServerResource, VmwareHostService { private static final Logger s_logger = Logger.getLogger(VmwareResource.class); @@ -258,7 +269,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa protected final long _ops_timeout = 900000; // 15 minutes time out to time protected final int _shutdown_waitMs = 300000; // wait up to 5 minutes for shutdown - + // out an operation protected final int _retry = 24; protected final int _sleep = 10000; @@ -279,11 +290,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa protected String _guestNetworkVSwitchName; protected VirtualSwitchType _vSwitchType = VirtualSwitchType.StandardVirtualSwitch; protected boolean _nexusVSwitch = false; - - protected float _cpuOverprovisioningFactor = 1; + protected boolean _fullCloneFlag = false; + protected boolean _reserveCpu = false; - - protected float _memOverprovisioningFactor = 1; + protected boolean _reserveMem = false; protected boolean _recycleHungWorker = false; protected DiskControllerType _rootDiskController = DiskControllerType.ide; @@ -313,11 +323,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa @Override public Answer executeRequest(Command cmd) { - if(s_logger.isTraceEnabled()) - s_logger.trace("Begin executeRequest(), cmd: " + cmd.getClass().getSimpleName()); - + if(s_logger.isTraceEnabled()) + s_logger.trace("Begin executeRequest(), cmd: " + cmd.getClass().getSimpleName()); + Answer answer = null; - NDC.push(_hostName != null ? _hostName : _guid + "(" + ComponentLocator.class.getPackage().getImplementationVersion() + ")"); + NDC.push(_hostName != null ? _hostName : _guid + "(" + this.getClass().getPackage().getImplementationVersion() + ")"); try { long cmdSequence = _cmdSequence++; Date startTime = DateUtil.currentGMTTime(); @@ -423,7 +433,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } else if (clz == CheckRouterCommand.class) { answer = execute((CheckRouterCommand) cmd); } else if (clz == SetFirewallRulesCommand.class) { - answer = execute((SetFirewallRulesCommand)cmd); + answer = execute((SetFirewallRulesCommand)cmd); } else if (clz == BumpUpPriorityCommand.class) { answer = execute((BumpUpPriorityCommand)cmd); } else if (clz == GetDomRVersionCmd.class) { @@ -442,12 +452,20 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa answer = execute((SetSourceNatCommand) cmd); } else if (clz == SetNetworkACLCommand.class) { answer = execute((SetNetworkACLCommand) cmd); - } else if (clz == SetPortForwardingRulesVpcCommand.class) { + } else if (cmd instanceof CreateVMSnapshotCommand) { + return execute((CreateVMSnapshotCommand)cmd); + } else if(cmd instanceof DeleteVMSnapshotCommand){ + return execute((DeleteVMSnapshotCommand)cmd); + } else if(cmd instanceof RevertToVMSnapshotCommand){ + return execute((RevertToVMSnapshotCommand)cmd); + }else if (clz == SetPortForwardingRulesVpcCommand.class) { answer = execute((SetPortForwardingRulesVpcCommand) cmd); } else if (clz == Site2SiteVpnCfgCommand.class) { answer = execute((Site2SiteVpnCfgCommand) cmd); } else if (clz == CheckS2SVpnConnectionsCommand.class) { answer = execute((CheckS2SVpnConnectionsCommand) cmd); + } else if (clz == ResizeVolumeCommand.class) { + return execute((ResizeVolumeCommand) cmd); } else { answer = Answer.createUnsupportedCommandAnswer(cmd); } @@ -472,8 +490,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa JmxUtil.unregisterMBean("VMware " + _morHyperHost.get_value(), "Command " + mbeanToRemove.getProp("Sequence") + "-" + mbeanToRemove.getProp("Name")); } } catch (Exception e) { - if(s_logger.isTraceEnabled()) - s_logger.trace("Unable to register JMX monitoring due to exception " + ExceptionUtil.toString(e)); + if(s_logger.isTraceEnabled()) + s_logger.trace("Unable to register JMX monitoring due to exception " + ExceptionUtil.toString(e)); } } @@ -481,12 +499,60 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa NDC.pop(); } - if(s_logger.isTraceEnabled()) - s_logger.trace("End executeRequest(), cmd: " + cmd.getClass().getSimpleName()); - + if(s_logger.isTraceEnabled()) + s_logger.trace("End executeRequest(), cmd: " + cmd.getClass().getSimpleName()); + return answer; } + private Answer execute(ResizeVolumeCommand cmd) { + String path = cmd.getPath(); + String vmName = cmd.getInstanceName(); + long newSize = cmd.getNewSize()/1024; + + try { + VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext()); + ManagedObjectReference morDc = hyperHost.getHyperHostDatacenter(); + // find VM through datacenter (VM is not at the target host yet) + VirtualMachineMO vmMo = hyperHost.findVmOnPeerHyperHost(vmName); + if (vmMo == null) { + String msg = "VM " + vmName + " does not exist in VMware datacenter"; + s_logger.error(msg); + throw new Exception(msg); + } + + Pair vdisk = vmMo.getDiskDevice(path, false); + if(vdisk == null) { + if(s_logger.isTraceEnabled()) + s_logger.trace("resize volume done (failed)"); + throw new Exception("No such disk device: " + path); + } + VirtualDisk disk = vdisk.first(); + long oldSize = disk.getCapacityInKB(); + if (newSize < oldSize){ + throw new Exception("VMware doesn't support shrinking volume from larger size: " + oldSize+ " MB to a smaller size: " + newSize + " MB"); + } else if(newSize == oldSize){ + return new ResizeVolumeAnswer(cmd, true, "success", newSize*1024); + } + disk.setCapacityInKB(newSize); + + VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); + VirtualDeviceConfigSpec deviceConfigSpec = new VirtualDeviceConfigSpec(); + deviceConfigSpec.setDevice(disk); + deviceConfigSpec.setOperation(VirtualDeviceConfigSpecOperation.edit); + vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec[] { deviceConfigSpec }); + if (!vmMo.configureVm(vmConfigSpec)) { + throw new Exception("Failed to configure VM to resize disk. vmName: " + vmName); + } + + return new ResizeVolumeAnswer(cmd, true, "success", newSize*1024); + } catch (Exception e) { + s_logger.error("Unable to resize volume",e); + String error = "failed to resize volume:" +e; + return new ResizeVolumeAnswer(cmd, false, error ); + } + } + protected Answer execute(CheckNetworkCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource CheckNetworkCommand " + _gson.toJson(cmd)); @@ -495,9 +561,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // TODO setup portgroup for private network needs to be done here now return new CheckNetworkAnswer(cmd, true , "Network Setup check by names is done"); } - + protected Answer execute(NetworkUsageCommand cmd) { - if ( cmd.isForVpc() ) { + if ( cmd.isForVpc() ) { return VPCNetworkUsage(cmd); } if (s_logger.isInfoEnabled()) { @@ -515,40 +581,40 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } protected NetworkUsageAnswer VPCNetworkUsage(NetworkUsageCommand cmd) { - String privateIp = cmd.getPrivateIP(); - String option = cmd.getOption(); - String publicIp = cmd.getGatewayIP(); + String privateIp = cmd.getPrivateIP(); + String option = cmd.getOption(); + String publicIp = cmd.getGatewayIP(); - String args = "-l " + publicIp+ " "; - if (option.equals("get")) { - args += "-g"; - } else if (option.equals("create")) { - args += "-c"; - String vpcCIDR = cmd.getVpcCIDR(); - args += " -v " + vpcCIDR; - } else if (option.equals("reset")) { - args += "-r"; - } else if (option.equals("vpn")) { - args += "-n"; - } else if (option.equals("remove")) { - args += "-d"; - } else { - return new NetworkUsageAnswer(cmd, "success", 0L, 0L); - } - try { - if (s_logger.isTraceEnabled()) { - s_logger.trace("Executing /opt/cloud/bin/vpc_netusage.sh " + args + " on DomR " + privateIp); - } - VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + String args = "-l " + publicIp+ " "; + if (option.equals("get")) { + args += "-g"; + } else if (option.equals("create")) { + args += "-c"; + String vpcCIDR = cmd.getVpcCIDR(); + args += " -v " + vpcCIDR; + } else if (option.equals("reset")) { + args += "-r"; + } else if (option.equals("vpn")) { + args += "-n"; + } else if (option.equals("remove")) { + args += "-d"; + } else { + return new NetworkUsageAnswer(cmd, "success", 0L, 0L); + } + try { + if (s_logger.isTraceEnabled()) { + s_logger.trace("Executing /opt/cloud/bin/vpc_netusage.sh " + args + " on DomR " + privateIp); + } + VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - Pair resultPair = SshHelper.sshExecute(privateIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_netusage.sh " + args); + Pair resultPair = SshHelper.sshExecute(privateIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null, "/opt/cloud/bin/vpc_netusage.sh " + args); - if (!resultPair.first()) { + if (!resultPair.first()) { throw new Exception(" vpc network usage plugin call failed "); - } - - if (option.equals("get") || option.equals("vpn")) { + } + + if (option.equals("get") || option.equals("vpn")) { String result = resultPair.second(); if (result == null || result.isEmpty()) { throw new Exception(" vpc network usage get returns empty "); @@ -566,10 +632,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } return new NetworkUsageAnswer(cmd, "success", 0L, 0L); } catch (Throwable e) { - s_logger.error("Unable to execute NetworkUsage command on DomR (" + privateIp + "), domR may not be ready yet. failure due to " - + VmwareHelper.getExceptionMessage(e), e); - } - return new NetworkUsageAnswer(cmd, "success", 0L, 0L); + s_logger.error("Unable to execute NetworkUsage command on DomR (" + privateIp + "), domR may not be ready yet. failure due to " + + VmwareHelper.getExceptionMessage(e), e); + } + return new NetworkUsageAnswer(cmd, "success", 0L, 0L); } protected Answer execute(SetPortForwardingRulesCommand cmd) { @@ -581,7 +647,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String args = ""; String[] results = new String[cmd.getRules().length]; int i = 0; - + boolean endResult = true; for (PortForwardingRuleTO rule : cmd.getRules()) { args += rule.revoked() ? " -D " : " -A "; @@ -614,58 +680,79 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new SetPortForwardingRulesAnswer(cmd, results, endResult); } - + protected SetFirewallRulesAnswer execute(SetFirewallRulesCommand cmd) { - String controlIp = getRouterSshControlIp(cmd); - String[] results = new String[cmd.getRules().length]; + String controlIp = getRouterSshControlIp(cmd); + String[] results = new String[cmd.getRules().length]; + FirewallRuleTO[] allrules = cmd.getRules(); + FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); - String[][] rules = cmd.generateFwRules(); - String args = ""; - args += " -F "; - StringBuilder sb = new StringBuilder(); - String[] fwRules = rules[0]; - if (fwRules.length > 0) { - for (int i = 0; i < fwRules.length; i++) { - sb.append(fwRules[i]).append(','); - } - args += " -a " + sb.toString(); - } + String[][] rules = cmd.generateFwRules(); + String args = ""; + args += " -F "; + if (trafficType == FirewallRule.TrafficType.Egress){ + args+= " -E "; + } - try { - VmwareManager mgr = getServiceContext().getStockObject( - VmwareManager.CONTEXT_STOCK_NAME); - Pair result = SshHelper.sshExecute(controlIp, - DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), - null, "/root/firewall_rule.sh " + args); + StringBuilder sb = new StringBuilder(); + String[] fwRules = rules[0]; + if (fwRules.length > 0) { + for (int i = 0; i < fwRules.length; i++) { + sb.append(fwRules[i]).append(','); + } + args += " -a " + sb.toString(); + } - if (s_logger.isDebugEnabled()) - s_logger.debug("Executing script on domain router " + controlIp - + ": /root/firewall_rule.sh " + args); + try { + VmwareManager mgr = getServiceContext().getStockObject( + VmwareManager.CONTEXT_STOCK_NAME); - if (!result.first()) { - s_logger.error("SetFirewallRulesCommand failure on setting one rule. args: " - + args); - //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails - for (int i=0; i < results.length; i++) { - results[i] = "Failed"; - } - - return new SetFirewallRulesAnswer(cmd, false, results); - } - } catch (Throwable e) { - s_logger.error("SetFirewallRulesCommand(args: " + args - + ") failed on setting one rule due to " - + VmwareHelper.getExceptionMessage(e), e); - //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails + Pair result = null; + + if (trafficType == FirewallRule.TrafficType.Egress){ + result = SshHelper.sshExecute(controlIp, + DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), + null, "/root/firewallRule_egress.sh " + args); + } else { + result = SshHelper.sshExecute(controlIp, + DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), + null, "/root/firewall_rule.sh " + args); + } + + if (s_logger.isDebugEnabled()) { + if (trafficType == FirewallRule.TrafficType.Egress){ + s_logger.debug("Executing script on domain router " + controlIp + + ": /root/firewallRule_egress.sh " + args); + } else { + s_logger.debug("Executing script on domain router " + controlIp + + ": /root/firewall_rule.sh " + args); + } + } + + if (!result.first()) { + s_logger.error("SetFirewallRulesCommand failure on setting one rule. args: " + + args); + //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails + for (int i=0; i < results.length; i++) { + results[i] = "Failed"; + } + + return new SetFirewallRulesAnswer(cmd, false, results); + } + } catch (Throwable e) { + s_logger.error("SetFirewallRulesCommand(args: " + args + + ") failed on setting one rule due to " + + VmwareHelper.getExceptionMessage(e), e); + //FIXME - in the future we have to process each rule separately; now we temporarily set every rule to be false if single rule fails for (int i=0; i < results.length; i++) { results[i] = "Failed"; } - return new SetFirewallRulesAnswer(cmd, false, results); - } + return new SetFirewallRulesAnswer(cmd, false, results); + } - return new SetFirewallRulesAnswer(cmd, true, results); + return new SetFirewallRulesAnswer(cmd, true, results); } - + protected Answer execute(SetStaticNatRulesCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource SetFirewallRuleCommand: " + _gson.toJson(cmd)); @@ -681,11 +768,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args += " -l " + rule.getSrcIp(); args += " -r " + rule.getDstIp(); - + if (rule.getProtocol() != null) { args += " -P " + rule.getProtocol().toLowerCase(); } - + args += " -d " + rule.getStringSrcPortRange(); args += " -G "; @@ -719,7 +806,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String controlIp = getRouterSshControlIp(cmd); - + assert(controlIp != null); LoadBalancerConfigurator cfgtr = new HAProxyConfigurator(); @@ -771,7 +858,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args += " -s " + sb.toString(); } - + Pair result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null, "scp " + tmpCfgFilePath + " /etc/haproxy/haproxy.cfg.new"); if (!result.first()) { @@ -948,7 +1035,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } Pair result = SshHelper.sshExecute(routerIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null, - "/opt/cloud/bin/vpc_guestnw.sh " + args); + "/opt/cloud/bin/vpc_guestnw.sh " + args); if (!result.first()) { String msg = "SetupGuestNetworkCommand on domain router " + routerIp + " failed. message: " + result.second(); @@ -1326,7 +1413,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (ip.isAdd()) { throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate IP with."); } else { - s_logger.debug("VIF to deassociate IP with does not exist, return success"); + s_logger.debug("VIF to deassociate IP with does not exist, return success"); return; } } @@ -1421,7 +1508,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa args += " -c "; args += "eth" + publicNicInfo.first(); - + args += " -g "; args += vlanGateway; @@ -1438,11 +1525,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } if (removeVif) { - - String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); - int nicMasks = Integer.parseInt(nicMasksStr); - nicMasks &= ~(1 << publicNicInfo.first().intValue()); - vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); + + String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); + int nicMasks = Integer.parseInt(nicMasksStr); + nicMasks &= ~(1 << publicNicInfo.first().intValue()); + vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); HostMO hostMo = vmMo.getRunningHost(); List networks = vmMo.getNetworksWithDetails(); @@ -1463,7 +1550,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa private void plugPublicNic(VirtualMachineMO vmMo, final String vlanId, final String vifMacAddress) throws Exception { // TODO : probably need to set traffic shaping Pair networkInfo = null; - + if (!_nexusVSwitch) { networkInfo = HypervisorHostHelper.prepareNetwork(this._publicNetworkVSwitchName, "cloud.public", vmMo.getRunningHost(), vlanId, null, null, this._ops_timeout, true); @@ -1495,40 +1582,40 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa deviceConfigSpecArray[0] = new VirtualDeviceConfigSpec(); deviceConfigSpecArray[0].setDevice(device); deviceConfigSpecArray[0].setOperation(VirtualDeviceConfigSpecOperation.edit); - + vmConfigSpec.setDeviceChange(deviceConfigSpecArray); if(!vmMo.configureVm(vmConfigSpec)) { throw new Exception("Failed to configure devices when plugPublicNic"); } } catch(Exception e) { - - // restore allocation mask in case of exceptions - String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); - int nicMasks = Integer.parseInt(nicMasksStr); - nicMasks &= ~(1 << nicIndex); - vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); - - throw e; + + // restore allocation mask in case of exceptions + String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); + int nicMasks = Integer.parseInt(nicMasksStr); + nicMasks &= ~(1 << nicIndex); + vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); + + throw e; } } - + private int allocPublicNicIndex(VirtualMachineMO vmMo) throws Exception { - String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); - if(nicMasksStr == null || nicMasksStr.isEmpty()) { - throw new Exception("Could not find NIC allocation info"); - } - - int nicMasks = Integer.parseInt(nicMasksStr); - VirtualDevice[] nicDevices = vmMo.getNicDevices(); - for(int i = 3; i < nicDevices.length; i++) { - if((nicMasks & (1 << i)) == 0) { - nicMasks |= (1 << i); - vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); - return i; - } - } - - throw new Exception("Could not allocate a free public NIC"); + String nicMasksStr = vmMo.getCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK); + if(nicMasksStr == null || nicMasksStr.isEmpty()) { + throw new Exception("Could not find NIC allocation info"); + } + + int nicMasks = Integer.parseInt(nicMasksStr); + VirtualDevice[] nicDevices = vmMo.getNicDevices(); + for(int i = 3; i < nicDevices.length; i++) { + if((nicMasks & (1 << i)) == 0) { + nicMasks |= (1 << i); + vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMasks)); + return i; + } + } + + throw new Exception("Could not allocate a free public NIC"); } protected Answer execute(IpAssocCommand cmd) { @@ -1554,7 +1641,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if(vmMo == null) { if(hyperHost instanceof HostMO) { ClusterMO clusterMo = new ClusterMO(hyperHost.getContext(), - ((HostMO)hyperHost).getParentMor()); + ((HostMO)hyperHost).getParentMor()); vmMo = clusterMo.findVmOnHyperHost(routerName); } } @@ -1584,7 +1671,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa protected Answer execute(SavePasswordCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource SavePasswordCommand. vmName: " + cmd.getVmName() + ", vmIp: " + cmd.getVmIpAddress() + ", password: " - + StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); + + StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); } String controlIp = getRouterSshControlIp(cmd); @@ -1597,7 +1684,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on domain router " + controlIp + ", /root/savepassword.sh " + args + " -p " + StringUtils.getMaskedPasswordForDisplay(cmd.getPassword())); } - + args += " -p " + password; @@ -1629,22 +1716,29 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } // ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domr "/root/edithosts.sh $mac $ip $vm $dfltrt $ns $staticrt" >/dev/null - String args = " " + cmd.getVmMac(); - args += " " + cmd.getVmIpAddress(); - args += " " + cmd.getVmName(); - - if (cmd.getDefaultRouter() != null) { - args += " " + cmd.getDefaultRouter(); + String args = " -m " + cmd.getVmMac(); + if (cmd.getVmIpAddress() != null) { + args += " -4 " + cmd.getVmIpAddress(); } - + args += " -h " + cmd.getVmName(); + + if (cmd.getDefaultRouter() != null) { + args += " -d " + cmd.getDefaultRouter(); + } + if (cmd.getDefaultDns() != null) { - args += " " + cmd.getDefaultDns(); + args += " -n " + cmd.getDefaultDns(); } if (cmd.getStaticRoutes() != null) { - args += " " + cmd.getStaticRoutes(); + args += " -s " + cmd.getStaticRoutes(); } + if (cmd.getVmIp6Address() != null) { + args += " -6 " + cmd.getVmIp6Address(); + args += " -u " + cmd.getDuid(); + } + if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on domR " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP) + ", /root/edithosts.sh " + args); } @@ -1673,7 +1767,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return new Answer(cmd); } - + protected CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd) { if (s_logger.isDebugEnabled()) { s_logger.debug("Executing resource CheckS2SVpnConnectionsCommand: " + _gson.toJson(cmd)); @@ -1736,7 +1830,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } return new CheckRouterAnswer(cmd, result.second(), true); } - + protected Answer execute(GetDomRVersionCmd cmd) { if (s_logger.isDebugEnabled()) { s_logger.debug("Executing resource GetDomRVersionCmd: " + _gson.toJson(cmd)); @@ -1770,7 +1864,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } return new GetDomRVersionAnswer(cmd, result.second(), lines[0], lines[1]); } - + protected Answer execute(BumpUpPriorityCommand cmd) { if (s_logger.isDebugEnabled()) { s_logger.debug("Executing resource BumpUpPriorityCommand: " + _gson.toJson(cmd)); @@ -1811,7 +1905,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String routerPrivateIpAddress = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); String controlIp = getRouterSshControlIp(cmd); - + String vmIpAddress = cmd.getVmIpAddress(); List vmData = cmd.getVmData(); String[] vmDataArgs = new String[vmData.size() * 2 + 4]; @@ -1937,7 +2031,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VirtualMachineTO vmSpec = cmd.getVirtualMachine(); String vmName = vmSpec.getName(); - + State state = State.Stopped; VmwareContext context = getServiceContext(); try { @@ -1950,8 +2044,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VirtualEthernetCardType nicDeviceType = VirtualEthernetCardType.valueOf(vmSpec.getDetails().get(VmDetailConstants.NIC_ADAPTER)); if(s_logger.isDebugEnabled()) - s_logger.debug("VM " + vmName + " will be started with NIC device type: " + nicDeviceType); - + s_logger.debug("VM " + vmName + " will be started with NIC device type: " + nicDeviceType); + VmwareHypervisorHost hyperHost = getHyperHost(context); VolumeTO[] disks = validateDisks(vmSpec.getDisks()); assert (disks.length > 0); @@ -1992,14 +2086,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa Pair rootDiskDataStoreDetails = null; for (VolumeTO vol : disks) { if (vol.getType() == Volume.Type.ROOT) { - rootDiskDataStoreDetails = dataStoresDetails.get(vol.getPoolUuid()); + rootDiskDataStoreDetails = dataStoresDetails.get(vol.getPoolUuid()); } } - assert (vmSpec.getSpeed() != null) && (rootDiskDataStoreDetails != null); - if (!hyperHost.createBlankVm(vmName, vmSpec.getCpus(), vmSpec.getSpeed().intValue(), - getReserveCpuMHz(vmSpec.getSpeed().intValue()), vmSpec.getLimitCpuUse(), ramMb, getReserveMemMB(ramMb), - translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).toString(), rootDiskDataStoreDetails.first(), false)) { + assert (vmSpec.getMinSpeed() != null) && (rootDiskDataStoreDetails != null); + if (!hyperHost.createBlankVm(vmName, vmSpec.getCpus(), vmSpec.getMaxSpeed().intValue(), + vmSpec.getMinSpeed(), vmSpec.getLimitCpuUse(),(int)(vmSpec.getMaxRam()/(1024*1024)), ramMb, + translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).toString(), rootDiskDataStoreDetails.first(), false)) { throw new Exception("Failed to create VM. vmName: " + vmName); } } @@ -2029,9 +2123,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec(); int ramMb = (int) (vmSpec.getMinRam() / (1024 * 1024)); - VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getSpeed().intValue(), - getReserveCpuMHz(vmSpec.getSpeed().intValue()), ramMb, getReserveMemMB(ramMb), - translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).toString(), vmSpec.getLimitCpuUse()); + VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(), + vmSpec.getMinSpeed(),(int) (vmSpec.getMaxRam()/(1024*1024)), ramMb, + translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).toString(), vmSpec.getLimitCpuUse()); VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[totalChangeDevices]; int i = 0; @@ -2049,7 +2143,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception(msg); } mgr.prepareSecondaryStorageStore(secStoreUrl); - + ManagedObjectReference morSecDs = prepareSecondaryDatastoreOnHost(secStoreUrl); if (morSecDs == null) { String msg = "Failed to prepare secondary storage on host, secondary store url: " + secStoreUrl; @@ -2059,15 +2153,15 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec(); Pair isoInfo = VmwareHelper.prepareIsoDevice(vmMo, String.format("[%s] systemvm/%s", secDsMo.getName(), mgr.getSystemVMIsoFileNameOnDatastore()), - secDsMo.getMor(), true, true, i, i + 1); + secDsMo.getMor(), true, true, i, i + 1); deviceConfigSpecArray[i].setDevice(isoInfo.first()); if (isoInfo.second()) { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at new device " + _gson.toJson(isoInfo.first())); + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at new device " + _gson.toJson(isoInfo.first())); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); } else { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.edit); } i++; @@ -2082,12 +2176,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa Pair isoInfo = VmwareHelper.prepareIsoDevice(vmMo, isoDatastoreInfo.first(), isoDatastoreInfo.second(), true, true, i, i + 1); deviceConfigSpecArray[i].setDevice(isoInfo.first()); if (isoInfo.second()) { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at new device " + _gson.toJson(isoInfo.first())); - deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at new device " + _gson.toJson(isoInfo.first())); + deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); } else { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.edit); } } else { @@ -2095,14 +2189,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa Pair isoInfo = VmwareHelper.prepareIsoDevice(vmMo, null, null, true, true, i, i + 1); deviceConfigSpecArray[i].setDevice(isoInfo.first()); if (isoInfo.second()) { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); - + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); + deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); } else { - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); - + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare ISO volume at existing device " + _gson.toJson(isoInfo.first())); + deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.edit); } } @@ -2116,15 +2210,15 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa controllerKey = ideControllerKey; } else { if(vol.getType() == Volume.Type.ROOT) { - if(vmSpec.getDetails() != null && vmSpec.getDetails().get(VmDetailConstants.ROOK_DISK_CONTROLLER) != null) - { - if(vmSpec.getDetails().get(VmDetailConstants.ROOK_DISK_CONTROLLER).equalsIgnoreCase("scsi")) - controllerKey = scsiControllerKey; - else - controllerKey = ideControllerKey; - } else { - controllerKey = scsiControllerKey; - } + if(vmSpec.getDetails() != null && vmSpec.getDetails().get(VmDetailConstants.ROOK_DISK_CONTROLLER) != null) + { + if(vmSpec.getDetails().get(VmDetailConstants.ROOK_DISK_CONTROLLER).equalsIgnoreCase("scsi")) + controllerKey = scsiControllerKey; + else + controllerKey = ideControllerKey; + } else { + controllerKey = scsiControllerKey; + } } else { // DATA volume always use SCSI device controllerKey = scsiControllerKey; @@ -2134,7 +2228,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (vol.getType() != Volume.Type.ISO) { Pair volumeDsDetails = dataStoresDetails.get(vol.getPoolUuid()); assert (volumeDsDetails != null); - VirtualDevice device; + VirtualDevice device; datastoreDiskPath = String.format("[%s] %s.vmdk", volumeDsDetails.second().getName(), vol.getPath()); String chainInfo = vol.getChainInfo(); @@ -2157,9 +2251,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa deviceConfigSpecArray[i].setDevice(device); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare volume at new device " + _gson.toJson(device)); - + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare volume at new device " + _gson.toJson(device)); + i++; } } @@ -2183,18 +2277,18 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Preparing NIC device on network " + networkInfo.second()); nic = VmwareHelper.prepareNicDevice(vmMo, networkInfo.first(), nicDeviceType, networkInfo.second(), nicTo.getMac(), i, i + 1, true, true); } - + deviceConfigSpecArray[i] = new VirtualDeviceConfigSpec(); deviceConfigSpecArray[i].setDevice(nic); deviceConfigSpecArray[i].setOperation(VirtualDeviceConfigSpecOperation.add); - - if(s_logger.isDebugEnabled()) - s_logger.debug("Prepare NIC at new device " + _gson.toJson(deviceConfigSpecArray[i])); - - // this is really a hacking for DomR, upon DomR startup, we will reset all the NIC allocation after eth3 + + if(s_logger.isDebugEnabled()) + s_logger.debug("Prepare NIC at new device " + _gson.toJson(deviceConfigSpecArray[i])); + + // this is really a hacking for DomR, upon DomR startup, we will reset all the NIC allocation after eth3 if(nicCount < 3) - nicMask |= (1 << nicCount); - + nicMask |= (1 << nicCount); + i++; nicCount++; } @@ -2202,34 +2296,34 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vmConfigSpec.setDeviceChange(deviceConfigSpecArray); // pass boot arguments through machine.id & perform customized options to VMX - + Map vmDetailOptions = validateVmDetails(vmSpec.getDetails()); OptionValue[] extraOptions = new OptionValue[2 + vmDetailOptions.size()]; extraOptions[0] = new OptionValue(); extraOptions[0].setKey("machine.id"); extraOptions[0].setValue(vmSpec.getBootArgs()); - + extraOptions[1] = new OptionValue(); extraOptions[1].setKey("devices.hotplug"); extraOptions[1].setValue("true"); int j = 2; for(Map.Entry entry : vmDetailOptions.entrySet()) { - extraOptions[j] = new OptionValue(); - extraOptions[j].setKey(entry.getKey()); - extraOptions[j].setValue(entry.getValue()); - j++; + extraOptions[j] = new OptionValue(); + extraOptions[j].setKey(entry.getKey()); + extraOptions[j].setValue(entry.getValue()); + j++; } - + String keyboardLayout = null; if(vmSpec.getDetails() != null) - keyboardLayout = vmSpec.getDetails().get(VmDetailConstants.KEYBOARD); + keyboardLayout = vmSpec.getDetails().get(VmDetailConstants.KEYBOARD); vmConfigSpec.setExtraConfig(configureVnc(extraOptions, hyperHost, vmName, vmSpec.getVncPassword(), keyboardLayout)); if (!vmMo.configureVm(vmConfigSpec)) { throw new Exception("Failed to configure VM before start. vmName: " + vmName); } - + vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, String.valueOf(nicMask)); if (!vmMo.powerOn()) { @@ -2257,46 +2351,32 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } } - + private Map validateVmDetails(Map vmDetails) { - Map validatedDetails = new HashMap(); - - if(vmDetails != null && vmDetails.size() > 0) { - for(Map.Entry entry : vmDetails.entrySet()) { - if("machine.id".equalsIgnoreCase(entry.getKey())) - continue; - else if("devices.hotplug".equalsIgnoreCase(entry.getKey())) - continue; - else if("RemoteDisplay.vnc.enabled".equalsIgnoreCase(entry.getKey())) - continue; - else if("RemoteDisplay.vnc.password".equalsIgnoreCase(entry.getKey())) - continue; - else if("RemoteDisplay.vnc.port".equalsIgnoreCase(entry.getKey())) - continue; - else if("RemoteDisplay.vnc.keymap".equalsIgnoreCase(entry.getKey())) - continue; - else - validatedDetails.put(entry.getKey(), entry.getValue()); - } - } - return validatedDetails; + Map validatedDetails = new HashMap(); + + if(vmDetails != null && vmDetails.size() > 0) { + for(Map.Entry entry : vmDetails.entrySet()) { + if("machine.id".equalsIgnoreCase(entry.getKey())) + continue; + else if("devices.hotplug".equalsIgnoreCase(entry.getKey())) + continue; + else if("RemoteDisplay.vnc.enabled".equalsIgnoreCase(entry.getKey())) + continue; + else if("RemoteDisplay.vnc.password".equalsIgnoreCase(entry.getKey())) + continue; + else if("RemoteDisplay.vnc.port".equalsIgnoreCase(entry.getKey())) + continue; + else if("RemoteDisplay.vnc.keymap".equalsIgnoreCase(entry.getKey())) + continue; + else + validatedDetails.put(entry.getKey(), entry.getValue()); + } + } + return validatedDetails; } - private int getReserveCpuMHz(int cpuMHz) { - if(this._reserveCpu) { - return (int)(cpuMHz / this._cpuOverprovisioningFactor); - } - - return 0; - } - - private int getReserveMemMB(int memMB) { - if(this._reserveMem) { - return (int)(memMB / this._memOverprovisioningFactor); - } - - return 0; - } + private NicTO[] sortNicsByDeviceId(NicTO[] nics) { @@ -2320,7 +2400,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return listForSort.toArray(new NicTO[0]); } - + private VolumeTO[] sortVolumesByDeviceId(VolumeTO[] volumes) { List listForSort = new ArrayList(); @@ -2384,38 +2464,38 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private Pair prepareNetworkFromNicInfo(HostMO hostMo, NicTO nicTo) throws Exception { - + Pair switchName = getTargetSwitch(nicTo); String namePrefix = getNetworkNamePrefix(nicTo); Pair networkInfo = null; s_logger.info("Prepare network on vSwitch: " + switchName + " with name prefix: " + namePrefix); - + if(!_nexusVSwitch) { - networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()), + networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout, !namePrefix.startsWith("cloud.private")); } else { - networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()), + networkInfo = HypervisorHostHelper.prepareNetwork(switchName.first(), namePrefix, hostMo, getVlanInfo(nicTo, switchName.second()), nicTo.getNetworkRateMbps(), nicTo.getNetworkRateMulticastMbps(), _ops_timeout); } - + return networkInfo; } - + // return Pair private Pair getTargetSwitch(NicTO nicTo) throws Exception { if(nicTo.getName() != null && !nicTo.getName().isEmpty()) { - String[] tokens = nicTo.getName().split(","); - - if(tokens.length == 2) { - return new Pair(tokens[0], tokens[1]); - } else { - return new Pair(nicTo.getName(), Vlan.UNTAGGED); - } + String[] tokens = nicTo.getName().split(","); + + if(tokens.length == 2) { + return new Pair(tokens[0], tokens[1]); + } else { + return new Pair(nicTo.getName(), Vlan.UNTAGGED); + } } - + if (nicTo.getType() == Networks.TrafficType.Guest) { return new Pair(this._guestNetworkVSwitchName, Vlan.UNTAGGED); } else if (nicTo.getType() == Networks.TrafficType.Control || nicTo.getType() == Networks.TrafficType.Management) { @@ -2430,7 +2510,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception("Unsupported traffic type: " + nicTo.getType().toString()); } } - + private String getNetworkNamePrefix(NicTO nicTo) throws Exception { if (nicTo.getType() == Networks.TrafficType.Guest) { return "cloud.guest"; @@ -2583,18 +2663,18 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource ReadyCommand: " + _gson.toJson(cmd)); } - + try { - VmwareContext context = getServiceContext(); - VmwareHypervisorHost hyperHost = getHyperHost(context); - if(hyperHost.isHyperHostConnected()) { + VmwareContext context = getServiceContext(); + VmwareHypervisorHost hyperHost = getHyperHost(context); + if(hyperHost.isHyperHostConnected()) { return new ReadyAnswer(cmd); - } else { - return new ReadyAnswer(cmd, "Host is not in connect state"); - } + } else { + return new ReadyAnswer(cmd, "Host is not in connect state"); + } } catch(Exception e) { - s_logger.error("Unexpected exception: ", e); - return new ReadyAnswer(cmd, VmwareHelper.getExceptionMessage(e)); + s_logger.error("Unexpected exception: ", e); + return new ReadyAnswer(cmd, VmwareHelper.getExceptionMessage(e)); } } @@ -2605,14 +2685,14 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareContext context = getServiceContext(); VmwareHypervisorHost hyperHost = getHyperHost(context); - + HostStatsEntry hostStats = new HostStatsEntry(cmd.getHostId(), 0, 0, 0, "host", 0, 0, 0, 0); Answer answer = new GetHostStatsAnswer(cmd, hostStats); try { HostStatsEntry entry = getHyperHostStats(hyperHost); if(entry != null) { - entry.setHostId(cmd.getHostId()); - answer = new GetHostStatsAnswer(cmd, entry); + entry.setHostId(cmd.getHostId()); + answer = new GetHostStatsAnswer(cmd, entry); } } catch (Exception e) { if (e instanceof RemoteException) { @@ -2646,9 +2726,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (requestedVmNames != null) { for (String vmName : requestedVmNames) { - if (newStates.get(vmName) != null) { - vmNames.add(vmName); - } + if (newStates.get(vmName) != null) { + vmNames.add(vmName); + } } } @@ -2712,19 +2792,18 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { vmMo.setCustomFieldValue(CustomFieldConstants.CLOUD_NIC_MASK, "0"); - + if (getVmState(vmMo) != State.Stopped) { - + // before we stop VM, remove all possible snapshots on the VM to let // disk chain be collapsed s_logger.info("Remove all snapshot before stopping VM " + cmd.getVmName()); - vmMo.removeAllSnapshots(); if (vmMo.safePowerOff(_shutdown_waitMs)) { state = State.Stopped; return new StopAnswer(cmd, "Stop VM " + cmd.getVmName() + " Succeed", 0, true); } else { - String msg = "Have problem in powering off VM " + cmd.getVmName() + ", let the process continue"; - s_logger.warn(msg); + String msg = "Have problem in powering off VM " + cmd.getVmName() + ", let the process continue"; + s_logger.warn(msg); return new StopAnswer(cmd, msg, 0, true); } } else { @@ -2896,7 +2975,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception(msg); } mgr.prepareSecondaryStorageStore(secStoreUrl); - + ManagedObjectReference morSecDs = prepareSecondaryDatastoreOnHost(secStoreUrl); if (morSecDs == null) { String msg = "Failed to prepare secondary storage on host, secondary store url: " + secStoreUrl; @@ -2974,9 +3053,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } private VmwareHypervisorHost getTargetHyperHost(DatacenterMO dcMo, String destIp) throws Exception { - + VmwareManager mgr = dcMo.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - + ObjectContent[] ocs = dcMo.getHostPropertiesOnDatacenterHostFolder(new String[] { "name", "parent" }); if (ocs != null && ocs.length > 0) { for (ObjectContent oc : ocs) { @@ -3011,8 +3090,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa ManagedObjectReference morDatastore = null; morDatastore = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, pool.getUuid()); if(morDatastore == null) - morDatastore = hyperHost.mountDatastore(pool.getType() == StoragePoolType.VMFS, pool.getHost(), - pool.getPort(), pool.getPath(), pool.getUuid().replace("-", "")); + morDatastore = hyperHost.mountDatastore(pool.getType() == StoragePoolType.VMFS, pool.getHost(), + pool.getPort(), pool.getPath(), pool.getUuid().replace("-", "")); assert (morDatastore != null); DatastoreSummary summary = new DatastoreMO(getServiceContext(), morDatastore).getSummary(); @@ -3040,9 +3119,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa StorageFilerTO pool = cmd.getPool(); try { - // We will leave datastore cleanup management to vCenter. Since for cluster VMFS datastore, it will always - // be mounted by vCenter. - + // We will leave datastore cleanup management to vCenter. Since for cluster VMFS datastore, it will always + // be mounted by vCenter. + // VmwareHypervisorHost hyperHost = this.getHyperHost(getServiceContext()); // hyperHost.unmountDatastore(pool.getUuid()); Answer answer = new Answer(cmd, true, "success"); @@ -3091,7 +3170,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (cmd.getAttach()) { vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs); } else { - vmMo.removeAllSnapshots(); + vmMo.removeAllSnapshots(); vmMo.detachDisk(datastoreVolumePath, false); } @@ -3133,7 +3212,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vmMo.mountToolsInstaller(); } else { try{ - vmMo.unmountToolsInstaller(); + vmMo.unmountToolsInstaller(); }catch(Throwable e){ vmMo.detachIso(null); } @@ -3176,13 +3255,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } if(cmd.isAttach()) { - String msg = "AttachIsoCommand(attach) failed due to " + VmwareHelper.getExceptionMessage(e); - s_logger.error(msg, e); - return new Answer(cmd, false, msg); + String msg = "AttachIsoCommand(attach) failed due to " + VmwareHelper.getExceptionMessage(e); + s_logger.error(msg, e); + return new Answer(cmd, false, msg); } else { - String msg = "AttachIsoCommand(detach) failed due to " + VmwareHelper.getExceptionMessage(e); - s_logger.warn(msg, e); - return new Answer(cmd, false, msg); + String msg = "AttachIsoCommand(detach) failed due to " + VmwareHelper.getExceptionMessage(e); + s_logger.warn(msg, e); + return new Answer(cmd, false, msg); } } } @@ -3270,7 +3349,42 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } + protected Answer execute(CreateVMSnapshotCommand cmd) { + try { + VmwareContext context = getServiceContext(); + VmwareManager mgr = context + .getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + return mgr.getStorageManager().execute(this, cmd); + } catch (Exception e) { + e.printStackTrace(); + return new CreateVMSnapshotAnswer(cmd, false, ""); + } + } + + protected Answer execute(DeleteVMSnapshotCommand cmd) { + try { + VmwareContext context = getServiceContext(); + VmwareManager mgr = context + .getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + + return mgr.getStorageManager().execute(this, cmd); + } catch (Exception e) { + e.printStackTrace(); + return new DeleteVMSnapshotAnswer(cmd, false, ""); + } + } + + protected Answer execute(RevertToVMSnapshotCommand cmd){ + try{ + VmwareContext context = getServiceContext(); + VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); + return mgr.getStorageManager().execute(this, cmd); + }catch (Exception e){ + e.printStackTrace(); + return new RevertToVMSnapshotAnswer(cmd,false,""); + } + } protected Answer execute(CreateVolumeFromSnapshotCommand cmd) { if (s_logger.isInfoEnabled()) { s_logger.info("Executing resource CreateVolumeFromSnapshotCommand: " + _gson.toJson(cmd)); @@ -3387,7 +3501,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } String msg = "Unable to execute GetStorageStatsCommand(storageId : " + cmd.getStorageId() + ", localPath: " + cmd.getLocalPath() + ", poolType: " + cmd.getPooltype() + ") due to " - + VmwareHelper.getExceptionMessage(e); + + VmwareHelper.getExceptionMessage(e); s_logger.error(msg, e); return new GetStorageStatsAnswer(cmd, msg); } @@ -3416,7 +3530,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa throw new Exception("Unable to find VM in vSphere, vm: " + cmd.getName()); } } - + Pair portInfo = vmMo.getVncPort(mgr.getManagementPortGroupByHost((HostMO)hyperHost)); if (s_logger.isTraceEnabled()) { @@ -3461,7 +3575,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); Pair result = SshHelper.sshExecute(controlIp, DEFAULT_DOMR_SSHPORT, "root", mgr.getSystemVMKeyFile(), null, "/bin/ping" + args); if(result.first()) - return new Answer(cmd); + return new Answer(cmd); } catch (Exception e) { s_logger.error("Unable to execute ping command on DomR (" + controlIp + "), domR may not be ready yet. failure due to " + VmwareHelper.getExceptionMessage(e), e); @@ -3551,7 +3665,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa ManagedObjectReference morDc = hyperHost.getHyperHostDatacenter(); ManagedObjectReference morCluster = hyperHost.getHyperHostCluster(); ClusterMO clusterMo = new ClusterMO(context, morCluster); - + if (cmd.getVolume().getType() == Volume.Type.ROOT) { String vmName = cmd.getVmName(); if (vmName != null) { @@ -3563,13 +3677,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa HostMO hostMo = vmMo.getRunningHost(); List networks = vmMo.getNetworksWithDetails(); - + // tear down all devices first before we destroy the VM to avoid accidently delete disk backing files if (getVmState(vmMo) != State.Stopped) - vmMo.safePowerOff(_shutdown_waitMs); + vmMo.safePowerOff(_shutdown_waitMs); vmMo.tearDownDevices(new Class[] { VirtualDisk.class, VirtualEthernetCard.class }); vmMo.destroy(); - + for (NetworkDetails netDetails : networks) { if (netDetails.getGCTag() != null && netDetails.getGCTag().equalsIgnoreCase("true")) { if (netDetails.getVMMorsOnNetwork() == null || netDetails.getVMMorsOnNetwork().length == 1) { @@ -3578,15 +3692,23 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } } - + if (s_logger.isInfoEnabled()) s_logger.info("Destroy volume by original name: " + cmd.getVolume().getPath() + ".vmdk"); dsMo.deleteFile(cmd.getVolume().getPath() + ".vmdk", morDc, true); - + // root volume may be created via linked-clone, delete the delta disk as well - if (s_logger.isInfoEnabled()) - s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-delta.vmdk"); + if (_fullCloneFlag) { + if (s_logger.isInfoEnabled()) { + s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-flat.vmdk"); + } + dsMo.deleteFile(cmd.getVolume().getPath() + "-flat.vmdk", morDc, true); + } else { + if (s_logger.isInfoEnabled()) { + s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-delta.vmdk"); + } dsMo.deleteFile(cmd.getVolume().getPath() + "-delta.vmdk", morDc, true); + } return new Answer(cmd, true, "Success"); } @@ -3594,13 +3716,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Destroy root volume directly from datastore"); } } else { - // evitTemplate will be converted into DestroyCommand, test if we are running in this case + // evitTemplate will be converted into DestroyCommand, test if we are running in this case VirtualMachineMO vmMo = clusterMo.findVmOnHyperHost(cmd.getVolume().getPath()); if (vmMo != null) { if (s_logger.isInfoEnabled()) s_logger.info("Destroy template volume " + cmd.getVolume().getPath()); - - vmMo.destroy(); + + vmMo.destroy(); return new Answer(cmd, true, "Success"); } } @@ -3622,9 +3744,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Empty disk chain info, fall back to try to delete by original backing file name"); } dsMo.deleteFile(cmd.getVolume().getPath() + ".vmdk", morDc, true); - + if (s_logger.isInfoEnabled()) { - s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-flat.vmdk"); + s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-flat.vmdk"); } dsMo.deleteFile(cmd.getVolume().getPath() + "-flat.vmdk", morDc, true); } @@ -3633,9 +3755,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.info("Destroy volume by original name: " + cmd.getVolume().getPath() + ".vmdk"); } dsMo.deleteFile(cmd.getVolume().getPath() + ".vmdk", morDc, true); - + if (s_logger.isInfoEnabled()) { - s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-flat.vmdk"); + s_logger.info("Destroy volume by derived name: " + cmd.getVolume().getPath() + "-flat.vmdk"); } dsMo.deleteFile(cmd.getVolume().getPath() + "-flat.vmdk", morDc, true); } @@ -3688,6 +3810,70 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } + + + private boolean createVMFullClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, + String vmdkName, ManagedObjectReference morDatastore, ManagedObjectReference morPool) throws Exception { + + if(dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmdkName)) + dsMo.deleteFile(String.format("[%s] %s/", dsMo.getName(), vmdkName), dcMo.getMor(), false); + + s_logger.info("creating full clone from template"); + if (!vmTemplate.createFullClone(vmdkName, dcMo.getVmFolder(), morPool, morDatastore)) { + String msg = "Unable to create full clone from the template"; + s_logger.error(msg); + throw new Exception(msg); + } + + // we can't rely on un-offical API (VirtualMachineMO.moveAllVmDiskFiles() any more, use hard-coded disk names that we know + // to move files + s_logger.info("Move volume out of volume-wrapper VM "); + dsMo.moveDatastoreFile(String.format("[%s] %s/%s.vmdk", dsMo.getName(), vmdkName, vmdkName), + dcMo.getMor(), dsMo.getMor(), + String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + + dsMo.moveDatastoreFile(String.format("[%s] %s/%s-flat.vmdk", dsMo.getName(), vmdkName, vmdkName), + dcMo.getMor(), dsMo.getMor(), + String.format("[%s] %s-flat.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + + return true; + } + + private boolean createVMLinkedClone(VirtualMachineMO vmTemplate, DatacenterMO dcMo, DatastoreMO dsMo, + String vmdkName, ManagedObjectReference morDatastore, ManagedObjectReference morPool) throws Exception { + + ManagedObjectReference morBaseSnapshot = vmTemplate.getSnapshotMor("cloud.template.base"); + if (morBaseSnapshot == null) { + String msg = "Unable to find template base snapshot, invalid template"; + s_logger.error(msg); + throw new Exception(msg); + } + + if(dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmdkName)) + dsMo.deleteFile(String.format("[%s] %s/", dsMo.getName(), vmdkName), dcMo.getMor(), false); + + s_logger.info("creating linked clone from template"); + if (!vmTemplate.createLinkedClone(vmdkName, morBaseSnapshot, dcMo.getVmFolder(), morPool, morDatastore)) { + String msg = "Unable to clone from the template"; + s_logger.error(msg); + throw new Exception(msg); + } + + // we can't rely on un-offical API (VirtualMachineMO.moveAllVmDiskFiles() any more, use hard-coded disk names that we know + // to move files + s_logger.info("Move volume out of volume-wrapper VM "); + dsMo.moveDatastoreFile(String.format("[%s] %s/%s.vmdk", dsMo.getName(), vmdkName, vmdkName), + dcMo.getMor(), dsMo.getMor(), + String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + + dsMo.moveDatastoreFile(String.format("[%s] %s/%s-delta.vmdk", dsMo.getName(), vmdkName, vmdkName), + dcMo.getMor(), dsMo.getMor(), + String.format("[%s] %s-delta.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); + + return true; + } + + @Override public synchronized CreateAnswer execute(CreateCommand cmd) { if (s_logger.isInfoEnabled()) { @@ -3744,40 +3930,19 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa s_logger.warn("Template host in vSphere is not in connected state, request template reload"); return new CreateAnswer(cmd, "Template host in vSphere is not in connected state, request template reload", true); } - + ManagedObjectReference morPool = hyperHost.getHyperHostOwnerResourcePool(); ManagedObjectReference morCluster = hyperHost.getHyperHostCluster(); - ManagedObjectReference morBaseSnapshot = vmTemplate.getSnapshotMor("cloud.template.base"); - if (morBaseSnapshot == null) { - String msg = "Unable to find template base snapshot, invalid template"; - s_logger.error(msg); - throw new Exception(msg); - } - - if(dsMo.folderExists(String.format("[%s]", dsMo.getName()), vmdkName)) - dsMo.deleteFile(String.format("[%s] %s/", dsMo.getName(), vmdkName), dcMo.getMor(), false); - - s_logger.info("create linked clone from template"); - if (!vmTemplate.createLinkedClone(vmdkName, morBaseSnapshot, dcMo.getVmFolder(), morPool, morDatastore)) { - String msg = "Unable to clone from the template"; - s_logger.error(msg); - throw new Exception(msg); + //createVMLinkedClone(vmTemplate, dcMo, dsMo, vmdkName, morDatastore, morPool); + if (!_fullCloneFlag) { + createVMLinkedClone(vmTemplate, dcMo, dsMo, vmdkName, morDatastore, morPool); + } else { + createVMFullClone(vmTemplate, dcMo, dsMo, vmdkName, morDatastore, morPool); } VirtualMachineMO vmMo = new ClusterMO(context, morCluster).findVmOnHyperHost(vmdkName); assert (vmMo != null); - // we can't rely on un-offical API (VirtualMachineMO.moveAllVmDiskFiles() any more, use hard-coded disk names that we know - // to move files - s_logger.info("Move volume out of volume-wrapper VM "); - dsMo.moveDatastoreFile(String.format("[%s] %s/%s.vmdk", dsMo.getName(), vmdkName, vmdkName), - dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); - - dsMo.moveDatastoreFile(String.format("[%s] %s/%s-delta.vmdk", dsMo.getName(), vmdkName, vmdkName), - dcMo.getMor(), dsMo.getMor(), - String.format("[%s] %s-delta.vmdk", dsMo.getName(), vmdkName), dcMo.getMor(), true); - s_logger.info("detach disks from volume-wrapper VM " + vmdkName); vmMo.detachAllDisks(); @@ -3879,13 +4044,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa VmwareContext context = getServiceContext(); VmwareHypervisorHost hyperHost = getHyperHost(context); VmwareManager mgr = hyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - + if(hyperHost.isHyperHostConnected()) { mgr.gcLeftOverVMs(context); - + if(_recycleHungWorker) { s_logger.info("Scan hung worker VM to recycle"); - + // GC worker that has been running for too long ObjectContent[] ocs = hyperHost.getVmPropertiesOnHyperHost( new String[] {"name", "config.template", "runtime.powerState", "runtime.bootTime"}); @@ -3897,7 +4062,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa boolean template = false; VirtualMachinePowerState powerState = VirtualMachinePowerState.poweredOff; GregorianCalendar bootTime = null; - + for(DynamicProperty prop : props) { if(prop.getName().equals("name")) name = prop.getVal().toString(); @@ -3908,19 +4073,19 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa else if(prop.getName().equals("runtime.bootTime")) bootTime = (GregorianCalendar)prop.getVal(); } - + if(!template && name.matches("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")) { boolean recycle = false; - + // recycle stopped worker VM and VM that has been running for too long (hard-coded 10 hours for now) if(powerState == VirtualMachinePowerState.poweredOff) recycle = true; else if(bootTime != null && (new Date().getTime() - bootTime.getTimeInMillis() > 10*3600*1000)) recycle = true; - + if(recycle) { s_logger.info("Recycle pending worker VM: " + name); - + VirtualMachineMO vmMo = new VirtualMachineMO(hyperHost.getContext(), oc.getObj()); vmMo.powerOff(); vmMo.destroy(); @@ -3932,7 +4097,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } else { s_logger.error("Host is no longer connected."); - return null; + return null; } } catch (Throwable e) { if (e instanceof RemoteException) { @@ -3953,25 +4118,25 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa @Override public StartupCommand[] initialize() { String hostApiVersion = "4.1"; - VmwareContext context = getServiceContext(); + VmwareContext context = getServiceContext(); try { VmwareHypervisorHost hyperHost = getHyperHost(context); assert(hyperHost instanceof HostMO); if(!((HostMO)hyperHost).isHyperHostConnected()) { - s_logger.info("Host " + hyperHost.getHyperHostName() + " is not in connected state"); - return null; + s_logger.info("Host " + hyperHost.getHyperHostName() + " is not in connected state"); + return null; } - + AboutInfo aboutInfo = ((HostMO)hyperHost).getHostAboutInfo(); hostApiVersion = aboutInfo.getApiVersion(); - + } catch (Exception e) { String msg = "VmwareResource intialize() failed due to : " + VmwareHelper.getExceptionMessage(e); s_logger.error(msg); invalidateServiceContext(); return null; } - + StartupRoutingCommand cmd = new StartupRoutingCommand(); fillHostInfo(cmd); @@ -3984,7 +4149,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa cmd.setHypervisorType(HypervisorType.VMware); cmd.setStateChanges(changes); cmd.setCluster(_cluster); - cmd.setVersion(hostApiVersion); + cmd.setHypervisorVersion(hostApiVersion); List storageCmds = initializeLocalStorage(); StartupCommand[] answerCmds = new StartupCommand[1 + storageCmds.size()]; @@ -4097,10 +4262,10 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa try { VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext()); - + assert(hyperHost instanceof HostMO); VmwareManager mgr = hyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - + VmwareHypervisorHostNetworkSummary summary = hyperHost.getHyperHostNetworkSummary(mgr.getManagementPortGroupByHost((HostMO)hyperHost)); if (summary == null) { throw new Exception("No ESX(i) host found"); @@ -4200,12 +4365,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (s_logger.isDebugEnabled()) { s_logger.debug("VM " + vm + " is now missing from host report but we detected that it might be migrated to other host by vCenter"); } - + if(oldState != State.Starting && oldState != State.Migrating) { s_logger.debug("VM " + vm + " is now missing from host report and VM is not at starting/migrating state, remove it from host VM-sync map, oldState: " + oldState); - _vms.remove(vm); + _vms.remove(vm); } else { - s_logger.debug("VM " + vm + " is missing from host report, but we will ignore VM " + vm + " in transition state " + oldState); + s_logger.debug("VM " + vm + " is missing from host report, but we will ignore VM " + vm + " in transition state " + oldState); } continue; } @@ -4248,76 +4413,76 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } protected OptionValue[] configureVnc(OptionValue[] optionsToMerge, VmwareHypervisorHost hyperHost, String vmName, - String vncPassword, String keyboardLayout) throws Exception { - + String vncPassword, String keyboardLayout) throws Exception { + VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(vmName); VmwareManager mgr = hyperHost.getContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME); if(!mgr.beginExclusiveOperation(600)) - throw new Exception("Unable to begin exclusive operation, lock time out"); - - try { - int maxVncPorts = 64; - int vncPort = 0; - Random random = new Random(); - - HostMO vmOwnerHost = vmMo.getRunningHost(); - - ManagedObjectReference morParent = vmOwnerHost.getParentMor(); - HashMap portInfo; - if(morParent.getType().equalsIgnoreCase("ClusterComputeResource")) { - ClusterMO clusterMo = new ClusterMO(vmOwnerHost.getContext(), morParent); - portInfo = clusterMo.getVmVncPortsOnCluster(); - } else { - portInfo = vmOwnerHost.getVmVncPortsOnHost(); - } - - // allocate first at 5900 - 5964 range - Collection existingPorts = portInfo.values(); - int val = random.nextInt(maxVncPorts); - int startVal = val; - do { - if (!existingPorts.contains(5900 + val)) { - vncPort = 5900 + val; - break; - } - - val = (++val) % maxVncPorts; - } while (val != startVal); - - if(vncPort == 0) { - s_logger.info("we've run out of range for ports between 5900-5964 for the cluster, we will try port range at 59000-60000"); + throw new Exception("Unable to begin exclusive operation, lock time out"); - Pair additionalRange = mgr.getAddiionalVncPortRange(); - maxVncPorts = additionalRange.second(); - val = random.nextInt(maxVncPorts); - startVal = val; - do { - if (!existingPorts.contains(additionalRange.first() + val)) { - vncPort = additionalRange.first() + val; - break; - } - - val = (++val) % maxVncPorts; - } while (val != startVal); - } - - if (vncPort == 0) { - throw new Exception("Unable to find an available VNC port on host"); - } - - if (s_logger.isInfoEnabled()) { - s_logger.info("Configure VNC port for VM " + vmName + ", port: " + vncPort + ", host: " + vmOwnerHost.getHyperHostName()); - } - - return VmwareHelper.composeVncOptions(optionsToMerge, true, vncPassword, vncPort, keyboardLayout); + try { + int maxVncPorts = 64; + int vncPort = 0; + Random random = new Random(); + + HostMO vmOwnerHost = vmMo.getRunningHost(); + + ManagedObjectReference morParent = vmOwnerHost.getParentMor(); + HashMap portInfo; + if(morParent.getType().equalsIgnoreCase("ClusterComputeResource")) { + ClusterMO clusterMo = new ClusterMO(vmOwnerHost.getContext(), morParent); + portInfo = clusterMo.getVmVncPortsOnCluster(); + } else { + portInfo = vmOwnerHost.getVmVncPortsOnHost(); + } + + // allocate first at 5900 - 5964 range + Collection existingPorts = portInfo.values(); + int val = random.nextInt(maxVncPorts); + int startVal = val; + do { + if (!existingPorts.contains(5900 + val)) { + vncPort = 5900 + val; + break; + } + + val = (++val) % maxVncPorts; + } while (val != startVal); + + if(vncPort == 0) { + s_logger.info("we've run out of range for ports between 5900-5964 for the cluster, we will try port range at 59000-60000"); + + Pair additionalRange = mgr.getAddiionalVncPortRange(); + maxVncPorts = additionalRange.second(); + val = random.nextInt(maxVncPorts); + startVal = val; + do { + if (!existingPorts.contains(additionalRange.first() + val)) { + vncPort = additionalRange.first() + val; + break; + } + + val = (++val) % maxVncPorts; + } while (val != startVal); + } + + if (vncPort == 0) { + throw new Exception("Unable to find an available VNC port on host"); + } + + if (s_logger.isInfoEnabled()) { + s_logger.info("Configure VNC port for VM " + vmName + ", port: " + vncPort + ", host: " + vmOwnerHost.getHyperHostName()); + } + + return VmwareHelper.composeVncOptions(optionsToMerge, true, vncPassword, vncPort, keyboardLayout); } finally { - try { - mgr.endExclusiveOperation(); - } catch(Throwable e) { - assert(false); - s_logger.error("Unexpected exception ", e); - } + try { + mgr.endExclusiveOperation(); + } catch(Throwable e) { + assert(false); + s_logger.error("Unexpected exception ", e); + } } } @@ -4362,7 +4527,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vlanId = tokens[2]; HypervisorHostHelper.prepareNetwork(this._privateNetworkVSwitchName, "cloud.private", - hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); + hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); } else { s_logger.info("Skip suspecious cloud network " + networkName); } @@ -4378,7 +4543,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vlanId = tokens[2]; HypervisorHostHelper.prepareNetwork(this._publicNetworkVSwitchName, "cloud.public", - hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); + hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); } else { s_logger.info("Skip suspecious cloud network " + networkName); } @@ -4395,7 +4560,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa vlanId = tokens[2]; HypervisorHostHelper.prepareNetwork(this._guestNetworkVSwitchName, "cloud.guest", - hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); + hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false); } else { s_logger.info("Skip suspecious cloud network " + networkName); } @@ -4404,7 +4569,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa } } } - + private HashMap getVmStates() throws Exception { VmwareHypervisorHost hyperHost = getHyperHost(getServiceContext()); ObjectContent[] ocs = hyperHost.getVmPropertiesOnHyperHost(new String[] { "name", "runtime.powerState", "config.template" }); @@ -4472,11 +4637,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa for (DynamicProperty objProp : objProps) { if (objProp.getName().equals("name")) { - name = objProp.getVal().toString(); + name = objProp.getVal().toString(); } else if (objProp.getName().equals("summary.config.numCpu")) { - numberCPUs = objProp.getVal().toString(); + numberCPUs = objProp.getVal().toString(); } else if (objProp.getName().equals("summary.quickStats.overallCpuUsage")) { - maxCpuUsage = objProp.getVal().toString(); + maxCpuUsage = objProp.getVal().toString(); } } @@ -4491,12 +4656,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa // get all the metrics from the available sample period PerfMetricId[] perfMetrics = service.queryAvailablePerfMetric(perfMgr, vmMor, null, null, null); if(perfMetrics != null) { - for(int index=0; index < perfMetrics.length; ++index) { - if ( ((rxPerfCounterInfo != null) && (perfMetrics[index].getCounterId() == rxPerfCounterInfo.getKey())) || - ((txPerfCounterInfo != null) && (perfMetrics[index].getCounterId() == txPerfCounterInfo.getKey())) ) { - vmNetworkMetrics.add(perfMetrics[index]); - } - } + for(int index=0; index < perfMetrics.length; ++index) { + if ( ((rxPerfCounterInfo != null) && (perfMetrics[index].getCounterId() == rxPerfCounterInfo.getKey())) || + ((txPerfCounterInfo != null) && (perfMetrics[index].getCounterId() == txPerfCounterInfo.getKey())) ) { + vmNetworkMetrics.add(perfMetrics[index]); + } + } } double networkReadKBs=0; @@ -4525,9 +4690,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if (vals[vi].getId().getCounterId() == txPerfCounterInfo.getKey()) { networkWriteKBs = sampleDuration * perfValues[3];//get the average TX rate multiplied by sampled duration } - } + } } - } + } } vmResponseMap.put(name, new VmStatsEntry(Integer.parseInt(maxCpuUsage), networkReadKBs, networkWriteKBs, Integer.parseInt(numberCPUs), "vm")); } @@ -4568,7 +4733,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return result.second(); } catch (Throwable e) { s_logger.error("Unable to execute NetworkUsage command on DomR (" + privateIpAddress + "), domR may not be ready yet. failure due to " - + VmwareHelper.getExceptionMessage(e), e); + + VmwareHelper.getExceptionMessage(e), e); } return null; @@ -4657,8 +4822,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa private static HostStatsEntry getHyperHostStats(VmwareHypervisorHost hyperHost) throws Exception { ComputeResourceSummary hardwareSummary = hyperHost.getHyperHostHardwareSummary(); if(hardwareSummary == null) - return null; - + return null; + HostStatsEntry entry = new HostStatsEntry(); entry.setEntityType("host"); @@ -4669,22 +4834,22 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa return entry; } - + private static String getRouterSshControlIp(NetworkElementCommand cmd) { - String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - String routerGuestIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP); - String zoneNetworkType = cmd.getAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE); - - if(routerGuestIp != null && zoneNetworkType != null && NetworkType.valueOf(zoneNetworkType) == NetworkType.Basic) { - if(s_logger.isDebugEnabled()) - s_logger.debug("In Basic zone mode, use router's guest IP for SSH control. guest IP : " + routerGuestIp); - - return routerGuestIp; - } - - if(s_logger.isDebugEnabled()) - s_logger.debug("Use router's private IP for SSH control. IP : " + routerIp); - return routerIp; + String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + String routerGuestIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_GUEST_IP); + String zoneNetworkType = cmd.getAccessDetail(NetworkElementCommand.ZONE_NETWORK_TYPE); + + if(routerGuestIp != null && zoneNetworkType != null && NetworkType.valueOf(zoneNetworkType) == NetworkType.Basic) { + if(s_logger.isDebugEnabled()) + s_logger.debug("In Basic zone mode, use router's guest IP for SSH control. guest IP : " + routerGuestIp); + + return routerGuestIp; + } + + if(s_logger.isDebugEnabled()) + s_logger.debug("Use router's private IP for SSH control. IP : " + routerIp); + return routerIp; } @Override @@ -4701,7 +4866,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa _dcId = (String) params.get("zone"); _pod = (String) params.get("pod"); _cluster = (String) params.get("cluster"); - + _guid = (String) params.get("guid"); String[] tokens = _guid.split("@"); _vCenterAddress = tokens[1]; @@ -4709,7 +4874,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa String[] hostTokens = tokens[0].split(":"); _morHyperHost.setType(hostTokens[0]); _morHyperHost.set_value(hostTokens[1]); - + VmwareContext context = getServiceContext(); try { VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); @@ -4718,9 +4883,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa CustomFieldsManagerMO cfmMo = new CustomFieldsManagerMO(context, context.getServiceContent().getCustomFieldsManager()); cfmMo.ensureCustomFieldDef("Datastore", CustomFieldConstants.CLOUD_UUID); if (mgr.getNexusVSwitchGlobalParameter()) { - cfmMo.ensureCustomFieldDef("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP); + cfmMo.ensureCustomFieldDef("DistributedVirtualPortgroup", CustomFieldConstants.CLOUD_GC_DVP); } else { - cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC); + cfmMo.ensureCustomFieldDef("Network", CustomFieldConstants.CLOUD_GC); } cfmMo.ensureCustomFieldDef("VirtualMachine", CustomFieldConstants.CLOUD_UUID); @@ -4754,36 +4919,35 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa if(_guestNetworkVSwitchName == null) { _guestNetworkVSwitchName = (String) params.get("guest.network.vswitch.name"); } - - String value = (String) params.get("cpu.overprovisioning.factor"); - if(value != null) - _cpuOverprovisioningFactor = Float.parseFloat(value); - value = (String) params.get("vmware.reserve.cpu"); + String value = (String) params.get("vmware.reserve.cpu"); if(value != null && value.equalsIgnoreCase("true")) _reserveCpu = true; - + value = (String) params.get("vmware.recycle.hung.wokervm"); if(value != null && value.equalsIgnoreCase("true")) _recycleHungWorker = true; - value = (String) params.get("mem.overprovisioning.factor"); - if(value != null) - _memOverprovisioningFactor = Float.parseFloat(value); - value = (String) params.get("vmware.reserve.mem"); if(value != null && value.equalsIgnoreCase("true")) _reserveMem = true; - + value = (String)params.get("vmware.root.disk.controller"); if(value != null && value.equalsIgnoreCase("scsi")) - _rootDiskController = DiskControllerType.scsi; + _rootDiskController = DiskControllerType.scsi; else - _rootDiskController = DiskControllerType.ide; + _rootDiskController = DiskControllerType.ide; value = params.get("vmware.use.nexus.vswitch").toString(); if(value != null && value.equalsIgnoreCase("true")) - _nexusVSwitch = true; + _nexusVSwitch = true; + + value = params.get("vmware.create.full.clone").toString(); + if (value != null && value.equalsIgnoreCase("true")) { + _fullCloneFlag = true; + } else { + _fullCloneFlag = false; + } s_logger.info("VmwareResource network configuration info. private vSwitch: " + _privateNetworkVSwitchName + ", public vSwitch: " + _publicNetworkVSwitchName + ", guest network: " + _guestNetworkVSwitchName); @@ -4825,25 +4989,25 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa _serviceContext = VmwareContextFactory.create(_vCenterAddress, _username, _password); VmwareHypervisorHost hyperHost = getHyperHost(_serviceContext, cmd); assert(hyperHost instanceof HostMO); - + HostFirewallSystemMO firewallMo = ((HostMO)hyperHost).getHostFirewallSystemMO(); boolean bRefresh = false; if(firewallMo != null) { - HostFirewallInfo firewallInfo = firewallMo.getFirewallInfo(); - if(firewallInfo != null) { - for(HostFirewallRuleset rule : firewallInfo.getRuleset()) { - if("vncServer".equalsIgnoreCase(rule.getKey())) { - bRefresh = true; - firewallMo.enableRuleset("vncServer"); - } else if("gdbserver".equalsIgnoreCase(rule.getKey())) { - bRefresh = true; - firewallMo.enableRuleset("gdbserver"); - } - } - } - - if(bRefresh) - firewallMo.refreshFirewall(); + HostFirewallInfo firewallInfo = firewallMo.getFirewallInfo(); + if(firewallInfo != null) { + for(HostFirewallRuleset rule : firewallInfo.getRuleset()) { + if("vncServer".equalsIgnoreCase(rule.getKey())) { + bRefresh = true; + firewallMo.enableRuleset("vncServer"); + } else if("gdbserver".equalsIgnoreCase(rule.getKey())) { + bRefresh = true; + firewallMo.enableRuleset("gdbserver"); + } + } + } + + if(bRefresh) + firewallMo.refreshFirewall(); } } catch (Exception e) { s_logger.error("Unable to connect to vSphere server: " + _vCenterAddress, e); @@ -4864,7 +5028,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa @Override public VmwareHypervisorHost getHyperHost(VmwareContext context, Command cmd) { if (_morHyperHost.getType().equalsIgnoreCase("HostSystem")) { - return new HostMO(context, _morHyperHost); + return new HostMO(context, _morHyperHost); } return new ClusterMO(context, _morHyperHost); } @@ -4877,8 +5041,38 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa assert(cmd != null); VmwareManager vmwareMgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME); - long checkPointId = vmwareMgr.pushCleanupCheckpoint(this._guid, vmName); - cmd.setContextParam("checkpoint", String.valueOf(checkPointId)); + // TODO: Fix this? long checkPointId = vmwareMgr.pushCleanupCheckpoint(this._guid, vmName); + // TODO: Fix this? cmd.setContextParam("checkpoint", String.valueOf(checkPointId)); return vmName; } + + @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/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java b/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java index 528075ea41a..e17d99d3184 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/CiscoNexusVSMDeviceManagerImpl.java @@ -18,6 +18,8 @@ package com.cloud.network; import java.util.List; +import javax.inject.Inject; + import org.apache.log4j.Logger; import com.cloud.agent.api.StartupCommand; @@ -36,7 +38,6 @@ import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.hypervisor.vmware.manager.VmwareManager; import com.cloud.resource.ResourceManager; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/dao/CiscoNexusVSMDeviceDaoImpl.java b/plugins/hypervisors/vmware/src/com/cloud/network/dao/CiscoNexusVSMDeviceDaoImpl.java index 7d8c5abfc07..cc25573dd2d 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/dao/CiscoNexusVSMDeviceDaoImpl.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/dao/CiscoNexusVSMDeviceDaoImpl.java @@ -20,6 +20,7 @@ import java.util.List; import javax.ejb.Local; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.network.CiscoNexusVSMDeviceVO; import com.cloud.utils.db.DB; @@ -28,6 +29,7 @@ import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value=CiscoNexusVSMDeviceDao.class) @DB(txn=false) public class CiscoNexusVSMDeviceDaoImpl extends GenericDaoBase implements CiscoNexusVSMDeviceDao { protected static final Logger s_logger = Logger.getLogger(CiscoNexusVSMDeviceDaoImpl.class); diff --git a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java index 68388a6fb18..daf7dd6bd40 100644 --- a/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java +++ b/plugins/hypervisors/vmware/src/com/cloud/network/element/CiscoNexusVSMElement.java @@ -25,8 +25,8 @@ import java.util.ArrayList; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; -import com.cloud.utils.PropertiesUtil; import org.apache.log4j.Logger; import com.cloud.api.commands.DeleteCiscoNexusVSMCmd; @@ -49,7 +49,6 @@ import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.dao.CiscoNexusVSMDeviceDao; -import com.cloud.utils.component.Inject; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; @@ -67,18 +66,18 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme private static final Logger s_logger = Logger.getLogger(CiscoNexusVSMElement.class); @Inject - CiscoNexusVSMDeviceDao _vsmDao; + CiscoNexusVSMDeviceDao _vsmDao; @Override public Map> getCapabilities() { return null; } - + @Override public Provider getProvider() { return null; } - + @Override public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) @@ -86,7 +85,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme InsufficientCapacityException { return true; } - + @Override public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, @@ -95,7 +94,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme InsufficientCapacityException { return true; } - + @Override public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, @@ -103,7 +102,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme ResourceUnavailableException { return true; } - + @Override public boolean shutdown(Network network, ReservationContext context, boolean cleanup) throws ConcurrentOperationException, @@ -116,7 +115,7 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme throws ConcurrentOperationException, ResourceUnavailableException { return true; } - + @Override public boolean isReady(PhysicalNetworkServiceProvider provider) { return true; @@ -128,19 +127,19 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme ResourceUnavailableException { return true; } - + @Override public boolean canEnableIndividualServices() { return true; } - + @Override public boolean verifyServicesCombination(Set services) { return true; } @Override - @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE, eventDescription = "deleting VSM", async = true) + @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DELETE, eventDescription = "deleting VSM", async = true) public boolean deleteCiscoNexusVSM(DeleteCiscoNexusVSMCmd cmd) { boolean result; try { @@ -151,16 +150,16 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme throw new CloudRuntimeException("Failed to delete specified VSM"); } return result; - } + } @Override - @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, eventDescription = "deleting VSM", async = true) + @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_ENABLE, eventDescription = "deleting VSM", async = true) public CiscoNexusVSMDeviceVO enableCiscoNexusVSM(EnableCiscoNexusVSMCmd cmd) { CiscoNexusVSMDeviceVO result; result = enableCiscoNexusVSM(cmd.getCiscoNexusVSMDeviceId()); return result; } - + @Override @ActionEvent(eventType = EventTypes.EVENT_EXTERNAL_SWITCH_MGMT_DEVICE_DISABLE, eventDescription = "deleting VSM", async = true) public CiscoNexusVSMDeviceVO disableCiscoNexusVSM(DisableCiscoNexusVSMCmd cmd) { @@ -168,16 +167,16 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme result = disableCiscoNexusVSM(cmd.getCiscoNexusVSMDeviceId()); return result; } - + @Override public List getCiscoNexusVSMs(ListCiscoNexusVSMsCmd cmd) { // If clusterId is defined, then it takes precedence, and we will return - // the VSM associated with this cluster. + // the VSM associated with this cluster. Long clusterId = cmd.getClusterId(); Long zoneId = cmd.getZoneId(); List result = new ArrayList(); - if (clusterId != null && clusterId.longValue() != 0) { + if (clusterId != null && clusterId.longValue() != 0) { // Find the VSM associated with this clusterId and return a list. CiscoNexusVSMDeviceVO vsm = getCiscoVSMbyClusId(cmd.getClusterId()); if (vsm == null) { @@ -186,13 +185,13 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme // Else, add it to a list and return the list. result.add(vsm); return result; - } + } // Else if there is only a zoneId defined, get a list of all vmware clusters // in the zone, and then for each cluster, pull the VSM and prepare a list. if (zoneId != null && zoneId.longValue() != 0) { - ManagementService ref = cmd.getMgmtServiceRef(); + ManagementService ref = cmd.getMgmtServiceRef(); List clusterList = ref.searchForClusters(zoneId, cmd.getStartIndex(), cmd.getPageSizeVal(), "VMware"); - + if (clusterList.size() == 0) { throw new CloudRuntimeException("No VMWare clusters found in the specified zone!"); } @@ -204,14 +203,14 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme } return result; } - + // If neither is defined, we will simply return the entire list of VSMs // configured in the management server. // TODO: Is this a safe thing to do? Only ROOT admin can invoke this call. - result = _vsmDao.listAllVSMs(); + result = _vsmDao.listAllVSMs(); return result; } - + @Override public CiscoNexusVSMResponse createCiscoNexusVSMResponse(CiscoNexusVSMDevice vsmDeviceVO) { CiscoNexusVSMResponse response = new CiscoNexusVSMResponse(); @@ -219,12 +218,12 @@ public class CiscoNexusVSMElement extends CiscoNexusVSMDeviceManagerImpl impleme response.setMgmtIpAddress(vsmDeviceVO.getipaddr()); return response; } - + public CiscoNexusVSMResponse createCiscoNexusVSMDetailedResponse(CiscoNexusVSMDevice vsmDeviceVO) { CiscoNexusVSMResponse response = new CiscoNexusVSMResponse(); response.setId(vsmDeviceVO.getUuid()); response.setDeviceName(vsmDeviceVO.getvsmName()); - response.setDeviceState(vsmDeviceVO.getvsmDeviceState().toString()); + response.setDeviceState(vsmDeviceVO.getvsmDeviceState().toString()); response.setMgmtIpAddress(vsmDeviceVO.getipaddr()); // The following values can be null, so check for that. if(vsmDeviceVO.getvsmConfigMode() != null) diff --git a/plugins/hypervisors/xen/pom.xml b/plugins/hypervisors/xen/pom.xml index 959c972e080..72d32f3029c 100644 --- a/plugins/hypervisors/xen/pom.xml +++ b/plugins/hypervisors/xen/pom.xml @@ -1,37 +1,41 @@ - - + + 4.0.0 cloud-plugin-hypervisor-xen Apache CloudStack Plugin - Hypervisor Xen org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml + + org.apache.cloudstack + cloud-engine-storage + ${project.version} + org.apache.cloudstack cloud-plugin-network-ovs ${project.version} + + org.apache.httpcomponents + httpclient + 4.2.2 + compile + org.apache.cloudstack xapi @@ -42,6 +46,6 @@ junit - + diff --git a/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java b/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java index d810c583b71..737b3b2890b 100755 --- a/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java +++ b/plugins/hypervisors/xen/src/com/cloud/ha/XenServerFencer.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; @@ -35,11 +36,11 @@ import com.cloud.host.Status; import com.cloud.host.dao.HostDao; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.resource.ResourceManager; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.VMInstanceVO; @Local(value=FenceBuilder.class) -public class XenServerFencer implements FenceBuilder { +public class XenServerFencer extends AdapterBase implements FenceBuilder { private static final Logger s_logger = Logger.getLogger(XenServerFencer.class); String _name; diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java index 585a18ce18f..8c38a696c00 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java @@ -17,15 +17,13 @@ package com.cloud.hypervisor; import javax.ejb.Local; +import javax.inject.Inject; import com.cloud.agent.api.to.VirtualMachineTO; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.storage.GuestOSVO; -import com.cloud.storage.Storage; import com.cloud.storage.dao.GuestOSDao; -import com.cloud.template.VirtualMachineTemplate; import com.cloud.template.VirtualMachineTemplate.BootloaderType; -import com.cloud.utils.component.Inject; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java index 48f9681d48c..c2f4923e7e6 100755 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/discoverer/XcpServerDiscoverer.java @@ -27,6 +27,7 @@ import java.util.Queue; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import javax.persistence.EntityExistsException; @@ -78,14 +79,13 @@ import com.cloud.resource.ResourceManager; import com.cloud.resource.ResourceStateAdapter; import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; +import com.cloud.storage.VMTemplateVO; import com.cloud.storage.Storage.ImageFormat; import com.cloud.storage.Storage.TemplateType; -import com.cloud.storage.VMTemplateVO; import com.cloud.storage.dao.VMTemplateDao; import com.cloud.storage.dao.VMTemplateHostDao; import com.cloud.user.Account; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.SearchCriteria.Op; import com.cloud.utils.db.SearchCriteria2; import com.cloud.utils.db.SearchCriteriaService; @@ -315,6 +315,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L params.put("wait", Integer.toString(_wait)); details.put("wait", Integer.toString(_wait)); params.put("migratewait", _configDao.getValue(Config.MigrateWait.toString())); + params.put(Config.XenMaxNics.toString().toLowerCase(), _configDao.getValue(Config.XenMaxNics.toString())); params.put(Config.InstanceName.toString().toLowerCase(), _instance); details.put(Config.InstanceName.toString().toLowerCase(), _instance); try { @@ -437,7 +438,7 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L if (prodBrand.equals("XenServer") && prodVersion.equals("6.0.2")) return new XenServer602Resource(); - + if (prodBrand.equals("XenServer") && prodVersion.equals("6.1.0")) return new XenServer610Resource(); @@ -449,18 +450,18 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L return new XenServer56FP1Resource(); } } - + if (prodBrand.equals("XCP_Kronos")) { return new XcpOssResource(); } - + String msg = "Only support XCP 1.0.0, 1.1.0, 1.5 beta; XenServer 5.6, XenServer 5.6 FP1, XenServer 5.6 SP2, Xenserver 6.0, 6.0.2, 6.1.0 but this one is " + prodBrand + " " + prodVersion; - _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg); - s_logger.debug(msg); - throw new RuntimeException(msg); + _alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg); + s_logger.debug(msg); + throw new RuntimeException(msg); } - + protected void serverConfig() { String value = _params.get(Config.XenSetupMultipath.key()); _setupMultipath = Boolean.parseBoolean(value); diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java index 66a5918b177..4a89806a49f 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java @@ -53,6 +53,9 @@ import javax.ejb.Local; import javax.naming.ConfigurationException; import javax.xml.parsers.DocumentBuilderFactory; +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; +import com.cloud.agent.api.to.*; +import com.cloud.network.rules.FirewallRule; import org.apache.log4j.Logger; import org.apache.xmlrpc.XmlRpcException; import org.w3c.dom.Document; @@ -87,9 +90,13 @@ import com.cloud.agent.api.Command; import com.cloud.agent.api.CreatePrivateTemplateFromSnapshotCommand; import com.cloud.agent.api.CreatePrivateTemplateFromVolumeCommand; import com.cloud.agent.api.CreateStoragePoolCommand; +import com.cloud.agent.api.CreateVMSnapshotAnswer; +import com.cloud.agent.api.CreateVMSnapshotCommand; import com.cloud.agent.api.CreateVolumeFromSnapshotAnswer; import com.cloud.agent.api.CreateVolumeFromSnapshotCommand; import com.cloud.agent.api.DeleteStoragePoolCommand; +import com.cloud.agent.api.DeleteVMSnapshotAnswer; +import com.cloud.agent.api.DeleteVMSnapshotCommand; import com.cloud.agent.api.GetDomRVersionAnswer; import com.cloud.agent.api.GetDomRVersionCmd; import com.cloud.agent.api.GetHostStatsAnswer; @@ -126,6 +133,8 @@ import com.cloud.agent.api.ReadyCommand; import com.cloud.agent.api.RebootAnswer; import com.cloud.agent.api.RebootCommand; import com.cloud.agent.api.RebootRouterCommand; +import com.cloud.agent.api.RevertToVMSnapshotAnswer; +import com.cloud.agent.api.RevertToVMSnapshotCommand; import com.cloud.agent.api.SecurityGroupRuleAnswer; import com.cloud.agent.api.SecurityGroupRulesCmd; import com.cloud.agent.api.SetupAnswer; @@ -182,6 +191,8 @@ import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer; import com.cloud.agent.api.storage.DestroyCommand; import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer; import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand; +import com.cloud.agent.api.storage.ResizeVolumeAnswer; +import com.cloud.agent.api.storage.ResizeVolumeCommand; import com.cloud.agent.api.to.IpAddressTO; import com.cloud.agent.api.to.NicTO; import com.cloud.agent.api.to.PortForwardingRuleTO; @@ -232,6 +243,7 @@ import com.cloud.utils.net.NetUtils; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine.State; +import com.cloud.vm.snapshot.VMSnapshot; import com.trilead.ssh2.SCPClient; import com.xensource.xenapi.Bond; import com.xensource.xenapi.Connection; @@ -251,6 +263,10 @@ import com.xensource.xenapi.Types; import com.xensource.xenapi.Types.BadServerResponse; import com.xensource.xenapi.Types.ConsoleProtocol; import com.xensource.xenapi.Types.IpConfigurationMode; +import com.xensource.xenapi.Types.OperationNotAllowed; +import com.xensource.xenapi.Types.SrFull; +import com.xensource.xenapi.Types.VbdType; +import com.xensource.xenapi.Types.VmBadPowerState; import com.xensource.xenapi.Types.VmPowerState; import com.xensource.xenapi.Types.XenAPIException; import com.xensource.xenapi.VBD; @@ -314,6 +330,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected boolean _canBridgeFirewall = false; protected boolean _isOvs = false; protected List _tmpDom0Vif = new ArrayList(); + protected XenServerStorageResource storageResource; + protected int _maxNics = 7; public enum SRType { NFS, LVM, ISCSI, ISO, LVMOISCSI, LVMOHBA, EXT, FILE; @@ -344,6 +362,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_statesTable.put(Types.VmPowerState.UNRECOGNIZED, State.Unknown); } + public XsHost getHost() { + return this._host; + } protected boolean cleanupHaltedVms(Connection conn) throws XenAPIException, XmlRpcException { Host host = Host.getByUuid(conn, _host.uuid); @@ -468,6 +489,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return execute((DeleteStoragePoolCommand) cmd); } else if (clazz == CopyVolumeCommand.class) { return execute((CopyVolumeCommand) cmd); + } else if (clazz == ResizeVolumeCommand.class) { + return execute((ResizeVolumeCommand) cmd); } else if (clazz == AttachVolumeCommand.class) { return execute((AttachVolumeCommand) cmd); } else if (clazz == AttachIsoCommand.class) { @@ -566,11 +589,111 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return execute((Site2SiteVpnCfgCommand) cmd); } else if (clazz == CheckS2SVpnConnectionsCommand.class) { return execute((CheckS2SVpnConnectionsCommand) cmd); + } else if (cmd instanceof StorageSubSystemCommand) { + return this.storageResource.handleStorageCommands((StorageSubSystemCommand)cmd); + } else if (clazz == CreateVMSnapshotCommand.class) { + return execute((CreateVMSnapshotCommand)cmd); + } else if (clazz == DeleteVMSnapshotCommand.class) { + return execute((DeleteVMSnapshotCommand)cmd); + } else if (clazz == RevertToVMSnapshotCommand.class) { + return execute((RevertToVMSnapshotCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } } + + + private Answer execute(RevertToVMSnapshotCommand cmd) { + String vmName = cmd.getVmName(); + List listVolumeTo = cmd.getVolumeTOs(); + VMSnapshot.Type vmSnapshotType = cmd.getTarget().getType(); + Boolean snapshotMemory = vmSnapshotType == VMSnapshot.Type.DiskAndMemory; + Connection conn = getConnection(); + VirtualMachine.State vmState = null; + VM vm = null; + try { + + // remove vm from s_vms, for delta sync + s_vms.remove(_cluster, _name, vmName); + + Set vmSnapshots = VM.getByNameLabel(conn, cmd.getTarget().getSnapshotName()); + if(vmSnapshots.size() == 0) + return new RevertToVMSnapshotAnswer(cmd, false, "Cannot find vmSnapshot with name: " + cmd.getTarget().getSnapshotName()); + + VM vmSnapshot = vmSnapshots.iterator().next(); + + // find target VM or creating a work VM + try { + vm = getVM(conn, vmName); + } catch (Exception e) { + vm = createWorkingVM(conn, vmName, cmd.getGuestOSType(), listVolumeTo); + } + + if (vm == null) { + return new RevertToVMSnapshotAnswer(cmd, false, + "Revert to VM Snapshot Failed due to can not find vm: " + vmName); + } + + // call plugin to execute revert + revertToSnapshot(conn, vmSnapshot, vmName, vm.getUuid(conn), snapshotMemory, _host.uuid); + vm = getVM(conn, vmName); + Set vbds = vm.getVBDs(conn); + Map vdiMap = new HashMap(); + // get vdi:vbdr to a map + for (VBD vbd : vbds) { + VBD.Record vbdr = vbd.getRecord(conn); + if (vbdr.type == Types.VbdType.DISK) { + VDI vdi = vbdr.VDI; + vdiMap.put(vbdr.userdevice, vdi); + } + } + + if (!snapshotMemory) { + vm.destroy(conn); + vmState = VirtualMachine.State.Stopped; + } else { + s_vms.put(_cluster, _name, vmName, State.Running); + vmState = VirtualMachine.State.Running; + } + + // after revert, VM's volumes path have been changed, need to report to manager + for (VolumeTO volumeTo : listVolumeTo) { + Long deviceId = volumeTo.getDeviceId(); + VDI vdi = vdiMap.get(deviceId.toString()); + volumeTo.setPath(vdi.getUuid(conn)); + } + + return new RevertToVMSnapshotAnswer(cmd, listVolumeTo,vmState); + } catch (Exception e) { + s_logger.error("revert vm " + vmName + + " to snapshot " + cmd.getTarget().getSnapshotName() + " failed due to " + e.getMessage()); + return new RevertToVMSnapshotAnswer(cmd, false, e.getMessage()); + } + } + + private String revertToSnapshot(Connection conn, VM vmSnapshot, + String vmName, String oldVmUuid, Boolean snapshotMemory, String hostUUID) + throws XenAPIException, XmlRpcException { + + String results = callHostPluginAsync(conn, "vmopsSnapshot", + "revert_memory_snapshot", 10 * 60 * 1000, "snapshotUUID", + vmSnapshot.getUuid(conn), "vmName", vmName, "oldVmUuid", + oldVmUuid, "snapshotMemory", snapshotMemory.toString(), "hostUUID", hostUUID); + String errMsg = null; + if (results == null || results.isEmpty()) { + errMsg = "revert_memory_snapshot return null"; + } else { + if (results.equals("0")) { + return results; + } else { + errMsg = "revert_memory_snapshot exception"; + } + } + s_logger.warn(errMsg); + throw new CloudRuntimeException(errMsg); + } + protected XsLocalNetwork getNativeNetworkForTraffic(Connection conn, TrafficType type, String name) throws XenAPIException, XmlRpcException { if (name != null) { if (s_logger.isDebugEnabled()) { @@ -588,7 +711,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new XsLocalNetwork(Network.getByUuid(conn, _host.privateNetwork), null, PIF.getByUuid(conn, _host.privatePif), null); } else if (type == TrafficType.Public) { return new XsLocalNetwork(Network.getByUuid(conn, _host.publicNetwork), null, PIF.getByUuid(conn, _host.publicPif), null); - } else if (type == TrafficType.Storage) { + } else if (type == TrafficType.Storage) { /* TrafficType.Storage is for secondary storage, while storageNetwork1 is for primary storage, we need better name here */ return new XsLocalNetwork(Network.getByUuid(conn, _host.storageNetwork1), null, PIF.getByUuid(conn, _host.storagePif1), null); } @@ -615,28 +738,28 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe // Create a VIF unless there's not already another VIF Set dom0Vifs = dom0.getVIFs(conn); for (VIF vif:dom0Vifs) { - vif.getRecord(conn); - if (vif.getNetwork(conn).getUuid(conn) == nw.getUuid(conn)) { - dom0vif = vif; - s_logger.debug("A VIF for dom0 has already been found - No need to create one"); - } + vif.getRecord(conn); + if (vif.getNetwork(conn).getUuid(conn) == nw.getUuid(conn)) { + dom0vif = vif; + s_logger.debug("A VIF for dom0 has already been found - No need to create one"); + } } if (dom0vif == null) { - s_logger.debug("Create a vif on dom0 for " + networkDesc); - VIF.Record vifr = new VIF.Record(); - vifr.VM = dom0; - vifr.device = getLowestAvailableVIFDeviceNum(conn, dom0); - if (vifr.device == null) { - s_logger.debug("Failed to create " + networkDesc + ", no vif available"); - return; - } - Map config = new HashMap(); - config.put("nameLabel", vifNameLabel); - vifr.otherConfig = config; - vifr.MAC = "FE:FF:FF:FF:FF:FF"; - vifr.network = nw; - - dom0vif = VIF.create(conn, vifr); + s_logger.debug("Create a vif on dom0 for " + networkDesc); + VIF.Record vifr = new VIF.Record(); + vifr.VM = dom0; + vifr.device = getLowestAvailableVIFDeviceNum(conn, dom0); + if (vifr.device == null) { + s_logger.debug("Failed to create " + networkDesc + ", no vif available"); + return; + } + Map config = new HashMap(); + config.put("nameLabel", vifNameLabel); + vifr.otherConfig = config; + vifr.MAC = "FE:FF:FF:FF:FF:FF"; + vifr.network = nw; + + dom0vif = VIF.create(conn, vifr); } // At this stage we surely have a VIF dom0vif.plug(conn); @@ -710,64 +833,64 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe * This method creates a XenServer network and configures it for being used as a L2-in-L3 tunneled network */ private synchronized Network configureTunnelNetwork(Connection conn, long networkId, long hostId, int key) { - try { - Network nw = findOrCreateTunnelNetwork(conn, key); - String nwName = "OVSTunnel" + key; - //Invoke plugin to setup the bridge which will be used by this network - String bridge = nw.getBridge(conn); - Map nwOtherConfig = nw.getOtherConfig(conn); - String configuredHosts = nwOtherConfig.get("ovs-host-setup"); - boolean configured = false; - if (configuredHosts!=null) { - String hostIdsStr[] = configuredHosts.split(","); - for (String hostIdStr:hostIdsStr) { - if (hostIdStr.equals(((Long)hostId).toString())) { - configured = true; - break; - } - } - } - if (!configured) { - // Plug dom0 vif only if not done before for network and host - enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key); - String result = callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge", "bridge", bridge, - "key", String.valueOf(key), - "xs_nw_uuid", nw.getUuid(conn), - "cs_host_id", ((Long)hostId).toString()); - //Note down the fact that the ovs bridge has been setup - String[] res = result.split(":"); - if (res.length != 2 || !res[0].equalsIgnoreCase("SUCCESS")) { - //TODO: Should make this error not fatal? - throw new CloudRuntimeException("Unable to pre-configure OVS bridge " + bridge + " for network ID:" + networkId + - " - " + res); - } - } - return nw; + try { + Network nw = findOrCreateTunnelNetwork(conn, key); + String nwName = "OVSTunnel" + key; + //Invoke plugin to setup the bridge which will be used by this network + String bridge = nw.getBridge(conn); + Map nwOtherConfig = nw.getOtherConfig(conn); + String configuredHosts = nwOtherConfig.get("ovs-host-setup"); + boolean configured = false; + if (configuredHosts!=null) { + String hostIdsStr[] = configuredHosts.split(","); + for (String hostIdStr:hostIdsStr) { + if (hostIdStr.equals(((Long)hostId).toString())) { + configured = true; + break; + } + } + } + if (!configured) { + // Plug dom0 vif only if not done before for network and host + enableXenServerNetwork(conn, nw, nwName, "tunnel network for account " + key); + String result = callHostPlugin(conn, "ovstunnel", "setup_ovs_bridge", "bridge", bridge, + "key", String.valueOf(key), + "xs_nw_uuid", nw.getUuid(conn), + "cs_host_id", ((Long)hostId).toString()); + //Note down the fact that the ovs bridge has been setup + String[] res = result.split(":"); + if (res.length != 2 || !res[0].equalsIgnoreCase("SUCCESS")) { + //TODO: Should make this error not fatal? + throw new CloudRuntimeException("Unable to pre-configure OVS bridge " + bridge + " for network ID:" + networkId + + " - " + res); + } + } + return nw; } catch (Exception e) { s_logger.warn("createandConfigureTunnelNetwork failed", e); return null; } } - + private synchronized void destroyTunnelNetwork(Connection conn, int key) { - try { - Network nw = findOrCreateTunnelNetwork(conn, key); + try { + Network nw = findOrCreateTunnelNetwork(conn, key); String bridge = nw.getBridge(conn); String result = callHostPlugin(conn, "ovstunnel", "destroy_ovs_bridge", "bridge", bridge); String[] res = result.split(":"); if (res.length != 2 || !res[0].equalsIgnoreCase("SUCCESS")) { - //TODO: Should make this error not fatal? - //Can Concurrent VM shutdown/migration/reboot events can cause this method - //to be executed on a bridge which has already been removed? - throw new CloudRuntimeException("Unable to remove OVS bridge " + bridge + ":" + res); + //TODO: Should make this error not fatal? + //Can Concurrent VM shutdown/migration/reboot events can cause this method + //to be executed on a bridge which has already been removed? + throw new CloudRuntimeException("Unable to remove OVS bridge " + bridge + ":" + res); } return; - } catch (Exception e) { + } catch (Exception e) { s_logger.warn("destroyTunnelNetwork failed:", e); return; - } + } } - + protected Network getNetwork(Connection conn, NicTO nic) throws XenAPIException, XmlRpcException { String name = nic.getName(); XsLocalNetwork network = getNativeNetworkForTraffic(conn, nic.getType(), name); @@ -795,13 +918,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return findOrCreateTunnelNetwork(conn, vnetId); } } else if (nic.getBroadcastType() == BroadcastDomainType.Storage) { - URI broadcastUri = nic.getBroadcastUri(); - if (broadcastUri == null) { - return network.getNetwork(); - } else { - long vlan = Long.parseLong(broadcastUri.getHost()); - return enableVlanNetwork(conn, vlan, network); - } + URI broadcastUri = nic.getBroadcastUri(); + if (broadcastUri == null) { + return network.getNetwork(); + } else { + long vlan = Long.parseLong(broadcastUri.getHost()); + return enableVlanNetwork(conn, vlan, network); + } } else if (nic.getBroadcastType() == BroadcastDomainType.Lswitch) { // Nicira Logical Switch return network.getNetwork(); @@ -881,26 +1004,26 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected VDI mount(Connection conn, String vmName, VolumeTO volume) throws XmlRpcException, XenAPIException { if (volume.getType() == Volume.Type.ISO) { - String isopath = volume.getPath(); - if (isopath == null) { - return null; - } - if (isopath.startsWith("xs-tools")) { - try { - Set vdis = VDI.getByNameLabel(conn, isopath); - if (vdis.isEmpty()) { - throw new CloudRuntimeException("Could not find ISO with URL: " + isopath); - } - return vdis.iterator().next(); + String isopath = volume.getPath(); + if (isopath == null) { + return null; + } + if (isopath.startsWith("xs-tools")) { + try { + Set vdis = VDI.getByNameLabel(conn, isopath); + if (vdis.isEmpty()) { + throw new CloudRuntimeException("Could not find ISO with URL: " + isopath); + } + return vdis.iterator().next(); + + } catch (XenAPIException e) { + throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString()); + } catch (Exception e) { + throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString()); + } + } - } catch (XenAPIException e) { - throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString()); - } catch (Exception e) { - throw new CloudRuntimeException("Unable to get pv iso: " + isopath + " due to " + e.toString()); - } - } - int index = isopath.lastIndexOf("/"); String mountpoint = isopath.substring(0, index); @@ -991,13 +1114,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe vm.setAffinity(conn, host); vm.removeFromOtherConfig(conn, "disks"); vm.setNameLabel(conn, vmSpec.getName()); - setMemory(conn, vm, vmSpec.getMinRam()); + setMemory(conn, vm, vmSpec.getMinRam(),vmSpec.getMaxRam()); vm.setVCPUsMax(conn, (long)vmSpec.getCpus()); vm.setVCPUsAtStartup(conn, (long)vmSpec.getCpus()); Map vcpuParams = new HashMap(); - Integer speed = vmSpec.getSpeed(); + Integer speed = vmSpec.getMinSpeed(); if (speed != null) { int cpuWeight = _maxWeight; //cpu_weight @@ -1172,11 +1295,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe for ( VM vm : vms ) { Set vbds = vm.getVBDs(conn); for( VBD vbd : vbds ) { - if (vbd.getType(conn) == Types.VbdType.CD ) { - vbd.eject(conn); - vbd.destroy(conn); - break; - } + if (vbd.getType(conn) == Types.VbdType.CD ) { + vbd.eject(conn); + vbd.destroy(conn); + break; + } } } } catch (Exception e) { @@ -1279,7 +1402,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vmName, State.Starting); + s_vms.put(_cluster, _name, vmName, State.Starting); } s_logger.debug("1. The VM " + vmName + " is in Starting state."); @@ -1301,7 +1424,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe startVM(conn, host, vm, vmName); if (_isOvs) { - // TODO(Salvatore-orlando): This code should go + // TODO(Salvatore-orlando): This code should go for (NicTO nic : vmSpec.getNics()) { if (nic.getBroadcastType() == Networks.BroadcastDomainType.Vswitch) { HashMap args = parseDefaultOvsRuleComamnd(nic.getBroadcastUri().toString().substring(Networks.BroadcastDomainType.Vswitch.scheme().length() + "://".length())); @@ -1325,7 +1448,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe boolean secGrpEnabled = false; for (NicTO nic : nics) { if (nic.isSecurityGroupEnabled() || (nic.getIsolationUri() != null - && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) { + && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString()))) { secGrpEnabled = true; break; } @@ -1344,7 +1467,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe NicTO[] nics = vmSpec.getNics(); for (NicTO nic : nics) { if ( nic.isSecurityGroupEnabled() || nic.getIsolationUri() != null - && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) { + && nic.getIsolationUri().getScheme().equalsIgnoreCase(IsolationType.Ec2.toString())) { result = callHostPlugin(conn, "vmops", "default_network_rules", "vmName", vmName, "vmIP", nic.getIp(), "vmMAC", nic.getMac(), "vmID", Long.toString(vmSpec.getId())); if (result == null || result.isEmpty() || !Boolean.parseBoolean(result)) { @@ -1367,10 +1490,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe synchronized (_cluster.intern()) { if (state != State.Stopped) { s_vms.put(_cluster, _name, vmName, state); - s_logger.debug("2. The VM " + vmName + " is in " + state + " state."); + s_logger.debug("2. The VM " + vmName + " is in " + state + " state."); } else { s_vms.remove(_cluster, _name, vmName); - s_logger.debug("The VM is in stopped state, detected problem during startup : " + vmName); + s_logger.debug("The VM is in stopped state, detected problem during startup : " + vmName); } } } @@ -1746,7 +1869,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe protected synchronized Answer execute(final DhcpEntryCommand cmd) { Connection conn = getConnection(); String args = "-r " + cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); + if (cmd.getVmIpAddress() != null) { args += " -v " + cmd.getVmIpAddress(); + } args += " -m " + cmd.getVmMac(); args += " -n " + cmd.getVmName(); if (cmd.getDefaultRouter() != null) { @@ -1755,9 +1880,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (cmd.getStaticRoutes() != null) { args += " -s " + cmd.getStaticRoutes(); } - + if (cmd.getDefaultDns() != null) { - args += " -N " + cmd.getDefaultDns(); + args += " -N " + cmd.getDefaultDns(); + } + + if (cmd.getVmIp6Address() != null) { + args += " -6 " + cmd.getVmIp6Address(); + args += " -u " + cmd.getDuid(); } String result = callHostPlugin(conn, "vmops", "saveDhcpEntry", "args", args); @@ -1935,10 +2065,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -c "; args += "eth" + correctVif.getDevice(conn); - + args += " -g "; args += vlanGateway; - + String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); if (result == null || result.isEmpty()) { @@ -1974,7 +2104,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe try { VM router = getVM(conn, vmName); - + VIF correctVif = getVifByMac(conn, router, ip.getVifMacAddress()); if (correctVif == null) { if (ip.isAdd()) { @@ -1984,7 +2114,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return; } } - + String args = "vpc_ipassoc.sh " + routerIp; if (ip.isAdd()) { @@ -1998,14 +2128,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -c "; args += "eth" + correctVif.getDevice(conn); - + args += " -g "; args += ip.getVlanGateway(); - + args += " -m "; args += Long.toString(NetUtils.getCidrSize(ip.getVlanNetmask())); - - + + args += " -n "; args += NetUtils.getSubNet(ip.getPublicIp(), ip.getVlanNetmask()); @@ -2019,7 +2149,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new Exception(msg); } } - + protected String networkUsage(Connection conn, final String privateIpAddress, final String option, final String vif) { if (option.equals("get")) { @@ -2056,9 +2186,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe try { Set vms = VM.getByNameLabel(conn, cmd.getName()); if(vms.size() == 1) { - int vncport = getVncPort(conn, vms.iterator().next()); - String consoleurl; - consoleurl = "consoleurl=" +getVncUrl(conn, vms.iterator().next()) + "&" +"sessionref="+ conn.getSessionReference(); + int vncport = getVncPort(conn, vms.iterator().next()); + String consoleurl; + consoleurl = "consoleurl=" +getVncUrl(conn, vms.iterator().next()) + "&" +"sessionref="+ conn.getSessionReference(); return new GetVncPortAnswer(cmd, consoleurl, vncport); } else { return new GetVncPortAnswer(cmd, "There are " + vms.size() + " VMs named " + cmd.getName()); @@ -2534,7 +2664,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe synchronized (_cluster.intern()) { s_vms.put(_cluster, _name, vmName, State.Running); } - s_logger.debug("3. The VM " + vmName + " is in Running state"); + s_logger.debug("3. The VM " + vmName + " is in Running state"); } return new CheckVirtualMachineAnswer(cmd, state, vncPort); @@ -2556,7 +2686,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe getNetwork(conn, nic); } synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vm.getName(), State.Migrating); + s_vms.put(_cluster, _name, vm.getName(), State.Migrating); } s_logger.debug("4. The VM " + vm.getName() + " is in Migrating state"); @@ -2628,7 +2758,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(errMsg); throw new CloudRuntimeException(errMsg); } - + boolean killCopyProcess(Connection conn, String nameLabel) { String results = callHostPluginAsync(conn, "vmops", "kill_copy_process", 60, "namelabel", nameLabel); @@ -2821,9 +2951,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe State state = null; state = s_vms.getState(_cluster, vmName); - + synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vmName, State.Stopping); + s_vms.put(_cluster, _name, vmName, State.Stopping); } s_logger.debug("5. The VM " + vmName + " is in Stopping state"); try { @@ -2863,10 +2993,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(msg, e); return new MigrateAnswer(cmd, false, msg, null); } finally { - synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vmName, state); - } - s_logger.debug("6. The VM " + vmName + " is in " + state + " state"); + synchronized (_cluster.intern()) { + s_vms.put(_cluster, _name, vmName, state); + } + s_logger.debug("6. The VM " + vmName + " is in " + state + " state"); } } @@ -2965,8 +3095,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe record = vm.getRecord(conn); Set consoles = record.consoles; if (consoles.isEmpty()) { - s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription); - return -1; + s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription); + return -1; } Iterator i = consoles.iterator(); } catch (XenAPIException e) { @@ -2991,23 +3121,23 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe vncport = vncport.replace("\n", ""); return NumbersUtil.parseInt(vncport, -1); } - + protected String getVncUrl(Connection conn, VM vm) { VM.Record record; Console c; try { record = vm.getRecord(conn); Set consoles = record.consoles; - + if (consoles.isEmpty()) { - s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription); - return null; + s_logger.warn("There are no Consoles available to the vm : " + record.nameDescription); + return null; } Iterator i = consoles.iterator(); while(i.hasNext()) { - c = i.next(); - if(c.getProtocol(conn) == ConsoleProtocol.RFB) - return c.getLocation(conn); + c = i.next(); + if(c.getProtocol(conn) == ConsoleProtocol.RFB) + return c.getLocation(conn); } } catch (XenAPIException e) { String msg = "Unable to get console url due to " + e.toString(); @@ -3018,14 +3148,14 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(msg, e); return null; } - return null; + return null; } @Override public RebootAnswer execute(RebootCommand cmd) { Connection conn = getConnection(); synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, cmd.getVmName(), State.Starting); + s_vms.put(_cluster, _name, cmd.getVmName(), State.Starting); } s_logger.debug("7. The VM " + cmd.getVmName() + " is in Starting state"); try { @@ -3050,9 +3180,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } return new RebootAnswer(cmd, "reboot succeeded", true); } finally { - synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, cmd.getVmName(), State.Running); - } + synchronized (_cluster.intern()) { + s_vms.put(_cluster, _name, cmd.getVmName(), State.Running); + } s_logger.debug("8. The VM " + cmd.getVmName() + " is in Running state"); } } @@ -3123,8 +3253,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - protected void setMemory(Connection conn, VM vm, long memsize) throws XmlRpcException, XenAPIException { - vm.setMemoryLimits(conn, memsize, memsize, memsize, memsize); + protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException { + vm.setMemoryLimits(conn, maxMemsize, maxMemsize, minMemsize, maxMemsize); } private void waitForTask(Connection c, Task task, long pollInterval, long timeout) throws XenAPIException, XmlRpcException { @@ -3514,10 +3644,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } if (vms.size() == 0) { - synchronized (_cluster.intern()) { - s_logger.info("VM does not exist on XenServer" + _host.uuid); - s_vms.remove(_cluster, _name, vmName); - } + synchronized (_cluster.intern()) { + s_logger.info("VM does not exist on XenServer" + _host.uuid); + s_vms.remove(_cluster, _name, vmName); + } return new StopAnswer(cmd, "VM does not exist", 0 , true); } for (VM vm : vms) { @@ -3536,9 +3666,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } State state = s_vms.getState(_cluster, vmName); - + synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vmName, State.Stopping); + s_vms.put(_cluster, _name, vmName, State.Stopping); } s_logger.debug("9. The VM " + vmName + " is in Stopping state"); @@ -3599,10 +3729,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String msg = "VM destroy failed in Stop " + vmName + " Command due to " + e.getMessage(); s_logger.warn(msg, e); } finally { - synchronized (_cluster.intern()) { - s_vms.put(_cluster, _name, vmName, state); - } - s_logger.debug("10. The VM " + vmName + " is in " + state + " state"); + synchronized (_cluster.intern()) { + s_vms.put(_cluster, _name, vmName, state); + } + s_logger.debug("10. The VM " + vmName + " is in " + state + " state"); } } } @@ -3713,22 +3843,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new CloudRuntimeException("Could not find an available slot in VM with name to attach a new disk."); } - - protected String getUnusedVIFNum(Connection conn, VM vm) { - String vmName = ""; - try { - vmName = vm.getNameLabel(conn); - Set allowedVIFDevices = vm.getAllowedVIFDevices(conn); - if (allowedVIFDevices.size() > 0) { - return allowedVIFDevices.iterator().next(); - } - } catch (Exception e) { - String msg = "getUnusedVIFNum failed due to " + e.toString(); - s_logger.warn(msg, e); - } - throw new CloudRuntimeException("Could not find available VIF slot in VM with name: " + vmName + " to plug a VIF"); - } - protected String callHostPlugin(Connection conn, String plugin, String cmd, String... params) { Map args = new HashMap(); String msg; @@ -3823,7 +3937,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return null; } - + protected VIF getCorrectVif(Connection conn, VM router, IpAddressTO ip) throws XmlRpcException, XenAPIException { NicTO nic = new NicTO(); nic.setType(ip.getTrafficType()); @@ -3846,7 +3960,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } return null; } - + protected VIF getVifByMac(Connection conn, VM router, String mac) throws XmlRpcException, XenAPIException { Set routerVIFs = router.getVIFs(conn); mac = mac.trim(); @@ -3860,22 +3974,29 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected String getLowestAvailableVIFDeviceNum(Connection conn, VM vm) { + String vmName = ""; try { - Set availableDeviceNums = vm.getAllowedVIFDevices(conn); - Iterator deviceNumsIterator = availableDeviceNums.iterator(); - List sortedDeviceNums = new ArrayList(); - - while (deviceNumsIterator.hasNext()) { - try { - sortedDeviceNums.add(Integer.valueOf(deviceNumsIterator.next())); + vmName = vm.getNameLabel(conn); + List usedDeviceNums = new ArrayList(); + Set vifs = vm.getVIFs(conn); + Iterator vifIter = vifs.iterator(); + while(vifIter.hasNext()){ + VIF vif = vifIter.next(); + try{ + usedDeviceNums.add(Integer.valueOf(vif.getDevice(conn))); } catch (NumberFormatException e) { - s_logger.debug("Obtained an invalid value for an available VIF device number for VM: " + vm.getNameLabel(conn)); - return null; + String msg = "Obtained an invalid value for an allocated VIF device number for VM: " + vmName; + s_logger.debug(msg, e); + throw new CloudRuntimeException(msg); } } - Collections.sort(sortedDeviceNums); - return String.valueOf(sortedDeviceNums.get(0)); + for(Integer i=0; i< _maxNics; i++){ + if(!usedDeviceNums.contains(i)){ + s_logger.debug("Lowest available Vif device number: "+i+" for VM: " + vmName); + return i.toString(); + } + } } catch (XmlRpcException e) { String msg = "Caught XmlRpcException: " + e.getMessage(); s_logger.warn(msg, e); @@ -3884,7 +4005,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(msg, e); } - return null; + throw new CloudRuntimeException("Could not find available VIF slot in VM with name: " + vmName); } protected VDI mount(Connection conn, StoragePoolType pooltype, String volumeFolder, String volumePath) { @@ -4229,7 +4350,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } Connection conn = getConnection(); if (!_canBridgeFirewall && !_isOvs) { - return new PingRoutingCommand(getType(), id, null); + return new PingRoutingCommand(getType(), id, null); } else if (_isOvs) { List>ovsStates = ovsFullSyncStates(); return new PingRoutingWithOvsCommand(getType(), id, null, ovsStates); @@ -4478,7 +4599,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe cmd.setHypervisorType(HypervisorType.XenServer); cmd.setCluster(_cluster); cmd.setPoolSync(false); - + Pool pool; try { pool = Pool.getByUuid(conn, _host.pool); @@ -4486,8 +4607,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Host.Record hostr = poolr.master.getRecord(conn); if (_host.uuid.equals(hostr.uuid)) { - HashMap> allStates=fullClusterSync(conn); - cmd.setClusterVMStateChanges(allStates); + HashMap> allStates=fullClusterSync(conn); + cmd.setClusterVMStateChanges(allStates); } } catch (Throwable e) { s_logger.warn("Check for master failed, failing the FULL Cluster sync command"); @@ -4693,6 +4814,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new CloudRuntimeException("Unable to authenticate"); } + com.trilead.ssh2.Session session = sshConnection.openSession(); SCPClient scp = new SCPClient(sshConnection); List files = getPatchFiles(); @@ -4741,6 +4863,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (s_logger.isDebugEnabled()) { s_logger.debug("Copying " + f + " to " + d + " on " + hr.address + " with permission " + p); } + try { + session.execCommand("mkdir -m 700 -p " + d); + } catch (IOException e) { + s_logger.debug("Unable to create destination path: " + d + " on " + hr.address + " but trying anyway"); + + } scp.put(f, d, p); } @@ -5049,7 +5177,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe boolean add = cmd.getAdd(); if( add ) { try { - SR sr = getStorageRepository(conn, pool); + SR sr = getStorageRepository(conn, pool.getUuid()); setupHeartbeatSr(conn, sr, false); long capacity = sr.getPhysicalSize(conn); long available = capacity - sr.getPhysicalUtilisation(conn); @@ -5072,7 +5200,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } else { try { - SR sr = getStorageRepository(conn, pool); + SR sr = getStorageRepository(conn, pool.getUuid()); String srUuid = sr.getUuid(conn); String result = callHostPluginPremium(conn, "setup_heartbeat_file", "host", _host.uuid, "sr", srUuid, "add", "false"); if (result == null || !result.split("#")[1].equals("0")) { @@ -5097,28 +5225,28 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return Boolean.valueOf(callHostPlugin(conn, "vmops", "can_bridge_firewall", "host_uuid", _host.uuid, "instance", _instance)); } - + private Answer execute(OvsSetupBridgeCommand cmd) { Connection conn = getConnection(); findOrCreateTunnelNetwork(conn, cmd.getKey()); configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getHostId(), cmd.getKey()); s_logger.debug("OVS Bridge configured"); - return new Answer(cmd, true, null); + return new Answer(cmd, true, null); } private Answer execute(OvsDestroyBridgeCommand cmd) { Connection conn = getConnection(); destroyTunnelNetwork(conn, cmd.getKey()); s_logger.debug("OVS Bridge destroyed"); - return new Answer(cmd, true, null); + return new Answer(cmd, true, null); } - + private Answer execute(OvsDestroyTunnelCommand cmd) { Connection conn = getConnection(); try { - Network nw = findOrCreateTunnelNetwork(conn, cmd.getNetworkId()); + Network nw = findOrCreateTunnelNetwork(conn, cmd.getNetworkId()); if (nw == null) { - s_logger.warn("Unable to find tunnel network for GRE key:" + cmd.getKey()); + s_logger.warn("Unable to find tunnel network for GRE key:" + cmd.getKey()); return new Answer(cmd, false, "No network found"); } @@ -5145,16 +5273,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Connection conn = getConnection(); String bridge = "unknown"; try { - Network nw = findOrCreateTunnelNetwork(conn, cmd.getKey()); + Network nw = findOrCreateTunnelNetwork(conn, cmd.getKey()); if (nw == null) { - s_logger.debug("Error during bridge setup"); + s_logger.debug("Error during bridge setup"); return new OvsCreateTunnelAnswer(cmd, false, "Cannot create network", bridge); } - + configureTunnelNetwork(conn, cmd.getNetworkId(), cmd.getFrom(), cmd.getKey()); bridge = nw.getBridge(conn); String result = callHostPlugin(conn, "ovstunnel", "create_tunnel", "bridge", bridge, "remote_ip", cmd.getRemoteIp(), - "key", cmd.getKey().toString(), "from", cmd.getFrom().toString(), "to", cmd.getTo().toString()); + "key", cmd.getKey().toString(), "from", cmd.getFrom().toString(), "to", cmd.getTo().toString()); String[] res = result.split(":"); if (res.length == 2 && res[0].equalsIgnoreCase("SUCCESS")) { return new OvsCreateTunnelAnswer(cmd, true, result, res[1], bridge); @@ -5162,8 +5290,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new OvsCreateTunnelAnswer(cmd, false, result, bridge); } } catch (Exception e) { - s_logger.debug("Error during tunnel setup"); - s_logger.warn("Caught execption when creating ovs tunnel", e); + s_logger.debug("Error during tunnel setup"); + s_logger.warn("Caught execption when creating ovs tunnel", e); return new OvsCreateTunnelAnswer(cmd, false, e.getMessage(), bridge); } } @@ -5249,9 +5377,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe private OvsFetchInterfaceAnswer execute(OvsFetchInterfaceCommand cmd) { - - String label = cmd.getLabel(); - s_logger.debug("Will look for network with name-label:" + label + " on host " + _host.ip); + + String label = cmd.getLabel(); + s_logger.debug("Will look for network with name-label:" + label + " on host " + _host.ip); Connection conn = getConnection(); try { XsLocalNetwork nw = this.getNetworkByName(conn, label); @@ -5260,17 +5388,17 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe Record pifRec = pif.getRecord(conn); s_logger.debug("PIF object:" + pifRec.uuid + "(" + pifRec.device + ")"); return new OvsFetchInterfaceAnswer(cmd, true, "Interface " + pifRec.device + " retrieved successfully", - pifRec.IP, pifRec.netmask, pifRec.MAC); + pifRec.IP, pifRec.netmask, pifRec.MAC); } catch (Exception e) { e.printStackTrace(); s_logger.error("An error occurred while fetching the interface for " + - label + " on host " + _host.ip + ":" + e.toString() + - "(" + e.getClass() + ")"); + label + " on host " + _host.ip + ":" + e.toString() + + "(" + e.getClass() + ")"); return new OvsFetchInterfaceAnswer(cmd, false, "EXCEPTION:" + e.getMessage()); } } - + private OvsCreateGreTunnelAnswer execute(OvsCreateGreTunnelCommand cmd) { _isOvs = true; @@ -5293,9 +5421,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } catch (Exception e) { e.printStackTrace(); s_logger.error("An error occurred while creating a GRE tunnel to " + - cmd.getRemoteIp() + " on host " + _host.ip + ":" + e.getMessage() + - "(" + e.getClass() + ")"); - + cmd.getRemoteIp() + " on host " + _host.ip + ":" + e.getMessage() + + "(" + e.getClass() + ")"); + } return new OvsCreateGreTunnelAnswer(cmd, false, "EXCEPTION", _host.ip, bridge); @@ -5310,10 +5438,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (!_canBridgeFirewall) { s_logger.warn("Host " + _host.ip + " cannot do bridge firewalling"); return new SecurityGroupRuleAnswer(cmd, false, - "Host " + _host.ip + " cannot do bridge firewalling", - SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL); + "Host " + _host.ip + " cannot do bridge firewalling", + SecurityGroupRuleAnswer.FailureReason.CANNOT_BRIDGE_FIREWALL); } - + String result = callHostPlugin(conn, "vmops", "network_rules", "vmName", cmd.getVmName(), "vmIP", cmd.getGuestIp(), @@ -5332,12 +5460,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new SecurityGroupRuleAnswer(cmd); } } - + protected Answer execute(DeleteStoragePoolCommand cmd) { Connection conn = getConnection(); StorageFilerTO poolTO = cmd.getPool(); try { - SR sr = getStorageRepository(conn, poolTO); + SR sr = getStorageRepository(conn, poolTO.getUuid()); removeSR(conn, sr); Answer answer = new Answer(cmd, true, "success"); return answer; @@ -5375,7 +5503,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if( hr.softwareVersion.get("product_version_text_short") != null ) { details.put("product_version_text_short", hr.softwareVersion.get("product_version_text_short")); cmd.setHypervisorVersion(hr.softwareVersion.get("product_version_text_short")); - + cmd.setHypervisorVersion(_host.product_version); } if (_privateNetworkName != null) { @@ -5519,6 +5647,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe value = (String) params.get("migratewait"); _migratewait = NumbersUtil.parseInt(value, 3600); + _maxNics = NumbersUtil.parseInt((String) params.get("xen.nics.max"), 7); + if (_pod == null) { throw new ConfigurationException("Unable to get the pod"); } @@ -5540,10 +5670,16 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } CheckXenHostInfo(); + + this.storageResource = getStorageResource(); return true; } + protected XenServerStorageResource getStorageResource() { + return new XenServerStorageResource(this); + } + private void CheckXenHostInfo() throws ConfigurationException { Connection conn = _connPool.slaveConnect(_host.ip, _username, _password); if( conn == null ) { @@ -5588,10 +5724,10 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe DiskProfile dskch = cmd.getDiskCharacteristics(); VDI vdi = null; try { - SR poolSr = getStorageRepository(conn, pool); + SR poolSr = getStorageRepository(conn, pool.getUuid()); if (cmd.getTemplateUrl() != null) { VDI tmpltvdi = null; - + tmpltvdi = getVDIbyUuid(conn, cmd.getTemplateUrl()); vdi = tmpltvdi.createClone(conn, new HashMap()); vdi.setNameLabel(conn, dskch.getName()); @@ -5618,6 +5754,23 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } + public Answer execute(ResizeVolumeCommand cmd) { + Connection conn = getConnection(); + StorageFilerTO pool = cmd.getPool(); + String volid = cmd.getPath(); + long newSize = cmd.getNewSize(); + + try { + VDI vdi = getVDIbyUuid(conn, volid); + vdi.resize(conn, newSize); + return new ResizeVolumeAnswer(cmd, true, "success", newSize); + } catch (Exception e) { + s_logger.warn("Unable to resize volume",e); + String error = "failed to resize volume:" +e; + return new ResizeVolumeAnswer(cmd, false, error ); + } + } + protected SR getISOSRbyVmName(Connection conn, String vmName) { try { Set srs = SR.getByNameLabel(conn, vmName + "-ISO"); @@ -5974,7 +6127,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String remoteVolumesMountPath = uri.getHost() + ":" + uri.getPath() + "/volumes/"; String volumeFolder = String.valueOf(cmd.getVolumeId()) + "/"; String mountpoint = remoteVolumesMountPath + volumeFolder; - SR primaryStoragePool = getStorageRepository(conn, poolTO); + SR primaryStoragePool = getStorageRepository(conn, poolTO.getUuid()); String srUuid = primaryStoragePool.getUuid(conn); if (toSecondaryStorage) { // Create the volume folder @@ -6117,6 +6270,199 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } + protected Answer execute(final CreateVMSnapshotCommand cmd) { + String vmName = cmd.getVmName(); + String vmSnapshotName = cmd.getTarget().getSnapshotName(); + List listVolumeTo = cmd.getVolumeTOs(); + VirtualMachine.State vmState = cmd.getVmState(); + String guestOSType = cmd.getGuestOSType(); + + boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory; + long timeout = 600; + + Connection conn = getConnection(); + VM vm = null; + VM vmSnapshot = null; + boolean success = false; + + try { + // check if VM snapshot already exists + Set vmSnapshots = VM.getByNameLabel(conn, cmd.getTarget().getSnapshotName()); + if(vmSnapshots.size() > 0) + return new CreateVMSnapshotAnswer(cmd, cmd.getTarget(), cmd.getVolumeTOs()); + + // check if there is already a task for this VM snapshot + Task task = null; + Set tasks = Task.getByNameLabel(conn, "Async.VM.snapshot"); + tasks.addAll(Task.getByNameLabel(conn, "Async.VM.checkpoint")); + for (Task taskItem : tasks) { + if(taskItem.getOtherConfig(conn).containsKey("CS_VM_SNAPSHOT_KEY")){ + String vmSnapshotTaskName = taskItem.getOtherConfig(conn).get("CS_VM_SNAPSHOT_KEY"); + if(vmSnapshotTaskName != null && vmSnapshotTaskName.equals(cmd.getTarget().getSnapshotName())){ + task = taskItem; + } + } + } + + // create a new task if there is no existing task for this VM snapshot + if(task == null){ + try { + vm = getVM(conn, vmName); + } catch (Exception e) { + if (!snapshotMemory) { + vm = createWorkingVM(conn, vmName, guestOSType, listVolumeTo); + } + } + + if (vm == null) { + return new CreateVMSnapshotAnswer(cmd, false, + "Creating VM Snapshot Failed due to can not find vm: " + + vmName); + } + + // call Xenserver API + if (!snapshotMemory) { + task = vm.snapshotAsync(conn, vmSnapshotName); + } else { + Set vbds = vm.getVBDs(conn); + Pool pool = Pool.getByUuid(conn, _host.pool); + for (VBD vbd: vbds){ + VBD.Record vbdr = vbd.getRecord(conn); + if (vbdr.userdevice.equals("0")){ + VDI vdi = vbdr.VDI; + SR sr = vdi.getSR(conn); + // store memory image on the same SR with ROOT volume + pool.setSuspendImageSR(conn, sr); + } + } + task = vm.checkpointAsync(conn, vmSnapshotName); + } + task.addToOtherConfig(conn, "CS_VM_SNAPSHOT_KEY", vmSnapshotName); + } + + waitForTask(conn, task, 1000, timeout * 1000); + checkForSuccess(conn, task); + String result = task.getResult(conn); + + // extract VM snapshot ref from result + String ref = result.substring("".length(), result.length() - "".length()); + vmSnapshot = Types.toVM(ref); + + success = true; + return new CreateVMSnapshotAnswer(cmd, cmd.getTarget(), cmd.getVolumeTOs()); + } catch (Exception e) { + String msg = e.getMessage(); + s_logger.error("Creating VM Snapshot " + cmd.getTarget().getSnapshotName() + " failed due to: " + msg); + return new CreateVMSnapshotAnswer(cmd, false, msg); + } finally { + try { + if (!success) { + if (vmSnapshot != null) { + s_logger.debug("Delete exsisting VM Snapshot " + + vmSnapshotName + + " after making VolumeTO failed"); + Set vbds = vmSnapshot.getVBDs(conn); + for (VBD vbd : vbds) { + VBD.Record vbdr = vbd.getRecord(conn); + if (vbdr.type == VbdType.DISK) { + VDI vdi = vbdr.VDI; + vdi.destroy(conn); + } + } + vmSnapshot.destroy(conn); + } + } + if (vmState == VirtualMachine.State.Stopped) { + if (vm != null) { + vm.destroy(conn); + } + } + } catch (Exception e2) { + s_logger.error("delete snapshot error due to " + + e2.getMessage()); + } + } + } + + private VM createWorkingVM(Connection conn, String vmName, + String guestOSType, List listVolumeTo) + throws BadServerResponse, VmBadPowerState, SrFull, + OperationNotAllowed, XenAPIException, XmlRpcException { + String guestOsTypeName = getGuestOsType(guestOSType, false); + if (guestOsTypeName == null) { + String msg = " Hypervisor " + this.getClass().getName() + + " doesn't support guest OS type " + guestOSType + + ". you can choose 'Other install media' to run it as HVM"; + s_logger.warn(msg); + throw new CloudRuntimeException(msg); + } + VM template = getVM(conn, guestOsTypeName); + VM vm = template.createClone(conn, vmName); + vm.setIsATemplate(conn, false); + Map vdiMap = new HashMap(); + for (VolumeTO volume : listVolumeTo) { + String vdiUuid = volume.getPath(); + try { + VDI vdi = VDI.getByUuid(conn, vdiUuid); + vdiMap.put(vdi, volume); + } catch (Types.UuidInvalid e) { + s_logger.warn("Unable to find vdi by uuid: " + vdiUuid + + ", skip it"); + } + } + for (VDI vdi : vdiMap.keySet()) { + VolumeTO volumeTO = vdiMap.get(vdi); + VBD.Record vbdr = new VBD.Record(); + vbdr.VM = vm; + vbdr.VDI = vdi; + if (volumeTO.getType() == Volume.Type.ROOT) { + vbdr.bootable = true; + vbdr.unpluggable = false; + } else { + vbdr.bootable = false; + vbdr.unpluggable = true; + } + vbdr.userdevice = new Long(volumeTO.getDeviceId()).toString(); + vbdr.mode = Types.VbdMode.RW; + vbdr.type = Types.VbdType.DISK; + VBD.create(conn, vbdr); + } + return vm; + } + + protected Answer execute(final DeleteVMSnapshotCommand cmd) { + String snapshotName = cmd.getTarget().getSnapshotName(); + Connection conn = getConnection(); + + try { + List vdiList = new ArrayList(); + Set snapshots = VM.getByNameLabel(conn, snapshotName); + if(snapshots.size() == 0){ + s_logger.warn("VM snapshot with name " + snapshotName + " does not exist, assume it is already deleted"); + return new DeleteVMSnapshotAnswer(cmd, cmd.getVolumeTOs()); + } + VM snapshot = snapshots.iterator().next(); + Set vbds = snapshot.getVBDs(conn); + for (VBD vbd : vbds) { + if (vbd.getType(conn) == VbdType.DISK) { + VDI vdi = vbd.getVDI(conn); + vdiList.add(vdi); + } + } + if(cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory) + vdiList.add(snapshot.getSuspendVDI(conn)); + snapshot.destroy(conn); + for (VDI vdi : vdiList) { + vdi.destroy(conn); + } + return new DeleteVMSnapshotAnswer(cmd, cmd.getVolumeTOs()); + } catch (Exception e) { + s_logger.warn("Catch Exception: " + e.getClass().toString() + + " due to " + e.toString(), e); + return new DeleteVMSnapshotAnswer(cmd, false, e.getMessage()); + } + } + protected Answer execute(final AttachIsoCommand cmd) { Connection conn = getConnection(); boolean attach = cmd.isAttach(); @@ -6530,7 +6876,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } finally { deleteSnapshotBackup(conn, dcId, accountId, volumeId, secondaryStorageMountPath, snapshotBackupUuid); } - } + } success = true; } finally { if( snapshotSr != null) { @@ -6777,30 +7123,30 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } - protected SR getStorageRepository(Connection conn, StorageFilerTO pool) { + protected SR getStorageRepository(Connection conn, String uuid) { Set srs; try { - srs = SR.getByNameLabel(conn, pool.getUuid()); + srs = SR.getByNameLabel(conn, uuid); } catch (XenAPIException e) { - throw new CloudRuntimeException("Unable to get SR " + pool.getUuid() + " due to " + e.toString(), e); + throw new CloudRuntimeException("Unable to get SR " + uuid + " due to " + e.toString(), e); } catch (Exception e) { - throw new CloudRuntimeException("Unable to get SR " + pool.getUuid() + " due to " + e.getMessage(), e); + throw new CloudRuntimeException("Unable to get SR " + uuid + " due to " + e.getMessage(), e); } if (srs.size() > 1) { - throw new CloudRuntimeException("More than one storage repository was found for pool with uuid: " + pool.getUuid()); + throw new CloudRuntimeException("More than one storage repository was found for pool with uuid: " + uuid); } else if (srs.size() == 1) { SR sr = srs.iterator().next(); if (s_logger.isDebugEnabled()) { - s_logger.debug("SR retrieved for " + pool.getId()); + s_logger.debug("SR retrieved for " + uuid); } if (checkSR(conn, sr)) { return sr; } - throw new CloudRuntimeException("SR check failed for storage pool: " + pool.getUuid() + "on host:" + _host.uuid); + throw new CloudRuntimeException("SR check failed for storage pool: " + uuid + "on host:" + _host.uuid); } else { - throw new CloudRuntimeException("Can not see storage pool: " + pool.getUuid() + " from on host:" + _host.uuid); + throw new CloudRuntimeException("Can not see storage pool: " + uuid + " from on host:" + _host.uuid); } } @@ -7161,14 +7507,18 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String callResult; Connection conn = getConnection(); String routerIp = cmd.getAccessDetail(NetworkElementCommand.ROUTER_IP); - + FirewallRuleTO[] allrules = cmd.getRules(); + FirewallRule.TrafficType trafficType = allrules[0].getTrafficType(); if (routerIp == null) { return new SetFirewallRulesAnswer(cmd, false, results); } String[][] rules = cmd.generateFwRules(); String args = ""; - args += routerIp + " -F "; + args += routerIp + " -F"; + if (trafficType == FirewallRule.TrafficType.Egress){ + args+= " -E"; + } StringBuilder sb = new StringBuilder(); String[] fwRules = rules[0]; if (fwRules.length > 0) { @@ -7250,12 +7600,12 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe synchronized (_cluster.intern()) { - HashMap> newStates = getAllVms(conn); - if (newStates == null) { - s_logger.warn("Unable to get the vm states so no state sync at this point."); - return null; - } - HashMap> oldStates = new HashMap>(s_vms.size(_cluster)); + HashMap> newStates = getAllVms(conn); + if (newStates == null) { + s_logger.warn("Unable to get the vm states so no state sync at this point."); + return null; + } + HashMap> oldStates = new HashMap>(s_vms.size(_cluster)); oldStates.putAll(s_vms.getClusterVmState(_cluster)); for (final Map.Entry> entry : newStates.entrySet()) { @@ -7270,7 +7620,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (!host_uuid.equals(oldState.first()) && newState != State.Stopped && newState != State.Stopping){ s_logger.warn("Detecting a change in host for " + vm); changes.put(vm, new Pair(host_uuid, newState)); - + s_logger.debug("11. The VM " + vm + " is in " + newState + " state"); s_vms.put(_cluster, host_uuid, vm, newState); continue; @@ -7280,7 +7630,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (newState == State.Stopped && oldState != null && oldState.second() != State.Stopping && oldState.second() != State.Stopped) { newState = getRealPowerState(conn, vm); } - + if (s_logger.isTraceEnabled()) { s_logger.trace("VM " + vm + ": xen has state " + newState + " and we have state " + (oldState != null ? oldState.toString() : "null")); } @@ -7295,7 +7645,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe changes.put(vm, new Pair(host_uuid, newState)); } else if (oldState.second() == State.Starting) { if (newState == State.Running) { - s_logger.debug("12. The VM " + vm + " is in " + State.Running + " state"); + s_logger.debug("12. The VM " + vm + " is in " + State.Running + " state"); s_vms.put(_cluster, host_uuid, vm, newState); } else if (newState == State.Stopped) { s_logger.warn("Ignoring vm " + vm + " because of a lag in starting the vm."); @@ -7307,13 +7657,13 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } } else if (oldState.second() == State.Stopping) { if (newState == State.Stopped) { - s_logger.debug("13. The VM " + vm + " is in " + State.Stopped + " state"); + s_logger.debug("13. The VM " + vm + " is in " + State.Stopped + " state"); s_vms.put(_cluster, host_uuid, vm, newState); } else if (newState == State.Running) { s_logger.warn("Ignoring vm " + vm + " because of a lag in stopping the vm. "); } } else if (oldState.second() != newState) { - s_logger.debug("14. The VM " + vm + " is in " + newState + " state was " + oldState.second()); + s_logger.debug("14. The VM " + vm + " is in " + newState + " state was " + oldState.second()); s_vms.put(_cluster, host_uuid, vm, newState); if (newState == State.Stopped) { /* @@ -7329,7 +7679,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe final String vm = entry.getKey(); final State oldState = entry.getValue().second(); String host_uuid = entry.getValue().first(); - + if (s_logger.isTraceEnabled()) { s_logger.trace("VM " + vm + " is now missing from xen so reporting stopped"); } @@ -7340,7 +7690,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } else if (oldState == State.Starting) { s_logger.warn("Ignoring VM " + vm + " in transition state starting."); } else if (oldState == State.Stopped) { - s_logger.debug("VM missing " + vm + " old state stopped so removing."); + s_logger.debug("VM missing " + vm + " old state stopped so removing."); s_vms.remove(_cluster, host_uuid, vm); } else if (oldState == State.Migrating) { s_logger.warn("Ignoring VM " + vm + " in migrating state."); @@ -7409,7 +7759,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe s_logger.warn(msg); return new PlugNicAnswer(cmd, false, msg); } - String deviceId = getUnusedVIFNum(conn, vm); + String deviceId = getLowestAvailableVIFDeviceNum(conn, vm); nic.setDeviceId(Integer.parseInt(deviceId)); vif = createVif(conn, vmName, vm, nic); vif.plug(conn); @@ -7514,31 +7864,31 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe if (cmd.isCreate()) { args += " -A"; args += " -l "; - args += cmd.getLocalPublicIp(); + args += cmd.getLocalPublicIp(); args += " -n "; - args += cmd.getLocalGuestCidr(); + args += cmd.getLocalGuestCidr(); args += " -g "; - args += cmd.getLocalPublicGateway(); + args += cmd.getLocalPublicGateway(); args += " -r "; - args += cmd.getPeerGatewayIp(); + args += cmd.getPeerGatewayIp(); args += " -N "; - args += cmd.getPeerGuestCidrList(); + args += cmd.getPeerGuestCidrList(); args += " -e "; - args += "\"" + cmd.getEspPolicy() + "\""; + args += "\"" + cmd.getEspPolicy() + "\""; args += " -i "; - args += "\"" + cmd.getIkePolicy() + "\""; + args += "\"" + cmd.getIkePolicy() + "\""; args += " -t "; - args += Long.toString(cmd.getIkeLifetime()); + args += Long.toString(cmd.getIkeLifetime()); args += " -T "; - args += Long.toString(cmd.getEspLifetime()); + args += Long.toString(cmd.getEspLifetime()); args += " -s "; - args += "\"" + cmd.getIpsecPsk() + "\""; - args += " -d "; - if (cmd.getDpd()) { - args += "1"; - } else { - args += "0"; - } + args += "\"" + cmd.getIpsecPsk() + "\""; + args += " -d "; + if (cmd.getDpd()) { + args += "1"; + } else { + args += "0"; + } } else { args += " -D"; args += " -r "; @@ -7564,7 +7914,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe VM router = getVM(conn, routerName); VIF correctVif = getCorrectVif(conn, router, pubIp); - + String args = "vpc_snat.sh " + routerIp; args += " -A "; @@ -7573,7 +7923,7 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe args += " -c "; args += "eth" + correctVif.getDevice(conn); - + String result = callHostPlugin(conn, "vmops", "routerProxy", "args", args); if (result == null || result.isEmpty()) { throw new InternalErrorException("Xen plugin \"vpc_snat\" failed."); @@ -7597,11 +7947,11 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe String [][] rules = cmd.generateFwRules(); StringBuilder sb = new StringBuilder(); String[] aclRules = rules[0]; - + for (int i = 0; i < aclRules.length; i++) { sb.append(aclRules[i]).append(','); } - + NicTO nic = cmd.getNic(); VIF vif = getVifByMac(conn, router, nic.getMac()); String args = "vpc_acl.sh " + routerIp; @@ -7653,8 +8003,8 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } return new SetPortForwardingRulesAnswer(cmd, results, endResult); } - - + + private SetStaticRouteAnswer execute(SetStaticRouteCommand cmd) { String callResult; Connection conn = getConnection(); @@ -7684,4 +8034,26 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe return new SetStaticRouteAnswer(cmd, false, null); } } + + @Override + public void setName(String name) { + } + + @Override + public void setConfigParams(Map params) { + } + + @Override + public Map getConfigParams() { + return null; + } + + @Override + public int getRunLevel() { + return 0; + } + + @Override + public void setRunLevel(int level) { + } } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java index 0a1064707b1..357b4333678 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpOssResource.java @@ -20,6 +20,7 @@ package com.cloud.hypervisor.xen.resource; import java.io.File; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.Set; import javax.ejb.Local; @@ -166,5 +167,4 @@ public class XcpOssResource extends CitrixResourceBase { } return answer; } - } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java index 0ce91bc58e2..7a958708e76 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XcpServerResource.java @@ -72,17 +72,17 @@ public class XcpServerResource extends CitrixResourceBase { } @Override - protected void setMemory(Connection conn, VM vm, long memsize) throws XmlRpcException, XenAPIException { + protected void setMemory(Connection conn, VM vm, long minMemsize, long maxMemsize) throws XmlRpcException, XenAPIException { vm.setMemoryStaticMin(conn, 33554432L); - vm.setMemoryDynamicMin(conn, 33554432L); - vm.setMemoryDynamicMax(conn, 33554432L); + //vm.setMemoryDynamicMin(conn, 33554432L); + //vm.setMemoryDynamicMax(conn, 33554432L); vm.setMemoryStaticMax(conn, 33554432L); - vm.setMemoryStaticMax(conn, memsize); - vm.setMemoryDynamicMax(conn, memsize); - vm.setMemoryDynamicMin(conn, memsize); - vm.setMemoryStaticMin(conn, memsize); + //vm.setMemoryStaticMax(conn, maxMemsize ); + vm.setMemoryDynamicMax(conn, maxMemsize ); + vm.setMemoryDynamicMin(conn, minMemsize ); + //vm.setMemoryStaticMin(conn, maxMemsize ); } @@ -99,7 +99,7 @@ public class XcpServerResource extends CitrixResourceBase { return answer; } catch (Exception ex) { s_logger.warn("Failed to get network usage stats due to ", ex); - return new NetworkUsageAnswer(cmd, ex); + return new NetworkUsageAnswer(cmd, ex); } } diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java index 58b8a035171..7040311d04e 100644 --- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java @@ -136,9 +136,9 @@ public class XenServer56FP1Resource extends XenServer56Resource { record.nameLabel = vmSpec.getName(); record.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY; record.actionsAfterShutdown = Types.OnNormalExit.DESTROY; - record.memoryDynamicMax = vmSpec.getMinRam(); + record.memoryDynamicMax = vmSpec.getMaxRam(); record.memoryDynamicMin = vmSpec.getMinRam(); - record.memoryStaticMax = vmSpec.getMinRam(); + record.memoryStaticMax = vmSpec.getMaxRam(); record.memoryStaticMin = vmSpec.getMinRam(); record.VCPUsMax = (long) vmSpec.getCpus(); record.VCPUsAtStartup = (long) vmSpec.getCpus(); @@ -152,7 +152,7 @@ public class XenServer56FP1Resource extends XenServer56Resource { Map vcpuParams = new HashMap(); - Integer speed = vmSpec.getSpeed(); + Integer speed = vmSpec.getMinSpeed(); if (speed != null) { int cpuWeight = _maxWeight; // cpu_weight diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java new file mode 100644 index 00000000000..9c291491114 --- /dev/null +++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServerStorageResource.java @@ -0,0 +1,662 @@ +/* + * 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.hypervisor.xen.resource; + +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreAnswer; +import org.apache.cloudstack.storage.command.AttachPrimaryDataStoreCmd; +import org.apache.cloudstack.storage.command.CopyCmd; +import org.apache.cloudstack.storage.command.CopyCmdAnswer; +import org.apache.cloudstack.storage.command.CreateObjectAnswer; +import org.apache.cloudstack.storage.command.CreateObjectCommand; +import org.apache.cloudstack.storage.command.CreatePrimaryDataStoreCmd; +import org.apache.cloudstack.storage.command.CreateVolumeFromBaseImageCommand; +import org.apache.cloudstack.storage.command.StorageSubSystemCommand; +import org.apache.cloudstack.storage.datastore.protocol.DataStoreProtocol; +import org.apache.cloudstack.storage.to.ImageOnPrimayDataStoreTO; +import org.apache.cloudstack.storage.to.VolumeTO; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.log4j.Logger; +import org.apache.xmlrpc.XmlRpcException; + +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.storage.DeleteVolumeCommand; +import com.cloud.hypervisor.xen.resource.CitrixResourceBase.SRType; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.utils.storage.encoding.DecodedDataObject; +import com.cloud.utils.storage.encoding.DecodedDataStore; +import com.cloud.utils.storage.encoding.Decoder; +import com.xensource.xenapi.Connection; +import com.xensource.xenapi.Host; +import com.xensource.xenapi.PBD; +import com.xensource.xenapi.SR; +import com.xensource.xenapi.Types; +import com.xensource.xenapi.Types.BadServerResponse; +import com.xensource.xenapi.Types.XenAPIException; +import com.xensource.xenapi.VDI; + +import edu.emory.mathcs.backport.java.util.Arrays; + +public class XenServerStorageResource { + private static final Logger s_logger = Logger.getLogger(XenServerStorageResource.class); + protected CitrixResourceBase hypervisorResource; + + public XenServerStorageResource(CitrixResourceBase resource) { + this.hypervisorResource = resource; + } + + public Answer handleStorageCommands(StorageSubSystemCommand command) { + if (command instanceof CopyCmd) { + return this.execute((CopyCmd)command); + } else if (command instanceof AttachPrimaryDataStoreCmd) { + return this.execute((AttachPrimaryDataStoreCmd)command); + } else if (command instanceof CreatePrimaryDataStoreCmd) { + return execute((CreatePrimaryDataStoreCmd) command); + } else if (command instanceof CreateVolumeFromBaseImageCommand) { + return execute((CreateVolumeFromBaseImageCommand)command); + } else if (command instanceof CreateObjectCommand) { + return execute((CreateObjectCommand) command); + } else if (command instanceof DeleteVolumeCommand) { + return execute((DeleteVolumeCommand)command); + } + return new Answer((Command)command, false, "not implemented yet"); + } + + protected SR getSRByNameLabel(Connection conn, String nameLabel) throws BadServerResponse, XenAPIException, XmlRpcException { + Set srs = SR.getByNameLabel(conn, nameLabel); + if (srs.size() != 1) { + throw new CloudRuntimeException("storage uuid: " + nameLabel + " is not unique"); + } + SR poolsr = srs.iterator().next(); + return poolsr; + } + + protected VDI createVdi(Connection conn, String vdiName, SR sr, long size) throws BadServerResponse, XenAPIException, XmlRpcException { + VDI.Record vdir = new VDI.Record(); + vdir.nameLabel = vdiName; + vdir.SR = sr; + vdir.type = Types.VdiType.USER; + + vdir.virtualSize = size; + VDI vdi = VDI.create(conn, vdir); + return vdi; + } + + protected void deleteVDI(Connection conn, VDI vdi) throws BadServerResponse, XenAPIException, XmlRpcException { + vdi.destroy(conn); + } + + private Map getParameters(URI uri) { + String parameters = uri.getQuery(); + Map params = new HashMap(); + List paraLists = Arrays.asList(parameters.split("&")); + for (String para : paraLists) { + String[] pair = para.split("="); + params.put(pair[0], pair[1]); + } + return params; + } + + protected CreateObjectAnswer getTemplateSize(CreateObjectCommand cmd, String templateUrl) { + Connection conn = hypervisorResource.getConnection(); + long size = this.getTemplateSize(conn, templateUrl); + return new CreateObjectAnswer(cmd, templateUrl, size); + } + protected CreateObjectAnswer execute(CreateObjectCommand cmd) { + String uriString = cmd.getObjectUri(); + DecodedDataObject obj = null; + + Connection conn = hypervisorResource.getConnection(); + VDI vdi = null; + boolean result = false; + String errorMsg = null; + + try { + obj = Decoder.decode(uriString); + + DecodedDataStore store = obj.getStore(); + if (obj.getObjType().equalsIgnoreCase("template") && store.getRole().equalsIgnoreCase("image")) { + return getTemplateSize(cmd, obj.getPath()); + } + + long size = obj.getSize(); + String name = obj.getName(); + String storeUuid = store.getUuid(); + SR primaryDataStoreSR = getSRByNameLabel(conn, storeUuid); + vdi = createVdi(conn, name, primaryDataStoreSR, size); + VDI.Record record = vdi.getRecord(conn); + result = true; + return new CreateObjectAnswer(cmd, record.uuid, record.virtualSize); + } catch (BadServerResponse e) { + s_logger.debug("Failed to create volume", e); + errorMsg = e.toString(); + } catch (XenAPIException e) { + s_logger.debug("Failed to create volume", e); + errorMsg = e.toString(); + } catch (XmlRpcException e) { + s_logger.debug("Failed to create volume", e); + errorMsg = e.toString(); + } catch (URISyntaxException e) { + s_logger.debug("Failed to create volume", e); + errorMsg = e.toString(); + } finally { + if (!result && vdi != null) { + try { + deleteVDI(conn, vdi); + } catch (Exception e) { + s_logger.debug("Faled to delete vdi: " + vdi.toString()); + } + } + } + + return new CreateObjectAnswer(cmd, false, errorMsg); + } + + protected Answer execute(DeleteVolumeCommand cmd) { + VolumeTO volume = null; + Connection conn = hypervisorResource.getConnection(); + String errorMsg = null; + try { + VDI vdi = VDI.getByUuid(conn, volume.getUuid()); + deleteVDI(conn, vdi); + return new Answer(cmd); + } catch (BadServerResponse e) { + s_logger.debug("Failed to delete volume", e); + errorMsg = e.toString(); + } catch (XenAPIException e) { + s_logger.debug("Failed to delete volume", e); + errorMsg = e.toString(); + } catch (XmlRpcException e) { + s_logger.debug("Failed to delete volume", e); + errorMsg = e.toString(); + } + + return new Answer(cmd, false, errorMsg); + } + + protected Answer execute(CreateVolumeFromBaseImageCommand cmd) { + VolumeTO volume = cmd.getVolume(); + ImageOnPrimayDataStoreTO baseImage = cmd.getImage(); + Connection conn = hypervisorResource.getConnection(); + + try { + VDI baseVdi = VDI.getByUuid(conn, baseImage.getPathOnPrimaryDataStore()); + VDI newVol = baseVdi.createClone(conn, new HashMap()); + newVol.setNameLabel(conn, volume.getName()); + return new CreateObjectAnswer(cmd, newVol.getUuid(conn), newVol.getVirtualSize(conn)); + } catch (BadServerResponse e) { + return new Answer(cmd, false, e.toString()); + } catch (XenAPIException e) { + return new Answer(cmd, false, e.toString()); + } catch (XmlRpcException e) { + return new Answer(cmd, false, e.toString()); + } + } + + protected SR getNfsSR(Connection conn, DecodedDataStore store) { + + Map deviceConfig = new HashMap(); + + String uuid = store.getUuid(); + try { + String server = store.getServer(); + String serverpath = store.getPath(); + + serverpath = serverpath.replace("//", "/"); + Set srs = SR.getAll(conn); + for (SR sr : srs) { + if (!SRType.NFS.equals(sr.getType(conn))) { + continue; + } + + Set pbds = sr.getPBDs(conn); + if (pbds.isEmpty()) { + continue; + } + + PBD pbd = pbds.iterator().next(); + + Map dc = pbd.getDeviceConfig(conn); + + if (dc == null) { + continue; + } + + if (dc.get("server") == null) { + continue; + } + + if (dc.get("serverpath") == null) { + continue; + } + + if (server.equals(dc.get("server")) && serverpath.equals(dc.get("serverpath"))) { + throw new CloudRuntimeException("There is a SR using the same configuration server:" + dc.get("server") + ", serverpath:" + + dc.get("serverpath") + " for pool " + uuid + "on host:" + hypervisorResource.getHost().uuid); + } + + } + deviceConfig.put("server", server); + deviceConfig.put("serverpath", serverpath); + Host host = Host.getByUuid(conn, hypervisorResource.getHost().uuid); + SR sr = SR.create(conn, host, deviceConfig, new Long(0), uuid, uuid, SRType.NFS.toString(), "user", true, + new HashMap()); + sr.scan(conn); + return sr; + } catch (XenAPIException e) { + throw new CloudRuntimeException("Unable to create NFS SR " + uuid, e); + } catch (XmlRpcException e) { + throw new CloudRuntimeException("Unable to create NFS SR " + uuid, e); + } + } + /* + protected SR getIscsiSR(Connection conn, PrimaryDataStoreTO pool) { + synchronized (pool.getUuid().intern()) { + Map deviceConfig = new HashMap(); + try { + String target = pool.getHost(); + String path = pool.getPath(); + if (path.endsWith("/")) { + path = path.substring(0, path.length() - 1); + } + + String tmp[] = path.split("/"); + if (tmp.length != 3) { + String msg = "Wrong iscsi path " + pool.getPath() + " it should be /targetIQN/LUN"; + s_logger.warn(msg); + throw new CloudRuntimeException(msg); + } + String targetiqn = tmp[1].trim(); + String lunid = tmp[2].trim(); + String scsiid = ""; + + Set srs = SR.getByNameLabel(conn, pool.getUuid()); + for (SR sr : srs) { + if (!SRType.LVMOISCSI.equals(sr.getType(conn))) { + continue; + } + Set pbds = sr.getPBDs(conn); + if (pbds.isEmpty()) { + continue; + } + PBD pbd = pbds.iterator().next(); + Map dc = pbd.getDeviceConfig(conn); + if (dc == null) { + continue; + } + if (dc.get("target") == null) { + continue; + } + if (dc.get("targetIQN") == null) { + continue; + } + if (dc.get("lunid") == null) { + continue; + } + if (target.equals(dc.get("target")) && targetiqn.equals(dc.get("targetIQN")) && lunid.equals(dc.get("lunid"))) { + throw new CloudRuntimeException("There is a SR using the same configuration target:" + dc.get("target") + ", targetIQN:" + + dc.get("targetIQN") + ", lunid:" + dc.get("lunid") + " for pool " + pool.getUuid() + "on host:" + _host.uuid); + } + } + deviceConfig.put("target", target); + deviceConfig.put("targetIQN", targetiqn); + + Host host = Host.getByUuid(conn, _host.uuid); + Map smConfig = new HashMap(); + String type = SRType.LVMOISCSI.toString(); + String poolId = Long.toString(pool.getId()); + SR sr = null; + try { + sr = SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), poolId, type, "user", true, + smConfig); + } catch (XenAPIException e) { + String errmsg = e.toString(); + if (errmsg.contains("SR_BACKEND_FAILURE_107")) { + String lun[] = errmsg.split(""); + boolean found = false; + for (int i = 1; i < lun.length; i++) { + int blunindex = lun[i].indexOf("") + 7; + int elunindex = lun[i].indexOf(""); + String ilun = lun[i].substring(blunindex, elunindex); + ilun = ilun.trim(); + if (ilun.equals(lunid)) { + int bscsiindex = lun[i].indexOf("") + 8; + int escsiindex = lun[i].indexOf(""); + scsiid = lun[i].substring(bscsiindex, escsiindex); + scsiid = scsiid.trim(); + found = true; + break; + } + } + if (!found) { + String msg = "can not find LUN " + lunid + " in " + errmsg; + s_logger.warn(msg); + throw new CloudRuntimeException(msg); + } + } else { + String msg = "Unable to create Iscsi SR " + deviceConfig + " due to " + e.toString(); + s_logger.warn(msg, e); + throw new CloudRuntimeException(msg, e); + } + } + deviceConfig.put("SCSIid", scsiid); + + String result = SR.probe(conn, host, deviceConfig, type , smConfig); + String pooluuid = null; + if( result.indexOf("") != -1) { + pooluuid = result.substring(result.indexOf("") + 6, result.indexOf("")).trim(); + } + if( pooluuid == null || pooluuid.length() != 36) { + sr = SR.create(conn, host, deviceConfig, new Long(0), pool.getUuid(), poolId, type, "user", true, + smConfig); + } else { + sr = SR.introduce(conn, pooluuid, pool.getUuid(), poolId, + type, "user", true, smConfig); + Pool.Record pRec = XenServerConnectionPool.getPoolRecord(conn); + PBD.Record rec = new PBD.Record(); + rec.deviceConfig = deviceConfig; + rec.host = pRec.master; + rec.SR = sr; + PBD pbd = PBD.create(conn, rec); + pbd.plug(conn); + } + sr.scan(conn); + return sr; + } catch (XenAPIException e) { + String msg = "Unable to create Iscsi SR " + deviceConfig + " due to " + e.toString(); + s_logger.warn(msg, e); + throw new CloudRuntimeException(msg, e); + } catch (Exception e) { + String msg = "Unable to create Iscsi SR " + deviceConfig + " due to " + e.getMessage(); + s_logger.warn(msg, e); + throw new CloudRuntimeException(msg, e); + } + } + }*/ + + protected Answer execute(CreatePrimaryDataStoreCmd cmd) { + Connection conn = hypervisorResource.getConnection(); + String storeUrl = cmd.getDataStore(); + + try { + DecodedDataObject obj = Decoder.decode(storeUrl); + DecodedDataStore store = obj.getStore(); + + if (store.getScheme().equalsIgnoreCase("nfs")) { + SR sr = getNfsSR(conn, store); + } else if (store.getScheme().equalsIgnoreCase("iscsi")) { + //getIscsiSR(conn, dataStore); + } else if (store.getScheme().equalsIgnoreCase("presetup")) { + } else { + return new Answer(cmd, false, "The pool type: " + store.getScheme() + " is not supported."); + } + return new Answer(cmd, true, "success"); + } catch (Exception e) { + // String msg = "Catch Exception " + e.getClass().getName() + ", create StoragePool failed due to " + e.toString() + " on host:" + _host.uuid + " pool: " + pool.getHost() + pool.getPath(); + //s_logger.warn(msg, e); + return new Answer(cmd, false, null); + } + } + + private long getTemplateSize(Connection conn, String url) { + String size = hypervisorResource.callHostPlugin(conn, "storagePlugin", "getTemplateSize", "srcUrl", url); + if (size.equalsIgnoreCase("") || size == null) { + throw new CloudRuntimeException("Can't get template size"); + } + + try { + return Long.parseLong(size); + } catch (NumberFormatException e) { + throw new CloudRuntimeException("Failed to get template lenght", e); + } + + /* + HttpHead method = new HttpHead(url); + DefaultHttpClient client = new DefaultHttpClient(); + try { + HttpResponse response = client.execute(method); + Header header = response.getFirstHeader("Content-Length"); + if (header == null) { + throw new CloudRuntimeException("Can't get content-lenght header from :" + url); + } + Long length = Long.parseLong(header.getValue()); + return length; + } catch (HttpException e) { + throw new CloudRuntimeException("Failed to get template lenght", e); + } catch (IOException e) { + throw new CloudRuntimeException("Failed to get template lenght", e); + } catch (NumberFormatException e) { + throw new CloudRuntimeException("Failed to get template lenght", e); + }*/ + } + + private void downloadHttpToLocalFile(String destFilePath, String url) { + File destFile = new File(destFilePath); + if (!destFile.exists()) { + throw new CloudRuntimeException("dest file doesn't exist: " + destFilePath); + } + + DefaultHttpClient client = new DefaultHttpClient(); + HttpGet getMethod = new HttpGet(url); + HttpResponse response; + BufferedOutputStream output = null; + long length = 0; + try { + response = client.execute(getMethod); + HttpEntity entity = response.getEntity(); + length = entity.getContentLength(); + output = new BufferedOutputStream(new FileOutputStream(destFile)); + entity.writeTo(output); + } catch (ClientProtocolException e) { + throw new CloudRuntimeException("Failed to download template", e); + } catch (IOException e) { + throw new CloudRuntimeException("Failed to download template", e); + } finally { + if (output != null) { + try { + output.close(); + } catch (IOException e) { + throw new CloudRuntimeException("Failed to download template", e); + } + } + } + + //double check the length + destFile = new File(destFilePath); + if (destFile.length() != length) { + throw new CloudRuntimeException("Download file length doesn't match: expected: " + length + ", actual: " + destFile.length()); + } + + } + + protected Answer directDownloadHttpTemplate(CopyCmd cmd, DecodedDataObject srcObj, DecodedDataObject destObj) { + Connection conn = hypervisorResource.getConnection(); + SR poolsr = null; + VDI vdi = null; + boolean result = false; + try { + if (destObj.getPath() == null) { + //need to create volume at first + + } + vdi = VDI.getByUuid(conn, destObj.getPath()); + if (vdi == null) { + throw new CloudRuntimeException("can't find volume: " + destObj.getPath()); + } + String destStoreUuid = destObj.getStore().getUuid(); + Set srs = SR.getByNameLabel(conn, destStoreUuid); + if (srs.size() != 1) { + throw new CloudRuntimeException("storage uuid: " + destStoreUuid + " is not unique"); + } + poolsr = srs.iterator().next(); + VDI.Record vdir = vdi.getRecord(conn); + String vdiLocation = vdir.location; + String pbdLocation = null; + if (destObj.getStore().getScheme().equalsIgnoreCase(DataStoreProtocol.NFS.toString())) { + pbdLocation = "/run/sr-mount/" + poolsr.getUuid(conn); + } else { + Set pbds = poolsr.getPBDs(conn); + if (pbds.size() != 1) { + throw new CloudRuntimeException("Don't how to handle multiple pbds:" + pbds.size() + " for sr: " + poolsr.getUuid(conn)); + } + PBD pbd = pbds.iterator().next(); + Map deviceCfg = pbd.getDeviceConfig(conn); + pbdLocation = deviceCfg.get("location"); + } + if (pbdLocation == null) { + throw new CloudRuntimeException("Can't get pbd location"); + } + + String vdiPath = pbdLocation + "/" + vdiLocation + ".vhd"; + //download a url into vdipath + //downloadHttpToLocalFile(vdiPath, template.getPath()); + hypervisorResource.callHostPlugin(conn, "storagePlugin", "downloadTemplateFromUrl", "destPath", vdiPath, "srcUrl", srcObj.getPath()); + result = true; + return new CopyCmdAnswer(cmd, vdi.getUuid(conn)); + } catch (BadServerResponse e) { + s_logger.debug("Failed to download template", e); + } catch (XenAPIException e) { + s_logger.debug("Failed to download template", e); + } catch (XmlRpcException e) { + s_logger.debug("Failed to download template", e); + } catch (Exception e) { + s_logger.debug("Failed to download template", e); + } finally { + if (!result && vdi != null) { + try { + vdi.destroy(conn); + } catch (BadServerResponse e) { + s_logger.debug("Failed to cleanup newly created vdi"); + } catch (XenAPIException e) { + s_logger.debug("Failed to cleanup newly created vdi"); + } catch (XmlRpcException e) { + s_logger.debug("Failed to cleanup newly created vdi"); + } + } + } + return new Answer(cmd, false, "Failed to download template"); + } + + protected Answer execute(AttachPrimaryDataStoreCmd cmd) { + String dataStoreUri = cmd.getDataStore(); + Connection conn = hypervisorResource.getConnection(); + try { + DecodedDataObject obj = Decoder.decode(dataStoreUri); + + DecodedDataStore store = obj.getStore(); + + SR sr = hypervisorResource.getStorageRepository(conn, store.getUuid()); + hypervisorResource.setupHeartbeatSr(conn, sr, false); + long capacity = sr.getPhysicalSize(conn); + long available = capacity - sr.getPhysicalUtilisation(conn); + if (capacity == -1) { + String msg = "Pool capacity is -1! pool: "; + s_logger.warn(msg); + return new Answer(cmd, false, msg); + } + AttachPrimaryDataStoreAnswer answer = new AttachPrimaryDataStoreAnswer(cmd); + answer.setCapacity(capacity); + answer.setUuid(sr.getUuid(conn)); + answer.setAvailable(available); + return answer; + } catch (XenAPIException e) { + String msg = "AttachPrimaryDataStoreCmd add XenAPIException:" + e.toString(); + s_logger.warn(msg, e); + return new Answer(cmd, false, msg); + } catch (Exception e) { + String msg = "AttachPrimaryDataStoreCmd failed:" + e.getMessage(); + s_logger.warn(msg, e); + return new Answer(cmd, false, msg); + } + } + + protected Answer execute(CopyCmd cmd) { + DecodedDataObject srcObj = null; + DecodedDataObject destObj = null; + try { + srcObj = Decoder.decode(cmd.getSrcUri()); + destObj = Decoder.decode(cmd.getDestUri()); + } catch (URISyntaxException e) { + return new Answer(cmd, false, e.toString()); + } + + + if (srcObj.getPath().startsWith("http")) { + return directDownloadHttpTemplate(cmd, srcObj, destObj); + } else { + return new Answer(cmd, false, "not implemented yet"); + /* + String tmplturl = cmd.getUrl(); + String poolName = cmd.getPoolUuid(); + int wait = cmd.getWait(); + try { + URI uri = new URI(tmplturl); + String tmplpath = uri.getHost() + ":" + uri.getPath(); + Connection conn = hypervisorResource.getConnection(); + SR poolsr = null; + Set srs = SR.getByNameLabel(conn, poolName); + if (srs.size() != 1) { + String msg = "There are " + srs.size() + " SRs with same name: " + poolName; + s_logger.warn(msg); + return new PrimaryStorageDownloadAnswer(msg); + } else { + poolsr = srs.iterator().next(); + } + String pUuid = poolsr.getUuid(conn); + boolean isISCSI = IsISCSI(poolsr.getType(conn)); + String uuid = copy_vhd_from_secondarystorage(conn, tmplpath, pUuid, wait); + VDI tmpl = getVDIbyUuid(conn, uuid); + VDI snapshotvdi = tmpl.snapshot(conn, new HashMap()); + String snapshotUuid = snapshotvdi.getUuid(conn); + snapshotvdi.setNameLabel(conn, "Template " + cmd.getName()); + String parentuuid = getVhdParent(conn, pUuid, snapshotUuid, isISCSI); + VDI parent = getVDIbyUuid(conn, parentuuid); + Long phySize = parent.getPhysicalUtilisation(conn); + tmpl.destroy(conn); + poolsr.scan(conn); + try{ + Thread.sleep(5000); + } catch (Exception e) { + } + return new PrimaryStorageDownloadAnswer(snapshotvdi.getUuid(conn), phySize); + } catch (Exception e) { + String msg = "Catch Exception " + e.getClass().getName() + " on host:" + _host.uuid + " for template: " + + tmplturl + " due to " + e.toString(); + s_logger.warn(msg, e); + return new PrimaryStorageDownloadAnswer(msg); + }*/ + } + + } +} diff --git a/plugins/network-elements/bigswitch-vns/pom.xml b/plugins/network-elements/bigswitch-vns/pom.xml new file mode 100644 index 00000000000..95a7692ce75 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/pom.xml @@ -0,0 +1,29 @@ + + + 4.0.0 + cloud-plugin-network-vns + Apache CloudStack Plugin - BigSwitch Virtual Network Segment + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../pom.xml + + diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.java new file mode 100644 index 00000000000..e950abe3bed --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkAnswer.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 CreateVnsNetworkAnswer extends Answer { + + public CreateVnsNetworkAnswer(Command command, boolean success, String details) { + super(command, success, details); + } + + public CreateVnsNetworkAnswer(Command command, Exception e) { + super(command, e); + } +} diff --git a/server/src/com/cloud/configuration/CloudZonesComponentLibrary.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java similarity index 52% rename from server/src/com/cloud/configuration/CloudZonesComponentLibrary.java rename to plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java index 13bb16f26b7..df9832889e8 100644 --- a/server/src/com/cloud/configuration/CloudZonesComponentLibrary.java +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsNetworkCommand.java @@ -14,24 +14,39 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.configuration; +package com.cloud.agent.api; -import com.cloud.agent.StartupCommandProcessor; -import com.cloud.agent.manager.authn.impl.BasicAgentAuthManager; +public class CreateVnsNetworkCommand extends Command { + private String _networkUuid; + private String _name; + private String _tenantUuid; + private int _vlan; -import com.cloud.hypervisor.CloudZonesStartupProcessor; -import com.cloud.network.element.CloudZonesNetworkElement; -import com.cloud.network.element.NetworkElement; - - - -public class CloudZonesComponentLibrary extends PremiumComponentLibrary { + public CreateVnsNetworkCommand(String networkUuid, String name, String tenantUuid, int vlan) { + this._networkUuid = networkUuid; + this._name = name; + this._tenantUuid = tenantUuid; + this._vlan = vlan; + } @Override - protected void populateAdapters() { - super.populateAdapters(); - addAdapter(NetworkElement.class, "CloudZones", CloudZonesNetworkElement.class); - addAdapter(StartupCommandProcessor.class, "BasicAgentAuthorizer", BasicAgentAuthManager.class); - addAdapter(StartupCommandProcessor.class, "CloudZonesStartupProcessor", CloudZonesStartupProcessor.class); + public boolean executeInSequence() { + return false; + } + + public String getNetworkUuid() { + return _networkUuid; + } + + public String getName() { + return _name; + } + + public String getTenantUuid() { + return _tenantUuid; + } + + public int getVlan() { + return _vlan; } } diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java new file mode 100644 index 00000000000..e88c7b5ffd0 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortAnswer.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +public class CreateVnsPortAnswer extends Answer { + + public CreateVnsPortAnswer(Command command, boolean success, + String details) { + super(command, success, details); + } + + public CreateVnsPortAnswer(Command command, Exception e) { + super(command, e); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java new file mode 100644 index 00000000000..a4a3a04d702 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/CreateVnsPortCommand.java @@ -0,0 +1,65 @@ +// 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 CreateVnsPortCommand extends Command { + private String _networkUuid; + private String _portUuid; + private String _tenantUuid; + private String _portName; + private String _mac; + + public CreateVnsPortCommand(String networkUuid, String portUuid, + String tenantUuid, String portName, String mac) { + this._networkUuid = networkUuid; + this._portUuid = portUuid; + this._tenantUuid = tenantUuid; + this._portName = portName; + this._mac = mac; + } + + + public String getNetworkUuid() { + return _networkUuid; + } + + + public String getPortUuid() { + return _portUuid; + } + + + public String getTenantUuid() { + return _tenantUuid; + } + + + public String getPortName() { + return _portName; + } + + + public String getMac() { + return _mac; + } + + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java new file mode 100644 index 00000000000..498180c8907 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkAnswer.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +public class DeleteVnsNetworkAnswer extends Answer { + + public DeleteVnsNetworkAnswer(Command command, boolean success, + String details) { + super(command, success, details); + } + + public DeleteVnsNetworkAnswer(Command command, Exception e) { + super(command, e); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java new file mode 100644 index 00000000000..6cf169bbfc9 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsNetworkCommand.java @@ -0,0 +1,41 @@ +// 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 DeleteVnsNetworkCommand extends Command { + + private String _tenantUuid; + private String _networkUuid; + + public DeleteVnsNetworkCommand(String tenantUuid, String networkUuid) { + this._tenantUuid = tenantUuid; + this._networkUuid = networkUuid; + } + + @Override + public boolean executeInSequence() { + return false; + } + + public String get_tenantUuid() { + return _tenantUuid; + } + + public String getNetworkUuid() { + return _networkUuid; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java new file mode 100644 index 00000000000..00c6abc9971 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortAnswer.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +public class DeleteVnsPortAnswer extends Answer { + + public DeleteVnsPortAnswer(Command command, boolean success, + String details) { + super(command, success, details); + } + + public DeleteVnsPortAnswer(Command command, Exception e) { + super(command, e); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.java new file mode 100644 index 00000000000..0cae01d471d --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/DeleteVnsPortCommand.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.agent.api; + +public class DeleteVnsPortCommand extends Command { + + private String _networkUuid; + private String _portUuid; + private String _tenantUuid; + + public DeleteVnsPortCommand(String networkUuid, String portUuid, String tenantUuid) { + this._networkUuid = networkUuid; + this._portUuid = portUuid; + this._tenantUuid = tenantUuid; + } + + public String getNetworkUuid() { + return _networkUuid; + } + + public String getPortUuid() { + return _portUuid; + } + + public String getTenantUuid() { + return _tenantUuid; + } + + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.java new file mode 100644 index 00000000000..8310b076370 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/StartupBigSwitchVnsCommand.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; + +import com.cloud.host.Host; + +public class StartupBigSwitchVnsCommand extends StartupCommand { + + public StartupBigSwitchVnsCommand() { + super(Host.Type.L2Networking); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java new file mode 100644 index 00000000000..6313d144647 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortAnswer.java @@ -0,0 +1,30 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +public class UpdateVnsPortAnswer extends Answer { + + public UpdateVnsPortAnswer(Command command, boolean success, + String details) { + super(command, success, details); + } + + public UpdateVnsPortAnswer(Command command, Exception e) { + super(command, e); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java new file mode 100644 index 00000000000..3492b99f3df --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/agent/api/UpdateVnsPortCommand.java @@ -0,0 +1,58 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.agent.api; + +public class UpdateVnsPortCommand extends Command { + private String _networkUuid; + private String _portUuid; + private String _tenantUuid; + private String _portName; + + public UpdateVnsPortCommand(String networkUuid, String portUuid, String tenantUuid, String portName) { + this._networkUuid = networkUuid; + this._portUuid = portUuid; + this._tenantUuid = tenantUuid; + this._portName = portName; + } + + + public String getNetworkUuid() { + return _networkUuid; + } + + + public String getPortUuid() { + return _portUuid; + } + + + public String getTenantUuid() { + return _tenantUuid; + } + + + public String getPortName() { + return _portName; + } + + + @Override + public boolean executeInSequence() { + return false; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java new file mode 100644 index 00000000000..30f631dd5d6 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/AddBigSwitchVnsDeviceCmd.java @@ -0,0 +1,111 @@ +// 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 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.PhysicalNetworkResponse; + +import com.cloud.api.response.BigSwitchVnsDeviceResponse; +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.network.BigSwitchVnsDeviceVO; +import com.cloud.network.element.BigSwitchVnsElementService; +import com.cloud.user.UserContext; +import com.cloud.utils.exception.CloudRuntimeException; + +@APICommand(name = "addBigSwitchVnsDevice", responseObject=BigSwitchVnsDeviceResponse.class, description="Adds a BigSwitch VNS device", since = "4.1.0") +public class AddBigSwitchVnsDeviceCmd extends BaseAsyncCmd { + private static final String s_name = "addbigswitchvnsdeviceresponse"; + @Inject BigSwitchVnsElementService _bigswitchVnsElementService; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, entityType = PhysicalNetworkResponse.class, + required=true, description="the Physical Network ID") + private Long physicalNetworkId; + + @Parameter(name=ApiConstants.HOST_NAME, type=CommandType.STRING, required=true, + description="Hostname of ip address of the BigSwitch VNS Controller.") + private String host; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public String getHost() { + return host; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { + try { + BigSwitchVnsDeviceVO bigswitchVnsDeviceVO = _bigswitchVnsElementService.addBigSwitchVnsDevice(this); + if (bigswitchVnsDeviceVO != null) { + BigSwitchVnsDeviceResponse response = _bigswitchVnsElementService.createBigSwitchVnsDeviceResponse(bigswitchVnsDeviceVO); + response.setObjectName("bigswitchvnsdevice"); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add BigSwitch VNS device due to internal error."); + } + } catch (InvalidParameterValueException invalidParamExcp) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + } catch (CloudRuntimeException runtimeExcp) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return UserContext.current().getCaller().getId(); + } + + @Override + public String getEventType() { + return VnsConstants.EVENT_EXTERNAL_VNS_CONTROLLER_ADD; + } + + @Override + public String getEventDescription() { + return "Adding a BigSwitch VNS Controller"; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java new file mode 100644 index 00000000000..f26bddedcb0 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/DeleteBigSwitchVnsDeviceCmd.java @@ -0,0 +1,100 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.api.commands; + + +import javax.inject.Inject; + +import org.apache.cloudstack.api.APICommand; +import org.apache.cloudstack.api.ApiErrorCode; +import org.apache.cloudstack.api.BaseAsyncCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.SuccessResponse; + +import 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.network.element.BigSwitchVnsElementService; +import com.cloud.user.UserContext; +import com.cloud.utils.exception.CloudRuntimeException; + +@APICommand(name = "deleteBigSwitchVnsDevice", responseObject=SuccessResponse.class, description=" delete a bigswitch vns device", since = "4.1.0") +public class DeleteBigSwitchVnsDeviceCmd extends BaseAsyncCmd { + private static final String s_name = "deletebigswitchvnsdeviceresponse"; + @Inject BigSwitchVnsElementService _bigswitchVnsElementService; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, type=CommandType.LONG, required=true, description="BigSwitch device ID") + private Long bigswitchVnsDeviceId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getBigSwitchVnsDeviceId() { + return bigswitchVnsDeviceId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException { + try { + boolean result = _bigswitchVnsElementService.deleteBigSwitchVnsDevice(this); + if (result) { + SuccessResponse response = new SuccessResponse(getCommandName()); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } else { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete BigSwitch device."); + } + } catch (InvalidParameterValueException invalidParamExcp) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + } catch (CloudRuntimeException runtimeExcp) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } + + @Override + public long getEntityOwnerId() { + return UserContext.current().getCaller().getId(); + } + + @Override + public String getEventType() { + return VnsConstants.EVENT_EXTERNAL_VNS_CONTROLLER_DELETE; + } + + @Override + public String getEventDescription() { + return "Deleting BigSwitch Vns Controller"; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.java new file mode 100644 index 00000000000..002d750604d --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/ListBigSwitchVnsDevicesCmd.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.api.commands; + +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.ApiErrorCode; +import org.apache.cloudstack.api.BaseListCmd; +import org.apache.cloudstack.api.Parameter; +import org.apache.cloudstack.api.ServerApiException; +import org.apache.cloudstack.api.response.ListResponse; +import org.apache.cloudstack.api.response.PhysicalNetworkResponse; +import org.apache.log4j.Logger; + +import com.cloud.api.response.BigSwitchVnsDeviceResponse; +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.network.BigSwitchVnsDeviceVO; +import com.cloud.network.element.BigSwitchVnsElementService; +import com.cloud.utils.exception.CloudRuntimeException; + +@APICommand(name = "listBigSwitchVnsDevices", responseObject=BigSwitchVnsDeviceResponse.class, description="Lists BigSwitch Vns devices", since = "4.1.0") +public class ListBigSwitchVnsDevicesCmd extends BaseListCmd { + public static final Logger s_logger = Logger.getLogger(ListBigSwitchVnsDevicesCmd.class.getName()); + private static final String s_name = "listbigswitchvnsdeviceresponse"; + @Inject BigSwitchVnsElementService _bigswitchVnsElementService; + + ///////////////////////////////////////////////////// + //////////////// API parameters ///////////////////// + ///////////////////////////////////////////////////// + + @Parameter(name=ApiConstants.PHYSICAL_NETWORK_ID, type=CommandType.UUID, + entityType = PhysicalNetworkResponse.class, + description="the Physical Network ID") + private Long physicalNetworkId; + + @Parameter(name=VnsConstants.BIGSWITCH_VNS_DEVICE_ID, + type=CommandType.LONG, + description="bigswitch vns device ID") + private Long bigswitchVnsDeviceId; + + ///////////////////////////////////////////////////// + /////////////////// Accessors /////////////////////// + ///////////////////////////////////////////////////// + + public Long getBigSwitchVnsDeviceId() { + return bigswitchVnsDeviceId; + } + + public Long getPhysicalNetworkId() { + return physicalNetworkId; + } + + ///////////////////////////////////////////////////// + /////////////// API Implementation/////////////////// + ///////////////////////////////////////////////////// + + @Override + public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, + ConcurrentOperationException, ResourceAllocationException { + try { + List bigswitchDevices = _bigswitchVnsElementService.listBigSwitchVnsDevices(this); + ListResponse response = new ListResponse(); + List bigswitchDevicesResponse = new ArrayList(); + + if (bigswitchDevices != null && !bigswitchDevices.isEmpty()) { + for (BigSwitchVnsDeviceVO bigswitchDeviceVO : bigswitchDevices) { + BigSwitchVnsDeviceResponse bigswitchDeviceResponse = + _bigswitchVnsElementService.createBigSwitchVnsDeviceResponse(bigswitchDeviceVO); + bigswitchDevicesResponse.add(bigswitchDeviceResponse); + } + } + + response.setResponses(bigswitchDevicesResponse); + response.setResponseName(getCommandName()); + this.setResponseObject(response); + } catch (InvalidParameterValueException invalidParamExcp) { + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); + } catch (CloudRuntimeException runtimeExcp) { + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); + } + } + + @Override + public String getCommandName() { + return s_name; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.java new file mode 100644 index 00000000000..c6a4336f8e8 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/commands/VnsConstants.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.api.commands; + + +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; + +import com.cloud.network.Network.Provider; + +public class VnsConstants { + public static final String BIGSWITCH_VNS_DEVICE_ID = "vnsdeviceid"; + public static final String BIGSWITCH_VNS_DEVICE_NAME = "bigswitchdevicename"; + + public static final String EVENT_EXTERNAL_VNS_CONTROLLER_ADD = "PHYSICAL.VNSCONTROLLER.ADD"; + public static final String EVENT_EXTERNAL_VNS_CONTROLLER_DELETE = "PHYSICAL.VNSCONTROLLER.DELETE"; + + public static final Provider BigSwitchVns = new Provider("BigSwitchVns", true); + + public static final NetworkDevice BigSwitchVnsDevice = new NetworkDevice("BigSwitchVns", BigSwitchVns.getName()); + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.java new file mode 100644 index 00000000000..ede5adf178e --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/api/response/BigSwitchVnsDeviceResponse.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.api.response; + +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.BaseResponse; +import org.apache.cloudstack.api.EntityReference; +import com.cloud.api.commands.VnsConstants; +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.serializer.Param; +import com.google.gson.annotations.SerializedName; + +@EntityReference(value=BigSwitchVnsDeviceVO.class) +public class BigSwitchVnsDeviceResponse extends BaseResponse { + @SerializedName(VnsConstants.BIGSWITCH_VNS_DEVICE_ID) @Param(description="device id of the BigSwitch Vns") + private String id; + + @SerializedName(ApiConstants.PHYSICAL_NETWORK_ID) @Param(description="the physical network to which this BigSwitch Vns belongs to") + private String physicalNetworkId; + + @SerializedName(ApiConstants.PROVIDER) @Param(description="name of the provider") + private String providerName; + + @SerializedName(VnsConstants.BIGSWITCH_VNS_DEVICE_NAME) @Param(description="device name") + private String deviceName; + + @SerializedName(ApiConstants.HOST_NAME) @Param(description="the controller Ip address") + private String hostName; + + public void setId(String vnsDeviceId) { + this.id = vnsDeviceId; + } + + public void setPhysicalNetworkId(String physicalNetworkId) { + this.physicalNetworkId = physicalNetworkId; + } + + public void setProviderName(String providerName) { + this.providerName = providerName; + } + + public void setDeviceName(String deviceName) { + this.deviceName = deviceName; + } + + public void setHostName(String hostName) { + this.hostName = hostName; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java new file mode 100644 index 00000000000..7e64833d2b0 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/BigSwitchVnsDeviceVO.java @@ -0,0 +1,94 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network; + +import java.util.UUID; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Table; + +@Entity +@Table(name="external_bigswitch_vns_devices") +public class BigSwitchVnsDeviceVO { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name="id") + private long id; + + @Column(name="uuid") + private String uuid; + + @Column(name="host_id") + private long hostId; + + @Column(name="physical_network_id") + private long physicalNetworkId; + + @Column(name="provider_name") + private String providerName; + + @Column(name="device_name") + private String deviceName; + + public BigSwitchVnsDeviceVO() { + this.uuid = UUID.randomUUID().toString(); + } + + public BigSwitchVnsDeviceVO(long hostId, long physicalNetworkId, + String providerName, String deviceName) { + super(); + this.hostId = hostId; + this.physicalNetworkId = physicalNetworkId; + this.providerName = providerName; + this.deviceName = deviceName; + this.uuid = UUID.randomUUID().toString(); + } + + public long getId() { + return id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public long getPhysicalNetworkId() { + return physicalNetworkId; + } + + public long getHostId() { + return hostId; + } + + public String getProviderName() { + return providerName; + } + + public String getDeviceName() { + return deviceName; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java new file mode 100644 index 00000000000..9a134676d1f --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Attachment.java @@ -0,0 +1,38 @@ +// 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.bigswitch; + +public class Attachment { + private String id; + private String mac; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getMac() { + return mac; + } + + public void setMac(String mac) { + this.mac = mac; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java new file mode 100644 index 00000000000..c409dcec9b7 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApi.java @@ -0,0 +1,330 @@ +// 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.bigswitch; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.lang.reflect.Type; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager; +import org.apache.commons.httpclient.NameValuePair; +import org.apache.commons.httpclient.cookie.CookiePolicy; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.httpclient.methods.StringRequestEntity; +import org.apache.log4j.Logger; + +import com.google.gson.Gson; +import com.google.gson.reflect.TypeToken; + +public class BigSwitchVnsApi { + private static final Logger s_logger = Logger.getLogger(BigSwitchVnsApi.class); + private final static String _protocol = "http"; + private final static String _nsBaseUri = "/networkService/v1.1"; + private final static String _controllerBaseUri = "/wm/core"; + private final static String CONTENT_TYPE = "Content-Type"; + private final static String CONTENT_JSON = "application/json"; + private final static String HTTP_HEADER_INSTANCE_ID = "HTTP_INSTANCE_ID"; + private final static String CLOUDSTACK_INSTANCE_ID = "org.apache.cloudstack"; + private final static MultiThreadedHttpConnectionManager s_httpClientManager = + new MultiThreadedHttpConnectionManager(); + + private String _host; + + private HttpClient _client; + + /* This factory method is protected so we can extend this + * in the unittests. + */ + protected HttpClient createHttpClient() { + return new HttpClient(s_httpClientManager); + } + + protected HttpMethod createMethod(String type, String uri, int port) throws BigSwitchVnsApiException { + String url; + try { + url = new URL(_protocol, _host, port, uri).toString(); + } catch (MalformedURLException e) { + s_logger.error("Unable to build BigSwitch API URL", e); + throw new BigSwitchVnsApiException("Unable to build v API URL", e); + } + + if ("post".equalsIgnoreCase(type)) { + return new PostMethod(url); + } + else if ("get".equalsIgnoreCase(type)) { + return new GetMethod(url); + } + else if ("delete".equalsIgnoreCase(type)) { + return new DeleteMethod(url); + } + else if ("put".equalsIgnoreCase(type)) { + return new PutMethod(url); + } + else { + throw new BigSwitchVnsApiException("Requesting unknown method type"); + } + } + + public BigSwitchVnsApi() { + _client = createHttpClient(); + _client.getParams().setCookiePolicy(CookiePolicy.BROWSER_COMPATIBILITY); + } + + public void setControllerAddress(String address) { + this._host = address; + } + + + /** + * Logs into the BigSwitch API. The cookie is stored in the _authcookie variable. + *

+ * The method returns false if the login failed or the connection could not be made. + * + */ + protected void login() throws BigSwitchVnsApiException { + return; + } + + public void createNetwork(Network network) + throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + network.getTenant_id() + "/network"; + executeCreateObject(network, new TypeToken(){}.getType(), + uri, Collections.emptyMap()); + } + + public void deleteNetwork(String tenantId, String networkId) throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId; + executeDeleteObject(uri); + } + + public void createPort(String networkUuid, Port port) + throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + port.getTenant_id() + "/networks/" + networkUuid + "/ports"; + executeCreateObject(port, new TypeToken(){}.getType(), + uri, Collections.emptyMap()); + } + + public void modifyPort(String networkId, Port port) + throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + port.getTenant_id() + "/networks/" + networkId + "/ports"; + executeUpdateObject(port, uri, Collections.emptyMap()); + } + + public void deletePort(String tenantId, String networkId, String portId) + throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId; + executeDeleteObject(uri); + } + + public void modifyPortAttachment(String tenantId, + String networkId, + String portId, + Attachment attachment) throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment"; + executeUpdateObject(attachment, uri, Collections.emptyMap()); + } + + public void deletePortAttachment(String tenantId, String networkId, String portId) + throws BigSwitchVnsApiException { + String uri = _nsBaseUri + "/tenant/" + tenantId + "/networks/" + networkId + "/ports/" + portId + "/attachment"; + executeDeleteObject(uri); + } + + public ControlClusterStatus getControlClusterStatus() throws BigSwitchVnsApiException { + String uri = _controllerBaseUri + "/health/json"; + ControlClusterStatus ccs = executeRetrieveObject(new TypeToken(){}.getType(), + uri, 80, null); + + return ccs; + } + + protected void executeUpdateObject(T newObject, String uri, Map parameters) + throws BigSwitchVnsApiException { + if (_host == null || _host.isEmpty()) { + throw new BigSwitchVnsApiException("Hostname is null or empty"); + } + + Gson gson = new Gson(); + + PutMethod pm = (PutMethod) createMethod("put", uri, 80); + pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); + pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID); + try { + pm.setRequestEntity(new StringRequestEntity( + gson.toJson(newObject), CONTENT_JSON, null)); + } catch (UnsupportedEncodingException e) { + throw new BigSwitchVnsApiException("Failed to encode json request body", e); + } + + executeMethod(pm); + + if (pm.getStatusCode() != HttpStatus.SC_OK) { + String errorMessage = responseToErrorMessage(pm); + pm.releaseConnection(); + s_logger.error("Failed to update object : " + errorMessage); + throw new BigSwitchVnsApiException("Failed to update object : " + errorMessage); + } + pm.releaseConnection(); + } + + protected void executeCreateObject(T newObject, Type returnObjectType, String uri, + Map parameters) + throws BigSwitchVnsApiException { + if (_host == null || _host.isEmpty()) { + throw new BigSwitchVnsApiException("Hostname is null or empty"); + } + + Gson gson = new Gson(); + + PostMethod pm = (PostMethod) createMethod("post", uri, 80); + pm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); + pm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID); + try { + pm.setRequestEntity(new StringRequestEntity( + gson.toJson(newObject), CONTENT_JSON, null)); + } catch (UnsupportedEncodingException e) { + throw new BigSwitchVnsApiException("Failed to encode json request body", e); + } + + executeMethod(pm); + + if (pm.getStatusCode() != HttpStatus.SC_OK) { + String errorMessage = responseToErrorMessage(pm); + pm.releaseConnection(); + s_logger.error("Failed to create object : " + errorMessage); + throw new BigSwitchVnsApiException("Failed to create object : " + errorMessage); + } + pm.releaseConnection(); + + return; + } + + protected void executeDeleteObject(String uri) throws BigSwitchVnsApiException { + if (_host == null || _host.isEmpty()) { + throw new BigSwitchVnsApiException("Hostname is null or empty"); + } + + DeleteMethod dm = (DeleteMethod) createMethod("delete", uri, 80); + dm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); + dm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID); + + executeMethod(dm); + + if (dm.getStatusCode() != HttpStatus.SC_OK) { + String errorMessage = responseToErrorMessage(dm); + dm.releaseConnection(); + s_logger.error("Failed to delete object : " + errorMessage); + throw new BigSwitchVnsApiException("Failed to delete object : " + errorMessage); + } + dm.releaseConnection(); + } + + @SuppressWarnings("unchecked") + protected T executeRetrieveObject(Type returnObjectType, String uri, int port, Map parameters) + throws BigSwitchVnsApiException { + if (_host == null || _host.isEmpty()) { + throw new BigSwitchVnsApiException("Hostname is null or empty"); + } + + GetMethod gm = (GetMethod) createMethod("get", uri, port); + gm.setRequestHeader(CONTENT_TYPE, CONTENT_JSON); + gm.setRequestHeader(HTTP_HEADER_INSTANCE_ID, CLOUDSTACK_INSTANCE_ID); + + if (parameters != null && !parameters.isEmpty()) { + List nameValuePairs = new ArrayList(parameters.size()); + for (Entry e : parameters.entrySet()) { + nameValuePairs.add(new NameValuePair(e.getKey(), e.getValue())); + } + gm.setQueryString(nameValuePairs.toArray(new NameValuePair[0])); + } + + executeMethod(gm); + + if (gm.getStatusCode() != HttpStatus.SC_OK) { + String errorMessage = responseToErrorMessage(gm); + gm.releaseConnection(); + s_logger.error("Failed to retrieve object : " + errorMessage); + throw new BigSwitchVnsApiException("Failed to retrieve object : " + errorMessage); + } + + Gson gson = new Gson(); + T returnValue; + try { + returnValue = (T)gson.fromJson(gm.getResponseBodyAsString(), returnObjectType); + } catch (IOException e) { + s_logger.error("IOException while retrieving response body",e); + throw new BigSwitchVnsApiException(e); + } finally { + gm.releaseConnection(); + } + return returnValue; + } + + protected void executeMethod(HttpMethodBase method) throws BigSwitchVnsApiException { + try { + _client.executeMethod(method); + if (method.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { + method.releaseConnection(); + // login and try again + login(); + _client.executeMethod(method); + } + } catch (HttpException e) { + s_logger.error("HttpException caught while trying to connect to the BigSwitch Controller", e); + method.releaseConnection(); + throw new BigSwitchVnsApiException("API call to BigSwitch Controller Failed", e); + } catch (IOException e) { + s_logger.error("IOException caught while trying to connect to the BigSwitch Controller", e); + method.releaseConnection(); + throw new BigSwitchVnsApiException("API call to BigSwitch Controller Failed", e); + } + } + + private String responseToErrorMessage(HttpMethodBase method) { + assert method.isRequestSent() : "no use getting an error message unless the request is sent"; + + if ("text/html".equals(method.getResponseHeader(CONTENT_TYPE).getValue())) { + // The error message is the response content + // Safety margin of 1024 characters, anything longer is probably useless + // and will clutter the logs + try { + return method.getResponseBodyAsString(1024); + } catch (IOException e) { + s_logger.debug("Error while loading response body", e); + } + } + + // The default + return method.getStatusText(); + } + +} \ No newline at end of file diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.java new file mode 100644 index 00000000000..49c32382936 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/BigSwitchVnsApiException.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.network.bigswitch; + +public class BigSwitchVnsApiException extends Exception { + + + private static final long serialVersionUID = -5864952230870945604L; + + public BigSwitchVnsApiException() { + } + + public BigSwitchVnsApiException(String message) { + super(message); + } + + public BigSwitchVnsApiException(Throwable cause) { + super(cause); + } + + public BigSwitchVnsApiException(String message, Throwable cause) { + super(message, cause); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java new file mode 100644 index 00000000000..9181afdc509 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/ControlClusterStatus.java @@ -0,0 +1,25 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package com.cloud.network.bigswitch; + +public class ControlClusterStatus { + private boolean healthy; + + public boolean getStatus() { + return healthy; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.java new file mode 100644 index 00000000000..c89c6932d31 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Network.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.network.bigswitch; + +public class Network { + private String id; + private String name; + private String tenant_id; + private int vlan; + private String gateway; + private String state; + + public String getUuid() { + return id; + } + + public void setUuid(String id) { + this.id = id; + } + + public String getDisplay_name() { + return name; + } + + public void setDisplay_name(String display_name) { + this.name = display_name; + } + + public String getTenant_id() { + return tenant_id; + } + + public void setTenant_id(String tenant_id) { + this.tenant_id = tenant_id; + } + + public int getVlan() { + return vlan; + } + + public void setVlan(int vlan) { + this.vlan = vlan; + } + + public String getGateway() { + return gateway; + } + + public void setGateway(String gateway) { + this.gateway = gateway; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java new file mode 100644 index 00000000000..bf749d084e2 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/bigswitch/Port.java @@ -0,0 +1,56 @@ +// 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.bigswitch; + +public class Port { + private String id; + private String name; + private String tenant_id; + private String state; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTenant_id() { + return tenant_id; + } + + public void setTenant_id(String tenant_id) { + this.tenant_id = tenant_id; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } +} diff --git a/core/src/com/cloud/vm/VirtualEnvironment.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java similarity index 63% rename from core/src/com/cloud/vm/VirtualEnvironment.java rename to plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java index 79d4a59bbfc..d9bbf9da737 100644 --- a/core/src/com/cloud/vm/VirtualEnvironment.java +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDao.java @@ -14,33 +14,19 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.vm; +package com.cloud.network.dao; import java.util.List; -/** - * - * be an information carrier within one thread only. - * - */ -public class VirtualEnvironment { +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.utils.db.GenericDao; + +public interface BigSwitchVnsDao extends GenericDao{ /** - * The actual machine + * list all the bigswitch Vns devices added in to this physical network + * @param physicalNetworkId physical Network Id + * @return list of BigSwitchVnsDeviceVO for this physical network. */ - public VirtualMachine machine; - - /** - * Disks to assign to the machine in order. - */ - public List disks; - - /** - * Networks to assign to the machine. - */ - public List networks; - - /** - * Boot options to assign to the machine. - */ - public String bootOptions; + List listByPhysicalNetwork(long physicalNetworkId); + } diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java new file mode 100644 index 00000000000..dad9f362f50 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/dao/BigSwitchVnsDaoImpl.java @@ -0,0 +1,51 @@ +// 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.dao; + +import java.util.List; + +import javax.ejb.Local; + +import org.springframework.stereotype.Component; + +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.utils.db.GenericDaoBase; +import com.cloud.utils.db.SearchBuilder; +import com.cloud.utils.db.SearchCriteria; +import com.cloud.utils.db.SearchCriteria.Op; + +@Component +@Local(value=BigSwitchVnsDao.class) +public class BigSwitchVnsDaoImpl extends GenericDaoBase + implements BigSwitchVnsDao { + + protected final SearchBuilder physicalNetworkIdSearch; + + public BigSwitchVnsDaoImpl() { + physicalNetworkIdSearch = createSearchBuilder(); + physicalNetworkIdSearch.and("physicalNetworkId", physicalNetworkIdSearch.entity().getPhysicalNetworkId(), Op.EQ); + physicalNetworkIdSearch.done(); + } + + @Override + public List listByPhysicalNetwork(long physicalNetworkId) { + SearchCriteria sc = physicalNetworkIdSearch.create(); + sc.setParameters("physicalNetworkId", physicalNetworkId); + return search(sc, null); + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java new file mode 100644 index 00000000000..95c9e18304a --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElement.java @@ -0,0 +1,545 @@ +// 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.element; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +import javax.ejb.Local; +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; +import org.apache.log4j.Logger; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.CreateVnsPortAnswer; +import com.cloud.agent.api.CreateVnsPortCommand; +import com.cloud.agent.api.DeleteVnsPortAnswer; +import com.cloud.agent.api.DeleteVnsPortCommand; +import com.cloud.agent.api.StartupBigSwitchVnsCommand; +import com.cloud.agent.api.StartupCommand; +import com.cloud.api.ApiDBUtils; +import com.cloud.api.commands.AddBigSwitchVnsDeviceCmd; +import com.cloud.api.commands.DeleteBigSwitchVnsDeviceCmd; +import com.cloud.api.commands.ListBigSwitchVnsDevicesCmd; +import com.cloud.api.commands.VnsConstants; +import com.cloud.api.response.BigSwitchVnsDeviceResponse; +import com.cloud.configuration.ConfigurationManager; +import com.cloud.dc.dao.VlanDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.exception.ConcurrentOperationException; +import com.cloud.exception.InsufficientCapacityException; +import com.cloud.exception.InvalidParameterValueException; +import com.cloud.exception.ResourceUnavailableException; +import com.cloud.host.DetailVO; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDetailsDao; +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.network.Network; +import com.cloud.network.Network.Capability; +import com.cloud.network.Network.Provider; +import com.cloud.network.Network.Service; +import com.cloud.network.NetworkModel; +import com.cloud.network.Networks; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.PhysicalNetwork; +import com.cloud.network.PhysicalNetworkServiceProvider; +import com.cloud.network.dao.BigSwitchVnsDao; +import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; +import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.network.resource.BigSwitchVnsResource; +import com.cloud.offering.NetworkOffering; +import com.cloud.resource.ResourceManager; +import com.cloud.resource.ResourceState; +import com.cloud.resource.ResourceStateAdapter; +import com.cloud.resource.ServerResource; +import com.cloud.resource.UnableDeleteHostException; +import com.cloud.utils.component.AdapterBase; +import com.cloud.utils.db.DB; +import com.cloud.utils.db.Transaction; +import com.cloud.utils.exception.CloudRuntimeException; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; +import org.springframework.stereotype.Component; + +@Component +@Local(value = {NetworkElement.class, ConnectivityProvider.class}) +public class BigSwitchVnsElement extends AdapterBase implements + BigSwitchVnsElementService, ConnectivityProvider, ResourceStateAdapter { + private static final Logger s_logger = Logger.getLogger(BigSwitchVnsElement.class); + + private static final Map> capabilities = setCapabilities(); + + @Inject + ResourceManager _resourceMgr; + @Inject + PhysicalNetworkDao _physicalNetworkDao; + @Inject + PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; + @Inject + BigSwitchVnsDao _bigswitchVnsDao; + @Inject + HostDetailsDao _hostDetailsDao; + @Inject + HostDao _hostDao; + @Inject + AgentManager _agentMgr; + @Inject + NetworkDao _networkDao; + @Inject + NetworkModel _networkModel; + @Inject + ConfigurationManager _configMgr; + @Inject + NetworkServiceMapDao _ntwkSrvcDao; + @Inject + VlanDao _vlanDao; + + @Override + public Map> getCapabilities() { + return capabilities; + } + + @Override + public Provider getProvider() { + return VnsConstants.BigSwitchVns; + } + + private boolean canHandle(Network network, Service service) { + s_logger.debug("Checking if BigSwitchVnsElement can handle service " + + service.getName() + " on network " + network.getDisplayText()); + if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { + return false; + } + + if (!_networkModel.isProviderForNetwork(getProvider(), + network.getId())) { + s_logger.debug("BigSwitchVnsElement is not a provider for network " + + network.getDisplayText()); + return false; + } + + if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), + service, VnsConstants.BigSwitchVns)) { + s_logger.debug("BigSwitchVnsElement can't provide the " + + service.getName() + " service on network " + + network.getDisplayText()); + return false; + } + + return true; + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + super.configure(name, params); + _resourceMgr.registerResourceStateAdapter(this.getClass() + .getSimpleName(), this); + return true; + } + + @Override + public boolean implement(Network network, NetworkOffering offering, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { + s_logger.debug("entering BigSwitchVnsElement implement function for network " + + network.getDisplayText() + + " (state " + + network.getState() + + ")"); + + return true; + } + + @Override + public boolean prepare(Network network, NicProfile nic, + VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { + + if (!canHandle(network, Service.Connectivity)) { + return false; + } + + if (network.getBroadcastUri() == null) { + s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); + return false; + } + + String mac = nic.getMacAddress(); + String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId(); + + List devices = _bigswitchVnsDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No BigSwitch Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0); + HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId()); + + CreateVnsPortCommand cmd = new CreateVnsPortCommand( + network.getBroadcastUri().getSchemeSpecificPart(), + vm.getUuid(), + tenantId, + nic.getName(), + mac); + CreateVnsPortAnswer answer = (CreateVnsPortAnswer) _agentMgr + .easySend(bigswitchVnsHost.getId(), cmd); + + if (answer == null || !answer.getResult()) { + s_logger.error("CreatePortCommand failed"); + return false; + } + + return true; + } + + @Override + public boolean release(Network network, NicProfile nic, + VirtualMachineProfile vm, + ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { + + if (!canHandle(network, Service.Connectivity)) { + return false; + } + + if (network.getBroadcastUri() == null) { + s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); + return false; + } + + String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId(); + + List devices = _bigswitchVnsDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No BigSwitch Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0); + HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId()); + + DeleteVnsPortCommand cmd = new DeleteVnsPortCommand( + network.getBroadcastUri().getSchemeSpecificPart(), + vm.getUuid(), + tenantId); + DeleteVnsPortAnswer answer = (DeleteVnsPortAnswer) _agentMgr + .easySend(bigswitchVnsHost.getId(), cmd); + + if (answer == null || !answer.getResult()) { + s_logger.error("DeletePortCommand failed"); + return false; + } + + return true; + } + + @Override + public boolean shutdown(Network network, ReservationContext context, + boolean cleanup) throws ConcurrentOperationException, + ResourceUnavailableException { + if (!canHandle(network, Service.Connectivity)) { + return false; + } + + return true; + } + + @Override + public boolean destroy(Network network, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + if (!canHandle(network, Service.Connectivity)) { + return false; + } + + return true; + } + + @Override + public boolean isReady(PhysicalNetworkServiceProvider provider) { + return true; + } + + @Override + public boolean shutdownProviderInstances( + PhysicalNetworkServiceProvider provider, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + // Nothing to do here. + return true; + } + + @Override + public boolean canEnableIndividualServices() { + return true; + } + + @Override + public boolean verifyServicesCombination(Set services) { + if (!services.contains(Service.Connectivity)) { + s_logger.warn("Unable to provide services without Connectivity service enabled for this element"); + return false; + } + return true; + } + + private static Map> setCapabilities() { + Map> capabilities = new HashMap>(); + + // L2 Support : SDN provisioning + capabilities.put(Service.Connectivity, null); + + return capabilities; + } + + @Override + @DB + public BigSwitchVnsDeviceVO addBigSwitchVnsDevice(AddBigSwitchVnsDeviceCmd cmd) { + ServerResource resource = new BigSwitchVnsResource(); + String deviceName = VnsConstants.BigSwitchVns.getName(); + NetworkDevice networkDevice = NetworkDevice + .getNetworkDevice(deviceName); + Long physicalNetworkId = cmd.getPhysicalNetworkId(); + BigSwitchVnsDeviceVO bigswitchVnsDevice = null; + + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork == null) { + throw new InvalidParameterValueException( + "Could not find phyical network with ID: " + + physicalNetworkId); + } + long zoneId = physicalNetwork.getDataCenterId(); + + PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao + .findByServiceProvider(physicalNetwork.getId(), + networkDevice.getNetworkServiceProvder()); + if (ntwkSvcProvider == null) { + throw new CloudRuntimeException("Network Service Provider: " + + networkDevice.getNetworkServiceProvder() + + " is not enabled in the physical network: " + + physicalNetworkId + "to add this device"); + } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { + throw new CloudRuntimeException("Network Service Provider: " + + ntwkSvcProvider.getProviderName() + + " is in shutdown state in the physical network: " + + physicalNetworkId + "to add this device"); + } + + if (_bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) { + throw new CloudRuntimeException( + "A BigSwitch controller device is already configured on this physical network"); + } + + Map params = new HashMap(); + params.put("guid", UUID.randomUUID().toString()); + params.put("zoneId", String.valueOf(physicalNetwork.getDataCenterId())); + params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId())); + params.put("name", "BigSwitch Controller - " + cmd.getHost()); + params.put("ip", cmd.getHost()); + // FIXME What to do with multiple isolation types + params.put("transportzoneisotype", + physicalNetwork.getIsolationMethods().get(0).toLowerCase()); + + Map hostdetails = new HashMap(); + hostdetails.putAll(params); + + Transaction txn = Transaction.currentTxn(); + try { + resource.configure(cmd.getHost(), hostdetails); + + Host host = _resourceMgr.addHost(zoneId, resource, + Host.Type.L2Networking, params); + if (host != null) { + txn.start(); + + bigswitchVnsDevice = new BigSwitchVnsDeviceVO(host.getId(), + physicalNetworkId, ntwkSvcProvider.getProviderName(), + deviceName); + _bigswitchVnsDao.persist(bigswitchVnsDevice); + + DetailVO detail = new DetailVO(host.getId(), + "bigswitchvnsdeviceid", + String.valueOf(bigswitchVnsDevice.getId())); + _hostDetailsDao.persist(detail); + + txn.commit(); + return bigswitchVnsDevice; + } else { + throw new CloudRuntimeException( + "Failed to add BigSwitch Vns Device due to internal error."); + } + } catch (ConfigurationException e) { + txn.rollback(); + throw new CloudRuntimeException(e.getMessage()); + } + } + + @Override + public BigSwitchVnsDeviceResponse createBigSwitchVnsDeviceResponse( + BigSwitchVnsDeviceVO bigswitchVnsDeviceVO) { + HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDeviceVO.getHostId()); + _hostDao.loadDetails(bigswitchVnsHost); + + BigSwitchVnsDeviceResponse response = new BigSwitchVnsDeviceResponse(); + response.setDeviceName(bigswitchVnsDeviceVO.getDeviceName()); + PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(bigswitchVnsDeviceVO.getPhysicalNetworkId()); + if (pnw != null) { + response.setPhysicalNetworkId(pnw.getUuid()); + } + response.setId(bigswitchVnsDeviceVO.getUuid()); + response.setProviderName(bigswitchVnsDeviceVO.getProviderName()); + response.setHostName(bigswitchVnsHost.getDetail("ip")); + response.setObjectName("bigswitchvnsdevice"); + return response; + } + + @Override + public boolean deleteBigSwitchVnsDevice(DeleteBigSwitchVnsDeviceCmd cmd) { + Long bigswitchVnsDeviceId = cmd.getBigSwitchVnsDeviceId(); + BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao + .findById(bigswitchVnsDeviceId); + if (bigswitchVnsDevice == null) { + throw new InvalidParameterValueException( + "Could not find a BigSwitch Controller with id " + bigswitchVnsDevice); + } + + // Find the physical network we work for + Long physicalNetworkId = bigswitchVnsDevice.getPhysicalNetworkId(); + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork != null) { + List networkList = _networkDao + .listByPhysicalNetwork(physicalNetworkId); + + // Networks with broadcast type lswitch are ours + for (NetworkVO network : networkList) { + if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { + if ((network.getState() != Network.State.Shutdown) + && (network.getState() != Network.State.Destroy)) { + throw new CloudRuntimeException( + "This BigSwitch Controller device can not be deleted as there are one or more " + + "logical networks provisioned by cloudstack."); + } + } + } + } + + HostVO bigswitchHost = _hostDao.findById(bigswitchVnsDevice.getHostId()); + Long hostId = bigswitchHost.getId(); + + bigswitchHost.setResourceState(ResourceState.Maintenance); + _hostDao.update(hostId, bigswitchHost); + _resourceMgr.deleteHost(hostId, false, false); + + _bigswitchVnsDao.remove(bigswitchVnsDeviceId); + return true; + } + + @Override + public List listBigSwitchVnsDevices( + ListBigSwitchVnsDevicesCmd cmd) { + Long physicalNetworkId = cmd.getPhysicalNetworkId(); + Long bigswitchVnsDeviceId = cmd.getBigSwitchVnsDeviceId(); + List responseList = new ArrayList(); + + if (physicalNetworkId == null && bigswitchVnsDeviceId == null) { + throw new InvalidParameterValueException( + "Either physical network Id or bigswitch device Id must be specified"); + } + + if (bigswitchVnsDeviceId != null) { + BigSwitchVnsDeviceVO bigswitchVnsDevice = _bigswitchVnsDao + .findById(bigswitchVnsDeviceId); + if (bigswitchVnsDevice == null) { + throw new InvalidParameterValueException( + "Could not find BigSwitch controller with id: " + + bigswitchVnsDevice); + } + responseList.add(bigswitchVnsDevice); + } else { + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork == null) { + throw new InvalidParameterValueException( + "Could not find a physical network with id: " + + physicalNetworkId); + } + responseList = _bigswitchVnsDao + .listByPhysicalNetwork(physicalNetworkId); + } + + return responseList; + } + + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, + StartupCommand[] cmd) { + // TODO Auto-generated method stub + return null; + } + + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { + if (!(startup[0] instanceof StartupBigSwitchVnsCommand)) { + return null; + } + host.setType(Host.Type.L2Networking); + return host; + } + + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, + boolean isForceDeleteStorage) throws UnableDeleteHostException { + if (!(host.getType() == Host.Type.L2Networking)) { + return null; + } + return new DeleteHostAnswer(true); + } + + @Override + public List> getCommands() { + List> cmdList = new ArrayList>(); + cmdList.add(AddBigSwitchVnsDeviceCmd.class); + cmdList.add(DeleteBigSwitchVnsDeviceCmd.class); + cmdList.add(ListBigSwitchVnsDevicesCmd.class); + return cmdList; + } + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.java new file mode 100644 index 00000000000..915a2c2fa46 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/element/BigSwitchVnsElementService.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.network.element; + +import java.util.List; + +import com.cloud.api.commands.AddBigSwitchVnsDeviceCmd; +import com.cloud.api.commands.DeleteBigSwitchVnsDeviceCmd; +import com.cloud.api.commands.ListBigSwitchVnsDevicesCmd; +import com.cloud.api.response.BigSwitchVnsDeviceResponse; +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.utils.component.PluggableService; + +public interface BigSwitchVnsElementService extends PluggableService { + + public BigSwitchVnsDeviceVO addBigSwitchVnsDevice(AddBigSwitchVnsDeviceCmd cmd); + + public BigSwitchVnsDeviceResponse createBigSwitchVnsDeviceResponse( + BigSwitchVnsDeviceVO bigswitchDeviceVO); + + boolean deleteBigSwitchVnsDevice(DeleteBigSwitchVnsDeviceCmd cmd); + + List listBigSwitchVnsDevices(ListBigSwitchVnsDevicesCmd cmd); + +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java new file mode 100644 index 00000000000..b96ea5606f7 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/guru/BigSwitchVnsGuestNetworkGuru.java @@ -0,0 +1,261 @@ +/* + * 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.guru; + +import com.cloud.agent.AgentManager; +import com.cloud.agent.api.CreateVnsNetworkAnswer; +import com.cloud.agent.api.CreateVnsNetworkCommand; +import com.cloud.agent.api.DeleteVnsNetworkCommand; +import com.cloud.dc.DataCenter; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.deploy.DeployDestination; +import com.cloud.deploy.DeploymentPlan; +import com.cloud.exception.InsufficientAddressCapacityException; +import com.cloud.exception.InsufficientVirtualNetworkCapcityException; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDetailsDao; +import com.cloud.network.BigSwitchVnsDeviceVO; +import com.cloud.network.Network; +import com.cloud.network.NetworkProfile; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.State; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.PhysicalNetwork; +import com.cloud.network.PhysicalNetwork.IsolationMethod; +import com.cloud.network.dao.BigSwitchVnsDao; +import com.cloud.network.dao.NetworkVO; +import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.offering.NetworkOffering; +import com.cloud.resource.ResourceManager; +import com.cloud.user.Account; +import com.cloud.user.dao.AccountDao; +import com.cloud.vm.NicProfile; +import com.cloud.vm.ReservationContext; +import com.cloud.vm.VirtualMachine; +import com.cloud.vm.VirtualMachineProfile; + +import java.net.URI; +import java.net.URISyntaxException; +import java.util.List; + +import org.apache.log4j.Logger; + +import javax.ejb.Local; +import javax.inject.Inject; + + +@Local(value = NetworkGuru.class) +public class BigSwitchVnsGuestNetworkGuru extends GuestNetworkGuru { + private static final Logger s_logger = Logger.getLogger(BigSwitchVnsGuestNetworkGuru.class); + + @Inject + DataCenterDao _zoneDao; + @Inject + PhysicalNetworkDao _physicalNetworkDao; + @Inject + AccountDao _accountDao; + @Inject + BigSwitchVnsDao _bigswitchVnsDao; + @Inject + HostDao _hostDao; + @Inject + ResourceManager _resourceMgr; + @Inject + AgentManager _agentMgr; + @Inject + HostDetailsDao _hostDetailsDao; + + public BigSwitchVnsGuestNetworkGuru() { + super(); + _isolationMethods = new IsolationMethod[] { IsolationMethod.VNS }; + } + + @Override + protected boolean canHandle(NetworkOffering offering, NetworkType networkType, + PhysicalNetwork physicalNetwork) { + if (networkType == NetworkType.Advanced + && isMyTrafficType(offering.getTrafficType()) + && offering.getGuestType() == Network.GuestType.Isolated + && isMyIsolationMethod(physicalNetwork)) { + return true; + } else { + s_logger.trace("We only take care of Guest networks of type " + GuestType.Isolated + + " in zone of type " + NetworkType.Advanced); + return false; + } + } + + @Override + public Network design(NetworkOffering offering, DeploymentPlan plan, + Network userSpecified, Account owner) { + // Check of the isolation type of the related physical network is VNS + PhysicalNetworkVO physnet = _physicalNetworkDao.findById(plan.getPhysicalNetworkId()); + if (physnet == null || + physnet.getIsolationMethods() == null || + !physnet.getIsolationMethods().contains("VNS")) { + s_logger.debug("Refusing to design this network, the physical isolation type is not VNS"); + return null; + } + + List devices = _bigswitchVnsDao.listByPhysicalNetwork(physnet.getId()); + if (devices.isEmpty()) { + s_logger.error("No BigSwitxh Controller on physical network " + physnet.getName()); + return null; + } + s_logger.debug("BigSwitch Controller " + devices.get(0).getUuid() + + " found on physical network " + physnet.getId()); + + s_logger.debug("Physical isolation type is VNS, asking GuestNetworkGuru to design this network"); + NetworkVO networkObject = (NetworkVO) super.design(offering, plan, userSpecified, owner); + if (networkObject == null) { + return null; + } + // Override the broadcast domain type + networkObject.setBroadcastDomainType(BroadcastDomainType.Lswitch); + + return networkObject; + } + + @Override + public Network implement(Network network, NetworkOffering offering, + DeployDestination dest, ReservationContext context) + throws InsufficientVirtualNetworkCapcityException { + assert (network.getState() == State.Implementing) : "Why are we implementing " + network; + + long dcId = dest.getDataCenter().getId(); + + //get physical network id + long physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, + offering.getTags(), + offering.getTrafficType()); + + NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), + network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, + network.getDataCenterId(), physicalNetworkId); + + if (network.getGateway() != null) { + implemented.setGateway(network.getGateway()); + } + + if (network.getCidr() != null) { + implemented.setCidr(network.getCidr()); + } + + String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, + network.getAccountId(), context.getReservationId()); + if (vnet == null) { + throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a " + + "part of network " + network + " implement ", DataCenter.class, dcId); + } + int vlan = Integer.parseInt(vnet); + + // Name is either the given name or the uuid + String name = network.getName(); + String networkUuid = implemented.getUuid(); + if (name == null || name.isEmpty()) { + name = ((NetworkVO)network).getUuid(); + } + if (name.length() > 64 ) { + name = name.substring(0, 63); // max length 64 + } + + String tenantId = context.getDomain().getName() + "-" + context.getAccount().getAccountId(); + List devices = _bigswitchVnsDao.listByPhysicalNetwork(physicalNetworkId); + if (devices.isEmpty()) { + s_logger.error("No BigSwitch Controller on physical network " + physicalNetworkId); + return null; + } + BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0); + HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId()); + _hostDao.loadDetails(bigswitchVnsHost); + + CreateVnsNetworkCommand cmd = new CreateVnsNetworkCommand(networkUuid, name, tenantId, vlan); + CreateVnsNetworkAnswer answer = (CreateVnsNetworkAnswer) _agentMgr.easySend(bigswitchVnsHost.getId(), cmd); + + if (answer == null || !answer.getResult()) { + s_logger.error ("CreateNetworkCommand failed"); + return null; + } + + try { + implemented.setBroadcastUri(new URI("vns", cmd.getNetworkUuid(), null)); + implemented.setBroadcastDomainType(BroadcastDomainType.Lswitch); + s_logger.info("Implemented OK, network " + networkUuid + " in tenant " + + tenantId + " linked to " + implemented.getBroadcastUri().toString()); + } catch (URISyntaxException e) { + s_logger.error("Unable to store network id in broadcast uri, uuid = " + implemented.getUuid(), e); + } + + return implemented; + } + + @Override + public void reserve(NicProfile nic, Network network, + VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) + throws InsufficientVirtualNetworkCapcityException, + InsufficientAddressCapacityException { + // TODO Auto-generated method stub + super.reserve(nic, network, vm, dest, context); + } + + @Override + public boolean release(NicProfile nic, + VirtualMachineProfile vm, + String reservationId) { + // TODO Auto-generated method stub + return super.release(nic, vm, reservationId); + } + + @Override + public void shutdown(NetworkProfile profile, NetworkOffering offering) { + NetworkVO networkObject = _networkDao.findById(profile.getId()); + if (networkObject.getBroadcastDomainType() != BroadcastDomainType.Lswitch || + networkObject.getBroadcastUri() == null) { + s_logger.warn("BroadcastUri is empty or incorrect for guestnetwork " + networkObject.getDisplayText()); + return; + } + + List devices = _bigswitchVnsDao.listByPhysicalNetwork(networkObject.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No BigSwitch Controller on physical network " + networkObject.getPhysicalNetworkId()); + return; + } + BigSwitchVnsDeviceVO bigswitchVnsDevice = devices.get(0); + HostVO bigswitchVnsHost = _hostDao.findById(bigswitchVnsDevice.getHostId()); + + String tenantId = profile.getNetworkDomain() + "-" + profile.getAccountId(); + + DeleteVnsNetworkCommand cmd = new DeleteVnsNetworkCommand(tenantId, + networkObject.getBroadcastUri().getSchemeSpecificPart()); + _agentMgr.easySend(bigswitchVnsHost.getId(), cmd); + + super.shutdown(profile, offering); + } + + @Override + public boolean trash(Network network, NetworkOffering offering, + Account owner) { + return super.trash(network, offering, owner); + } +} diff --git a/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java new file mode 100644 index 00000000000..8d070b589de --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/src/com/cloud/network/resource/BigSwitchVnsResource.java @@ -0,0 +1,323 @@ +// 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.resource; + +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.apache.log4j.Logger; + +import com.cloud.agent.IAgentControl; +import com.cloud.agent.api.Answer; +import com.cloud.agent.api.Command; +import com.cloud.agent.api.CreateVnsNetworkAnswer; +import com.cloud.agent.api.CreateVnsNetworkCommand; +import com.cloud.agent.api.CreateVnsPortAnswer; +import com.cloud.agent.api.CreateVnsPortCommand; +import com.cloud.agent.api.DeleteVnsNetworkAnswer; +import com.cloud.agent.api.DeleteVnsNetworkCommand; +import com.cloud.agent.api.DeleteVnsPortAnswer; +import com.cloud.agent.api.DeleteVnsPortCommand; +import com.cloud.agent.api.MaintainAnswer; +import com.cloud.agent.api.MaintainCommand; +import com.cloud.agent.api.PingCommand; +import com.cloud.agent.api.ReadyAnswer; +import com.cloud.agent.api.ReadyCommand; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.StartupBigSwitchVnsCommand; +import com.cloud.agent.api.UpdateVnsPortAnswer; +import com.cloud.agent.api.UpdateVnsPortCommand; +import com.cloud.host.Host; +import com.cloud.host.Host.Type; +import com.cloud.network.bigswitch.BigSwitchVnsApi; +import com.cloud.network.bigswitch.BigSwitchVnsApiException; +import com.cloud.network.bigswitch.ControlClusterStatus; +import com.cloud.network.bigswitch.Attachment; +import com.cloud.network.bigswitch.Network; +import com.cloud.network.bigswitch.Port; +import com.cloud.resource.ServerResource; +import com.cloud.utils.component.ManagerBase; + +public class BigSwitchVnsResource extends ManagerBase implements ServerResource { + private static final Logger s_logger = Logger.getLogger(BigSwitchVnsResource.class); + + private String _name; + private String _guid; + private String _zoneId; + private int _numRetries; + + private BigSwitchVnsApi _bigswitchVnsApi; + + protected BigSwitchVnsApi createBigSwitchVnsApi() { + return new BigSwitchVnsApi(); + } + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + + _name = (String) params.get("name"); + if (_name == null) { + throw new ConfigurationException("Unable to find name"); + } + + _guid = (String)params.get("guid"); + if (_guid == null) { + throw new ConfigurationException("Unable to find the guid"); + } + + _zoneId = (String) params.get("zoneId"); + if (_zoneId == null) { + throw new ConfigurationException("Unable to find zone"); + } + + _numRetries = 2; + + String ip = (String) params.get("ip"); + if (ip == null) { + throw new ConfigurationException("Unable to find IP"); + } + + _bigswitchVnsApi = createBigSwitchVnsApi(); + _bigswitchVnsApi.setControllerAddress(ip); + + return true; + } + + @Override + public boolean start() { + return true; + } + + @Override + public boolean stop() { + return true; + } + + @Override + public String getName() { + return _name; + } + + @Override + public Type getType() { + // Think up a better name for this Type? + return Host.Type.L2Networking; + } + + @Override + public StartupCommand[] initialize() { + StartupBigSwitchVnsCommand sc = new StartupBigSwitchVnsCommand(); + sc.setGuid(_guid); + sc.setName(_name); + sc.setDataCenter(_zoneId); + sc.setPod(""); + sc.setPrivateIpAddress(""); + sc.setStorageIpAddress(""); + sc.setVersion(""); + return new StartupCommand[] { sc }; + } + + @Override + public PingCommand getCurrentStatus(long id) { + try { + ControlClusterStatus ccs = _bigswitchVnsApi.getControlClusterStatus(); + if (!ccs.getStatus()) { + s_logger.error("ControlCluster state is not ready: " + ccs.getStatus()); + return null; + } + } catch (BigSwitchVnsApiException e) { + s_logger.error("getControlClusterStatus failed", e); + return null; + } + return new PingCommand(Host.Type.L2Networking, id); + } + + @Override + public Answer executeRequest(Command cmd) { + return executeRequest(cmd, _numRetries); + } + + public Answer executeRequest(Command cmd, int numRetries) { + if (cmd instanceof ReadyCommand) { + return executeRequest((ReadyCommand) cmd); + } + else if (cmd instanceof MaintainCommand) { + return executeRequest((MaintainCommand)cmd); + } + else if (cmd instanceof CreateVnsNetworkCommand) { + return executeRequest((CreateVnsNetworkCommand)cmd, numRetries); + } + else if (cmd instanceof DeleteVnsNetworkCommand) { + return executeRequest((DeleteVnsNetworkCommand) cmd, numRetries); + } + else if (cmd instanceof CreateVnsPortCommand) { + return executeRequest((CreateVnsPortCommand) cmd, numRetries); + } + else if (cmd instanceof DeleteVnsPortCommand) { + return executeRequest((DeleteVnsPortCommand) cmd, numRetries); + } + else if (cmd instanceof UpdateVnsPortCommand) { + return executeRequest((UpdateVnsPortCommand) cmd, numRetries); + } + s_logger.debug("Received unsupported command " + cmd.toString()); + return Answer.createUnsupportedCommandAnswer(cmd); + } + + @Override + public void disconnected() { + } + + @Override + public IAgentControl getAgentControl() { + return null; + } + + @Override + public void setAgentControl(IAgentControl agentControl) { + } + + private Answer executeRequest(CreateVnsNetworkCommand cmd, int numRetries) { + Network network = new Network(); + network.setTenant_id(cmd.getTenantUuid()); + network.setUuid(cmd.getNetworkUuid()); + network.setDisplay_name(truncate("vns-cloudstack-" + cmd.getName(), 64)); + network.setVlan(cmd.getVlan()); + + try { + _bigswitchVnsApi.createNetwork(network); + return new CreateVnsNetworkAnswer(cmd, true, "VNS " + network.getUuid() + " created"); + } catch (BigSwitchVnsApiException e) { + if (numRetries > 0) { + return retry(cmd, --numRetries); + } + else { + return new CreateVnsNetworkAnswer(cmd, e); + } + } + + } + + private Answer executeRequest(DeleteVnsNetworkCommand cmd, int numRetries) { + try { + _bigswitchVnsApi.deleteNetwork(cmd.get_tenantUuid(), cmd.getNetworkUuid()); + return new DeleteVnsNetworkAnswer(cmd, true, "VNS " + cmd.getNetworkUuid() + " deleted"); + } catch (BigSwitchVnsApiException e) { + if (numRetries > 0) { + return retry(cmd, --numRetries); + } + else { + return new DeleteVnsNetworkAnswer(cmd, e); + } + } + } + + private Answer executeRequest(CreateVnsPortCommand cmd, int numRetries) { + Port port = new Port(); + port.setId(cmd.getPortUuid()); + port.setName(cmd.getPortName()); + port.setTenant_id(cmd.getTenantUuid()); + + try { + _bigswitchVnsApi.createPort(cmd.getNetworkUuid(), port); + try { + Attachment attachment = new Attachment(); + attachment.setId(cmd.getPortUuid()); + attachment.setMac(cmd.getMac()); + _bigswitchVnsApi.modifyPortAttachment(cmd.getTenantUuid(), + cmd.getNetworkUuid(), cmd.getPortUuid(), attachment); + + } catch (BigSwitchVnsApiException ex) { + s_logger.warn("modifyPortAttachment failed after switchport was created, removing switchport"); + _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid()); + throw (ex); // Rethrow the original exception + } + return new CreateVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " created"); + } catch (BigSwitchVnsApiException e) { + if (numRetries > 0) { + return retry(cmd, --numRetries); + } + else { + return new CreateVnsPortAnswer(cmd, e); + } + } + } + + private Answer executeRequest(DeleteVnsPortCommand cmd, int numRetries) { + try { + _bigswitchVnsApi.deletePortAttachment(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid()); + try { + _bigswitchVnsApi.deletePort(cmd.getTenantUuid(), cmd.getNetworkUuid(), cmd.getPortUuid()); + } catch (BigSwitchVnsApiException ex) { + s_logger.warn("deletePort failed after portAttachment was removed"); + throw (ex); // Rethrow the original exception + } + return new DeleteVnsPortAnswer(cmd, true, "network port " + cmd.getPortUuid() + " deleted"); + } catch (BigSwitchVnsApiException e) { + if (numRetries > 0) { + return retry(cmd, --numRetries); + } + else { + return new DeleteVnsPortAnswer(cmd, e); + } + } + } + + private Answer executeRequest(UpdateVnsPortCommand cmd, int numRetries) { + Port port = new Port(); + port.setId(cmd.getPortUuid()); + port.setName(cmd.getPortName()); + port.setTenant_id(cmd.getTenantUuid()); + + try { + _bigswitchVnsApi.modifyPort(cmd.getNetworkUuid(), port); + return new UpdateVnsPortAnswer(cmd, true, "Network Port " + cmd.getPortUuid() + " updated"); + } catch (BigSwitchVnsApiException e) { + if (numRetries > 0) { + return retry(cmd, --numRetries); + } + else { + return new UpdateVnsPortAnswer(cmd, e); + } + } + + } + + private Answer executeRequest(ReadyCommand cmd) { + return new ReadyAnswer(cmd); + } + + private Answer executeRequest(MaintainCommand cmd) { + return new MaintainAnswer(cmd); + } + + private Answer retry(Command cmd, int numRetries) { + s_logger.warn("Retrying " + cmd.getClass().getSimpleName() + ". Number of retries remaining: " + numRetries); + return executeRequest(cmd, numRetries); + } + + private String truncate(String string, int length) { + if (string.length() <= length) { + return string; + } + else { + return string.substring(0, length); + } + } + +} diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java new file mode 100644 index 00000000000..cab06ba821f --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/bigswitch/BigSwitchApiTest.java @@ -0,0 +1,228 @@ +// 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.bigswitch; + +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.util.Collections; + +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpException; +import org.apache.commons.httpclient.HttpMethod; +import org.apache.commons.httpclient.methods.DeleteMethod; +import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.PutMethod; +import org.apache.commons.httpclient.params.HttpClientParams; +import org.apache.http.HttpStatus; +import org.junit.Before; +import org.junit.Test; + +public class BigSwitchApiTest { + BigSwitchVnsApi _api; + HttpClient _client = mock(HttpClient.class); + HttpMethod _method; + + @Before + public void setUp() { + HttpClientParams hmp = mock(HttpClientParams.class); + when (_client.getParams()).thenReturn(hmp); + _api = new BigSwitchVnsApi() { + @Override + protected HttpClient createHttpClient() { + return _client; + } + + @Override + protected HttpMethod createMethod(String type, String uri, int port) { + return _method; + } + }; + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteUpdateObjectWithoutHostname() throws BigSwitchVnsApiException { + _api.setControllerAddress(null); + _api.executeUpdateObject(new String(), "/", Collections. emptyMap()); + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteCreateObjectWithoutHostname() throws BigSwitchVnsApiException { + _api.setControllerAddress(null); + _api.executeCreateObject(new String(), String.class, "/", Collections. emptyMap()); + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteDeleteObjectWithoutHostname() throws BigSwitchVnsApiException { + _api.setControllerAddress(null); + _api.executeDeleteObject("/"); + } + + @Test + public void executeMethodTest() throws BigSwitchVnsApiException { + GetMethod gm = mock(GetMethod.class); + + when(gm.getStatusCode()).thenReturn(HttpStatus.SC_OK); + _api.executeMethod(gm); + verify(gm, times(1)).getStatusCode(); + } + + /* Bit of a roundabout way to ensure that login is called after an un authorized result + * It not possible to properly mock login() + */ + @Test (expected=BigSwitchVnsApiException.class) + public void executeMethodTestWithLogin() throws BigSwitchVnsApiException, HttpException, IOException { + GetMethod gm = mock(GetMethod.class); + when(_client.executeMethod((HttpMethod)any())).thenThrow(new HttpException()); + when(gm.getStatusCode()).thenReturn(HttpStatus.SC_UNAUTHORIZED).thenReturn(HttpStatus.SC_UNAUTHORIZED); + _api.executeMethod(gm); + verify(gm, times(1)).getStatusCode(); + } + + @Test + public void testExecuteCreateObject() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + _method = mock(PostMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK); + _api.executeCreateObject(network, Network.class, "/", Collections. emptyMap()); + verify(_method, times(1)).releaseConnection(); + + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteCreateObjectFailure() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + _method = mock(PostMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); + Header header = mock(Header.class); + when(header.getValue()).thenReturn("text/html"); + when(_method.getResponseHeader("Content-Type")).thenReturn(header); + when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); + when(_method.isRequestSent()).thenReturn(true); + try { + _api.executeCreateObject(network, Network.class, "/", Collections. emptyMap()); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteCreateObjectException() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException()); + _method = mock(PostMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); + Header header = mock(Header.class); + when(header.getValue()).thenReturn("text/html"); + when(_method.getResponseHeader("Content-Type")).thenReturn(header); + when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); + try { + _api.executeCreateObject(network, Network.class, "/", Collections. emptyMap()); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + + @Test + public void testExecuteUpdateObject() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + _method = mock(PutMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK); + _api.executeUpdateObject(network, "/", Collections. emptyMap()); + verify(_method, times(1)).releaseConnection(); + verify(_client, times(1)).executeMethod(_method); + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteUpdateObjectFailure() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + _method = mock(PutMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); + Header header = mock(Header.class); + when(header.getValue()).thenReturn("text/html"); + when(_method.getResponseHeader("Content-Type")).thenReturn(header); + when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); + when(_method.isRequestSent()).thenReturn(true); + try { + _api.executeUpdateObject(network, "/", Collections. emptyMap()); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteUpdateObjectException() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + Network network = new Network(); + _method = mock(PutMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK); + when(_client.executeMethod((HttpMethod) any())).thenThrow(new IOException()); + try { + _api.executeUpdateObject(network, "/", Collections. emptyMap()); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + + @Test + public void testExecuteDeleteObject() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + _method = mock(DeleteMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK); + _api.executeDeleteObject("/"); + verify(_method, times(1)).releaseConnection(); + verify(_client, times(1)).executeMethod(_method); + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteDeleteObjectFailure() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + _method = mock(DeleteMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_INTERNAL_SERVER_ERROR); + Header header = mock(Header.class); + when(header.getValue()).thenReturn("text/html"); + when(_method.getResponseHeader("Content-Type")).thenReturn(header); + when(_method.getResponseBodyAsString()).thenReturn("Off to timbuktu, won't be back later."); + when(_method.isRequestSent()).thenReturn(true); + try { + _api.executeDeleteObject("/"); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + + @Test (expected=BigSwitchVnsApiException.class) + public void testExecuteDeleteObjectException() throws BigSwitchVnsApiException, IOException { + _api.setControllerAddress("10.10.0.10"); + _method = mock(DeleteMethod.class); + when(_method.getStatusCode()).thenReturn(HttpStatus.SC_OK); + when(_client.executeMethod((HttpMethod) any())).thenThrow(new HttpException()); + try { + _api.executeDeleteObject("/"); + } finally { + verify(_method, times(1)).releaseConnection(); + } + } + +} diff --git a/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java new file mode 100644 index 00000000000..514385feaa5 --- /dev/null +++ b/plugins/network-elements/bigswitch-vns/test/com/cloud/network/resource/BigSwitchVnsResourceTest.java @@ -0,0 +1,254 @@ +// 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.resource; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import javax.naming.ConfigurationException; + +import org.junit.Before; +import org.junit.Test; + +import com.cloud.agent.api.CreateVnsNetworkAnswer; +import com.cloud.agent.api.CreateVnsNetworkCommand; +import com.cloud.agent.api.CreateVnsPortAnswer; +import com.cloud.agent.api.CreateVnsPortCommand; +import com.cloud.agent.api.DeleteVnsNetworkAnswer; +import com.cloud.agent.api.DeleteVnsNetworkCommand; +import com.cloud.agent.api.DeleteVnsPortAnswer; +import com.cloud.agent.api.DeleteVnsPortCommand; +import com.cloud.agent.api.PingCommand; +import com.cloud.agent.api.StartupCommand; +import com.cloud.agent.api.UpdateVnsPortAnswer; +import com.cloud.agent.api.UpdateVnsPortCommand; +import com.cloud.host.Host; +import com.cloud.network.bigswitch.Attachment; +import com.cloud.network.bigswitch.ControlClusterStatus; +import com.cloud.network.bigswitch.Network; +import com.cloud.network.bigswitch.Port; +import com.cloud.network.bigswitch.BigSwitchVnsApi; +import com.cloud.network.bigswitch.BigSwitchVnsApiException; + +public class BigSwitchVnsResourceTest { + BigSwitchVnsApi _bigswitchVnsApi = mock(BigSwitchVnsApi.class); + BigSwitchVnsResource _resource; + Map _parameters; + + @Before + public void setUp() throws ConfigurationException { + _resource = new BigSwitchVnsResource() { + protected BigSwitchVnsApi createBigSwitchVnsApi() { + return _bigswitchVnsApi; + } + }; + + _parameters = new HashMap(); + _parameters.put("name","bigswitchvnstestdevice"); + _parameters.put("ip","127.0.0.1"); + _parameters.put("guid", "aaaaa-bbbbb-ccccc"); + _parameters.put("zoneId", "blublub"); + } + + @Test (expected=ConfigurationException.class) + public void resourceConfigureFailure() throws ConfigurationException { + _resource.configure("BigSwitchVnsResource", Collections.emptyMap()); + } + + @Test + public void resourceConfigure() throws ConfigurationException { + _resource.configure("BigSwitchVnsResource", _parameters); + + verify(_bigswitchVnsApi).setControllerAddress("127.0.0.1"); + + assertTrue("bigswitchvnstestdevice".equals(_resource.getName())); + + /* Pretty lame test, but here to assure this plugin fails + * if the type name ever changes from L2Networking + */ + assertTrue(_resource.getType() == Host.Type.L2Networking); + } + + @Test + public void testInitialization() throws ConfigurationException { + _resource.configure("BigSwitchVnsResource", _parameters); + + StartupCommand[] sc = _resource.initialize(); + assertTrue(sc.length ==1); + assertTrue("aaaaa-bbbbb-ccccc".equals(sc[0].getGuid())); + assertTrue("bigswitchvnstestdevice".equals(sc[0].getName())); + assertTrue("blublub".equals(sc[0].getDataCenter())); + } + + @Test + public void testPingCommandStatusOk() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + ControlClusterStatus ccs = mock(ControlClusterStatus.class); + when(ccs.getStatus()).thenReturn(true); + when(_bigswitchVnsApi.getControlClusterStatus()).thenReturn(ccs); + + PingCommand ping = _resource.getCurrentStatus(42); + assertTrue(ping != null); + assertTrue(ping.getHostId() == 42); + assertTrue(ping.getHostType() == Host.Type.L2Networking); + } + + @Test + public void testPingCommandStatusFail() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + ControlClusterStatus ccs = mock(ControlClusterStatus.class); + when(ccs.getStatus()).thenReturn(false); + when(_bigswitchVnsApi.getControlClusterStatus()).thenReturn(ccs); + + PingCommand ping = _resource.getCurrentStatus(42); + assertTrue(ping == null); + } + + @Test + public void testPingCommandStatusApiException() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + ControlClusterStatus ccs = mock(ControlClusterStatus.class); + when(ccs.getStatus()).thenReturn(false); + when(_bigswitchVnsApi.getControlClusterStatus()).thenThrow(new BigSwitchVnsApiException()); + + PingCommand ping = _resource.getCurrentStatus(42); + assertTrue(ping == null); + } + + @Test + public void testRetries() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Network network = mock(Network.class); + when(network.getUuid()).thenReturn("cccc").thenReturn("cccc"); + + CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1); + CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc); + assertTrue(cntka.getResult()); + } + + @Test + public void testCreateNetwork() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Network network = mock(Network.class); + when(network.getUuid()).thenReturn("cccc").thenReturn("cccc"); + + CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1); + CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc); + assertTrue(cntka.getResult()); + } + + @Test + public void testCreateNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Network network = mock(Network.class); + when(network.getUuid()).thenReturn("cccc").thenReturn("cccc"); + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createNetwork((Network)any()); + + CreateVnsNetworkCommand cntkc = new CreateVnsNetworkCommand((String)_parameters.get("guid"), "networkName", "tenantid", 1); + CreateVnsNetworkAnswer cntka = (CreateVnsNetworkAnswer) _resource.executeRequest(cntkc); + assertFalse(cntka.getResult()); + } + + @Test + public void testDeleteNetwork() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + DeleteVnsNetworkCommand dntkc = new DeleteVnsNetworkCommand("tenantid", "networkid"); + DeleteVnsNetworkAnswer dntka = (DeleteVnsNetworkAnswer) _resource.executeRequest(dntkc); + assertTrue(dntka.getResult()); + } + + @Test + public void testDeleteNetworkApiException() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).deleteNetwork((String)any(), (String)any()); + + DeleteVnsNetworkCommand dntkc = new DeleteVnsNetworkCommand("tenantid", "networkid"); + DeleteVnsNetworkAnswer dntka = (DeleteVnsNetworkAnswer) _resource.executeRequest(dntkc); + assertFalse(dntka.getResult()); + } + + @Test + public void testCreatePort() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Port networkp = mock(Port.class); + when(networkp.getId()).thenReturn("eeee"); + + CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff"); + CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc); + assertTrue(cntka.getResult()); + } + + @Test + public void testCreatePortApiExceptionInCreate() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Port networkp = mock(Port.class); + when(networkp.getId()).thenReturn("eeee"); + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).createPort((String)any(), (Port)any()); + + CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff"); + CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc); + assertFalse(cntka.getResult()); + } + + @Test + public void testCreatePortApiExceptionInModify() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + Port networkp = mock(Port.class); + when(networkp.getId()).thenReturn("eeee"); + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPortAttachment((String)any(), (String)any(), (String)any(), (Attachment)any()); + + CreateVnsPortCommand cntkc = new CreateVnsPortCommand("networkid", "portid", "tenantid", "portname", "aa:bb:cc:dd:ee:ff"); + CreateVnsPortAnswer cntka = (CreateVnsPortAnswer) _resource.executeRequest(cntkc); + assertFalse(cntka.getResult()); + verify(_bigswitchVnsApi, atLeastOnce()).deletePort((String) any(), (String) any(), (String) any()); + } + + @Test + public void testDeletePortException() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).deletePort((String) any(), (String) any(), (String) any()); + DeleteVnsPortAnswer dntkpa = (DeleteVnsPortAnswer) _resource.executeRequest(new DeleteVnsPortCommand("networkId", + "portid", "tenantid")); + assertFalse(dntkpa.getResult()); + } + + @Test + public void testUpdatePortException() throws ConfigurationException, BigSwitchVnsApiException { + _resource.configure("BigSwitchVnsResource", _parameters); + + doThrow(new BigSwitchVnsApiException()).when(_bigswitchVnsApi).modifyPort((String) any(), (Port)any()); + UpdateVnsPortAnswer dntkpa = (UpdateVnsPortAnswer) _resource.executeRequest( + new UpdateVnsPortCommand("networkId","portId","tenantId","portname")); + assertFalse(dntkpa.getResult()); + } +} diff --git a/plugins/network-elements/dns-notifier/pom.xml b/plugins/network-elements/dns-notifier/pom.xml index ea35d788653..1dea4b933d1 100644 --- a/plugins/network-elements/dns-notifier/pom.xml +++ b/plugins/network-elements/dns-notifier/pom.xml @@ -22,7 +22,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml org.apache.cloudstack diff --git a/plugins/network-elements/dns-notifier/resources/components-example.xml b/plugins/network-elements/dns-notifier/resources/components-example.xml index 412da0e289e..36441bd667b 100755 --- a/plugins/network-elements/dns-notifier/resources/components-example.xml +++ b/plugins/network-elements/dns-notifier/resources/components-example.xml @@ -29,7 +29,7 @@ under the License. - + true diff --git a/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java b/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java index f9aa063973b..907e8e7219e 100644 --- a/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java +++ b/plugins/network-elements/dns-notifier/src/org/apache/cloudstack/network/element/DnsNotifier.java @@ -35,6 +35,7 @@ import com.cloud.network.Network.Service; import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.element.NetworkElement; import com.cloud.offering.NetworkOffering; +import com.cloud.utils.component.AdapterBase; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; @@ -45,34 +46,12 @@ import com.cloud.vm.VirtualMachineProfile; * */ @Local(NetworkElement.class) -public class DnsNotifier implements NetworkElement { - String _name = null; +public class DnsNotifier extends AdapterBase implements NetworkElement { public DnsNotifier() { } - @Override - public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; - return true; - } - - @Override - public String getName() { - return _name; - } - - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - @Override public Map> getCapabilities() { Map> caps = new HashMap>(); diff --git a/plugins/network-elements/elastic-loadbalancer/pom.xml b/plugins/network-elements/elastic-loadbalancer/pom.xml index dac500d8fd2..4d02a61e93e 100644 --- a/plugins/network-elements/elastic-loadbalancer/pom.xml +++ b/plugins/network-elements/elastic-loadbalancer/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java index 34cbe086452..abb36c36963 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/element/ElasticLoadBalancerElement.java @@ -22,9 +22,11 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.configuration.Config; import com.cloud.configuration.dao.ConfigurationDao; @@ -36,7 +38,7 @@ import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.PublicIpAddress; @@ -46,18 +48,17 @@ import com.cloud.network.lb.LoadBalancingRule; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.Inject; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; - +@Component @Local(value=NetworkElement.class) public class ElasticLoadBalancerElement extends AdapterBase implements LoadBalancingServiceProvider, IpDeployer { private static final Logger s_logger = Logger.getLogger(ElasticLoadBalancerElement.class); private static final Map> capabilities = setCapabilities(); - @Inject NetworkManager _networkManager; + @Inject NetworkModel _networkManager; @Inject ElasticLoadBalancerManager _lbMgr; @Inject ConfigurationDao _configDao; @Inject NetworkOfferingDao _networkOfferingDao; diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java index 736307ba176..81039d1f3c7 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java @@ -30,10 +30,12 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.cloudstack.api.command.user.loadbalancer.CreateLoadBalancerRuleCmd; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.AgentManager.OnError; @@ -73,21 +75,22 @@ import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.StorageUnavailableException; import com.cloud.hypervisor.Hypervisor.HypervisorType; import com.cloud.network.ElasticLbVmMapVO; -import com.cloud.network.IPAddressVO; -import com.cloud.network.LoadBalancerVO; import com.cloud.network.Network; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.VirtualRouterProvider; import com.cloud.network.VirtualRouterProvider.VirtualRouterProviderType; import com.cloud.network.addr.PublicIp; import com.cloud.network.dao.IPAddressDao; +import com.cloud.network.dao.IPAddressVO; import com.cloud.network.dao.LoadBalancerDao; +import com.cloud.network.dao.LoadBalancerVO; import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.VirtualRouterProviderDao; import com.cloud.network.lb.LoadBalancingRule.LbDestination; @@ -100,8 +103,8 @@ import com.cloud.network.router.VpcVirtualNetworkApplianceManager; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.FirewallRule.Purpose; import com.cloud.network.rules.LoadBalancer; +import com.cloud.offering.NetworkOffering; import com.cloud.offering.ServiceOffering; -import com.cloud.offerings.NetworkOfferingVO; import com.cloud.offerings.dao.NetworkOfferingDao; import com.cloud.service.ServiceOfferingVO; import com.cloud.service.dao.ServiceOfferingDao; @@ -114,8 +117,8 @@ import com.cloud.user.UserContext; import com.cloud.user.dao.AccountDao; import com.cloud.utils.NumbersUtil; import com.cloud.utils.Pair; -import com.cloud.utils.component.Inject; import com.cloud.utils.component.Manager; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.DB; import com.cloud.utils.db.SearchBuilder; @@ -136,17 +139,20 @@ import com.cloud.vm.VirtualMachineProfile.Param; import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.NicDao; +@Component @Local(value = { ElasticLoadBalancerManager.class }) -public class ElasticLoadBalancerManagerImpl implements -ElasticLoadBalancerManager, Manager, VirtualMachineGuru { +public class ElasticLoadBalancerManagerImpl extends ManagerBase implements +ElasticLoadBalancerManager, VirtualMachineGuru { private static final Logger s_logger = Logger .getLogger(ElasticLoadBalancerManagerImpl.class); - + @Inject IPAddressDao _ipAddressDao; @Inject AgentManager _agentMgr; @Inject + NetworkModel _networkModel; + @Inject NetworkManager _networkMgr; @Inject LoadBalancerDao _loadBalancerDao = null; @@ -195,11 +201,10 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @Inject NicDao _nicDao; - String _name; String _instance; static final private String _elbVmNamePrefix = "l"; static final private String _systemVmType = "elbvm"; - + boolean _enabled; TrafficType _frontendTrafficType = TrafficType.Guest; @@ -208,13 +213,13 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { ScheduledExecutorService _gcThreadPool; String _mgmtCidr; String _mgmtHost; - + Set _gcCandidateElbVmIds = Collections.newSetFromMap(new ConcurrentHashMap()); - + int _elasticLbVmRamSize; int _elasticLbvmCpuMHz; int _elasticLbvmNumCpu; - + private Long getPodIdForDirectIp(IPAddressVO ipAddr) { PodVlanMapVO podVlanMaps = _podVlanMapDao.listPodVlanMapsByVlan(ipAddr.getVlanId()); if (podVlanMaps == null) { @@ -244,14 +249,14 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { s_logger.debug("Deployed ELB vm = " + elbVm); return elbVm; - + } catch (Throwable t) { s_logger.warn("Error while deploying ELB VM: ", t); return null; } } - + private boolean sendCommandsToRouter(final DomainRouterVO elbVm, Commands cmds) throws AgentUnavailableException { Answer[] answers = null; @@ -291,7 +296,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { String protocol = rule.getProtocol(); String algorithm = rule.getAlgorithm(); - String elbIp = _networkMgr.getIp(rule.getSourceIpAddressId()).getAddress() + String elbIp = _networkModel.getIp(rule.getSourceIpAddressId()).getAddress() .addr(); int srcPort = rule.getSourcePortStart(); String uuid = rule.getUuid(); @@ -312,7 +317,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { cmd.lbStatsUri = _configDao.getValue(Config.NetworkLBHaproxyStatsUri.key()); cmd.lbStatsAuth = _configDao.getValue(Config.NetworkLBHaproxyStatsAuth.key()); cmd.lbStatsPort = _configDao.getValue(Config.NetworkLBHaproxyStatsPort.key()); - + cmds.addCommand(cmd); } @@ -324,7 +329,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { // Send commands to elbVm return sendCommandsToRouter(elbVm, cmds); } - + protected DomainRouterVO findElbVmForLb(FirewallRule lb) {//TODO: use a table to lookup ElasticLbVmMapVO map = _elbVmMapDao.findOneByIp(lb.getSourceIpAddressId()); if (map == null) { @@ -337,7 +342,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @Override public boolean applyLoadBalancerRules(Network network, List rules) - throws ResourceUnavailableException { + throws ResourceUnavailableException { if (rules == null || rules.isEmpty()) { return true; } @@ -345,9 +350,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { s_logger.warn("ELB: Not handling non-LB firewall rules"); return false; } - + DomainRouterVO elbVm = findElbVmForLb(rules.get(0)); - + if (elbVm == null) { s_logger.warn("Unable to apply lb rules, ELB vm doesn't exist in the network " + network.getId()); @@ -385,7 +390,6 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; final Map configs = _configDao.getConfiguration("AgentManager", params); _systemAcct = _accountService.getSystemAccount(); _instance = configs.get("instance.name"); @@ -394,7 +398,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { } _mgmtCidr = _configDao.getValue(Config.ManagementNetwork.key()); _mgmtHost = _configDao.getValue(Config.ManagementHostIPAdr.key()); - + boolean useLocalStorage = Boolean.parseBoolean(configs.get(Config.SystemVMUseLocalStorage.key())); _elasticLbVmRamSize = NumbersUtil.parseInt(configs.get(Config.ElasticLoadBalancerVmMemory.key()), DEFAULT_ELB_VM_RAMSIZE); @@ -405,7 +409,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { true, null, true, VirtualMachine.Type.ElasticLoadBalancerVm, true); _elasticLbVmOffering.setUniqueName(ServiceOffering.elbVmDefaultOffUniqueName); _elasticLbVmOffering = _serviceOfferingDao.persistSystemServiceOffering(_elasticLbVmOffering); - + String enabled = _configDao.getValue(Config.ElasticLoadBalancerEnabled.key()); _enabled = (enabled == null) ? false: Boolean.parseBoolean(enabled); s_logger.info("Elastic Load balancer enabled: " + _enabled); @@ -426,25 +430,10 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { _gcThreadPool.scheduleAtFixedRate(new CleanupThread(), gcIntervalMinutes, gcIntervalMinutes, TimeUnit.MINUTES); _itMgr.registerGuru(VirtualMachine.Type.ElasticLoadBalancerVm, this); } - + return true; } - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - - @Override - public String getName() { - return _name; - } - private DomainRouterVO findELBVmWithCapacity(Network guestNetwork, IPAddressVO ipAddr) { List unusedElbVms = _elbVmMapDao.listUnusedElbVms(); if (unusedElbVms.size() > 0) { @@ -457,9 +446,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { } return null; } - + public DomainRouterVO deployELBVm(Network guestNetwork, DeployDestination dest, Account owner, Map params) throws - ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { + ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { long dcId = dest.getDataCenter().getId(); // lock guest network @@ -472,7 +461,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { try { - if (_networkMgr.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) { + if (_networkModel.isNetworkSystem(guestNetwork) || guestNetwork.getGuestType() == Network.GuestType.Shared) { owner = _accountService.getSystemAccount(); } @@ -480,12 +469,12 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { s_logger.debug("Starting a ELB vm for network configurations: " + guestNetwork + " in " + dest); } assert guestNetwork.getState() == Network.State.Implemented - || guestNetwork.getState() == Network.State.Setup + || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: " + guestNetwork; DataCenterDeployment plan = null; DomainRouterVO elbVm = null; - + plan = new DataCenterDeployment(dcId, dest.getPod().getId(), null, null, null, null); if (elbVm == null) { @@ -493,9 +482,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { if (s_logger.isDebugEnabled()) { s_logger.debug("Creating the ELB vm " + id); } - - List offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemControlNetwork); - NetworkOfferingVO controlOffering = offerings.get(0); + + List offerings = _networkModel.getSystemAccountNetworkOfferings(NetworkOffering.SystemControlNetwork); + NetworkOffering controlOffering = offerings.get(0); NetworkVO controlConfig = _networkMgr.setupNetwork(_systemAcct, controlOffering, plan, null, null, false).get(0); List> networks = new ArrayList>(2); @@ -507,7 +496,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { VMTemplateVO template = _templateDao.findSystemVMTemplate(dcId); String typeString = "ElasticLoadBalancerVm"; - Long physicalNetworkId = _networkMgr.getPhysicalNetworkId(guestNetwork); + Long physicalNetworkId = _networkModel.getPhysicalNetworkId(guestNetwork); PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, typeString); if (provider == null) { throw new CloudRuntimeException("Cannot find service provider " + typeString + " in physical network " + physicalNetworkId); @@ -516,7 +505,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { if (vrProvider == null) { throw new CloudRuntimeException("Cannot find virtual router provider " + typeString + " as service provider " + provider.getId()); } - + elbVm = new DomainRouterVO(id, _elasticLbVmOffering.getId(), vrProvider.getId(), VirtualMachineName.getSystemVmName(id, _instance, _elbVmNamePrefix), template.getId(), template.getHypervisorType(), template.getGuestOSId(), owner.getDomainId(), owner.getId(), false, 0, false, RedundantState.UNKNOWN, @@ -536,7 +525,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { _networkDao.releaseFromLockTable(guestNetworkId); } } - + private DomainRouterVO start(DomainRouterVO elbVm, User user, Account caller, Map params) throws StorageUnavailableException, InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException { s_logger.debug("Starting ELB VM " + elbVm); @@ -546,7 +535,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { return null; } } - + private DomainRouterVO stop(DomainRouterVO elbVm, boolean forced, User user, Account caller) throws ConcurrentOperationException, ResourceUnavailableException { s_logger.debug("Stopping ELB vm " + elbVm); try { @@ -559,7 +548,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { throw new CloudRuntimeException("Unable to stop " + elbVm, e); } } - + protected List findExistingLoadBalancers(String lbName, Long ipId, Long accountId, Long domainId, Integer publicPort) { SearchBuilder sb = _lbDao.createSearchBuilder(); sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ); @@ -587,16 +576,16 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { sc.setParameters("publicPort", publicPort); } List lbs = _lbDao.search(sc, null); - + return lbs == null || lbs.size()==0 ? null: lbs; } - + @DB public PublicIp allocDirectIp(Account account, long guestNetworkId) throws InsufficientAddressCapacityException { - Network frontEndNetwork = _networkMgr.getNetwork(guestNetworkId); + Network frontEndNetwork = _networkModel.getNetwork(guestNetworkId); Transaction txn = Transaction.currentTxn(); txn.start(); - + PublicIp ip = _networkMgr.assignPublicIpAddress(frontEndNetwork.getDataCenterId(), null, account, VlanType.DirectAttached, frontEndNetwork.getId(), null, true); IPAddressVO ipvo = _ipAddressDao.findById(ip.getId()); ipvo.setAssociatedWithNetworkId(frontEndNetwork.getId()); @@ -606,7 +595,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { return ip; } - + public void releaseIp(long ipId, long userId, Account caller) { s_logger.info("ELB: Release public IP for loadbalancing " + ipId); IPAddressVO ipvo = _ipAddressDao.findById(ipId); @@ -620,11 +609,11 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @DB public LoadBalancer handleCreateLoadBalancerRule(CreateLoadBalancerRuleCmd lb, Account account, long networkId) throws InsufficientAddressCapacityException, NetworkRuleConflictException { //this part of code is executed when the LB provider is Elastic Load Balancer vm - if (!_networkMgr.isProviderSupportServiceInNetwork(lb.getNetworkId(), Service.Lb, Provider.ElasticLoadBalancerVm)) { - return null; - } - - Long ipId = lb.getSourceIpAddressId(); + if (!_networkModel.isProviderSupportServiceInNetwork(lb.getNetworkId(), Service.Lb, Provider.ElasticLoadBalancerVm)) { + return null; + } + + Long ipId = lb.getSourceIpAddressId(); if (ipId != null) { return null; } @@ -659,9 +648,9 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { throw new NetworkRuleConflictException("ELB: Found existing load balancers matching requested new LB"); } - Network network = _networkMgr.getNetwork(networkId); + Network network = _networkModel.getNetwork(networkId); IPAddressVO ipAddr = _ipAddressDao.findById(ipId); - + LoadBalancer result = null; try { lb.setSourceIpAddressId(ipId); @@ -693,26 +682,26 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { elbVm = _routerDao.findById(elbVmMap.getElbVmId()); } } - + if (elbVm == null) { s_logger.warn("No ELB VM can be found or deployed"); s_logger.warn("Deleting LB since we failed to deploy ELB VM"); _lbDao.remove(result.getId()); return null; } - + ElasticLbVmMapVO mapping = new ElasticLbVmMapVO(ipId, elbVm.getId(), result.getId()); _elbVmMapDao.persist(mapping); return result; - + } finally { if (account != null) { _accountDao.releaseFromLockTable(account.getId()); } } - + } - + void garbageCollectUnusedElbVms() { List unusedElbVms = _elbVmMapDao.listUnusedElbVms(); if (unusedElbVms != null && unusedElbVms.size() > 0) @@ -754,12 +743,12 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { } _gcCandidateElbVmIds = currentGcCandidates; } - + public class CleanupThread implements Runnable { @Override public void run() { garbageCollectUnusedElbVms(); - + } CleanupThread() { @@ -867,7 +856,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { if (defaultDns2 != null) { buf.append(" dns2=").append(defaultDns2); } - + if (s_logger.isDebugEnabled()) { s_logger.debug("Boot Args for " + profile + ": " + buf.toString()); } @@ -914,7 +903,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @Override public boolean finalizeCommandsOnStart(Commands cmds, VirtualMachineProfile profile) { DomainRouterVO elbVm = profile.getVirtualMachine(); - DataCenterVO dcVo = _dcDao.findById(elbVm.getDataCenterIdToDeployIn()); + DataCenterVO dcVo = _dcDao.findById(elbVm.getDataCenterId()); NicProfile controlNic = null; Long guestNetworkId = null; @@ -971,7 +960,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { processStopOrRebootAnswer(elbVm, answer); } } - + public void processStopOrRebootAnswer(final DomainRouterVO elbVm, Answer answer) { //TODO: process network usage stats } @@ -979,7 +968,7 @@ ElasticLoadBalancerManager, Manager, VirtualMachineGuru { @Override public void finalizeExpunge(DomainRouterVO vm) { // no-op - + } @Override diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDao.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDao.java index 725377c1d96..5c03a3cfda3 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDao.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDao.java @@ -19,7 +19,7 @@ package com.cloud.network.lb.dao; import java.util.List; import com.cloud.network.ElasticLbVmMapVO; -import com.cloud.network.LoadBalancerVO; +import com.cloud.network.dao.LoadBalancerVO; import com.cloud.utils.db.GenericDao; import com.cloud.vm.DomainRouterVO; diff --git a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDaoImpl.java b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDaoImpl.java index 08c1efbd563..fcf835c1fab 100644 --- a/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDaoImpl.java +++ b/plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/dao/ElasticLbVmMapDaoImpl.java @@ -18,15 +18,19 @@ package com.cloud.network.lb.dao; import java.util.List; +import javax.annotation.PostConstruct; import javax.ejb.Local; +import javax.inject.Inject; + +import org.springframework.stereotype.Component; import com.cloud.network.ElasticLbVmMapVO; -import com.cloud.network.LoadBalancerVO; import com.cloud.network.dao.LoadBalancerDao; import com.cloud.network.dao.LoadBalancerDaoImpl; +import com.cloud.network.dao.LoadBalancerVO; import com.cloud.network.router.VirtualRouter.Role; import com.cloud.network.router.VirtualRouter.Role; -import com.cloud.utils.component.ComponentLocator; + import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.JoinBuilder.JoinType; import com.cloud.utils.db.SearchBuilder; @@ -35,22 +39,27 @@ import com.cloud.vm.DomainRouterVO; import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.DomainRouterDaoImpl; +@Component @Local(value={ElasticLbVmMapDao.class}) public class ElasticLbVmMapDaoImpl extends GenericDaoBase implements ElasticLbVmMapDao { - protected final DomainRouterDao _routerDao = ComponentLocator.inject(DomainRouterDaoImpl.class); - protected final LoadBalancerDao _loadbalancerDao = ComponentLocator.inject(LoadBalancerDaoImpl.class); + @Inject protected DomainRouterDao _routerDao; + @Inject protected LoadBalancerDao _loadbalancerDao; - protected final SearchBuilder AllFieldsSearch; - protected final SearchBuilder UnusedVmSearch; - protected final SearchBuilder LoadBalancersForElbVmSearch; + protected SearchBuilder AllFieldsSearch; + protected SearchBuilder UnusedVmSearch; + protected SearchBuilder LoadBalancersForElbVmSearch; - protected final SearchBuilder ElbVmSearch; + protected SearchBuilder ElbVmSearch; - protected final SearchBuilder LoadBalancerSearch; + protected SearchBuilder LoadBalancerSearch; - protected ElasticLbVmMapDaoImpl() { + public ElasticLbVmMapDaoImpl() { + } + + @PostConstruct + protected void init() { AllFieldsSearch = createSearchBuilder(); AllFieldsSearch.and("ipId", AllFieldsSearch.entity().getIpAddressId(), SearchCriteria.Op.EQ); AllFieldsSearch.and("lbId", AllFieldsSearch.entity().getLbId(), SearchCriteria.Op.EQ); diff --git a/plugins/network-elements/f5/pom.xml b/plugins/network-elements/f5/pom.xml index bf40332cfbb..d0f8133f2b4 100644 --- a/plugins/network-elements/f5/pom.xml +++ b/plugins/network-elements/f5/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java index 69a21fc184c..1509936a81d 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddExternalLoadBalancerCmd.java @@ -17,14 +17,16 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; @@ -76,7 +78,7 @@ public class AddExternalLoadBalancerCmd extends BaseCmd { return password; } - @PlugService + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// @@ -102,9 +104,9 @@ public class AddExternalLoadBalancerCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException ipve) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); } catch (CloudRuntimeException cre) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); } } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java index a5616e0ee73..1670351c55d 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/AddF5LoadBalancerCmd.java @@ -17,6 +17,8 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -29,7 +31,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -39,7 +41,7 @@ public class AddF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddF5LoadBalancerCmd.class.getName()); private static final String s_name = "addf5bigiploadbalancerresponse"; - @PlugService F5ExternalLoadBalancerElementService _f5DeviceManagerService; + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -99,12 +101,12 @@ public class AddF5LoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add F5 Big IP load balancer due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add F5 Big IP load balancer due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java index e796b57cc41..209a25845cb 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ConfigureF5LoadBalancerCmd.java @@ -17,6 +17,8 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -28,7 +30,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -38,7 +40,7 @@ public class ConfigureF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureF5LoadBalancerCmd.class.getName()); private static final String s_name = "configuref5Rloadbalancerresponse"; - @PlugService F5ExternalLoadBalancerElementService _f5DeviceManagerService; + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -77,12 +79,12 @@ public class ConfigureF5LoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure F5 load balancer due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure F5 load balancer due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java index d3015712596..e13afbf9a85 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteExternalLoadBalancerCmd.java @@ -17,6 +17,8 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.HostResponse; import org.apache.log4j.Logger; @@ -53,7 +55,7 @@ public class DeleteExternalLoadBalancerCmd extends BaseCmd { /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @PlugService + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; @Override @@ -75,10 +77,10 @@ public class DeleteExternalLoadBalancerCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete external load balancer."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete external load balancer."); } } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to delete external load balancer."); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete external load balancer."); } } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java index 8b53d70f76d..691643d1370 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/DeleteF5LoadBalancerCmd.java @@ -17,15 +17,17 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.BaseAsyncCmd; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.api.response.F5LoadBalancerResponse; @@ -43,7 +45,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class DeleteF5LoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteF5LoadBalancerCmd.class.getName()); private static final String s_name = "deletef5loadbalancerresponse"; - @PlugService F5ExternalLoadBalancerElementService _f5DeviceManagerService; + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -74,12 +76,12 @@ public class DeleteF5LoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete F5 load balancer."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete F5 load balancer."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java index 72313aa0c0c..4d2a53469f0 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListExternalLoadBalancersCmd.java @@ -20,6 +20,8 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -57,7 +59,7 @@ public class ListExternalLoadBalancersCmd extends BaseListCmd { /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @PlugService + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; @Override diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java index bf1164b4d05..ca2c2fe2f2d 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancerNetworksCmd.java @@ -20,14 +20,16 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; @@ -46,7 +48,7 @@ public class ListF5LoadBalancerNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListF5LoadBalancerNetworksCmd.class.getName()); private static final String s_name = "listf5loadbalancernetworksresponse"; - @PlugService F5ExternalLoadBalancerElementService _f5DeviceManagerService; + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -86,9 +88,9 @@ public class ListF5LoadBalancerNetworksCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java index c03d55abc0a..d40014954d1 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java +++ b/plugins/network-elements/f5/src/com/cloud/api/commands/ListF5LoadBalancersCmd.java @@ -20,6 +20,8 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -32,7 +34,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.F5ExternalLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; @@ -40,7 +42,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class ListF5LoadBalancersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListF5LoadBalancersCmd.class.getName()); private static final String s_name = "listf5loadbalancerresponse"; - @PlugService F5ExternalLoadBalancerElementService _f5DeviceManagerService; + @Inject F5ExternalLoadBalancerElementService _f5DeviceManagerService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -88,9 +90,9 @@ public class ListF5LoadBalancersCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/f5/src/com/cloud/api/response/F5LoadBalancerResponse.java b/plugins/network-elements/f5/src/com/cloud/api/response/F5LoadBalancerResponse.java index 19e67260b90..6179037706f 100644 --- a/plugins/network-elements/f5/src/com/cloud/api/response/F5LoadBalancerResponse.java +++ b/plugins/network-elements/f5/src/com/cloud/api/response/F5LoadBalancerResponse.java @@ -21,7 +21,8 @@ import org.apache.cloudstack.api.ApiConstants; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; -import com.cloud.network.ExternalLoadBalancerDeviceVO; + +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; @EntityReference(value=ExternalLoadBalancerDeviceVO.class) public class F5LoadBalancerResponse extends BaseResponse { diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java index 70faaccc461..94c098ed4bb 100644 --- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java +++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElement.java @@ -11,13 +11,11 @@ // 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.network.element; -import java.lang.Class; -import java.lang.String; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -25,8 +23,10 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; -import com.cloud.utils.PropertiesUtil; +import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; @@ -57,35 +57,31 @@ import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.ExternalLoadBalancerDeviceManager; import com.cloud.network.ExternalLoadBalancerDeviceManagerImpl; -import com.cloud.network.ExternalLoadBalancerDeviceVO; -import com.cloud.network.ExternalLoadBalancerDeviceVO.LBDeviceState; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkExternalLoadBalancerVO; -import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetworkServiceProvider; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.PublicIpAddress; import com.cloud.network.dao.ExternalLoadBalancerDeviceDao; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkExternalLoadBalancerDao; +import com.cloud.network.dao.NetworkExternalLoadBalancerVO; import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState; import com.cloud.network.lb.LoadBalancingRule; import com.cloud.network.resource.F5BigIpResource; import com.cloud.network.rules.LbStickinessMethod; import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType; import com.cloud.offering.NetworkOffering; -import com.cloud.resource.ServerResource; -import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Inject; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; @@ -93,13 +89,13 @@ import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; import com.google.gson.Gson; -@Local(value = NetworkElement.class) +@Local(value = {NetworkElement.class, LoadBalancingServiceProvider.class, IpDeployer.class}) public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, IpDeployer, F5ExternalLoadBalancerElementService, ExternalLoadBalancerDeviceManager { private static final Logger s_logger = Logger.getLogger(F5ExternalLoadBalancerElement.class); @Inject - NetworkManager _networkManager; + NetworkModel _networkManager; @Inject ConfigurationManager _configMgr; @Inject @@ -132,7 +128,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan @Override public boolean implement(Network guestConfig, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, - InsufficientNetworkCapacityException { + InsufficientNetworkCapacityException { if (!canHandle(guestConfig)) { return false; @@ -147,7 +143,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan @Override public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, - InsufficientNetworkCapacityException, ResourceUnavailableException { + InsufficientNetworkCapacityException, ResourceUnavailableException { return true; } @@ -212,8 +208,8 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan // Specifies that load balancing rules can only be made with public IPs that aren't source NAT IPs lbCapabilities.put(Capability.LoadBalancingSupportedIps, "additional"); - // Support inline mode with firewall - lbCapabilities.put(Capability.InlineMode, "true"); + // Support inline mode with firewall + lbCapabilities.put(Capability.InlineMode, "true"); LbStickinessMethod method; List methodList = new ArrayList(); @@ -252,7 +248,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan @Override public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, - ResourceUnavailableException { + ResourceUnavailableException { // TODO Auto-generated method stub return true; } @@ -298,7 +294,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan pNetwork = physicalNetworks.get(0); String deviceType = NetworkDevice.F5BigIpLoadBalancer.getName(); - lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, (ServerResource) new F5BigIpResource()); + lbDeviceVO = addExternalLoadBalancer(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, new F5BigIpResource()); if (lbDeviceVO != null) { lbHost = _hostDao.findById(lbDeviceVO.getHostId()); @@ -351,7 +347,7 @@ public class F5ExternalLoadBalancerElement extends ExternalLoadBalancerDeviceMan throw new InvalidParameterValueException("Invalid F5 load balancer device type"); } - return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, (ServerResource) new F5BigIpResource()); + return addExternalLoadBalancer(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, new F5BigIpResource()); } diff --git a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElementService.java b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElementService.java index 951bc3cc3b1..4a66e3bccbc 100644 --- a/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElementService.java +++ b/plugins/network-elements/f5/src/com/cloud/network/element/F5ExternalLoadBalancerElementService.java @@ -28,8 +28,9 @@ import com.cloud.api.commands.ListF5LoadBalancerNetworksCmd; import com.cloud.api.commands.ListF5LoadBalancersCmd; import com.cloud.api.response.F5LoadBalancerResponse; import com.cloud.host.Host; -import com.cloud.network.ExternalLoadBalancerDeviceVO; import com.cloud.network.Network; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; + import org.apache.cloudstack.api.response.ExternalLoadBalancerResponse; import com.cloud.utils.component.PluggableService; diff --git a/plugins/network-elements/f5/src/com/cloud/network/resource/F5BigIpResource.java b/plugins/network-elements/f5/src/com/cloud/network/resource/F5BigIpResource.java index c9c3711bfc1..1733712366b 100644 --- a/plugins/network-elements/f5/src/com/cloud/network/resource/F5BigIpResource.java +++ b/plugins/network-elements/f5/src/com/cloud/network/resource/F5BigIpResource.java @@ -196,7 +196,7 @@ public class F5BigIpResource implements ServerResource { cmd.setPod(""); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(""); - cmd.setVersion(""); + cmd.setVersion(F5BigIpResource.class.getPackage().getImplementationVersion()); cmd.setGuid(_guid); return new StartupCommand[]{cmd}; } @@ -1066,6 +1066,36 @@ public class F5BigIpResource implements ServerResource { private static String[] genStringArray(String s) { return new String[]{s}; + } + + @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/plugins/network-elements/juniper-srx/pom.xml b/plugins/network-elements/juniper-srx/pom.xml index 6040720da6e..28f2c29eda7 100644 --- a/plugins/network-elements/juniper-srx/pom.xml +++ b/plugins/network-elements/juniper-srx/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java index cda27fb8960..d2d016950c7 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddExternalFirewallCmd.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.host.Host; @@ -79,7 +81,7 @@ public class AddExternalFirewallCmd extends BaseCmd { /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @PlugService JuniperSRXFirewallElementService _srxElementService; + @Inject JuniperSRXFirewallElementService _srxElementService; @Override public String getCommandName() { @@ -101,9 +103,9 @@ public class AddExternalFirewallCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException ipve) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, ipve.getMessage()); } catch (CloudRuntimeException cre) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, cre.getMessage()); } } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java index a2ad4e5ce2b..f5bb037ca00 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/AddSrxFirewallCmd.java @@ -16,15 +16,17 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import com.cloud.api.response.SrxFirewallResponse; import com.cloud.event.EventTypes; @@ -33,7 +35,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalFirewallDeviceVO; +import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -42,7 +44,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class AddSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddSrxFirewallCmd.class.getName()); private static final String s_name = "addsrxfirewallresponse"; - @PlugService JuniperSRXFirewallElementService _srxFwService; + @Inject JuniperSRXFirewallElementService _srxFwService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -102,12 +104,12 @@ public class AddSrxFirewallCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add SRX firewall due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add SRX firewall due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java index 482fcc8c0c7..9bffee1f85c 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ConfigureSrxFirewallCmd.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import com.cloud.api.response.SrxFirewallResponse; import com.cloud.event.EventTypes; @@ -32,7 +34,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalFirewallDeviceVO; +import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -42,7 +44,7 @@ public class ConfigureSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureSrxFirewallCmd.class.getName()); private static final String s_name = "configuresrxfirewallresponse"; - @PlugService JuniperSRXFirewallElementService _srxFwService; + @Inject JuniperSRXFirewallElementService _srxFwService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -81,12 +83,12 @@ public class ConfigureSrxFirewallCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure SRX firewall device due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure SRX firewall device due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java index 5cdc9e3c92c..a3a512f66e8 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteExternalFirewallCmd.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.response.HostResponse; import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.exception.InvalidParameterValueException; @@ -55,7 +57,7 @@ public class DeleteExternalFirewallCmd extends BaseCmd { /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @PlugService JuniperSRXFirewallElementService _srxElementService; + @Inject JuniperSRXFirewallElementService _srxElementService; @Override public String getCommandName() { @@ -77,10 +79,10 @@ public class DeleteExternalFirewallCmd extends BaseCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete external firewall."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete external firewall."); } } catch (InvalidParameterValueException e) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, "Failed to delete external firewall."); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Failed to delete external firewall."); } } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java index 1dc792a723a..ce804a71cd5 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/DeleteSrxFirewallCmd.java @@ -16,14 +16,16 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.api.response.SrxFirewallResponse; @@ -41,7 +43,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class DeleteSrxFirewallCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteSrxFirewallCmd.class.getName()); private static final String s_name = "deletesrxfirewallresponse"; - @PlugService JuniperSRXFirewallElementService _srxElementService; + @Inject JuniperSRXFirewallElementService _srxElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -72,12 +74,12 @@ public class DeleteSrxFirewallCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete SRX firewall device"); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete SRX firewall device"); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java index 65aa92ba818..6db9ce83f46 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListExternalFirewallsCmd.java @@ -19,6 +19,8 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd; import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.log4j.Logger; @@ -27,7 +29,6 @@ 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.response.ListResponse; import com.cloud.host.Host; import com.cloud.network.element.JuniperSRXFirewallElementService; @@ -58,7 +59,7 @@ public class ListExternalFirewallsCmd extends BaseListCmd { /////////////// API Implementation/////////////////// ///////////////////////////////////////////////////// - @PlugService JuniperSRXFirewallElementService _srxElementService; + @Inject JuniperSRXFirewallElementService _srxElementService; @Override public String getCommandName() { diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java index 9c2b3962a6f..72caf09f39c 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallNetworksCmd.java @@ -19,6 +19,8 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.log4j.Logger; @@ -40,7 +42,7 @@ public class ListSrxFirewallNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSrxFirewallNetworksCmd.class.getName()); private static final String s_name = "listsrxfirewallnetworksresponse"; - @PlugService JuniperSRXFirewallElementService _srxFwService; + @Inject JuniperSRXFirewallElementService _srxFwService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -80,9 +82,9 @@ public class ListSrxFirewallNetworksCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java index 6508cc83c7d..320a684bb5a 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/commands/ListSrxFirewallsCmd.java @@ -19,6 +19,8 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -31,7 +33,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalFirewallDeviceVO; +import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.element.JuniperSRXFirewallElementService; import com.cloud.utils.exception.CloudRuntimeException; @@ -40,7 +42,7 @@ public class ListSrxFirewallsCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListSrxFirewallsCmd.class.getName()); private static final String s_name = "listsrxfirewallresponse"; - @PlugService JuniperSRXFirewallElementService _srxFwService; + @Inject JuniperSRXFirewallElementService _srxFwService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -88,9 +90,9 @@ public class ListSrxFirewallsCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/api/response/SrxFirewallResponse.java b/plugins/network-elements/juniper-srx/src/com/cloud/api/response/SrxFirewallResponse.java index 56aab70f2f3..db947fc16b5 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/api/response/SrxFirewallResponse.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/api/response/SrxFirewallResponse.java @@ -21,7 +21,8 @@ import org.apache.cloudstack.api.EntityReference; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; -import com.cloud.network.ExternalFirewallDeviceVO; + +import com.cloud.network.dao.ExternalFirewallDeviceVO; @EntityReference(value=ExternalFirewallDeviceVO.class) @SuppressWarnings("unused") diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java index ead2af9396d..af0912ad9f5 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXExternalFirewallElement.java @@ -11,12 +11,11 @@ // 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.network.element; -import java.lang.String; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -24,8 +23,10 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; -import com.cloud.utils.PropertiesUtil; +import org.apache.cloudstack.api.response.ExternalFirewallResponse; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import org.apache.log4j.Logger; import com.cloud.api.ApiDBUtils; @@ -56,53 +57,51 @@ import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.ExternalFirewallDeviceManagerImpl; -import com.cloud.network.ExternalFirewallDeviceVO; -import com.cloud.network.ExternalFirewallDeviceVO.FirewallDeviceState; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkExternalFirewallVO; -import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkModel; import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetworkServiceProvider; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.PublicIpAddress; import com.cloud.network.RemoteAccessVpn; import com.cloud.network.VpnUser; import com.cloud.network.dao.ExternalFirewallDeviceDao; +import com.cloud.network.dao.ExternalFirewallDeviceVO; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkExternalFirewallDao; +import com.cloud.network.dao.NetworkExternalFirewallVO; import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.network.dao.ExternalFirewallDeviceVO.FirewallDeviceState; import com.cloud.network.resource.JuniperSrxResource; import com.cloud.network.rules.FirewallRule; import com.cloud.network.rules.PortForwardingRule; import com.cloud.network.rules.StaticNat; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.dao.NetworkOfferingDao; -import com.cloud.resource.ServerResource; -import org.apache.cloudstack.api.response.ExternalFirewallResponse; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Inject; import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; -@Local(value = NetworkElement.class) +@Local(value = {NetworkElement.class, FirewallServiceProvider.class, + PortForwardingServiceProvider.class, IpDeployer.class, + SourceNatServiceProvider.class, RemoteAccessVPNServiceProvider.class}) public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceManagerImpl implements SourceNatServiceProvider, FirewallServiceProvider, - PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, JuniperSRXFirewallElementService, StaticNatServiceProvider { +PortForwardingServiceProvider, RemoteAccessVPNServiceProvider, IpDeployer, JuniperSRXFirewallElementService, StaticNatServiceProvider { private static final Logger s_logger = Logger.getLogger(JuniperSRXExternalFirewallElement.class); private static final Map> capabilities = setCapabilities(); @Inject - NetworkManager _networkManager; + NetworkModel _networkManager; @Inject HostDao _hostDao; @Inject @@ -152,7 +151,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan @Override public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws ResourceUnavailableException, ConcurrentOperationException, - InsufficientNetworkCapacityException { + InsufficientNetworkCapacityException { DataCenter zone = _configMgr.getZone(network.getDataCenterId()); // don't have to implement network is Basic zone @@ -177,7 +176,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan @Override public boolean prepare(Network config, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, - InsufficientNetworkCapacityException, ResourceUnavailableException { + InsufficientNetworkCapacityException, ResourceUnavailableException { return true; } @@ -275,6 +274,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan firewallCapabilities.put(Capability.SupportedProtocols, "tcp,udp,icmp"); firewallCapabilities.put(Capability.MultipleIps, "true"); firewallCapabilities.put(Capability.TrafficStatistics, "per public ip"); + firewallCapabilities.put(Capability.SupportedTrafficDirection, "ingress"); capabilities.put(Service.Firewall, firewallCapabilities); // Disabling VPN for Juniper in Acton as it 1) Was never tested 2) probably just doesn't work @@ -326,7 +326,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan @Override public boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, - ResourceUnavailableException { + ResourceUnavailableException { // TODO Auto-generated method stub return true; } @@ -358,7 +358,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan pNetwork = physicalNetworks.get(0); String deviceType = NetworkDevice.JuniperSRXFirewall.getName(); - ExternalFirewallDeviceVO fwDeviceVO = addExternalFirewall(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, (ServerResource) new JuniperSrxResource()); + ExternalFirewallDeviceVO fwDeviceVO = addExternalFirewall(pNetwork.getId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceType, new JuniperSrxResource()); if (fwDeviceVO != null) { fwHost = _hostDao.findById(fwDeviceVO.getHostId()); } @@ -398,6 +398,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan return firewallHosts; } + @Override public ExternalFirewallResponse createExternalFirewallResponse(Host externalFirewall) { return super.createExternalFirewallResponse(externalFirewall); } @@ -423,7 +424,7 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan throw new InvalidParameterValueException("Invalid SRX firewall device type"); } return addExternalFirewall(cmd.getPhysicalNetworkId(), cmd.getUrl(), cmd.getUsername(), cmd.getPassword(), deviceName, - (ServerResource) new JuniperSrxResource()); + new JuniperSrxResource()); } @Override @@ -568,8 +569,8 @@ public class JuniperSRXExternalFirewallElement extends ExternalFirewallDeviceMan return true; } - @Override - public boolean applyStaticNats(Network config, List rules) throws ResourceUnavailableException { + @Override + public boolean applyStaticNats(Network config, List rules) throws ResourceUnavailableException { if (!canHandle(config, Service.StaticNat)) { return false; } diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXFirewallElementService.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXFirewallElementService.java index d5f53843ca1..2da5b471fe5 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXFirewallElementService.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/element/JuniperSRXFirewallElementService.java @@ -28,8 +28,9 @@ import com.cloud.api.commands.ListSrxFirewallNetworksCmd; import com.cloud.api.commands.ListSrxFirewallsCmd; import com.cloud.api.response.SrxFirewallResponse; import com.cloud.host.Host; -import com.cloud.network.ExternalFirewallDeviceVO; import com.cloud.network.Network; +import com.cloud.network.dao.ExternalFirewallDeviceVO; + import org.apache.cloudstack.api.response.ExternalFirewallResponse; import com.cloud.utils.component.PluggableService; diff --git a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java index f823ab8af4f..84821680198 100644 --- a/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java +++ b/plugins/network-elements/juniper-srx/src/com/cloud/network/resource/JuniperSrxResource.java @@ -447,7 +447,7 @@ public class JuniperSrxResource implements ServerResource { cmd.setPod(""); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(""); - cmd.setVersion(""); + cmd.setVersion(JuniperSrxResource.class.getPackage().getImplementationVersion()); cmd.setGuid(_guid); return new StartupCommand[]{cmd}; } @@ -3420,6 +3420,36 @@ public class JuniperSrxResource implements ServerResource { } else { return doc; } - } + } + + @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/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java index a45c5c0a47c..48833b31919 100644 --- a/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java +++ b/plugins/network-elements/midokura-midonet/src/com/cloud/network/element/MidokuraMidonetElement.java @@ -36,12 +36,15 @@ import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import javax.ejb.Local; import java.lang.Class; import java.util.Map; import java.util.Set; + +@Component @Local(value = NetworkElement.class) public class MidokuraMidonetElement extends AdapterBase implements ConnectivityProvider, PluggableService { private static final Logger s_logger = Logger.getLogger(MidokuraMidonetElement.class); diff --git a/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java b/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java index 0526b45ada9..ed0eb3cc537 100644 --- a/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java +++ b/plugins/network-elements/midokura-midonet/src/com/cloud/network/guru/MidokuraMidonetGuestNetworkGuru.java @@ -23,6 +23,7 @@ import com.cloud.dc.DataCenter.NetworkType; import com.cloud.network.PhysicalNetwork; import com.cloud.offering.NetworkOffering; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import javax.ejb.Local; @@ -32,6 +33,7 @@ import javax.ejb.Local; * Time: 10:46 AM */ +@Component @Local(value = NetworkGuru.class) public class MidokuraMidonetGuestNetworkGuru extends GuestNetworkGuru { private static final Logger s_logger = Logger.getLogger(MidokuraMidonetGuestNetworkGuru.class); diff --git a/plugins/network-elements/netscaler/pom.xml b/plugins/network-elements/netscaler/pom.xml index b11009d8b1a..1eb73a236dc 100644 --- a/plugins/network-elements/netscaler/pom.xml +++ b/plugins/network-elements/netscaler/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java index 9d902975723..80c8cb94ea7 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/AddNetscalerLoadBalancerCmd.java @@ -15,6 +15,8 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -26,7 +28,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -36,7 +38,7 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(AddNetscalerLoadBalancerCmd.class.getName()); private static final String s_name = "addnetscalerloadbalancerresponse"; - @PlugService NetscalerLoadBalancerElementService _netsclarLbService; + @Inject NetscalerLoadBalancerElementService _netsclarLbService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -96,12 +98,12 @@ public class AddNetscalerLoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add netscaler load balancer due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java index e0ec73ad501..a04a48ded95 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ConfigureNetscalerLoadBalancerCmd.java @@ -16,6 +16,8 @@ package com.cloud.api.commands; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PodResponse; import org.apache.log4j.Logger; @@ -28,7 +30,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.user.UserContext; import com.cloud.utils.exception.CloudRuntimeException; @@ -38,7 +40,7 @@ public class ConfigureNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(ConfigureNetscalerLoadBalancerCmd.class.getName()); private static final String s_name = "configurenetscalerloadbalancerresponse"; - @PlugService NetscalerLoadBalancerElementService _netsclarLbService; + @Inject NetscalerLoadBalancerElementService _netsclarLbService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -101,12 +103,12 @@ public class ConfigureNetscalerLoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to configure netscaler load balancer due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to configure netscaler load balancer due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java index ec7faab39d4..76f0273aecc 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/DeleteNetscalerLoadBalancerCmd.java @@ -15,14 +15,16 @@ package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.api.response.NetscalerLoadBalancerResponse; @@ -41,7 +43,7 @@ public class DeleteNetscalerLoadBalancerCmd extends BaseAsyncCmd { public static final Logger s_logger = Logger.getLogger(DeleteNetscalerLoadBalancerCmd.class.getName()); private static final String s_name = "deletenetscalerloadbalancerresponse"; - @PlugService NetscalerLoadBalancerElementService _netsclarLbService; + @Inject NetscalerLoadBalancerElementService _netsclarLbService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -72,12 +74,12 @@ public class DeleteNetscalerLoadBalancerCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete netscaler load balancer."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete netscaler load balancer."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java index 52476df8316..f182b4e3f1f 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancerNetworksCmd.java @@ -17,14 +17,16 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; @@ -43,7 +45,7 @@ public class ListNetscalerLoadBalancerNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancerNetworksCmd.class.getName()); private static final String s_name = "listnetscalerloadbalancernetworksresponse"; - @PlugService NetscalerLoadBalancerElementService _netsclarLbService; + @Inject NetscalerLoadBalancerElementService _netsclarLbService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -83,9 +85,9 @@ public class ListNetscalerLoadBalancerNetworksCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java index bf679fa51c1..25cf479e3e6 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/commands/ListNetscalerLoadBalancersCmd.java @@ -17,15 +17,17 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import com.cloud.api.response.NetscalerLoadBalancerResponse; @@ -34,7 +36,7 @@ import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceUnavailableException; -import com.cloud.network.ExternalLoadBalancerDeviceVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.element.NetscalerLoadBalancerElementService; import com.cloud.utils.exception.CloudRuntimeException; @@ -43,7 +45,7 @@ public class ListNetscalerLoadBalancersCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNetscalerLoadBalancersCmd.class.getName()); private static final String s_name = "listnetscalerloadbalancerresponse"; - @PlugService NetscalerLoadBalancerElementService _netsclarLbService; + @Inject NetscalerLoadBalancerElementService _netsclarLbService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -91,9 +93,9 @@ public class ListNetscalerLoadBalancersCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java index 40be29e560b..bd2588054d2 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java +++ b/plugins/network-elements/netscaler/src/com/cloud/api/response/NetscalerLoadBalancerResponse.java @@ -23,7 +23,8 @@ import org.apache.cloudstack.api.EntityReference; import com.cloud.serializer.Param; import com.google.gson.annotations.SerializedName; import org.apache.cloudstack.api.BaseResponse; -import com.cloud.network.ExternalLoadBalancerDeviceVO; + +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; @EntityReference(value=ExternalLoadBalancerDeviceVO.class) @SuppressWarnings("unused") diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java index 44af53a0b64..30dd06db1aa 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java +++ b/plugins/network-elements/netscaler/src/com/cloud/network/dao/NetScalerPodDaoImpl.java @@ -20,6 +20,8 @@ import java.util.List; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.network.NetScalerPodVO; import com.cloud.utils.db.DB; import com.cloud.utils.db.GenericDaoBase; @@ -27,6 +29,7 @@ import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value=NetScalerPodDao.class) @DB(txn=false) public class NetScalerPodDaoImpl extends GenericDaoBase implements NetScalerPodDao { diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java index c0f91bb42d2..8f902df703f 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java +++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerElement.java @@ -11,12 +11,11 @@ // 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 +// KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. package com.cloud.network.element; -import java.lang.Class; import java.net.URI; import java.util.ArrayList; import java.util.HashMap; @@ -26,9 +25,12 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; -import com.cloud.utils.PropertiesUtil; +import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -37,8 +39,6 @@ import com.cloud.agent.api.routing.SetStaticNatRulesAnswer; import com.cloud.agent.api.routing.SetStaticNatRulesCommand; import com.cloud.agent.api.to.LoadBalancerTO; import com.cloud.agent.api.to.StaticNatRuleTO; -import org.apache.cloudstack.api.ApiConstants; - import com.cloud.api.ApiDBUtils; import com.cloud.api.commands.AddNetscalerLoadBalancerCmd; import com.cloud.api.commands.ConfigureNetscalerLoadBalancerCmd; @@ -67,31 +67,30 @@ import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.ExternalLoadBalancerDeviceManager; import com.cloud.network.ExternalLoadBalancerDeviceManagerImpl; -import com.cloud.network.ExternalLoadBalancerDeviceVO; -import com.cloud.network.ExternalLoadBalancerDeviceVO.LBDeviceState; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import com.cloud.network.IpAddress; import com.cloud.network.NetScalerPodVO; import com.cloud.network.Network; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkExternalLoadBalancerVO; -import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.TrafficType; import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetworkServiceProvider; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.PublicIpAddress; import com.cloud.network.as.AutoScaleCounter; import com.cloud.network.as.AutoScaleCounter.AutoScaleCounterType; import com.cloud.network.dao.ExternalLoadBalancerDeviceDao; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.network.dao.NetScalerPodDao; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkExternalLoadBalancerDao; +import com.cloud.network.dao.NetworkExternalLoadBalancerVO; import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO.LBDeviceState; import com.cloud.network.lb.LoadBalancingRule; import com.cloud.network.lb.LoadBalancingRule.LbDestination; import com.cloud.network.resource.NetscalerResource; @@ -102,7 +101,6 @@ import com.cloud.network.rules.LbStickinessMethod.StickinessMethodType; import com.cloud.network.rules.StaticNat; import com.cloud.offering.NetworkOffering; import com.cloud.utils.NumbersUtil; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; @@ -113,7 +111,7 @@ import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; import com.google.gson.Gson; -@Local(value = NetworkElement.class) +@Local(value = {NetworkElement.class, StaticNatServiceProvider.class, LoadBalancingServiceProvider.class}) public class NetscalerElement extends ExternalLoadBalancerDeviceManagerImpl implements LoadBalancingServiceProvider, NetscalerLoadBalancerElementService, ExternalLoadBalancerDeviceManager, IpDeployer, StaticNatServiceProvider { @@ -122,7 +120,7 @@ StaticNatServiceProvider { public static final AutoScaleCounterType AutoScaleCounterNetscaler = new AutoScaleCounterType("netscaler"); @Inject - NetworkManager _networkManager; + NetworkModel _networkManager; @Inject ConfigurationManager _configMgr; @Inject @@ -130,7 +128,7 @@ StaticNatServiceProvider { @Inject AgentManager _agentMgr; @Inject - NetworkManager _networkMgr; + NetworkModel _networkMgr; @Inject HostDao _hostDao; @Inject @@ -179,7 +177,7 @@ StaticNatServiceProvider { } if (_ntwkSrvcDao.canProviderSupportServiceInNetwork(guestConfig.getId(), Service.StaticNat, Network.Provider.Netscaler) && !isBasicZoneNetwok(guestConfig)) { - s_logger.error("NetScaler provider can not be Static Nat service provider for the network " + guestConfig.getGuestType() + + s_logger.error("NetScaler provider can not be Static Nat service provider for the network " + guestConfig.getGuestType() + " and traffic type " + guestConfig.getTrafficType()); return false; } @@ -617,13 +615,13 @@ StaticNatServiceProvider { // NetScaler can only act as Lb and Static Nat service provider if (services != null && !services.isEmpty() && !netscalerServices.containsAll(services)) { s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " - + services + " is not supported."); + + services + " is not supported."); String servicesList = ""; for (Service service : services) { servicesList += service.getName() + " "; } - s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " - + servicesList + " is not supported."); + s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " + + servicesList + " is not supported."); s_logger.warn("NetScaler network element can only support LB and Static NAT services and service combination " + services + " is not supported."); return false; @@ -769,7 +767,7 @@ StaticNatServiceProvider { } else { if (rules != null) { for (StaticNat rule : rules) { - // validate if EIP rule can be configured. + // validate if EIP rule can be configured. ExternalLoadBalancerDeviceVO lbDevice = getNetScalerForEIP(rule); if (lbDevice == null) { String errMsg = "There is no NetScaler device configured to perform EIP to guest IP address: " + rule.getDestIpAddress(); diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerLoadBalancerElementService.java b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerLoadBalancerElementService.java index 158b36e5475..03b7a262d19 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerLoadBalancerElementService.java +++ b/plugins/network-elements/netscaler/src/com/cloud/network/element/NetscalerLoadBalancerElementService.java @@ -23,8 +23,8 @@ import com.cloud.api.commands.DeleteNetscalerLoadBalancerCmd; import com.cloud.api.commands.ListNetscalerLoadBalancerNetworksCmd; import com.cloud.api.commands.ListNetscalerLoadBalancersCmd; import com.cloud.api.response.NetscalerLoadBalancerResponse; -import com.cloud.network.ExternalLoadBalancerDeviceVO; import com.cloud.network.Network; +import com.cloud.network.dao.ExternalLoadBalancerDeviceVO; import com.cloud.utils.component.PluggableService; public interface NetscalerLoadBalancerElementService extends PluggableService { diff --git a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java index afb01353e1e..abea4649dbe 100644 --- a/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java +++ b/plugins/network-elements/netscaler/src/com/cloud/network/resource/NetscalerResource.java @@ -369,7 +369,7 @@ public class NetscalerResource implements ServerResource { cmd.setPod(""); cmd.setPrivateIpAddress(_ip); cmd.setStorageIpAddress(""); - cmd.setVersion(""); + cmd.setVersion(NetscalerResource.class.getPackage().getImplementationVersion()); cmd.setGuid(_guid); return new StartupCommand[]{cmd}; } @@ -2342,4 +2342,34 @@ public class NetscalerResource implements ServerResource { public void disconnected() { return; } + + @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/plugins/network-elements/nicira-nvp/pom.xml b/plugins/network-elements/nicira-nvp/pom.xml index 70f85607e4a..4e05a4f9fae 100644 --- a/plugins/network-elements/nicira-nvp/pom.xml +++ b/plugins/network-elements/nicira-nvp/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java index 1734ce2ff3d..5b2dacfe00f 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/AddNiciraNvpDeviceCmd.java @@ -16,6 +16,8 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -37,7 +39,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd { private static final Logger s_logger = Logger.getLogger(AddNiciraNvpDeviceCmd.class.getName()); private static final String s_name = "addniciranvpdeviceresponse"; - @PlugService NiciraNvpElementService _niciraNvpElementService; + @Inject NiciraNvpElementService _niciraNvpElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -104,12 +106,12 @@ public class AddNiciraNvpDeviceCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseAsyncCmd.INTERNAL_ERROR, "Failed to add Nicira NVP device due to internal error."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Nicira NVP device due to internal error."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java index 12544410599..8d21a55a65e 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/DeleteNiciraNvpDeviceCmd.java @@ -16,15 +16,17 @@ // under the License. package com.cloud.api.commands; +import javax.inject.Inject; + import com.cloud.api.response.NiciraNvpDeviceResponse; import org.apache.log4j.Logger; import org.apache.cloudstack.api.ApiConstants; +import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.SuccessResponse; import com.cloud.event.EventTypes; @@ -41,7 +43,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd { private static final Logger s_logger = Logger.getLogger(DeleteNiciraNvpDeviceCmd.class.getName()); private static final String s_name = "deleteniciranvpdeviceresponse"; - @PlugService NiciraNvpElementService _niciraNvpElementService; + @Inject NiciraNvpElementService _niciraNvpElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -72,12 +74,12 @@ public class DeleteNiciraNvpDeviceCmd extends BaseAsyncCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } else { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to delete Nicira device."); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete Nicira device."); } } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java index bea417d3687..e224cea7598 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDeviceNetworksCmd.java @@ -19,15 +19,17 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + import com.cloud.api.response.NiciraNvpDeviceResponse; import org.apache.log4j.Logger; 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.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.NetworkResponse; @@ -45,7 +47,7 @@ public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd { public static final Logger s_logger = Logger.getLogger(ListNiciraNvpDeviceNetworksCmd.class.getName()); private static final String s_name = "listniciranvpdevicenetworks"; - @PlugService NiciraNvpElementService _niciraNvpElementService; + @Inject NiciraNvpElementService _niciraNvpElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -85,9 +87,9 @@ public class ListNiciraNvpDeviceNetworksCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java index 04aab2a296a..81cbb23ff54 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/api/commands/ListNiciraNvpDevicesCmd.java @@ -19,11 +19,13 @@ package com.cloud.api.commands; import java.util.ArrayList; import java.util.List; +import javax.inject.Inject; + 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.Parameter; -import org.apache.cloudstack.api.PlugService; import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.response.PhysicalNetworkResponse; import org.apache.log4j.Logger; @@ -44,7 +46,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class ListNiciraNvpDevicesCmd extends BaseListCmd { private static final Logger s_logger = Logger.getLogger(ListNiciraNvpDevicesCmd.class.getName()); private static final String s_name = "listniciranvpdeviceresponse"; - @PlugService NiciraNvpElementService _niciraNvpElementService; + @Inject NiciraNvpElementService _niciraNvpElementService; ///////////////////////////////////////////////////// //////////////// API parameters ///////////////////// @@ -92,9 +94,9 @@ public class ListNiciraNvpDevicesCmd extends BaseListCmd { response.setResponseName(getCommandName()); this.setResponseObject(response); } catch (InvalidParameterValueException invalidParamExcp) { - throw new ServerApiException(BaseCmd.PARAM_ERROR, invalidParamExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.PARAM_ERROR, invalidParamExcp.getMessage()); } catch (CloudRuntimeException runtimeExcp) { - throw new ServerApiException(BaseCmd.INTERNAL_ERROR, runtimeExcp.getMessage()); + throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, runtimeExcp.getMessage()); } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java index 95bfc02e6dc..62662c54036 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpDaoImpl.java @@ -20,12 +20,15 @@ import java.util.List; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.network.NiciraNvpDeviceVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value=NiciraNvpDao.class) public class NiciraNvpDaoImpl extends GenericDaoBase implements NiciraNvpDao { diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java index 31babbbe83e..b40aad48d36 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpNicMappingDaoImpl.java @@ -18,12 +18,15 @@ package com.cloud.network.dao; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.network.NiciraNvpNicMappingVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value=NiciraNvpNicMappingDao.class) public class NiciraNvpNicMappingDaoImpl extends GenericDaoBase implements NiciraNvpNicMappingDao { diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java index 091207c8896..d3192ec723f 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/dao/NiciraNvpRouterMappingDaoImpl.java @@ -18,12 +18,15 @@ package com.cloud.network.dao; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.network.NiciraNvpRouterMappingVO; import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value=NiciraNvpRouterMappingDao.class) public class NiciraNvpRouterMappingDaoImpl extends GenericDaoBase implements NiciraNvpRouterMappingDao { diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java index 6bcaeeeb235..3ca34473cd7 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/element/NiciraNvpElement.java @@ -25,10 +25,12 @@ import java.util.Set; import java.util.UUID; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; -import com.cloud.utils.PropertiesUtil; +import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.ConfigurePortForwardingRulesOnLogicalRouterAnswer; @@ -71,32 +73,32 @@ import com.cloud.host.Host; import com.cloud.host.HostVO; import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; +import com.cloud.network.IpAddress; import com.cloud.network.Network; -import org.apache.cloudstack.network.ExternalNetworkDeviceManager.NetworkDevice; import com.cloud.network.Network.Capability; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkVO; +import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks; import com.cloud.network.Networks.BroadcastDomainType; -import com.cloud.network.IpAddress; -import com.cloud.network.NetworkManager; import com.cloud.network.NiciraNvpDeviceVO; import com.cloud.network.NiciraNvpNicMappingVO; import com.cloud.network.NiciraNvpRouterMappingVO; import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetworkServiceProvider; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.PublicIpAddress; import com.cloud.network.addr.PublicIp; import com.cloud.network.dao.NetworkDao; import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.NiciraNvpDao; import com.cloud.network.dao.NiciraNvpNicMappingDao; import com.cloud.network.dao.NiciraNvpRouterMappingDao; import com.cloud.network.dao.PhysicalNetworkDao; import com.cloud.network.dao.PhysicalNetworkServiceProviderDao; import com.cloud.network.dao.PhysicalNetworkServiceProviderVO; +import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.network.resource.NiciraNvpResource; import com.cloud.network.rules.PortForwardingRule; import com.cloud.network.rules.StaticNat; @@ -108,7 +110,6 @@ import com.cloud.resource.ServerResource; import com.cloud.resource.UnableDeleteHostException; import com.cloud.user.Account; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.Inject; import com.cloud.utils.db.DB; import com.cloud.utils.db.Transaction; import com.cloud.utils.exception.CloudRuntimeException; @@ -120,837 +121,833 @@ import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; import com.cloud.vm.dao.NicDao; -@Local(value = NetworkElement.class) +@Component +@Local(value = {NetworkElement.class, ConnectivityProvider.class, + SourceNatServiceProvider.class, StaticNatServiceProvider.class, + PortForwardingServiceProvider.class, IpDeployer.class} ) public class NiciraNvpElement extends AdapterBase implements - ConnectivityProvider, SourceNatServiceProvider, - PortForwardingServiceProvider, StaticNatServiceProvider, - NiciraNvpElementService, ResourceStateAdapter, IpDeployer { - private static final Logger s_logger = Logger - .getLogger(NiciraNvpElement.class); +ConnectivityProvider, SourceNatServiceProvider, +PortForwardingServiceProvider, StaticNatServiceProvider, +NiciraNvpElementService, ResourceStateAdapter, IpDeployer { + private static final Logger s_logger = Logger + .getLogger(NiciraNvpElement.class); - private static final Map> capabilities = setCapabilities(); + private static final Map> capabilities = setCapabilities(); - @Inject - NicDao _nicDao; - @Inject - ResourceManager _resourceMgr; - @Inject - PhysicalNetworkDao _physicalNetworkDao; - @Inject - PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; - @Inject - NiciraNvpDao _niciraNvpDao; - @Inject - HostDetailsDao _hostDetailsDao; - @Inject - HostDao _hostDao; - @Inject - AgentManager _agentMgr; - @Inject - NiciraNvpNicMappingDao _niciraNvpNicMappingDao; - @Inject - NiciraNvpRouterMappingDao _niciraNvpRouterMappingDao; - @Inject - NetworkDao _networkDao; - @Inject - NetworkManager _networkManager; - @Inject - ConfigurationManager _configMgr; - @Inject - NetworkServiceMapDao _ntwkSrvcDao; - @Inject - VlanDao _vlanDao; + @Inject + NicDao _nicDao; + @Inject + ResourceManager _resourceMgr; + @Inject + PhysicalNetworkDao _physicalNetworkDao; + @Inject + PhysicalNetworkServiceProviderDao _physicalNetworkServiceProviderDao; + @Inject + NiciraNvpDao _niciraNvpDao; + @Inject + HostDetailsDao _hostDetailsDao; + @Inject + HostDao _hostDao; + @Inject + AgentManager _agentMgr; + @Inject + NiciraNvpNicMappingDao _niciraNvpNicMappingDao; + @Inject + NiciraNvpRouterMappingDao _niciraNvpRouterMappingDao; + @Inject + NetworkDao _networkDao; + @Inject + NetworkManager _networkManager; + @Inject + NetworkModel _networkModel; + @Inject + ConfigurationManager _configMgr; + @Inject + NetworkServiceMapDao _ntwkSrvcDao; + @Inject + VlanDao _vlanDao; - @Override - public Map> getCapabilities() { - return capabilities; - } + @Override + public Map> getCapabilities() { + return capabilities; + } - @Override - public Provider getProvider() { - return Provider.NiciraNvp; - } + @Override + public Provider getProvider() { + return Provider.NiciraNvp; + } - protected boolean canHandle(Network network, Service service) { - s_logger.debug("Checking if NiciraNvpElement can handle service " - + service.getName() + " on network " + network.getDisplayText()); - if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { - return false; - } + protected boolean canHandle(Network network, Service service) { + s_logger.debug("Checking if NiciraNvpElement can handle service " + + service.getName() + " on network " + network.getDisplayText()); + if (network.getBroadcastDomainType() != BroadcastDomainType.Lswitch) { + return false; + } - if (!_networkManager.isProviderForNetwork(getProvider(), - network.getId())) { - s_logger.debug("NiciraNvpElement is not a provider for network " - + network.getDisplayText()); - return false; - } + if (!_networkModel.isProviderForNetwork(getProvider(), + network.getId())) { + s_logger.debug("NiciraNvpElement is not a provider for network " + + network.getDisplayText()); + return false; + } - if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), - service, Network.Provider.NiciraNvp)) { - s_logger.debug("NiciraNvpElement can't provide the " - + service.getName() + " service on network " - + network.getDisplayText()); - return false; - } + if (!_ntwkSrvcDao.canProviderSupportServiceInNetwork(network.getId(), + service, Network.Provider.NiciraNvp)) { + s_logger.debug("NiciraNvpElement can't provide the " + + service.getName() + " service on network " + + network.getDisplayText()); + return false; + } - return true; - } + return true; + } - @Override - public boolean configure(String name, Map params) - throws ConfigurationException { - super.configure(name, params); - _resourceMgr.registerResourceStateAdapter(this.getClass() - .getSimpleName(), this); - return true; - } + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + super.configure(name, params); + _resourceMgr.registerResourceStateAdapter(name, this); + return true; + } - @Override - public boolean implement(Network network, NetworkOffering offering, - DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { - s_logger.debug("entering NiciraNvpElement implement function for network " - + network.getDisplayText() - + " (state " - + network.getState() - + ")"); + @Override + public boolean implement(Network network, NetworkOffering offering, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { + s_logger.debug("entering NiciraNvpElement implement function for network " + + network.getDisplayText() + + " (state " + + network.getState() + + ")"); - if (!canHandle(network, Service.Connectivity)) { - return false; - } + if (!canHandle(network, Service.Connectivity)) { + return false; + } - if (network.getBroadcastUri() == null) { - s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); - return false; - } + if (network.getBroadcastUri() == null) { + s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); + return false; + } - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - _hostDao.loadDetails(niciraNvpHost); + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + _hostDao.loadDetails(niciraNvpHost); - Account owner = context.getAccount(); + Account owner = context.getAccount(); - /** - * Lock the network as we might need to do multiple operations that - * should be done only once. - */ - Network lock = _networkDao.acquireInLockTable(network.getId(), - _networkManager.getNetworkLockTimeout()); - if (lock == null) { - throw new ConcurrentOperationException("Unable to lock network " - + network.getId()); - } - try { - // Implement SourceNat immediately as we have al the info already - if (_networkManager.isProviderSupportServiceInNetwork( - network.getId(), Service.SourceNat, Provider.NiciraNvp)) { - s_logger.debug("Apparently we are supposed to provide SourceNat on this network"); + /** + * Lock the network as we might need to do multiple operations that + * should be done only once. + */ +// Network lock = _networkDao.acquireInLockTable(network.getId(), +// _networkModel.getNetworkLockTimeout()); +// if (lock == null) { +// throw new ConcurrentOperationException("Unable to lock network " +// + network.getId()); +// } - PublicIp sourceNatIp = _networkManager - .assignSourceNatIpAddressToGuestNetwork(owner, network); - String publicCidr = sourceNatIp.getAddress().addr() + "/" - + NetUtils.getCidrSize(sourceNatIp.getVlanNetmask()); - String internalCidr = network.getGateway() + "/" - + network.getCidr().split("/")[1]; - long vlanid = (Vlan.UNTAGGED.equals(sourceNatIp.getVlanTag())) ? 0 - : Long.parseLong(sourceNatIp.getVlanTag()); + // Implement SourceNat immediately as we have al the info already + if (_networkModel.isProviderSupportServiceInNetwork( + network.getId(), Service.SourceNat, Provider.NiciraNvp)) { + s_logger.debug("Apparently we are supposed to provide SourceNat on this network"); - CreateLogicalRouterCommand cmd = new CreateLogicalRouterCommand( - niciraNvpHost.getDetail("l3gatewayserviceuuid"), vlanid, - network.getBroadcastUri().getSchemeSpecificPart(), - "router-" + network.getDisplayText(), publicCidr, - sourceNatIp.getGateway(), internalCidr, context - .getDomain().getName() - + "-" - + context.getAccount().getAccountName()); - CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer) _agentMgr - .easySend(niciraNvpHost.getId(), cmd); - if (answer.getResult() == false) { - s_logger.error("Failed to create Logical Router for network " - + network.getDisplayText()); - return false; - } + PublicIp sourceNatIp = _networkManager + .assignSourceNatIpAddressToGuestNetwork(owner, network); + String publicCidr = sourceNatIp.getAddress().addr() + "/" + + NetUtils.getCidrSize(sourceNatIp.getVlanNetmask()); + String internalCidr = network.getGateway() + "/" + + network.getCidr().split("/")[1]; + long vlanid = (Vlan.UNTAGGED.equals(sourceNatIp.getVlanTag())) ? 0 + : Long.parseLong(sourceNatIp.getVlanTag()); - // Store the uuid so we can easily find it during cleanup - NiciraNvpRouterMappingVO routermapping = - new NiciraNvpRouterMappingVO(answer.getLogicalRouterUuid(), network.getId()); - _niciraNvpRouterMappingDao.persist(routermapping); - } - } finally { - if (lock != null) { - _networkDao.releaseFromLockTable(lock.getId()); - if (s_logger.isDebugEnabled()) { - s_logger.debug("Lock is released for network id " - + lock.getId() + " as a part of router startup in " - + dest); - } - } - } - return true; - } + CreateLogicalRouterCommand cmd = new CreateLogicalRouterCommand( + niciraNvpHost.getDetail("l3gatewayserviceuuid"), vlanid, + network.getBroadcastUri().getSchemeSpecificPart(), + "router-" + network.getDisplayText(), publicCidr, + sourceNatIp.getGateway(), internalCidr, context + .getDomain().getName() + + "-" + + context.getAccount().getAccountName()); + CreateLogicalRouterAnswer answer = (CreateLogicalRouterAnswer) _agentMgr + .easySend(niciraNvpHost.getId(), cmd); + if (answer.getResult() == false) { + s_logger.error("Failed to create Logical Router for network " + + network.getDisplayText()); + return false; + } - @Override - public boolean prepare(Network network, NicProfile nic, - VirtualMachineProfile vm, - DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { + // Store the uuid so we can easily find it during cleanup + NiciraNvpRouterMappingVO routermapping = + new NiciraNvpRouterMappingVO(answer.getLogicalRouterUuid(), network.getId()); + _niciraNvpRouterMappingDao.persist(routermapping); + } - if (!canHandle(network, Service.Connectivity)) { - return false; - } - if (network.getBroadcastUri() == null) { - s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); - return false; - } + return true; + } - NicVO nicVO = _nicDao.findById(nic.getId()); + @Override + public boolean prepare(Network network, NicProfile nic, + VirtualMachineProfile vm, + DeployDestination dest, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + if (!canHandle(network, Service.Connectivity)) { + return false; + } - NiciraNvpNicMappingVO existingNicMap = _niciraNvpNicMappingDao - .findByNicUuid(nicVO.getUuid()); - if (existingNicMap != null) { - FindLogicalSwitchPortCommand findCmd = new FindLogicalSwitchPortCommand( - existingNicMap.getLogicalSwitchUuid(), - existingNicMap.getLogicalSwitchPortUuid()); - FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer) _agentMgr - .easySend(niciraNvpHost.getId(), findCmd); + if (network.getBroadcastUri() == null) { + s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); + return false; + } - if (answer.getResult()) { - s_logger.warn("Existing Logical Switchport found for nic " - + nic.getName() + " with uuid " - + existingNicMap.getLogicalSwitchPortUuid()); - UpdateLogicalSwitchPortCommand cmd = new UpdateLogicalSwitchPortCommand( - existingNicMap.getLogicalSwitchPortUuid(), network - .getBroadcastUri().getSchemeSpecificPart(), - nicVO.getUuid(), context.getDomain().getName() + "-" - + context.getAccount().getAccountName(), - nic.getName()); - _agentMgr.easySend(niciraNvpHost.getId(), cmd); - return true; - } else { - s_logger.error("Stale entry found for nic " + nic.getName() - + " with logical switchport uuid " - + existingNicMap.getLogicalSwitchPortUuid()); - _niciraNvpNicMappingDao.remove(existingNicMap.getId()); - } - } + NicVO nicVO = _nicDao.findById(nic.getId()); - CreateLogicalSwitchPortCommand cmd = new CreateLogicalSwitchPortCommand( - network.getBroadcastUri().getSchemeSpecificPart(), - nicVO.getUuid(), context.getDomain().getName() + "-" - + context.getAccount().getAccountName(), nic.getName()); - CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer) _agentMgr - .easySend(niciraNvpHost.getId(), cmd); + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - if (answer == null || !answer.getResult()) { - s_logger.error("CreateLogicalSwitchPortCommand failed"); - return false; - } + NiciraNvpNicMappingVO existingNicMap = _niciraNvpNicMappingDao + .findByNicUuid(nicVO.getUuid()); + if (existingNicMap != null) { + FindLogicalSwitchPortCommand findCmd = new FindLogicalSwitchPortCommand( + existingNicMap.getLogicalSwitchUuid(), + existingNicMap.getLogicalSwitchPortUuid()); + FindLogicalSwitchPortAnswer answer = (FindLogicalSwitchPortAnswer) _agentMgr + .easySend(niciraNvpHost.getId(), findCmd); - NiciraNvpNicMappingVO nicMap = new NiciraNvpNicMappingVO(network - .getBroadcastUri().getSchemeSpecificPart(), - answer.getLogicalSwitchPortUuid(), nicVO.getUuid()); - _niciraNvpNicMappingDao.persist(nicMap); + if (answer.getResult()) { + s_logger.warn("Existing Logical Switchport found for nic " + + nic.getName() + " with uuid " + + existingNicMap.getLogicalSwitchPortUuid()); + UpdateLogicalSwitchPortCommand cmd = new UpdateLogicalSwitchPortCommand( + existingNicMap.getLogicalSwitchPortUuid(), network + .getBroadcastUri().getSchemeSpecificPart(), + nicVO.getUuid(), context.getDomain().getName() + "-" + + context.getAccount().getAccountName(), + nic.getName()); + _agentMgr.easySend(niciraNvpHost.getId(), cmd); + return true; + } else { + s_logger.error("Stale entry found for nic " + nic.getName() + + " with logical switchport uuid " + + existingNicMap.getLogicalSwitchPortUuid()); + _niciraNvpNicMappingDao.remove(existingNicMap.getId()); + } + } - return true; - } + CreateLogicalSwitchPortCommand cmd = new CreateLogicalSwitchPortCommand( + network.getBroadcastUri().getSchemeSpecificPart(), + nicVO.getUuid(), context.getDomain().getName() + "-" + + context.getAccount().getAccountName(), nic.getName()); + CreateLogicalSwitchPortAnswer answer = (CreateLogicalSwitchPortAnswer) _agentMgr + .easySend(niciraNvpHost.getId(), cmd); - @Override - public boolean release(Network network, NicProfile nic, - VirtualMachineProfile vm, - ReservationContext context) throws ConcurrentOperationException, - ResourceUnavailableException { + if (answer == null || !answer.getResult()) { + s_logger.error("CreateLogicalSwitchPortCommand failed"); + return false; + } - if (!canHandle(network, Service.Connectivity)) { - return false; - } + NiciraNvpNicMappingVO nicMap = new NiciraNvpNicMappingVO(network + .getBroadcastUri().getSchemeSpecificPart(), + answer.getLogicalSwitchPortUuid(), nicVO.getUuid()); + _niciraNvpNicMappingDao.persist(nicMap); - if (network.getBroadcastUri() == null) { - s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); - return false; - } + return true; + } - NicVO nicVO = _nicDao.findById(nic.getId()); + @Override + public boolean release(Network network, NicProfile nic, + VirtualMachineProfile vm, + ReservationContext context) throws ConcurrentOperationException, + ResourceUnavailableException { - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + if (!canHandle(network, Service.Connectivity)) { + return false; + } - NiciraNvpNicMappingVO nicMap = _niciraNvpNicMappingDao - .findByNicUuid(nicVO.getUuid()); - if (nicMap == null) { - s_logger.error("No mapping for nic " + nic.getName()); - return false; - } + if (network.getBroadcastUri() == null) { + s_logger.error("Nic has no broadcast Uri with the LSwitch Uuid"); + return false; + } - DeleteLogicalSwitchPortCommand cmd = new DeleteLogicalSwitchPortCommand( - nicMap.getLogicalSwitchUuid(), - nicMap.getLogicalSwitchPortUuid()); - DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer) _agentMgr - .easySend(niciraNvpHost.getId(), cmd); + NicVO nicVO = _nicDao.findById(nic.getId()); - if (answer == null || !answer.getResult()) { - s_logger.error("DeleteLogicalSwitchPortCommand failed"); - return false; - } + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - _niciraNvpNicMappingDao.remove(nicMap.getId()); + NiciraNvpNicMappingVO nicMap = _niciraNvpNicMappingDao + .findByNicUuid(nicVO.getUuid()); + if (nicMap == null) { + s_logger.error("No mapping for nic " + nic.getName()); + return false; + } - return true; - } + DeleteLogicalSwitchPortCommand cmd = new DeleteLogicalSwitchPortCommand( + nicMap.getLogicalSwitchUuid(), + nicMap.getLogicalSwitchPortUuid()); + DeleteLogicalSwitchPortAnswer answer = (DeleteLogicalSwitchPortAnswer) _agentMgr + .easySend(niciraNvpHost.getId(), cmd); - @Override - public boolean shutdown(Network network, ReservationContext context, - boolean cleanup) throws ConcurrentOperationException, - ResourceUnavailableException { - if (!canHandle(network, Service.Connectivity)) { - return false; - } + if (answer == null || !answer.getResult()) { + s_logger.error("DeleteLogicalSwitchPortCommand failed"); + return false; + } - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + _niciraNvpNicMappingDao.remove(nicMap.getId()); - if (_networkManager.isProviderSupportServiceInNetwork(network.getId(), - Service.SourceNat, Provider.NiciraNvp)) { - s_logger.debug("Apparently we were providing SourceNat on this network"); + return true; + } - // Deleting the LogicalRouter will also take care of all provisioned - // nat rules. - NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao - .findByNetworkId(network.getId()); - if (routermapping == null) { - s_logger.warn("No logical router uuid found for network " - + network.getDisplayText()); - // This might be cause by a failed deployment, so don't make shutdown fail as well. - return true; - } + @Override + public boolean shutdown(Network network, ReservationContext context, + boolean cleanup) throws ConcurrentOperationException, + ResourceUnavailableException { + if (!canHandle(network, Service.Connectivity)) { + return false; + } - DeleteLogicalRouterCommand cmd = new DeleteLogicalRouterCommand(routermapping.getLogicalRouterUuid()); - DeleteLogicalRouterAnswer answer = - (DeleteLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); - if (answer.getResult() == false) { - s_logger.error("Failed to delete LogicalRouter for network " - + network.getDisplayText()); - return false; - } + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - _niciraNvpRouterMappingDao.remove(routermapping.getId()); - } + if (_networkModel.isProviderSupportServiceInNetwork(network.getId(), + Service.SourceNat, Provider.NiciraNvp)) { + s_logger.debug("Apparently we were providing SourceNat on this network"); - return true; - } + // Deleting the LogicalRouter will also take care of all provisioned + // nat rules. + NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao + .findByNetworkId(network.getId()); + if (routermapping == null) { + s_logger.warn("No logical router uuid found for network " + + network.getDisplayText()); + // This might be cause by a failed deployment, so don't make shutdown fail as well. + return true; + } - @Override - public boolean destroy(Network network, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException { - if (!canHandle(network, Service.Connectivity)) { - return false; - } + DeleteLogicalRouterCommand cmd = new DeleteLogicalRouterCommand(routermapping.getLogicalRouterUuid()); + DeleteLogicalRouterAnswer answer = + (DeleteLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); + if (answer.getResult() == false) { + s_logger.error("Failed to delete LogicalRouter for network " + + network.getDisplayText()); + return false; + } - return true; - } + _niciraNvpRouterMappingDao.remove(routermapping.getId()); + } - @Override - public boolean isReady(PhysicalNetworkServiceProvider provider) { - return true; - } + return true; + } - @Override - public boolean shutdownProviderInstances( - PhysicalNetworkServiceProvider provider, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException { - // Nothing to do here. - return true; - } + @Override + public boolean destroy(Network network, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + if (!canHandle(network, Service.Connectivity)) { + return false; + } - @Override - public boolean canEnableIndividualServices() { - return true; - } + return true; + } - @Override - public boolean verifyServicesCombination(Set services) { - // This element can only function in a Nicra Nvp based - // SDN network, so Connectivity needs to be present here - if (!services.contains(Service.Connectivity)) { - s_logger.warn("Unable to provide services without Connectivity service enabled for this element"); - return false; - } - if ((services.contains(Service.PortForwarding) || services.contains(Service.StaticNat)) && !services.contains(Service.SourceNat)) { - s_logger.warn("Unable to provide StaticNat and/or PortForwarding without the SourceNat service"); - return false; - } - return true; - } + @Override + public boolean isReady(PhysicalNetworkServiceProvider provider) { + return true; + } - private static Map> setCapabilities() { - Map> capabilities = new HashMap>(); + @Override + public boolean shutdownProviderInstances( + PhysicalNetworkServiceProvider provider, ReservationContext context) + throws ConcurrentOperationException, ResourceUnavailableException { + // Nothing to do here. + return true; + } - // L2 Support : SDN provisioning - capabilities.put(Service.Connectivity, null); + @Override + public boolean canEnableIndividualServices() { + return true; + } - // L3 Support : Generic? - capabilities.put(Service.Gateway, null); + @Override + public boolean verifyServicesCombination(Set services) { + // This element can only function in a Nicra Nvp based + // SDN network, so Connectivity needs to be present here + if (!services.contains(Service.Connectivity)) { + s_logger.warn("Unable to provide services without Connectivity service enabled for this element"); + return false; + } + if ((services.contains(Service.PortForwarding) || services.contains(Service.StaticNat)) && !services.contains(Service.SourceNat)) { + s_logger.warn("Unable to provide StaticNat and/or PortForwarding without the SourceNat service"); + return false; + } + return true; + } - // L3 Support : SourceNat - Map sourceNatCapabilities = new HashMap(); - sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, - "peraccount"); - sourceNatCapabilities.put(Capability.RedundantRouter, "false"); - capabilities.put(Service.SourceNat, sourceNatCapabilities); + private static Map> setCapabilities() { + Map> capabilities = new HashMap>(); - // L3 Support : Port Forwarding - capabilities.put(Service.PortForwarding, null); + // L2 Support : SDN provisioning + capabilities.put(Service.Connectivity, null); - // L3 support : StaticNat - capabilities.put(Service.StaticNat, null); + // L3 Support : Generic? + capabilities.put(Service.Gateway, null); - return capabilities; - } + // L3 Support : SourceNat + Map sourceNatCapabilities = new HashMap(); + sourceNatCapabilities.put(Capability.SupportedSourceNatTypes, + "peraccount"); + sourceNatCapabilities.put(Capability.RedundantRouter, "false"); + capabilities.put(Service.SourceNat, sourceNatCapabilities); - @Override - public List> getCommands() { + // L3 Support : Port Forwarding + capabilities.put(Service.PortForwarding, null); + + // L3 support : StaticNat + capabilities.put(Service.StaticNat, null); + + return capabilities; + } + + @Override + public List> getCommands() { List> cmdList = new ArrayList>(); cmdList.add(AddNiciraNvpDeviceCmd.class); cmdList.add(DeleteNiciraNvpDeviceCmd.class); cmdList.add(ListNiciraNvpDeviceNetworksCmd.class); cmdList.add(ListNiciraNvpDevicesCmd.class); return cmdList; - } + } - @Override - @DB - public NiciraNvpDeviceVO addNiciraNvpDevice(AddNiciraNvpDeviceCmd cmd) { - ServerResource resource = new NiciraNvpResource(); - String deviceName = Network.Provider.NiciraNvp.getName(); - NetworkDevice networkDevice = NetworkDevice - .getNetworkDevice(deviceName); - Long physicalNetworkId = cmd.getPhysicalNetworkId(); - NiciraNvpDeviceVO niciraNvpDevice = null; + @Override + @DB + public NiciraNvpDeviceVO addNiciraNvpDevice(AddNiciraNvpDeviceCmd cmd) { + ServerResource resource = new NiciraNvpResource(); + String deviceName = Network.Provider.NiciraNvp.getName(); + NetworkDevice networkDevice = NetworkDevice + .getNetworkDevice(deviceName); + Long physicalNetworkId = cmd.getPhysicalNetworkId(); + NiciraNvpDeviceVO niciraNvpDevice = null; - PhysicalNetworkVO physicalNetwork = _physicalNetworkDao - .findById(physicalNetworkId); - if (physicalNetwork == null) { - throw new InvalidParameterValueException( - "Could not find phyical network with ID: " - + physicalNetworkId); - } - long zoneId = physicalNetwork.getDataCenterId(); + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork == null) { + throw new InvalidParameterValueException( + "Could not find phyical network with ID: " + + physicalNetworkId); + } + long zoneId = physicalNetwork.getDataCenterId(); - PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao - .findByServiceProvider(physicalNetwork.getId(), - networkDevice.getNetworkServiceProvder()); - if (ntwkSvcProvider == null) { - throw new CloudRuntimeException("Network Service Provider: " - + networkDevice.getNetworkServiceProvder() - + " is not enabled in the physical network: " - + physicalNetworkId + "to add this device"); - } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { - throw new CloudRuntimeException("Network Service Provider: " - + ntwkSvcProvider.getProviderName() - + " is in shutdown state in the physical network: " - + physicalNetworkId + "to add this device"); - } + PhysicalNetworkServiceProviderVO ntwkSvcProvider = _physicalNetworkServiceProviderDao + .findByServiceProvider(physicalNetwork.getId(), + networkDevice.getNetworkServiceProvder()); + if (ntwkSvcProvider == null) { + throw new CloudRuntimeException("Network Service Provider: " + + networkDevice.getNetworkServiceProvder() + + " is not enabled in the physical network: " + + physicalNetworkId + "to add this device"); + } else if (ntwkSvcProvider.getState() == PhysicalNetworkServiceProvider.State.Shutdown) { + throw new CloudRuntimeException("Network Service Provider: " + + ntwkSvcProvider.getProviderName() + + " is in shutdown state in the physical network: " + + physicalNetworkId + "to add this device"); + } - if (_niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) { - throw new CloudRuntimeException( - "A NiciraNvp device is already configured on this physical network"); - } + if (_niciraNvpDao.listByPhysicalNetwork(physicalNetworkId).size() != 0) { + throw new CloudRuntimeException( + "A NiciraNvp device is already configured on this physical network"); + } - Map params = new HashMap(); - params.put("guid", UUID.randomUUID().toString()); - params.put("zoneId", String.valueOf(physicalNetwork.getDataCenterId())); - params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId())); - params.put("name", "Nicira Controller - " + cmd.getHost()); - params.put("ip", cmd.getHost()); - params.put("adminuser", cmd.getUsername()); - params.put("adminpass", cmd.getPassword()); - params.put("transportzoneuuid", cmd.getTransportzoneUuid()); - // FIXME What to do with multiple isolation types - params.put("transportzoneisotype", - physicalNetwork.getIsolationMethods().get(0).toLowerCase()); - if (cmd.getL3GatewayServiceUuid() != null) { - params.put("l3gatewayserviceuuid", cmd.getL3GatewayServiceUuid()); - } + Map params = new HashMap(); + params.put("guid", UUID.randomUUID().toString()); + params.put("zoneId", String.valueOf(physicalNetwork.getDataCenterId())); + params.put("physicalNetworkId", String.valueOf(physicalNetwork.getId())); + params.put("name", "Nicira Controller - " + cmd.getHost()); + params.put("ip", cmd.getHost()); + params.put("adminuser", cmd.getUsername()); + params.put("adminpass", cmd.getPassword()); + params.put("transportzoneuuid", cmd.getTransportzoneUuid()); + // FIXME What to do with multiple isolation types + params.put("transportzoneisotype", + physicalNetwork.getIsolationMethods().get(0).toLowerCase()); + if (cmd.getL3GatewayServiceUuid() != null) { + params.put("l3gatewayserviceuuid", cmd.getL3GatewayServiceUuid()); + } - Map hostdetails = new HashMap(); - hostdetails.putAll(params); + Map hostdetails = new HashMap(); + hostdetails.putAll(params); - Transaction txn = Transaction.currentTxn(); - try { - resource.configure(cmd.getHost(), hostdetails); + Transaction txn = Transaction.currentTxn(); + try { + resource.configure(cmd.getHost(), hostdetails); - Host host = _resourceMgr.addHost(zoneId, resource, - Host.Type.L2Networking, params); - if (host != null) { - txn.start(); + Host host = _resourceMgr.addHost(zoneId, resource, + Host.Type.L2Networking, params); + if (host != null) { + txn.start(); - niciraNvpDevice = new NiciraNvpDeviceVO(host.getId(), - physicalNetworkId, ntwkSvcProvider.getProviderName(), - deviceName); - _niciraNvpDao.persist(niciraNvpDevice); + niciraNvpDevice = new NiciraNvpDeviceVO(host.getId(), + physicalNetworkId, ntwkSvcProvider.getProviderName(), + deviceName); + _niciraNvpDao.persist(niciraNvpDevice); - DetailVO detail = new DetailVO(host.getId(), - "niciranvpdeviceid", String.valueOf(niciraNvpDevice - .getId())); - _hostDetailsDao.persist(detail); + DetailVO detail = new DetailVO(host.getId(), + "niciranvpdeviceid", String.valueOf(niciraNvpDevice + .getId())); + _hostDetailsDao.persist(detail); - txn.commit(); - return niciraNvpDevice; - } else { - throw new CloudRuntimeException( - "Failed to add Nicira Nvp Device due to internal error."); - } - } catch (ConfigurationException e) { - txn.rollback(); - throw new CloudRuntimeException(e.getMessage()); - } - } + txn.commit(); + return niciraNvpDevice; + } else { + throw new CloudRuntimeException( + "Failed to add Nicira Nvp Device due to internal error."); + } + } catch (ConfigurationException e) { + txn.rollback(); + throw new CloudRuntimeException(e.getMessage()); + } + } - @Override - public NiciraNvpDeviceResponse createNiciraNvpDeviceResponse( - NiciraNvpDeviceVO niciraNvpDeviceVO) { - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDeviceVO.getHostId()); - _hostDao.loadDetails(niciraNvpHost); + @Override + public NiciraNvpDeviceResponse createNiciraNvpDeviceResponse( + NiciraNvpDeviceVO niciraNvpDeviceVO) { + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDeviceVO.getHostId()); + _hostDao.loadDetails(niciraNvpHost); - NiciraNvpDeviceResponse response = new NiciraNvpDeviceResponse(); - response.setDeviceName(niciraNvpDeviceVO.getDeviceName()); + NiciraNvpDeviceResponse response = new NiciraNvpDeviceResponse(); + response.setDeviceName(niciraNvpDeviceVO.getDeviceName()); PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(niciraNvpDeviceVO.getPhysicalNetworkId()); if (pnw != null) { response.setPhysicalNetworkId(pnw.getUuid()); } - response.setId(niciraNvpDeviceVO.getUuid()); - response.setProviderName(niciraNvpDeviceVO.getProviderName()); - response.setHostName(niciraNvpHost.getDetail("ip")); - response.setTransportZoneUuid(niciraNvpHost.getDetail("transportzoneuuid")); - response.setL3GatewayServiceUuid(niciraNvpHost.getDetail("l3gatewayserviceuuid")); - response.setObjectName("niciranvpdevice"); - return response; - } + response.setId(niciraNvpDeviceVO.getUuid()); + response.setProviderName(niciraNvpDeviceVO.getProviderName()); + response.setHostName(niciraNvpHost.getDetail("ip")); + response.setTransportZoneUuid(niciraNvpHost.getDetail("transportzoneuuid")); + response.setL3GatewayServiceUuid(niciraNvpHost.getDetail("l3gatewayserviceuuid")); + response.setObjectName("niciranvpdevice"); + return response; + } - @Override - public boolean deleteNiciraNvpDevice(DeleteNiciraNvpDeviceCmd cmd) { - Long niciraDeviceId = cmd.getNiciraNvpDeviceId(); - NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao - .findById(niciraDeviceId); - if (niciraNvpDevice == null) { - throw new InvalidParameterValueException( - "Could not find a nicira device with id " + niciraDeviceId); - } + @Override + public boolean deleteNiciraNvpDevice(DeleteNiciraNvpDeviceCmd cmd) { + Long niciraDeviceId = cmd.getNiciraNvpDeviceId(); + NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao + .findById(niciraDeviceId); + if (niciraNvpDevice == null) { + throw new InvalidParameterValueException( + "Could not find a nicira device with id " + niciraDeviceId); + } - // Find the physical network we work for - Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId(); - PhysicalNetworkVO physicalNetwork = _physicalNetworkDao - .findById(physicalNetworkId); - if (physicalNetwork != null) { - // Lets see if there are networks that use us - // Find the nicira networks on this physical network - List networkList = _networkDao - .listByPhysicalNetwork(physicalNetworkId); + // Find the physical network we work for + Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId(); + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork != null) { + // Lets see if there are networks that use us + // Find the nicira networks on this physical network + List networkList = _networkDao + .listByPhysicalNetwork(physicalNetworkId); - // Networks with broadcast type lswitch are ours - for (NetworkVO network : networkList) { - if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { - if ((network.getState() != Network.State.Shutdown) - && (network.getState() != Network.State.Destroy)) { - throw new CloudRuntimeException( - "This Nicira Nvp device can not be deleted as there are one or more logical networks provisioned by cloudstack."); - } - } - } - } + // Networks with broadcast type lswitch are ours + for (NetworkVO network : networkList) { + if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { + if ((network.getState() != Network.State.Shutdown) + && (network.getState() != Network.State.Destroy)) { + throw new CloudRuntimeException( + "This Nicira Nvp device can not be deleted as there are one or more logical networks provisioned by cloudstack."); + } + } + } + } - HostVO niciraHost = _hostDao.findById(niciraNvpDevice.getHostId()); - Long hostId = niciraHost.getId(); + HostVO niciraHost = _hostDao.findById(niciraNvpDevice.getHostId()); + Long hostId = niciraHost.getId(); - niciraHost.setResourceState(ResourceState.Maintenance); - _hostDao.update(hostId, niciraHost); - _resourceMgr.deleteHost(hostId, false, false); + niciraHost.setResourceState(ResourceState.Maintenance); + _hostDao.update(hostId, niciraHost); + _resourceMgr.deleteHost(hostId, false, false); - _niciraNvpDao.remove(niciraDeviceId); - return true; - } + _niciraNvpDao.remove(niciraDeviceId); + return true; + } - @Override - public List listNiciraNvpDevices( - ListNiciraNvpDevicesCmd cmd) { - Long physicalNetworkId = cmd.getPhysicalNetworkId(); - Long niciraNvpDeviceId = cmd.getNiciraNvpDeviceId(); - List responseList = new ArrayList(); + @Override + public List listNiciraNvpDevices( + ListNiciraNvpDevicesCmd cmd) { + Long physicalNetworkId = cmd.getPhysicalNetworkId(); + Long niciraNvpDeviceId = cmd.getNiciraNvpDeviceId(); + List responseList = new ArrayList(); - if (physicalNetworkId == null && niciraNvpDeviceId == null) { - throw new InvalidParameterValueException( - "Either physical network Id or nicira device Id must be specified"); - } + if (physicalNetworkId == null && niciraNvpDeviceId == null) { + throw new InvalidParameterValueException( + "Either physical network Id or nicira device Id must be specified"); + } - if (niciraNvpDeviceId != null) { - NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao - .findById(niciraNvpDeviceId); - if (niciraNvpDevice == null) { - throw new InvalidParameterValueException( - "Could not find Nicira Nvp device with id: " - + niciraNvpDevice); - } - responseList.add(niciraNvpDevice); - } else { - PhysicalNetworkVO physicalNetwork = _physicalNetworkDao - .findById(physicalNetworkId); - if (physicalNetwork == null) { - throw new InvalidParameterValueException( - "Could not find a physical network with id: " - + physicalNetworkId); - } - responseList = _niciraNvpDao - .listByPhysicalNetwork(physicalNetworkId); - } + if (niciraNvpDeviceId != null) { + NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao + .findById(niciraNvpDeviceId); + if (niciraNvpDevice == null) { + throw new InvalidParameterValueException( + "Could not find Nicira Nvp device with id: " + + niciraNvpDevice); + } + responseList.add(niciraNvpDevice); + } else { + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork == null) { + throw new InvalidParameterValueException( + "Could not find a physical network with id: " + + physicalNetworkId); + } + responseList = _niciraNvpDao + .listByPhysicalNetwork(physicalNetworkId); + } - return responseList; - } + return responseList; + } - @Override - public List listNiciraNvpDeviceNetworks( - ListNiciraNvpDeviceNetworksCmd cmd) { - Long niciraDeviceId = cmd.getNiciraNvpDeviceId(); - NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao - .findById(niciraDeviceId); - if (niciraNvpDevice == null) { - throw new InvalidParameterValueException( - "Could not find a nicira device with id " + niciraDeviceId); - } + @Override + public List listNiciraNvpDeviceNetworks( + ListNiciraNvpDeviceNetworksCmd cmd) { + Long niciraDeviceId = cmd.getNiciraNvpDeviceId(); + NiciraNvpDeviceVO niciraNvpDevice = _niciraNvpDao + .findById(niciraDeviceId); + if (niciraNvpDevice == null) { + throw new InvalidParameterValueException( + "Could not find a nicira device with id " + niciraDeviceId); + } - // Find the physical network we work for - Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId(); - PhysicalNetworkVO physicalNetwork = _physicalNetworkDao - .findById(physicalNetworkId); - if (physicalNetwork == null) { - // No such physical network, so no provisioned networks - return Collections.emptyList(); - } + // Find the physical network we work for + Long physicalNetworkId = niciraNvpDevice.getPhysicalNetworkId(); + PhysicalNetworkVO physicalNetwork = _physicalNetworkDao + .findById(physicalNetworkId); + if (physicalNetwork == null) { + // No such physical network, so no provisioned networks + return Collections.emptyList(); + } - // Find the nicira networks on this physical network - List networkList = _networkDao - .listByPhysicalNetwork(physicalNetworkId); + // Find the nicira networks on this physical network + List networkList = _networkDao + .listByPhysicalNetwork(physicalNetworkId); - // Networks with broadcast type lswitch are ours - List responseList = new ArrayList(); - for (NetworkVO network : networkList) { - if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { - responseList.add(network); - } - } + // Networks with broadcast type lswitch are ours + List responseList = new ArrayList(); + for (NetworkVO network : networkList) { + if (network.getBroadcastDomainType() == Networks.BroadcastDomainType.Lswitch) { + responseList.add(network); + } + } - return responseList; - } + return responseList; + } - @Override - public HostVO createHostVOForConnectedAgent(HostVO host, - StartupCommand[] cmd) { - // TODO Auto-generated method stub - return null; - } + @Override + public HostVO createHostVOForConnectedAgent(HostVO host, + StartupCommand[] cmd) { + // TODO Auto-generated method stub + return null; + } - @Override - public HostVO createHostVOForDirectConnectAgent(HostVO host, - StartupCommand[] startup, ServerResource resource, - Map details, List hostTags) { - if (!(startup[0] instanceof StartupNiciraNvpCommand)) { - return null; - } - host.setType(Host.Type.L2Networking); - return host; - } + @Override + public HostVO createHostVOForDirectConnectAgent(HostVO host, + StartupCommand[] startup, ServerResource resource, + Map details, List hostTags) { + if (!(startup[0] instanceof StartupNiciraNvpCommand)) { + return null; + } + host.setType(Host.Type.L2Networking); + return host; + } - @Override - public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, - boolean isForceDeleteStorage) throws UnableDeleteHostException { - if (!(host.getType() == Host.Type.L2Networking)) { - return null; - } - return new DeleteHostAnswer(true); - } + @Override + public DeleteHostAnswer deleteHost(HostVO host, boolean isForced, + boolean isForceDeleteStorage) throws UnableDeleteHostException { + if (!(host.getType() == Host.Type.L2Networking)) { + return null; + } + return new DeleteHostAnswer(true); + } - /** - * From interface SourceNatServiceProvider - */ - @Override - public IpDeployer getIpDeployer(Network network) { - return this; - } + /** + * From interface SourceNatServiceProvider + */ + @Override + public IpDeployer getIpDeployer(Network network) { + return this; + } - /** - * From interface IpDeployer - * - * @param network - * @param ipAddress - * @param services - * @return - * @throws ResourceUnavailableException - */ - @Override - public boolean applyIps(Network network, - List ipAddress, Set services) - throws ResourceUnavailableException { - if (services.contains(Service.SourceNat)) { - // Only if we need to provide SourceNat we need to configure the logical router - // SourceNat is required for StaticNat and PortForwarding - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - _hostDao.loadDetails(niciraNvpHost); + /** + * From interface IpDeployer + * + * @param network + * @param ipAddress + * @param services + * @return + * @throws ResourceUnavailableException + */ + @Override + public boolean applyIps(Network network, + List ipAddress, Set services) + throws ResourceUnavailableException { + if (services.contains(Service.SourceNat)) { + // Only if we need to provide SourceNat we need to configure the logical router + // SourceNat is required for StaticNat and PortForwarding + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + _hostDao.loadDetails(niciraNvpHost); - NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao - .findByNetworkId(network.getId()); - if (routermapping == null) { - s_logger.error("No logical router uuid found for network " - + network.getDisplayText()); - return false; - } + NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao + .findByNetworkId(network.getId()); + if (routermapping == null) { + s_logger.error("No logical router uuid found for network " + + network.getDisplayText()); + return false; + } - List cidrs = new ArrayList(); - for (PublicIpAddress ip : ipAddress) { - cidrs.add(ip.getAddress().addr() + "/" + NetUtils.getCidrSize(ip.getNetmask())); - } - ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), - niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs); - ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); - //FIXME answer can be null if the host is down - return answer.getResult(); - } - else { - s_logger.debug("No need to provision ip addresses as we are not providing L3 services."); - } + List cidrs = new ArrayList(); + for (PublicIpAddress ip : ipAddress) { + cidrs.add(ip.getAddress().addr() + "/" + NetUtils.getCidrSize(ip.getNetmask())); + } + ConfigurePublicIpsOnLogicalRouterCommand cmd = new ConfigurePublicIpsOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), + niciraNvpHost.getDetail("l3gatewayserviceuuid"), cidrs); + ConfigurePublicIpsOnLogicalRouterAnswer answer = (ConfigurePublicIpsOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); + //FIXME answer can be null if the host is down + return answer.getResult(); + } + else { + s_logger.debug("No need to provision ip addresses as we are not providing L3 services."); + } - return true; - } + return true; + } - /** - * From interface StaticNatServiceProvider - */ - @Override - public boolean applyStaticNats(Network network, - List rules) - throws ResourceUnavailableException { + /** + * From interface StaticNatServiceProvider + */ + @Override + public boolean applyStaticNats(Network network, + List rules) + throws ResourceUnavailableException { if (!canHandle(network, Service.StaticNat)) { return false; } - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao - .findByNetworkId(network.getId()); - if (routermapping == null) { - s_logger.error("No logical router uuid found for network " - + network.getDisplayText()); - return false; - } + NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao + .findByNetworkId(network.getId()); + if (routermapping == null) { + s_logger.error("No logical router uuid found for network " + + network.getDisplayText()); + return false; + } - List staticNatRules = new ArrayList(); + List staticNatRules = new ArrayList(); for (StaticNat rule : rules) { - IpAddress sourceIp = _networkManager.getIp(rule.getSourceIpAddressId()); + IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId()); // Force the nat rule into the StaticNatRuleTO, no use making a new TO object // we only need the source and destination ip. Unfortunately no mention if a rule // is new. StaticNatRuleTO ruleTO = new StaticNatRuleTO(1, - sourceIp.getAddress().addr(), 0, 65535, - rule.getDestIpAddress(), 0, 65535, - "any", rule.isForRevoke(), false); + sourceIp.getAddress().addr(), 0, 65535, + rule.getDestIpAddress(), 0, 65535, + "any", rule.isForRevoke(), false); staticNatRules.add(ruleTO); } ConfigureStaticNatRulesOnLogicalRouterCommand cmd = - new ConfigureStaticNatRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), staticNatRules); + new ConfigureStaticNatRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), staticNatRules); ConfigureStaticNatRulesOnLogicalRouterAnswer answer = (ConfigureStaticNatRulesOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); return answer.getResult(); - } + } - /** - * From interface PortForwardingServiceProvider - */ - @Override - public boolean applyPFRules(Network network, List rules) - throws ResourceUnavailableException { + /** + * From interface PortForwardingServiceProvider + */ + @Override + public boolean applyPFRules(Network network, List rules) + throws ResourceUnavailableException { if (!canHandle(network, Service.PortForwarding)) { return false; } - List devices = _niciraNvpDao - .listByPhysicalNetwork(network.getPhysicalNetworkId()); - if (devices.isEmpty()) { - s_logger.error("No NiciraNvp Controller on physical network " - + network.getPhysicalNetworkId()); - return false; - } - NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); - HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); + List devices = _niciraNvpDao + .listByPhysicalNetwork(network.getPhysicalNetworkId()); + if (devices.isEmpty()) { + s_logger.error("No NiciraNvp Controller on physical network " + + network.getPhysicalNetworkId()); + return false; + } + NiciraNvpDeviceVO niciraNvpDevice = devices.get(0); + HostVO niciraNvpHost = _hostDao.findById(niciraNvpDevice.getHostId()); - NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao - .findByNetworkId(network.getId()); - if (routermapping == null) { - s_logger.error("No logical router uuid found for network " - + network.getDisplayText()); - return false; - } + NiciraNvpRouterMappingVO routermapping = _niciraNvpRouterMappingDao + .findByNetworkId(network.getId()); + if (routermapping == null) { + s_logger.error("No logical router uuid found for network " + + network.getDisplayText()); + return false; + } - List portForwardingRules = new ArrayList(); + List portForwardingRules = new ArrayList(); for (PortForwardingRule rule : rules) { - IpAddress sourceIp = _networkManager.getIp(rule.getSourceIpAddressId()); + IpAddress sourceIp = _networkModel.getIp(rule.getSourceIpAddressId()); Vlan vlan = _vlanDao.findById(sourceIp.getVlanId()); - PortForwardingRuleTO ruleTO = new PortForwardingRuleTO((PortForwardingRule) rule, vlan.getVlanTag(), sourceIp.getAddress().addr()); + PortForwardingRuleTO ruleTO = new PortForwardingRuleTO(rule, vlan.getVlanTag(), sourceIp.getAddress().addr()); portForwardingRules.add(ruleTO); } ConfigurePortForwardingRulesOnLogicalRouterCommand cmd = - new ConfigurePortForwardingRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), portForwardingRules); + new ConfigurePortForwardingRulesOnLogicalRouterCommand(routermapping.getLogicalRouterUuid(), portForwardingRules); ConfigurePortForwardingRulesOnLogicalRouterAnswer answer = (ConfigurePortForwardingRulesOnLogicalRouterAnswer) _agentMgr.easySend(niciraNvpHost.getId(), cmd); return answer.getResult(); - } + } } diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java index 99be680a5c6..b78d165ddd6 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/guru/NiciraNvpGuestNetworkGuru.java @@ -21,6 +21,7 @@ import java.net.URISyntaxException; import java.util.List; import javax.ejb.Local; +import javax.inject.Inject; import org.apache.log4j.Logger; @@ -41,26 +42,24 @@ import com.cloud.host.dao.HostDao; import com.cloud.host.dao.HostDetailsDao; import com.cloud.network.Network; import com.cloud.network.Network.Service; -import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.NetworkProfile; -import com.cloud.network.NetworkVO; import com.cloud.network.Network.GuestType; import com.cloud.network.Network.State; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.NiciraNvpDeviceVO; import com.cloud.network.PhysicalNetwork; import com.cloud.network.PhysicalNetwork.IsolationMethod; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.dao.NetworkDao; -import com.cloud.network.dao.NetworkServiceMapDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.NiciraNvpDao; import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; import com.cloud.resource.ResourceManager; import com.cloud.user.Account; import com.cloud.user.dao.AccountDao; -import com.cloud.utils.component.Inject; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; @@ -70,10 +69,9 @@ import com.cloud.vm.VirtualMachineProfile; public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { private static final Logger s_logger = Logger.getLogger(NiciraNvpGuestNetworkGuru.class); + @Inject - NetworkManager _externalNetworkManager; - @Inject - NetworkManager _networkMgr; + NetworkModel _networkModel; @Inject NetworkDao _networkDao; @Inject @@ -153,7 +151,12 @@ public class NiciraNvpGuestNetworkGuru extends GuestNetworkGuru { long dcId = dest.getDataCenter().getId(); //get physical network id - long physicalNetworkId = _networkMgr.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType()); + Long physicalNetworkId = network.getPhysicalNetworkId(); + + // physical network id can be null in Guest Network in Basic zone, so locate the physical network + if (physicalNetworkId == null) { + physicalNetworkId = _networkModel.findPhysicalNetworkId(dcId, offering.getTags(), offering.getTrafficType()); + } NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), State.Allocated, network.getDataCenterId(), physicalNetworkId); diff --git a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java index 12ed72a1fd5..6a9a0060387 100644 --- a/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java +++ b/plugins/network-elements/nicira-nvp/src/com/cloud/network/resource/NiciraNvpResource.java @@ -166,7 +166,7 @@ public class NiciraNvpResource implements ServerResource { sc.setPod(""); sc.setPrivateIpAddress(""); sc.setStorageIpAddress(""); - sc.setVersion(""); + sc.setVersion(NiciraNvpResource.class.getPackage().getImplementationVersion()); return new StartupCommand[] { sc }; } @@ -794,5 +794,35 @@ public class NiciraNvpResource implements ServerResource { return rulepair; } + + @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/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java index acfd3bcdb9e..09d50a33a64 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/element/NiciraNvpElementTest.java @@ -33,6 +33,7 @@ import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Provider; import com.cloud.network.Network.Service; import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.dao.NetworkServiceMapDao; @@ -48,6 +49,7 @@ public class NiciraNvpElementTest { NiciraNvpElement _element = new NiciraNvpElement(); NetworkManager _networkManager = mock(NetworkManager.class); + NetworkModel _networkModel = mock(NetworkModel.class); NetworkServiceMapDao _ntwkSrvcDao = mock (NetworkServiceMapDao.class); @Before @@ -55,9 +57,10 @@ public class NiciraNvpElementTest { _element._resourceMgr = mock(ResourceManager.class); _element._networkManager = _networkManager; _element._ntwkSrvcDao = _ntwkSrvcDao; + _element._networkModel = _networkModel; // Standard responses - when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); _element.configure("NiciraNvpTestElement", Collections. emptyMap()); } @@ -81,12 +84,12 @@ public class NiciraNvpElementTest { // No nvp provider in the network assertFalse(_element.canHandle(net, Service.Connectivity)); - when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(false); + when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(false); when(_ntwkSrvcDao.canProviderSupportServiceInNetwork(42L, Service.Connectivity, Provider.NiciraNvp)).thenReturn(true); // NVP provider does not provide Connectivity for this network assertFalse(_element.canHandle(net, Service.Connectivity)); - when(_networkManager.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); + when(_networkModel.isProviderForNetwork(Provider.NiciraNvp, 42L)).thenReturn(true); // Only service Connectivity is supported assertFalse(_element.canHandle(net, Service.Dhcp)); diff --git a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java index e37b2f42105..0e4f8fd4f84 100644 --- a/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java +++ b/plugins/network-elements/nicira-nvp/test/com/cloud/network/guru/NiciraNvpGuestNetworkGuruTest.java @@ -44,15 +44,16 @@ import com.cloud.network.Network.GuestType; import com.cloud.network.Network.Service; import com.cloud.network.Network.State; import com.cloud.network.NetworkManager; +import com.cloud.network.NetworkModel; import com.cloud.network.NetworkProfile; -import com.cloud.network.NetworkVO; import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.TrafficType; import com.cloud.network.NiciraNvpDeviceVO; -import com.cloud.network.PhysicalNetworkVO; import com.cloud.network.dao.NetworkDao; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.dao.NiciraNvpDao; import com.cloud.network.dao.PhysicalNetworkDao; +import com.cloud.network.dao.PhysicalNetworkVO; import com.cloud.offering.NetworkOffering; import com.cloud.offerings.dao.NetworkOfferingServiceMapDao; import com.cloud.user.Account; @@ -67,6 +68,8 @@ public class NiciraNvpGuestNetworkGuruTest { NetworkOfferingServiceMapDao nosd = mock(NetworkOfferingServiceMapDao.class); AgentManager agentmgr = mock (AgentManager.class); NetworkManager netmgr = mock (NetworkManager.class); + NetworkModel netmodel = mock (NetworkModel.class); + HostDao hostdao = mock (HostDao.class); NetworkDao netdao = mock(NetworkDao.class); NiciraNvpGuestNetworkGuru guru; @@ -80,7 +83,7 @@ public class NiciraNvpGuestNetworkGuruTest { guru._niciraNvpDao = nvpdao; guru._dcDao = dcdao; guru._ntwkOfferingSrvcDao = nosd; - guru._networkMgr = netmgr; + guru._networkModel = netmodel; guru._hostDao = hostdao; guru._agentMgr = agentmgr; guru._networkDao = netdao; @@ -249,6 +252,7 @@ public class NiciraNvpGuestNetworkGuruTest { NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); + when(network.getPhysicalNetworkId()).thenReturn(42L); DeployDestination dest = mock(DeployDestination.class); @@ -261,7 +265,7 @@ public class NiciraNvpGuestNetworkGuruTest { when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(42L); - when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); Account acc = mock(Account.class); @@ -305,7 +309,7 @@ public class NiciraNvpGuestNetworkGuruTest { when(network.getState()).thenReturn(State.Implementing); when(network.getGateway()).thenReturn("10.1.1.1"); when(network.getCidr()).thenReturn("10.1.1.0/24"); - + when(network.getPhysicalNetworkId()).thenReturn(42L); DeployDestination dest = mock(DeployDestination.class); @@ -318,7 +322,7 @@ public class NiciraNvpGuestNetworkGuruTest { when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(42L); - when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); Account acc = mock(Account.class); @@ -362,6 +366,7 @@ public class NiciraNvpGuestNetworkGuruTest { NetworkVO network = mock(NetworkVO.class); when(network.getName()).thenReturn("testnetwork"); when(network.getState()).thenReturn(State.Implementing); + when(network.getPhysicalNetworkId()).thenReturn(42L); DeployDestination dest = mock(DeployDestination.class); @@ -374,7 +379,7 @@ public class NiciraNvpGuestNetworkGuruTest { when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(42L); - when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); Account acc = mock(Account.class); @@ -432,7 +437,7 @@ public class NiciraNvpGuestNetworkGuruTest { when(niciraHost.getDetail("transportzoneisotype")).thenReturn("stt"); when(niciraHost.getId()).thenReturn(42L); - when(netmgr.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); + when(netmodel.findPhysicalNetworkId(anyLong(), (String) any(), (TrafficType) any())).thenReturn(42L); Domain dom = mock(Domain.class); when(dom.getName()).thenReturn("domain"); Account acc = mock(Account.class); diff --git a/plugins/network-elements/ovs/pom.xml b/plugins/network-elements/ovs/pom.xml index ab7ffab8465..7964b931e19 100644 --- a/plugins/network-elements/ovs/pom.xml +++ b/plugins/network-elements/ovs/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java index 5e8639c3188..40be5ff7b45 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/element/OvsElement.java @@ -20,6 +20,7 @@ import java.util.Map; import java.util.Set; import javax.ejb.Local; +import javax.inject.Inject; import com.cloud.deploy.DeployDestination; import com.cloud.exception.ConcurrentOperationException; @@ -34,13 +35,12 @@ import com.cloud.network.PhysicalNetworkServiceProvider; import com.cloud.network.ovs.OvsTunnelManager; import com.cloud.offering.NetworkOffering; import com.cloud.utils.component.AdapterBase; -import com.cloud.utils.component.Inject; import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; -@Local(value = NetworkElement.class) +@Local(value = {NetworkElement.class}) public class OvsElement extends AdapterBase implements NetworkElement { @Inject OvsTunnelManager _ovsTunnelMgr; @@ -64,18 +64,18 @@ public class OvsElement extends AdapterBase implements NetworkElement { @Override public boolean implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { //Consider actually implementing the network here - return true; + return true; } @Override public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) - throws ConcurrentOperationException, ResourceUnavailableException, - InsufficientCapacityException { + throws ConcurrentOperationException, ResourceUnavailableException, + InsufficientCapacityException { if (nic.getBroadcastType() != Networks.BroadcastDomainType.Vswitch) { return true; } @@ -115,7 +115,7 @@ public class OvsElement extends AdapterBase implements NetworkElement { @Override public boolean isReady(PhysicalNetworkServiceProvider provider) { - return true; + return true; } @Override diff --git a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java index 16e1ecc1cec..781b4b9b2f2 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/guru/OvsGuestNetworkGuru.java @@ -16,52 +16,46 @@ // under the License. package com.cloud.network.guru; -import java.util.List; - import javax.ejb.Local; +import javax.inject.Inject; +import com.cloud.event.ActionEventUtils; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter.NetworkType; import com.cloud.deploy.DeployDestination; import com.cloud.deploy.DeploymentPlan; import com.cloud.event.EventTypes; -import com.cloud.event.EventUtils; import com.cloud.event.EventVO; -import com.cloud.exception.InsufficientAddressCapacityException; import com.cloud.exception.InsufficientVirtualNetworkCapcityException; import com.cloud.network.Network; -import com.cloud.network.NetworkManager; -import com.cloud.network.NetworkVO; +import com.cloud.network.Network.GuestType; +import com.cloud.network.Network.State; +import com.cloud.network.Networks.BroadcastDomainType; +import com.cloud.network.PhysicalNetwork; +import com.cloud.network.PhysicalNetwork.IsolationMethod; +import com.cloud.network.dao.NetworkVO; import com.cloud.network.ovs.OvsTunnelManager; import com.cloud.offering.NetworkOffering; import com.cloud.user.Account; import com.cloud.user.UserContext; -import com.cloud.utils.component.Inject; -import com.cloud.vm.Nic.ReservationStrategy; -import com.cloud.vm.NicProfile; import com.cloud.vm.ReservationContext; -import com.cloud.vm.VirtualMachine; -import com.cloud.vm.VirtualMachineProfile; -import com.cloud.network.Networks.BroadcastDomainType; -import com.cloud.network.Network.GuestType; -import com.cloud.network.Network.State; -import com.cloud.network.PhysicalNetwork; -import com.cloud.network.PhysicalNetwork.IsolationMethod; +@Component @Local(value=NetworkGuru.class) public class OvsGuestNetworkGuru extends GuestNetworkGuru { - private static final Logger s_logger = Logger.getLogger(OvsGuestNetworkGuru.class); - - @Inject NetworkManager _externalNetworkManager; - @Inject OvsTunnelManager _ovsTunnelMgr; + private static final Logger s_logger = Logger.getLogger(OvsGuestNetworkGuru.class); + + @Inject OvsTunnelManager _ovsTunnelMgr; OvsGuestNetworkGuru() { super(); _isolationMethods = new IsolationMethod[] { IsolationMethod.GRE, IsolationMethod.L3, IsolationMethod.VLAN }; } - + + @Override protected boolean canHandle(NetworkOffering offering, final NetworkType networkType, final PhysicalNetwork physicalNetwork) { // This guru handles only Guest Isolated network that supports Source @@ -78,46 +72,47 @@ public class OvsGuestNetworkGuru extends GuestNetworkGuru { return false; } } - - @Override + + @Override public Network design(NetworkOffering offering, DeploymentPlan plan, Network userSpecified, Account owner) { - - if (!_ovsTunnelMgr.isOvsTunnelEnabled()) { - return null; - } - + + if (!_ovsTunnelMgr.isOvsTunnelEnabled()) { + return null; + } + NetworkVO config = (NetworkVO) super.design(offering, plan, userSpecified, owner); if (config == null) { - return null; + return null; } - + config.setBroadcastDomainType(BroadcastDomainType.Vswitch); - + return config; - } - + } + + @Override protected void allocateVnet(Network network, NetworkVO implemented, long dcId, - long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException { + long physicalNetworkId, String reservationId) throws InsufficientVirtualNetworkCapcityException { if (network.getBroadcastUri() == null) { String vnet = _dcDao.allocateVnet(dcId, physicalNetworkId, network.getAccountId(), reservationId); if (vnet == null) { throw new InsufficientVirtualNetworkCapcityException("Unable to allocate vnet as a part of network " + network + " implement ", DataCenter.class, dcId); } implemented.setBroadcastUri(BroadcastDomainType.Vswitch.toUri(vnet)); - EventUtils.saveEvent(UserContext.current().getCallerUserId(), network.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone Vlan: "+vnet+ " Network Id: "+network.getId(), 0); + ActionEventUtils.onCompletedActionEvent(UserContext.current().getCallerUserId(), network.getAccountId(), EventVO.LEVEL_INFO, EventTypes.EVENT_ZONE_VLAN_ASSIGN, "Assigned Zone Vlan: " + vnet + " Network Id: " + network.getId(), 0); } else { implemented.setBroadcastUri(network.getBroadcastUri()); } } - - @Override - public Network implement(Network config, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException { - assert (config.getState() == State.Implementing) : "Why are we implementing " + config; - if (!_ovsTunnelMgr.isOvsTunnelEnabled()) { - return null; - } - NetworkVO implemented = (NetworkVO)super.implement(config, offering, dest, context); - return implemented; - } - + + @Override + public Network implement(Network config, NetworkOffering offering, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException { + assert (config.getState() == State.Implementing) : "Why are we implementing " + config; + if (!_ovsTunnelMgr.isOvsTunnelEnabled()) { + return null; + } + NetworkVO implemented = (NetworkVO)super.implement(config, offering, dest, context); + return implemented; + } + } diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java index 1699732e45e..b1ecaaccd76 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/OvsTunnelManagerImpl.java @@ -23,10 +23,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import javax.persistence.EntityExistsException; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.agent.AgentManager; import com.cloud.agent.api.Answer; @@ -49,7 +51,7 @@ import com.cloud.network.ovs.dao.OvsTunnelInterfaceDao; import com.cloud.network.ovs.dao.OvsTunnelInterfaceVO; import com.cloud.network.ovs.dao.OvsTunnelNetworkDao; import com.cloud.network.ovs.dao.OvsTunnelNetworkVO; -import com.cloud.utils.component.Inject; +import com.cloud.utils.component.ManagerBase; import com.cloud.utils.concurrency.NamedThreadFactory; import com.cloud.utils.db.DB; import com.cloud.utils.exception.CloudRuntimeException; @@ -63,12 +65,12 @@ import com.cloud.vm.dao.DomainRouterDao; import com.cloud.vm.dao.NicDao; import com.cloud.vm.dao.UserVmDao; +@Component @Local(value={OvsTunnelManager.class}) -public class OvsTunnelManagerImpl implements OvsTunnelManager { +public class OvsTunnelManagerImpl extends ManagerBase implements OvsTunnelManager { public static final Logger s_logger = Logger.getLogger(OvsTunnelManagerImpl.class.getName()); - String _name; boolean _isEnabled; ScheduledExecutorService _executorPool; ScheduledExecutorService _cleanupExecutor; @@ -86,7 +88,6 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager { @Override public boolean configure(String name, Map params) throws ConfigurationException { - _name = name; _isEnabled = Boolean.parseBoolean(_configDao.getValue(Config.OvsTunnelNetwork.key())); if (_isEnabled) { @@ -375,21 +376,6 @@ public class OvsTunnelManagerImpl implements OvsTunnelManager { } } - @Override - public boolean start() { - return true; - } - - @Override - public boolean stop() { - return true; - } - - @Override - public String getName() { - return _name; - } - @Override public boolean isOvsTunnelEnabled() { return _isEnabled; diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java index 8794763bcdc..99d7d0d729d 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelInterfaceDaoImpl.java @@ -21,11 +21,14 @@ import java.util.List; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value = { OvsTunnelInterfaceDao.class }) public class OvsTunnelInterfaceDaoImpl extends GenericDaoBase implements OvsTunnelInterfaceDao { diff --git a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java index 6e0c02c9290..099b3ba19ae 100644 --- a/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java +++ b/plugins/network-elements/ovs/src/com/cloud/network/ovs/dao/OvsTunnelNetworkDaoImpl.java @@ -21,11 +21,14 @@ import java.util.List; import javax.ejb.Local; +import org.springframework.stereotype.Component; + import com.cloud.utils.db.GenericDaoBase; import com.cloud.utils.db.SearchBuilder; import com.cloud.utils.db.SearchCriteria; import com.cloud.utils.db.SearchCriteria.Op; +@Component @Local(value = { OvsTunnelNetworkDao.class }) public class OvsTunnelNetworkDaoImpl extends GenericDaoBase implements OvsTunnelNetworkDao { diff --git a/plugins/pom.xml b/plugins/pom.xml old mode 100644 new mode 100755 index 113d5f20aaa..b856cd2a73b --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -1,3 +1,4 @@ + - +--> 4.0.0 cloudstack-plugins Apache CloudStack Plugin POM @@ -24,7 +24,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT install @@ -32,6 +32,7 @@ test + api/rate-limit api/discovery acl/static-role-based deployment-planners/user-concentrated-pod @@ -40,10 +41,14 @@ hypervisors/ovm hypervisors/xen hypervisors/kvm + event-bus/rabbitmq hypervisors/simulator + hypervisors/baremetal + hypervisors/ucs network-elements/elastic-loadbalancer network-elements/ovs network-elements/nicira-nvp + network-elements/bigswitch-vns network-elements/cisco-vnmc storage-allocators/random user-authenticators/ldap @@ -51,6 +56,8 @@ user-authenticators/plain-text user-authenticators/sha256salted network-elements/dns-notifier + storage/image/s3 + storage/volume/solidfire diff --git a/plugins/storage-allocators/random/pom.xml b/plugins/storage-allocators/random/pom.xml index b476d1de49f..06754ffc133 100644 --- a/plugins/storage-allocators/random/pom.xml +++ b/plugins/storage-allocators/random/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/storage-allocators/random/src/com/cloud/storage/allocator/RandomStoragePoolAllocator.java b/plugins/storage-allocators/random/src/com/cloud/storage/allocator/RandomStoragePoolAllocator.java index 919270349a9..af21f50cc6f 100644 --- a/plugins/storage-allocators/random/src/com/cloud/storage/allocator/RandomStoragePoolAllocator.java +++ b/plugins/storage-allocators/random/src/com/cloud/storage/allocator/RandomStoragePoolAllocator.java @@ -21,18 +21,20 @@ import java.util.List; import javax.ejb.Local; +import org.apache.cloudstack.storage.datastore.db.StoragePoolVO; import org.apache.log4j.Logger; +import org.springframework.stereotype.Component; import com.cloud.deploy.DeploymentPlan; import com.cloud.deploy.DeploymentPlanner.ExcludeList; import com.cloud.server.StatsCollector; import com.cloud.storage.StoragePool; -import com.cloud.storage.StoragePoolVO; import com.cloud.storage.VMTemplateVO; import com.cloud.vm.DiskProfile; import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachineProfile; +@Component @Local(value=StoragePoolAllocator.class) public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator { private static final Logger s_logger = Logger.getLogger(RandomStoragePoolAllocator.class); @@ -75,7 +77,8 @@ public class RandomStoragePoolAllocator extends AbstractStoragePoolAllocator { break; } if (checkPool(avoid, pool, dskCh, template, null, sc, plan)) { - suitablePools.add(pool); + StoragePool pol = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(pool.getId()); + suitablePools.add(pol); } } diff --git a/plugins/storage/image/s3/pom.xml b/plugins/storage/image/s3/pom.xml new file mode 100644 index 00000000000..7ab0d3e9301 --- /dev/null +++ b/plugins/storage/image/s3/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + cloud-plugin-storage-image-s3 + Apache CloudStack Plugin - Storage Image S3 + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage-image + ${project.version} + + + + install + src + test + + diff --git a/plugins/storage/volume/solidfire/pom.xml b/plugins/storage/volume/solidfire/pom.xml new file mode 100644 index 00000000000..9db0685e91b --- /dev/null +++ b/plugins/storage/volume/solidfire/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + cloud-plugin-storage-volume-solidfire + Apache CloudStack Plugin - Storage Volume solidfire + + org.apache.cloudstack + cloudstack-plugins + 4.2.0-SNAPSHOT + ../../../pom.xml + + + + org.apache.cloudstack + cloud-engine-storage-volume + ${project.version} + + + mysql + mysql-connector-java + ${cs.mysql.version} + provided + + + + install + src + test + + + maven-surefire-plugin + + true + + + + integration-test + + test + + + + + + + diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java new file mode 100644 index 00000000000..f31126c2aeb --- /dev/null +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java @@ -0,0 +1,96 @@ +// 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.storage.datastore.driver; + +import java.util.Set; + +import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult; +import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult; +import org.apache.cloudstack.engine.subsystem.api.storage.DataObject; +import org.apache.cloudstack.engine.subsystem.api.storage.DataStore; +import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint; +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver; +import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo; +import org.apache.cloudstack.framework.async.AsyncCompletionCallback; + +public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver { + + @Override + public String grantAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean revokeAccess(DataObject data, EndPoint ep) { + // TODO Auto-generated method stub + return false; + } + + @Override + public Set listObjects(DataStore store) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void createAsync(DataObject data, AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void deleteAsync(DataObject data, AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void copyAsync(DataObject srcdata, DataObject destData, AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public boolean canCopy(DataObject srcData, DataObject destData) { + // TODO Auto-generated method stub + return false; + } + + @Override + public void revertSnapshot(SnapshotInfo snapshot, AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void resize(DataObject data, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + @Override + public void takeSnapshot(SnapshotInfo snapshot, + AsyncCompletionCallback callback) { + // TODO Auto-generated method stub + + } + + +} diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.java new file mode 100644 index 00000000000..650cac8518d --- /dev/null +++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/provider/SolidfirePrimaryDataStoreProvider.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 org.apache.cloudstack.storage.datastore.provider; + +import org.springframework.stereotype.Component; + +@Component +public class SolidfirePrimaryDataStoreProvider extends + DefaultPrimaryDatastoreProviderImpl { + private final String name = "Solidfre Primary Data Store Provider"; + + + public SolidfirePrimaryDataStoreProvider() { + + + // TODO Auto-generated constructor stub + } + + @Override + public String getName() { + return name; + } + + +} diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.java new file mode 100644 index 00000000000..63669c453d7 --- /dev/null +++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/AopTestAdvice.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 org.apache.cloudstack.storage.test; + +import org.aspectj.lang.ProceedingJoinPoint; + +import com.cloud.utils.db.Transaction; + +public class AopTestAdvice { + public Object AopTestMethod(ProceedingJoinPoint call) throws Throwable { + Transaction txn = Transaction.open(call.getSignature().getName()); + Object ret = null; + try { + ret = call.proceed(); + } finally { + txn.close(); + } + return ret; + } +} diff --git a/server/src/com/cloud/baremetal/ExternalDhcpEntryListener.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java similarity index 50% rename from server/src/com/cloud/baremetal/ExternalDhcpEntryListener.java rename to plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java index d27d7972139..eb6fe453886 100644 --- a/server/src/com/cloud/baremetal/ExternalDhcpEntryListener.java +++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/ChildTestConfiguration.java @@ -14,31 +14,38 @@ // KIND, either express or implied. See the License for the // specific language governing permissions and limitations // under the License. -package com.cloud.baremetal; +package org.apache.cloudstack.storage.test; -public interface ExternalDhcpEntryListener { - public class DhcpEntryState { - String _name; - - public static final DhcpEntryState add = new DhcpEntryState("add"); - public static final DhcpEntryState old = new DhcpEntryState("old"); - public static final DhcpEntryState del = new DhcpEntryState("del"); - - public DhcpEntryState(String name) { - _name = name; - } - - public String getName() { - return _name; - } +import org.apache.cloudstack.storage.image.motion.ImageMotionService; +import org.mockito.Mockito; +import org.springframework.context.annotation.Bean; + +import com.cloud.agent.AgentManager; +import com.cloud.host.dao.HostDao; + +public class ChildTestConfiguration extends TestConfiguration { + + @Override + @Bean + public HostDao hostDao() { + HostDao dao = super.hostDao(); + HostDao nDao = Mockito.spy(dao); + return nDao; } - /** - * Notify that DHCP entry state change - * @param ip - * @param mac - * @param DHCP entry state - * @return: true means continuous listen on the entry, false cancels the listener - */ - public boolean notify(String ip, String mac, DhcpEntryState state, Object userData); + @Bean + public AgentManager agentMgr() { + return Mockito.mock(AgentManager.class); + } + + @Bean + public ImageMotionService imageMotion() { + return Mockito.mock(ImageMotionService.class); + } + +/* @Override + @Bean + public PrimaryDataStoreDao primaryDataStoreDao() { + return Mockito.mock(PrimaryDataStoreDaoImpl.class); + }*/ } diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.java new file mode 100644 index 00000000000..2c6092d7408 --- /dev/null +++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/TestConfiguration.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 org.apache.cloudstack.storage.test; + +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDaoImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import com.cloud.host.dao.HostDao; +import com.cloud.host.dao.HostDaoImpl; + +@Configuration +public class TestConfiguration { + @Bean + public HostDao hostDao() { + return new HostDaoImpl(); + } + @Bean + public PrimaryDataStoreDao primaryDataStoreDao() { + return new PrimaryDataStoreDaoImpl(); + } +} diff --git a/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java new file mode 100644 index 00000000000..91c446fe5ae --- /dev/null +++ b/plugins/storage/volume/solidfire/test/org/apache/cloudstack/storage/test/VolumeTest.java @@ -0,0 +1,151 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +package org.apache.cloudstack.storage.test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import javax.inject.Inject; +import javax.naming.ConfigurationException; + +import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreInfo; +import org.apache.cloudstack.storage.command.CreateObjectAnswer; +import org.apache.cloudstack.storage.command.CreateVolumeFromBaseImageCommand; +import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao; +import org.apache.cloudstack.storage.datastore.provider.PrimaryDataStoreProvider; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.springframework.test.context.ContextConfiguration; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import com.cloud.agent.AgentManager; +import com.cloud.dc.ClusterVO; +import com.cloud.dc.DataCenter.NetworkType; +import com.cloud.dc.DataCenterVO; +import com.cloud.dc.HostPodVO; +import com.cloud.dc.dao.ClusterDao; +import com.cloud.dc.dao.DataCenterDao; +import com.cloud.dc.dao.HostPodDao; +import com.cloud.exception.AgentUnavailableException; +import com.cloud.exception.OperationTimedoutException; +import com.cloud.host.Host; +import com.cloud.host.HostVO; +import com.cloud.host.dao.HostDao; +import com.cloud.hypervisor.Hypervisor.HypervisorType; +import com.cloud.org.Cluster.ClusterType; +import com.cloud.org.Managed.ManagedState; +import com.cloud.resource.ResourceState; + + +@RunWith(SpringJUnit4ClassRunner.class) +@ContextConfiguration(locations="classpath:/resource/storageContext.xml") +public class VolumeTest { + @Inject + HostDao hostDao; + @Inject + HostPodDao podDao; + @Inject + ClusterDao clusterDao; + @Inject + DataCenterDao dcDao; + @Inject + PrimaryDataStoreDao primaryStoreDao; + //@Inject + //PrimaryDataStoreProviderManager primaryDataStoreProviderMgr; + @Inject + AgentManager agentMgr; + Long dcId; + Long clusterId; + @Before + public void setUp() { + //create data center + DataCenterVO dc = new DataCenterVO(UUID.randomUUID().toString(), "test", "8.8.8.8", null, "10.0.0.1", null, "10.0.0.1/24", + null, null, NetworkType.Basic, null, null, true, true, null, null); + dc = dcDao.persist(dc); + dcId = dc.getId(); + //create pod + + HostPodVO pod = new HostPodVO(UUID.randomUUID().toString(), dc.getId(), "192.168.56.1", "192.168.56.0/24", 8, "test"); + pod = podDao.persist(pod); + //create xen cluster + ClusterVO cluster = new ClusterVO(dc.getId(), pod.getId(), "devcloud cluster"); + cluster.setHypervisorType(HypervisorType.XenServer.toString()); + cluster.setClusterType(ClusterType.CloudManaged); + cluster.setManagedState(ManagedState.Managed); + cluster = clusterDao.persist(cluster); + clusterId = cluster.getId(); + //create xen host + + HostVO host = new HostVO(UUID.randomUUID().toString()); + host.setName("devcloud xen host"); + host.setType(Host.Type.Routing); + host.setPrivateIpAddress("192.168.56.2"); + host.setDataCenterId(dc.getId()); + host.setVersion("6.0.1"); + host.setAvailable(true); + host.setSetup(true); + host.setLastPinged(0); + host.setResourceState(ResourceState.Enabled); + host.setClusterId(cluster.getId()); + + host = hostDao.persist(host); + List results = new ArrayList(); + results.add(host); + Mockito.when(hostDao.listAll()).thenReturn(results); + Mockito.when(hostDao.findHypervisorHostInCluster(Mockito.anyLong())).thenReturn(results); + CreateObjectAnswer createVolumeFromImageAnswer = new CreateObjectAnswer(null,UUID.randomUUID().toString(), null); + + try { + Mockito.when(agentMgr.send(Mockito.anyLong(), Mockito.any(CreateVolumeFromBaseImageCommand.class))).thenReturn(createVolumeFromImageAnswer); + } catch (AgentUnavailableException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (OperationTimedoutException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + + //Mockito.when(primaryStoreDao.findById(Mockito.anyLong())).thenReturn(primaryStore); + } + + private PrimaryDataStoreInfo createPrimaryDataStore() { + try { + //primaryDataStoreProviderMgr.configure("primary data store mgr", new HashMap()); + //PrimaryDataStoreProvider provider = primaryDataStoreProviderMgr.getDataStoreProvider("Solidfre Primary Data Store Provider"); + Map params = new HashMap(); + params.put("url", "nfs://test/test"); + params.put("dcId", dcId.toString()); + params.put("clusterId", clusterId.toString()); + params.put("name", "my primary data store"); + //PrimaryDataStoreInfo primaryDataStoreInfo = provider.registerDataStore(params); + return null; + } catch (Exception e) { + return null; + } + } + + @Test + public void createPrimaryDataStoreTest() { + createPrimaryDataStore(); + } +} diff --git a/plugins/storage/volume/solidfire/test/resource/storageContext.xml b/plugins/storage/volume/solidfire/test/resource/storageContext.xml new file mode 100644 index 00000000000..e4ba9867803 --- /dev/null +++ b/plugins/storage/volume/solidfire/test/resource/storageContext.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/user-authenticators/ldap/pom.xml b/plugins/user-authenticators/ldap/pom.xml index 05e9466d825..5c45f1177b6 100644 --- a/plugins/user-authenticators/ldap/pom.xml +++ b/plugins/user-authenticators/ldap/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/ldap/src/com/cloud/server/auth/LDAPUserAuthenticator.java b/plugins/user-authenticators/ldap/src/com/cloud/server/auth/LDAPUserAuthenticator.java index 358605a8c2e..61eebe5fc93 100644 --- a/plugins/user-authenticators/ldap/src/com/cloud/server/auth/LDAPUserAuthenticator.java +++ b/plugins/user-authenticators/ldap/src/com/cloud/server/auth/LDAPUserAuthenticator.java @@ -21,6 +21,7 @@ import java.util.Hashtable; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import javax.naming.Context; import javax.naming.NamingEnumeration; @@ -30,25 +31,22 @@ import javax.naming.directory.InitialDirContext; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; +import org.apache.cloudstack.api.ApiConstants.LDAPParams; import org.apache.log4j.Logger; import org.bouncycastle.util.encoders.Base64; -import org.apache.cloudstack.api.ApiConstants.LDAPParams; import com.cloud.configuration.dao.ConfigurationDao; -import com.cloud.server.ManagementServer; import com.cloud.user.UserAccount; import com.cloud.user.dao.UserAccountDao; -import com.cloud.utils.component.ComponentLocator; import com.cloud.utils.exception.CloudRuntimeException; - @Local(value={UserAuthenticator.class}) public class LDAPUserAuthenticator extends DefaultUserAuthenticator { public static final Logger s_logger = Logger.getLogger(LDAPUserAuthenticator.class); - private ConfigurationDao _configDao; - private UserAccountDao _userAccountDao; - + @Inject private ConfigurationDao _configDao; + @Inject private UserAccountDao _userAccountDao; + @Override public boolean authenticate(String username, String password, Long domainId, Map requestParameters ) { if (s_logger.isDebugEnabled()) { @@ -68,19 +66,19 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator { String port = _configDao.getValue(LDAPParams.port.toString()); String queryFilter = _configDao.getValue(LDAPParams.queryfilter.toString()); String searchBase = _configDao.getValue(LDAPParams.searchbase.toString()); - String useSSL = _configDao.getValue(LDAPParams.usessl.toString()); + Boolean useSSL = Boolean.valueOf(_configDao.getValue(LDAPParams.usessl.toString())); String bindDN = _configDao.getValue(LDAPParams.dn.toString()); String bindPasswd = _configDao.getValue(LDAPParams.passwd.toString()); String trustStore = _configDao.getValue(LDAPParams.truststore.toString()); String trustStorePassword = _configDao.getValue(LDAPParams.truststorepass.toString()); - + try { // get all params Hashtable env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); String protocol = "ldap://" ; - if (new Boolean(useSSL)){ - env.put(Context.SECURITY_PROTOCOL, "ssl"); + if (useSSL){ + env.put(Context.SECURITY_PROTOCOL, "ssl"); protocol="ldaps://" ; System.setProperty("javax.net.ssl.trustStore", trustStore); System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword); @@ -92,10 +90,10 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator { env.put(Context.SECURITY_CREDENTIALS, bindPasswd); } else { - // Use anonymous authentication - env.put(Context.SECURITY_AUTHENTICATION, "none"); + // Use anonymous authentication + env.put(Context.SECURITY_AUTHENTICATION, "none"); } - // Create the initial context + // Create the initial context DirContext ctx = new InitialDirContext(env); // use this context to search @@ -103,7 +101,7 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator { queryFilter = queryFilter.replaceAll("\\%u", username); queryFilter = queryFilter.replaceAll("\\%n", user.getFirstname() + " " + user.getLastname()); queryFilter = queryFilter.replaceAll("\\%e", user.getEmail()); - + SearchControls sc = new SearchControls(); String[] searchFilter = { "dn" }; @@ -111,22 +109,22 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator { sc.setReturningAttributes(searchFilter); sc.setSearchScope(SearchControls.SUBTREE_SCOPE); sc.setCountLimit(1); - + // Search for objects with those matching attributes NamingEnumeration answer = ctx.search(searchBase, queryFilter, sc); - SearchResult sr = (SearchResult)answer.next(); + SearchResult sr = answer.next(); String cn = sr.getName(); answer.close(); ctx.close(); - + s_logger.info("DN from LDAP =" + cn); - + // check the password env = new Hashtable(11); env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); protocol = "ldap://" ; - if (new Boolean(useSSL)){ - env.put(Context.SECURITY_PROTOCOL, "ssl"); + if (useSSL){ + env.put(Context.SECURITY_PROTOCOL, "ssl"); protocol="ldaps://" ; } env.put(Context.PROVIDER_URL, protocol + url + ":" + port); @@ -135,41 +133,38 @@ public class LDAPUserAuthenticator extends DefaultUserAuthenticator { // Create the initial context ctx = new InitialDirContext(env); ctx.close(); - + } catch (NamingException ne) { - ne.printStackTrace(); - s_logger.warn("Authentication failed due to " + ne.getMessage()); + s_logger.warn("Authentication Failed ! " + ne.getMessage() + (ne.getCause() != null ? ("; Caused by:" + ne.getCause().getMessage()) : "")); return false; } catch (Exception e){ - e.printStackTrace(); + e.printStackTrace(); s_logger.warn("Unknown error encountered " + e.getMessage()); return false; } - + // authenticate return true; } + @Override public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name); - _configDao = locator.getDao(ConfigurationDao.class); - _userAccountDao = locator.getDao(UserAccountDao.class); return true; } - @Override - public String encode(String password) { - // Password is not used, so set to a random string - try { - SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG"); - byte bytes[] = new byte[20]; - randomGen.nextBytes(bytes); - return Base64.encode(bytes).toString(); - } catch (NoSuchAlgorithmException e) { - throw new CloudRuntimeException("Failed to generate random password",e); - } - } + @Override + public String encode(String password) { + // Password is not used, so set to a random string + try { + SecureRandom randomGen = SecureRandom.getInstance("SHA1PRNG"); + byte bytes[] = new byte[20]; + randomGen.nextBytes(bytes); + return Base64.encode(bytes).toString(); + } catch (NoSuchAlgorithmException e) { + throw new CloudRuntimeException("Failed to generate random password",e); + } + } } diff --git a/plugins/user-authenticators/md5/pom.xml b/plugins/user-authenticators/md5/pom.xml index f358f8f1c21..605014ff953 100644 --- a/plugins/user-authenticators/md5/pom.xml +++ b/plugins/user-authenticators/md5/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java b/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java index b0cf0b03cd6..026125ea0f6 100644 --- a/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java +++ b/plugins/user-authenticators/md5/src/com/cloud/server/auth/MD5UserAuthenticator.java @@ -21,14 +21,13 @@ import java.security.NoSuchAlgorithmException; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; - -import com.cloud.server.ManagementServer; import com.cloud.user.UserAccount; import com.cloud.user.dao.UserAccountDao; -import com.cloud.utils.component.ComponentLocator; + import com.cloud.utils.exception.CloudRuntimeException; /** @@ -40,7 +39,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class MD5UserAuthenticator extends DefaultUserAuthenticator { public static final Logger s_logger = Logger.getLogger(MD5UserAuthenticator.class); - private UserAccountDao _userAccountDao; + @Inject private UserAccountDao _userAccountDao; @Override public boolean authenticate(String username, String password, Long domainId, Map requestParameters ) { @@ -63,8 +62,6 @@ public class MD5UserAuthenticator extends DefaultUserAuthenticator { public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name); - _userAccountDao = locator.getDao(UserAccountDao.class); return true; } diff --git a/plugins/user-authenticators/plain-text/pom.xml b/plugins/user-authenticators/plain-text/pom.xml index 6406fa92489..60336ebb22d 100644 --- a/plugins/user-authenticators/plain-text/pom.xml +++ b/plugins/user-authenticators/plain-text/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java b/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java index 59e12e50048..52e7cb3e297 100644 --- a/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java +++ b/plugins/user-authenticators/plain-text/src/com/cloud/server/auth/PlainTextUserAuthenticator.java @@ -21,14 +21,14 @@ import java.security.NoSuchAlgorithmException; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; -import com.cloud.server.ManagementServer; import com.cloud.user.UserAccount; import com.cloud.user.dao.UserAccountDao; -import com.cloud.utils.component.ComponentLocator; + import com.cloud.utils.exception.CloudRuntimeException; @@ -36,7 +36,7 @@ import com.cloud.utils.exception.CloudRuntimeException; public class PlainTextUserAuthenticator extends DefaultUserAuthenticator { public static final Logger s_logger = Logger.getLogger(PlainTextUserAuthenticator.class); - private UserAccountDao _userAccountDao; + @Inject private UserAccountDao _userAccountDao; @Override public boolean authenticate(String username, String password, Long domainId, Map requestParameters ) { @@ -83,8 +83,6 @@ public class PlainTextUserAuthenticator extends DefaultUserAuthenticator { public boolean configure(String name, Map params) throws ConfigurationException { super.configure(name, params); - ComponentLocator locator = ComponentLocator.getLocator(ManagementServer.Name); - _userAccountDao = locator.getDao(UserAccountDao.class); return true; } diff --git a/plugins/user-authenticators/sha256salted/pom.xml b/plugins/user-authenticators/sha256salted/pom.xml index 3f530f76e17..22e97632e3d 100644 --- a/plugins/user-authenticators/sha256salted/pom.xml +++ b/plugins/user-authenticators/sha256salted/pom.xml @@ -23,7 +23,7 @@ org.apache.cloudstack cloudstack-plugins - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT ../../pom.xml diff --git a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java index 26c33a5a9ec..1b29f69794a 100644 --- a/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java +++ b/plugins/user-authenticators/sha256salted/src/com/cloud/server/auth/SHA256SaltedUserAuthenticator.java @@ -23,40 +23,38 @@ import java.security.SecureRandom; import java.util.Map; import javax.ejb.Local; +import javax.inject.Inject; import javax.naming.ConfigurationException; import org.apache.log4j.Logger; import org.bouncycastle.util.encoders.Base64; -import com.cloud.server.ManagementServer; -import com.cloud.servlet.CloudStartupServlet; import com.cloud.user.UserAccount; import com.cloud.user.dao.UserAccountDao; -import com.cloud.utils.component.ComponentLocator; -import com.cloud.utils.component.Inject; import com.cloud.utils.exception.CloudRuntimeException; @Local(value={UserAuthenticator.class}) public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator { - public static final Logger s_logger = Logger.getLogger(SHA256SaltedUserAuthenticator.class); - - @Inject - private UserAccountDao _userAccountDao; - private static int s_saltlen = 20; + public static final Logger s_logger = Logger.getLogger(SHA256SaltedUserAuthenticator.class); - public boolean configure(String name, Map params) - throws ConfigurationException { - super.configure(name, params); - return true; - } - - /* (non-Javadoc) - * @see com.cloud.server.auth.UserAuthenticator#authenticate(java.lang.String, java.lang.String, java.lang.Long, java.util.Map) - */ - @Override - public boolean authenticate(String username, String password, - Long domainId, Map requestParameters) { - if (s_logger.isDebugEnabled()) { + @Inject + private UserAccountDao _userAccountDao; + private static int s_saltlen = 20; + + @Override + public boolean configure(String name, Map params) + throws ConfigurationException { + super.configure(name, params); + return true; + } + + /* (non-Javadoc) + * @see com.cloud.server.auth.UserAuthenticator#authenticate(java.lang.String, java.lang.String, java.lang.Long, java.util.Map) + */ + @Override + public boolean authenticate(String username, String password, + Long domainId, Map requestParameters) { + if (s_logger.isDebugEnabled()) { s_logger.debug("Retrieving user: " + username); } UserAccount user = _userAccountDao.getUserAccount(username, domainId); @@ -64,59 +62,59 @@ public class SHA256SaltedUserAuthenticator extends DefaultUserAuthenticator { s_logger.debug("Unable to find user with " + username + " in domain " + domainId); return false; } - + try { - String storedPassword[] = user.getPassword().split(":"); - if (storedPassword.length != 2) { - s_logger.warn("The stored password for " + username + " isn't in the right format for this authenticator"); - return false; - } - byte salt[] = Base64.decode(storedPassword[0]); - String hashedPassword = encode(password, salt); - return storedPassword[1].equals(hashedPassword); - } catch (NoSuchAlgorithmException e) { - throw new CloudRuntimeException("Unable to hash password", e); - } catch (UnsupportedEncodingException e) { - throw new CloudRuntimeException("Unable to hash password", e); - } - } + String storedPassword[] = user.getPassword().split(":"); + if (storedPassword.length != 2) { + s_logger.warn("The stored password for " + username + " isn't in the right format for this authenticator"); + return false; + } + byte salt[] = Base64.decode(storedPassword[0]); + String hashedPassword = encode(password, salt); + return storedPassword[1].equals(hashedPassword); + } catch (NoSuchAlgorithmException e) { + throw new CloudRuntimeException("Unable to hash password", e); + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Unable to hash password", e); + } + } - /* (non-Javadoc) - * @see com.cloud.server.auth.UserAuthenticator#encode(java.lang.String) - */ - @Override - public String encode(String password) { - // 1. Generate the salt - SecureRandom randomGen; - try { - randomGen = SecureRandom.getInstance("SHA1PRNG"); - - byte salt[] = new byte[s_saltlen]; - randomGen.nextBytes(salt); - - String saltString = new String(Base64.encode(salt)); - String hashString = encode(password, salt); - - // 3. concatenate the two and return - return saltString + ":" + hashString; - } catch (NoSuchAlgorithmException e) { - throw new CloudRuntimeException("Unable to hash password", e); - } catch (UnsupportedEncodingException e) { - throw new CloudRuntimeException("Unable to hash password", e); - } - } + /* (non-Javadoc) + * @see com.cloud.server.auth.UserAuthenticator#encode(java.lang.String) + */ + @Override + public String encode(String password) { + // 1. Generate the salt + SecureRandom randomGen; + try { + randomGen = SecureRandom.getInstance("SHA1PRNG"); - public String encode(String password, byte[] salt) throws UnsupportedEncodingException, NoSuchAlgorithmException { - byte[] passwordBytes = password.getBytes("UTF-8"); - byte[] hashSource = new byte[passwordBytes.length + s_saltlen]; - System.arraycopy(passwordBytes, 0, hashSource, 0, passwordBytes.length); - System.arraycopy(salt, 0, hashSource, passwordBytes.length, s_saltlen); - - // 2. Hash the password with the salt - MessageDigest md = MessageDigest.getInstance("SHA-256"); - md.update(hashSource); - byte[] digest = md.digest(); - - return new String(Base64.encode(digest)); - } + byte salt[] = new byte[s_saltlen]; + randomGen.nextBytes(salt); + + String saltString = new String(Base64.encode(salt)); + String hashString = encode(password, salt); + + // 3. concatenate the two and return + return saltString + ":" + hashString; + } catch (NoSuchAlgorithmException e) { + throw new CloudRuntimeException("Unable to hash password", e); + } catch (UnsupportedEncodingException e) { + throw new CloudRuntimeException("Unable to hash password", e); + } + } + + public String encode(String password, byte[] salt) throws UnsupportedEncodingException, NoSuchAlgorithmException { + byte[] passwordBytes = password.getBytes("UTF-8"); + byte[] hashSource = new byte[passwordBytes.length + s_saltlen]; + System.arraycopy(passwordBytes, 0, hashSource, 0, passwordBytes.length); + System.arraycopy(salt, 0, hashSource, passwordBytes.length, s_saltlen); + + // 2. Hash the password with the salt + MessageDigest md = MessageDigest.getInstance("SHA-256"); + md.update(hashSource); + byte[] digest = md.digest(); + + return new String(Base64.encode(digest)); + } } diff --git a/pom.xml b/pom.xml index c440a660322..beeccaf936a 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ org.apache.cloudstack cloudstack - 4.1.0-SNAPSHOT + 4.2.0-SNAPSHOT pom Apache CloudStack Apache CloudStack is an IaaS (“Infrastracture as a Serviceâ€) cloud orchestration platform. @@ -43,6 +43,7 @@ + 1.6 UTF-8 @@ -74,19 +75,21 @@ 3.1.3 1.4 1.4 - 1.5.1 + 1.5.6 1.5.1 1.2.8 2.0.4 2.4 1.2 1.0-20081010.060147 + 3.1.2.RELEASE 4.1 1.9.5 1.3.21.1 2.6 1.4 0.9.8 + 0.10 @@ -153,17 +156,18 @@ api agent - console-proxy core server usage utils deps/XenServerJava plugins - awsapi patches - client + engine + framework + services test + client @@ -182,12 +186,106 @@ junit ${cs.junit.version} test + + + + org.springframework + spring-core + ${org.springframework.version} + + + org.springframework + spring-context + ${org.springframework.version} + + org.springframework + spring-web + ${org.springframework.version} + + org.mockito mockito-all 1.9.5 test + + + + org.springframework + spring-test + ${org.springframework.version} + test + + + + org.aspectj + aspectjrt + 1.7.1 + + + org.aspectj + aspectjweaver + 1.7.1 + + + javax.inject + javax.inject + 1 @@ -195,6 +293,36 @@ install + + + org.eclipse.m2e + lifecycle-mapping + 1.0.0 + + + + + + + org.apache.maven.plugins + + + maven-antrun-plugin + + [1.7,) + + run + + + + + + + + + + org.apache.tomcat.maven tomcat7-maven-plugin @@ -233,7 +361,7 @@ **/target/** **/.vagrant build/build.number - console-proxy/js/jquery.js + services/console-proxy/server/js/jquery.js debian/compat debian/control debian/dirs @@ -244,6 +372,13 @@ dist/console-proxy/js/jquery.js scripts/vm/systemvm/id_rsa.cloud tools/devcloud/basebuild/puppet-devcloudinitial/files/network.conf + tools/appliance/definitions/systemvmtemplate/base.sh + tools/appliance/definitions/systemvmtemplate/cleanup.sh + tools/appliance/definitions/systemvmtemplate/definition.rb + tools/appliance/definitions/systemvmtemplate/preseed.cfg + tools/appliance/definitions/systemvmtemplate/zerodisk.sh + tools/devcloud/src/deps/boxes/basebox-build/definition.rb + tools/devcloud/src/deps/boxes/basebox-build/preseed.cfg ui/lib/flot/jquery.colorhelpers.js ui/lib/flot/jquery.flot.crosshair.js ui/lib/flot/jquery.flot.fillbetween.js @@ -267,6 +402,7 @@ ui/lib/qunit/qunit.css ui/lib/qunit/qunit.js ui/lib/reset.css + ui/lib/require.js waf patches/systemvm/debian/systemvm.vmx patches/systemvm/debian/config/root/.ssh/authorized_keys @@ -278,16 +414,13 @@ patches/systemvm/debian/config/etc/dnsmasq.conf patches/systemvm/debian/config/etc/vpcdnsmasq.conf patches/systemvm/debian/config/etc/ssh/sshd_config - patches/systemvm/debian/config/etc/rsyslog.conf - patches/systemvm/debian/config/etc/logrotate.conf patches/systemvm/debian/config/etc/logrotate.d/* patches/systemvm/debian/config/etc/sysctl.conf patches/systemvm/debian/config/root/redundant_router/keepalived.conf.templ patches/systemvm/debian/config/root/redundant_router/arping_gateways.sh.templ patches/systemvm/debian/config/root/redundant_router/conntrackd.conf.templ - patches/systemvm/debian/vpn/etc/ipsec.conf patches/systemvm/debian/vpn/etc/ppp/options.xl2tpd patches/systemvm/debian/vpn/etc/xl2tpd/xl2tpd.conf @@ -310,40 +443,40 @@ ${cs.jdk.version} ${cs.jdk.version} - true - 128m - 512m + true + 128m + 512m - - org.apache.maven.plugins - maven-jar-plugin - 2.4 - - - - true - true - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.7 - - - remove-old-installers - - remove-project-artifact - - - true - - - - + + org.apache.maven.plugins + maven-jar-plugin + 2.4 + + + + true + true + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.7 + + + remove-old-installers + + remove-project-artifact + + + true + + + + org.apache.maven.plugins maven-dependency-plugin @@ -364,15 +497,20 @@ + + awsapi + + awsapi + + developer + + tools/devcloud/devcloud.cfg + developer - tools/apidoc - tools/devcloud - tools/devcloud-kvm - tools/marvin - tools/cli + tools @@ -386,5 +524,113 @@ vmware-base + + simulator + + + deploydb-simulator + + + + + + org.codehaus.mojo + properties-maven-plugin + 1.0-alpha-2 + + + initialize + + read-project-properties + + + + ${project.basedir}/utils/conf/db.properties + ${project.basedir}/utils/conf/db.properties.override + + true + + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + + mysql + mysql-connector-java + ${cs.mysql.version} + + + commons-dbcp + commons-dbcp + ${cs.dbcp.version} + + + commons-pool + commons-pool + ${cs.pool.version} + + + org.jasypt + jasypt + ${cs.jasypt.version} + + + org.apache.cloudstack + cloud-utils + ${project.version} + + + org.apache.cloudstack + cloud-server + ${project.version} + + + + + process-resources + create-schema + + java + + + + + false + true + + org.apache.cloudstack + cloud-server + + com.cloud.upgrade.DatabaseCreator + + + ${project.basedir}/utils/conf/db.properties + ${project.basedir}/utils/conf/db.properties.override + + ${basedir}/target/db/create-schema-simulator.sql + ${basedir}/target/db/templates.simulator.sql + + com.cloud.upgrade.DatabaseUpgradeChecker + --database=simulator + --rootpassword=${db.root.password} + + + + + catalina.home + ${project.basedir}/utils + + + + + + + diff --git a/python/lib/cloudutils/serviceConfig.py b/python/lib/cloudutils/serviceConfig.py index 6b211eb5074..1e32d0f3b0f 100755 --- a/python/lib/cloudutils/serviceConfig.py +++ b/python/lib/cloudutils/serviceConfig.py @@ -54,9 +54,9 @@ class serviceCfgBase(object): except: logging.debug(formatExceptionInfo()) if self.syscfg.env.mode == "Server": - raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloud/setupManagement.log for detail"%self.serviceName) + raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloudstack/setupManagement.log for detail"%self.serviceName) else: - raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloud/setupAgent.log for detail"%self.serviceName) + raise CloudRuntimeException("Configure %s failed, Please check the /var/log/cloudstack/setupAgent.log for detail"%self.serviceName) def backup(self): if self.status is None: @@ -386,7 +386,7 @@ class securityPolicyConfigUbuntu(serviceCfgBase): return True except: - raise CloudRuntimeException("Failed to configure apparmor, please see the /var/log/cloud/setupAgent.log for detail, \ + raise CloudRuntimeException("Failed to configure apparmor, please see the /var/log/cloudstack/setupAgent.log for detail, \ or you can manually disable it before starting myCloud") def restore(self): @@ -416,7 +416,7 @@ class securityPolicyConfigRedhat(serviceCfgBase): cfo.replace_line("SELINUX=", "SELINUX=permissive") return True except: - raise CloudRuntimeException("Failed to configure selinux, please see the /var/log/cloud/setupAgent.log for detail, \ + raise CloudRuntimeException("Failed to configure selinux, please see the /var/log/cloudstack/setupAgent.log for detail, \ or you can manually disable it before starting myCloud") else: return True @@ -602,7 +602,7 @@ class cloudAgentConfig(serviceCfgBase): def configMyCloud(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloudstack/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("port", "443") @@ -624,7 +624,7 @@ class cloudAgentConfig(serviceCfgBase): def configAgent(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloudstack/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("pod", self.syscfg.env.pod) @@ -639,16 +639,16 @@ class cloudAgentConfig(serviceCfgBase): cfo.addEntry("resource", "com.cloud.hypervisor.kvm.resource.LibvirtComputingResource") cfo.save() - self.syscfg.svo.stopService("cloud-agent") + self.syscfg.svo.stopService("cloudstack-agent") bash("sleep 30") - self.syscfg.svo.enableService("cloud-agent") + self.syscfg.svo.enableService("cloudstack-agent") return True except: raise def configConsole(self): try: - cfo = configFileOps("/etc/cloud/agent/agent.properties", self) + cfo = configFileOps("/etc/cloudstack/agent/agent.properties", self) cfo.addEntry("host", self.syscfg.env.mgtSvr) cfo.addEntry("zone", self.syscfg.env.zone) cfo.addEntry("pod", self.syscfg.env.pod) @@ -661,8 +661,8 @@ class cloudAgentConfig(serviceCfgBase): cfo.addEntry("resource", "com.cloud.agent.resource.computing.consoleProxyResource") cfo.save() - self.syscfg.svo.stopService("cloud-agent") - self.syscfg.svo.enableService("cloud-agent") + self.syscfg.svo.stopService("cloudstack-agent") + self.syscfg.svo.enableService("cloudstack-agent") return True except: raise diff --git a/python/lib/cloudutils/serviceConfigServer.py b/python/lib/cloudutils/serviceConfigServer.py index 3fb973986e4..a08ce02d766 100644 --- a/python/lib/cloudutils/serviceConfigServer.py +++ b/python/lib/cloudutils/serviceConfigServer.py @@ -73,39 +73,39 @@ class cloudManagementConfig(serviceCfgBase): bash("iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 8250 ") #generate keystore - keyPath = "/var/lib/cloud/management/web.keystore" + keyPath = "/var/cloudstack/management/web.keystore" if not os.path.exists(keyPath): cmd = bash("keytool -genkey -keystore %s -storepass \"cloud.com\" -keypass \"cloud.com\" -validity 3650 -dname cn=\"Cloudstack User\",ou=\"mycloud.cloud.com\",o=\"mycloud.cloud.com\",c=\"Unknown\""%keyPath) if not cmd.isSuccess(): raise CloudInternalException(cmd.getErrMsg()) - cfo = configFileOps("/etc/cloud/management/tomcat6.conf", self) + cfo = configFileOps("/etc/cloudstack/management/tomcat6.conf", self) cfo.add_lines("JAVA_OPTS+=\" -Djavax.net.ssl.trustStore=%s \""%keyPath) elif self.syscfg.env.svrMode == "HttpsServer": - if not os.path.exists("/etc/cloud/management/server-ssl.xml") or not os.path.exists("/etc/cloud/management/tomcat6-ssl.conf"): - raise CloudRuntimeException("Cannot find /etc/cloud/management/server-ssl.xml or /etc/cloud/management/tomcat6-ssl.conf, https enables failed") - if os.path.exists("/etc/cloud/management/server.xml"): - bash("rm -f /etc/cloud/management/server.xml") - if os.path.exists("/etc/cloud/management/tomcat6.conf"): - bash("rm -f /etc/cloud/management/tomcat6.conf") - bash("ln -s /etc/cloud/management/server-ssl.xml /etc/cloud/management/server.xml") - bash("ln -s /etc/cloud/management/tomcat6-ssl.conf /etc/cloud/management/tomcat6.conf") + if not os.path.exists("/etc/cloudstack/management/server-ssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-ssl.conf"): + raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-ssl.xml or /etc/cloudstack/management/tomcat6-ssl.conf, https enables failed") + if os.path.exists("/etc/cloudstack/management/server.xml"): + bash("rm -f /etc/cloudstack/management/server.xml") + if os.path.exists("/etc/cloudstack/management/tomcat6.conf"): + bash("rm -f /etc/cloudstack/management/tomcat6.conf") + bash("ln -s /etc/cloudstack/management/server-ssl.xml /etc/cloudstack/management/server.xml") + bash("ln -s /etc/cloudstack/management/tomcat6-ssl.conf /etc/cloudstack/management/tomcat6.conf") if not bash("iptables-save |grep PREROUTING | grep 6443").isSuccess(): bash("iptables -A PREROUTING -t nat -p tcp --dport 443 -j REDIRECT --to-port 6443") else: - if not os.path.exists("/etc/cloud/management/server-nonssl.xml") or not os.path.exists("/etc/cloud/management/tomcat6-nonssl.conf"): - raise CloudRuntimeException("Cannot find /etc/cloud/management/server-nonssl.xml or /etc/cloud/management/tomcat6-nonssl.conf, https enables failed") - if os.path.exists("/etc/cloud/management/server.xml"): - bash("rm -f /etc/cloud/management/server.xml") - if os.path.exists("/etc/cloud/management/tomcat6.conf"): - bash("rm -f /etc/cloud/management/tomcat6.conf") - bash("ln -s /etc/cloud/management/server-nonssl.xml /etc/cloud/management/server.xml") - bash("ln -s /etc/cloud/management/tomcat6-nonssl.conf /etc/cloud/management/tomcat6.conf") + if not os.path.exists("/etc/cloudstack/management/server-nonssl.xml") or not os.path.exists("/etc/cloudstack/management/tomcat6-nonssl.conf"): + raise CloudRuntimeException("Cannot find /etc/cloudstack/management/server-nonssl.xml or /etc/cloudstack/management/tomcat6-nonssl.conf, https enables failed") + if os.path.exists("/etc/cloudstack/management/server.xml"): + bash("rm -f /etc/cloudstack/management/server.xml") + if os.path.exists("/etc/cloudstack/management/tomcat6.conf"): + bash("rm -f /etc/cloudstack/management/tomcat6.conf") + bash("ln -s /etc/cloudstack/management/server-nonssl.xml /etc/cloudstack/management/server.xml") + bash("ln -s /etc/cloudstack/management/tomcat6-nonssl.conf /etc/cloudstack/management/tomcat6.conf") #distro like sl 6.1 needs this folder, or tomcat6 failed to start checkHostName() - bash("mkdir /var/log/cloud-management/") + bash("mkdir /var/log/cloudstack-management/") #set max process per account is unlimited if os.path.exists("/etc/security/limits.conf"): cfo = configFileOps("/etc/security/limits.conf") @@ -118,9 +118,8 @@ class cloudManagementConfig(serviceCfgBase): except: pass - self.syscfg.svo.stopService("cloud-management") - if self.syscfg.svo.enableService("cloud-management"): + self.syscfg.svo.stopService("cloudstack-management") + if self.syscfg.svo.enableService("cloudstack-management"): return True else: - raise CloudRuntimeException("Failed to configure %s, please see the /var/log/cloud/setupManagement.log for detail"%self.serviceName) - + raise CloudRuntimeException("Failed to configure %s, please see the /var/log/cloudstack/setupManagement.log for detail"%self.serviceName) diff --git a/python/lib/cloudutils/utilities.py b/python/lib/cloudutils/utilities.py index 3f5f2a9dc8b..739a48385a0 100755 --- a/python/lib/cloudutils/utilities.py +++ b/python/lib/cloudutils/utilities.py @@ -110,7 +110,7 @@ class Distribution: self.distro = "Fedora" elif os.path.exists("/etc/redhat-release"): version = file("/etc/redhat-release").readline() - if version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.2") or version.find("CentOS release 6.3") != -1: + if version.find("Red Hat Enterprise Linux Server release 6") != -1 or version.find("Scientific Linux release 6") != -1 or version.find("CentOS Linux release 6") != -1 or version.find("CentOS release 6.2") != -1 or version.find("CentOS release 6.3") != -1: self.distro = "RHEL6" elif version.find("CentOS release") != -1: self.distro = "CentOS" @@ -122,7 +122,14 @@ class Distribution: if kernel.find("2.6.32") != -1: self.release = "10.04" self.arch = bash("uname -m").getStdout() - + elif os.path.exists("/usr/bin/lsb_release"): + o = bash("/usr/bin/lsb_release -i") + distributor = o.getStdout().split(":\t")[1] + if "Debian" in distributor: + # This obviously needs a rewrite at some point + self.distro = "Ubuntu" + else: + raise UnknownSystemException(distributor) else: raise UnknownSystemException diff --git a/scripts/network/domr/call_firewall.sh b/scripts/network/domr/call_firewall.sh index 08da3411cbe..f6ad0be1316 100755 --- a/scripts/network/domr/call_firewall.sh +++ b/scripts/network/domr/call_firewall.sh @@ -46,28 +46,25 @@ then exit 1 fi fflag= -while getopts ':F' OPTION +eflag= +while getopts ':FE' OPTION do case $OPTION in F) fflag=1 - ;; + ;; + E) eflag=1 + ;; \?) ;; esac done -if [ -n "$fflag" ] +if [ -n "$eflag" ] +then + ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/firewallRule_egress.sh $*" +elif [ -n "$fflag" ] then ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/firewall_rule.sh $*" else ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$domRIp "/root/firewall.sh $*" fi exit $? - - - - - - - - - diff --git a/scripts/network/domr/dhcp_entry.sh b/scripts/network/domr/dhcp_entry.sh index c1bf3543dfb..e417f7273a2 100755 --- a/scripts/network/domr/dhcp_entry.sh +++ b/scripts/network/domr/dhcp_entry.sh @@ -22,24 +22,12 @@ # @VERSION@ usage() { - printf "Usage: %s: -r -m -v -n \n" $(basename $0) >&2 + printf "Usage: %s: -r -m -v -n -s -d -N -6 -u \n" $(basename $0) >&2 exit 2 } cert="/root/.ssh/id_rsa.cloud" -add_dhcp_entry() { - local domr=$1 - local mac=$2 - local ip=$3 - local vm=$4 - local dfltrt=$5 - local ns=$6 - local staticrt=$7 - ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domr "/root/edithosts.sh $mac $ip $vm $dfltrt $ns $staticrt" >/dev/null - return $? -} - domrIp= vmMac= vmIp= @@ -47,30 +35,46 @@ vmName= staticrt= dfltrt= dns= +ipv6= +duid= -while getopts 'r:m:v:n:d:s:N:' OPTION +opts= + +while getopts 'r:m:v:n:d:s:N:6:u:' OPTION do case $OPTION in - r) domrIp="$OPTARG" - ;; - v) vmIp="$OPTARG" - ;; - m) vmMac="$OPTARG" - ;; - n) vmName="$OPTARG" - ;; - s) staticrt="$OPTARG" - ;; - d) dfltrt="$OPTARG" - ;; - N) dns="$OPTARG" - ;; - ?) usage - exit 1 - ;; + r) domrIp="$OPTARG" + ;; + v) vmIp="$OPTARG" + opts="$opts -4 $vmIp" + ;; + m) vmMac="$OPTARG" + opts="$opts -m $vmMac" + ;; + n) vmName="$OPTARG" + opts="$opts -h $vmName" + ;; + s) staticrt="$OPTARG" + opts="$opts -s $staticrt" + ;; + d) dfltrt="$OPTARG" + opts="$opts -d $dfltrt" + ;; + N) dns="$OPTARG" + opts="$opts -n $dns" + ;; + 6) ipv6="$OPTARG" + opts="$opts -6 $ipv6" + ;; + u) duid="$OPTARG" + opts="$opts -u $duid" + ;; + ?) usage + exit 1 + ;; esac done -add_dhcp_entry $domrIp $vmMac $vmIp $vmName $dfltrt $dns $staticrt +ssh -p 3922 -o StrictHostKeyChecking=no -i $cert root@$domrIp "/root/edithosts.sh $opts " >/dev/null exit $? diff --git a/scripts/network/exdhcp/prepare_dhcpd.sh b/scripts/network/exdhcp/prepare_dhcpd.sh old mode 100644 new mode 100755 diff --git a/scripts/network/exdhcp/prepare_dnsmasq.sh b/scripts/network/exdhcp/prepare_dnsmasq.sh old mode 100644 new mode 100755 diff --git a/scripts/network/ping/baremetal_user_data.py b/scripts/network/ping/baremetal_user_data.py new file mode 100755 index 00000000000..a8ce32cb3ba --- /dev/null +++ b/scripts/network/ping/baremetal_user_data.py @@ -0,0 +1,104 @@ +# 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. + +''' +Created on Jul 2, 2012 + +@author: frank +''' +import sys +import os +import os.path +import base64 + +HTML_ROOT = "/var/www/html/" + +def writeIfNotHere(fileName, texts): + if not os.path.exists(fileName): + entries = [] + else: + f = open(fileName, 'r') + entries = f.readlines() + f.close() + + texts = [ "%s\n" % t for t in texts ] + need = False + for t in texts: + if not t in entries: + entries.append(t) + need = True + + if need: + f = open(fileName, 'w') + f.write(''.join(entries)) + f.close() + +def createRedirectEntry(vmIp, folder, filename): + entry = "RewriteRule ^%s$ ../%s/%%{REMOTE_ADDR}/%s [L,NC,QSA]" % (filename, folder, filename) + htaccessFolder="/var/www/html/latest" + htaccessFile=os.path.join(htaccessFolder, ".htaccess") + if not os.path.exists(htaccessFolder): + os.makedirs(htaccessFolder) + writeIfNotHere(htaccessFile, ["Options +FollowSymLinks", "RewriteEngine On", entry]) + + htaccessFolder = os.path.join("/var/www/html/", folder, vmIp) + if not os.path.exists(htaccessFolder): + os.makedirs(htaccessFolder) + htaccessFile=os.path.join(htaccessFolder, ".htaccess") + entry="Options -Indexes\nOrder Deny,Allow\nDeny from all\nAllow from %s" % vmIp + f = open(htaccessFile, 'w') + f.write(entry) + f.close() + + if folder in ['metadata', 'meta-data']: + entry1="RewriteRule ^meta-data/(.+)$ ../%s/%%{REMOTE_ADDR}/$1 [L,NC,QSA]" % folder + htaccessFolder="/var/www/html/latest" + htaccessFile=os.path.join(htaccessFolder, ".htaccess") + entry2="RewriteRule ^meta-data/$ ../%s/%%{REMOTE_ADDR}/meta-data [L,NC,QSA]" % folder + writeIfNotHere(htaccessFile, [entry1, entry2]) + + +def addUserData(vmIp, folder, fileName, contents): + + baseFolder = os.path.join(HTML_ROOT, folder, vmIp) + if not os.path.exists(baseFolder): + os.makedirs(baseFolder) + + createRedirectEntry(vmIp, folder, fileName) + + datafileName = os.path.join(HTML_ROOT, folder, vmIp, fileName) + metaManifest = os.path.join(HTML_ROOT, folder, vmIp, "meta-data") + if folder == "userdata": + if contents != "none": + contents = base64.urlsafe_b64decode(contents) + else: + contents = "" + + f = open(datafileName, 'w') + f.write(contents) + f.close() + + if folder == "metadata" or folder == "meta-data": + writeIfNotHere(metaManifest, fileName) + +if __name__ == '__main__': + string = sys.argv[1] + allEntires = string.split(";") + for entry in allEntires: + (vmIp, folder, fileName, contents) = entry.split(',', 3) + addUserData(vmIp, folder, fileName, contents) + sys.exit(0) diff --git a/scripts/network/ping/prepare_kickstart_bootfile.py b/scripts/network/ping/prepare_kickstart_bootfile.py new file mode 100755 index 00000000000..4378293b43a --- /dev/null +++ b/scripts/network/ping/prepare_kickstart_bootfile.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# Copyright 2012 Citrix Systems, Inc. Licensed under the +# Apache License, Version 2.0 (the "License"); you may not use this +# file except in compliance with the License. Citrix Systems, Inc. +# reserves all rights not expressly granted by the License. +# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Automatically generated by addcopyright.py at 04/03/2012 + + + + + +# Usage: prepare_tftp_bootfile.py tftp_dir mac cifs_server share directory image_to_restore cifs_username cifs_password +import os, sys +from sys import exit +from os import makedirs +from os.path import exists, join + +fmt1 = '''DEFAULT default +PROMPT 1 +TIMEOUT 26 +DISPLAY boot.msg +LABEL default +KERNEL %s +APPEND ramdisk_size=66000 initrd=%s ksdevice=%s ks=%s +''' +fmt2 = '''DEFAULT default +PROMPT 1 +TIMEOUT 26 +DISPLAY boot.msg +LABEL default +KERNEL %s +APPEND ramdisk_size=66000 initrd=%s ks=%s +''' + +tftp_dir = '' +mac = '' +kernel = '' +initrd = '' +ks_file = '' +ks_device = '' + +def prepare(): + try: + pxelinux = join(tftp_dir, "pxelinux.cfg") + if exists(pxelinux) == False: + makedirs(pxelinux) + + cfg_name = "01-" + mac.replace(':','-').lower() + cfg_path = join(pxelinux, cfg_name) + f = open(cfg_path, "w") + if ks_device == '': + stuff = fmt2 % (kernel, initrd, ks_file) + else: + stuff = fmt1 % (kernel, initrd, ks_device, ks_file) + f.write(stuff) + f.close() + return 0 + except Exception, e: + print e + return 1 + + +if __name__ == "__main__": + if len(sys.argv) < 7: + print "Usage: prepare_kickstart_bootfile.py tftp_dir mac kernel initrd ks_file ks_device" + exit(1) + + (tftp_dir, mac, kernel, initrd, ks_file, ks_device) = sys.argv[1:] + + ret = prepare() + exit(ret) diff --git a/scripts/network/ping/prepare_kickstart_kernel_initrd.py b/scripts/network/ping/prepare_kickstart_kernel_initrd.py new file mode 100755 index 00000000000..b234a62de70 --- /dev/null +++ b/scripts/network/ping/prepare_kickstart_kernel_initrd.py @@ -0,0 +1,70 @@ +#!/usr/bin/python +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import sys +import tempfile +import os.path +import os + +iso_folder = '' +copy_to = '' + +def cmd(cmdstr, err=True): + if os.system(cmdstr) != 0 and err: + raise Exception("Failed to run shell command: %s" % cmdstr) + +def prepare(): + try: + kernel = os.path.join(copy_to, "vmlinuz") + initrd = os.path.join(copy_to, "initrd.img") + if os.path.exists(kernel) and os.path.exists(initrd): + print "Having template(%s) prepared already, skip copying" % copy_to + return 0 + else: + if not os.path.exists(copy_to): + os.makedirs(copy_to) + + mnt_path = tempfile.mkdtemp() + try: + mnt = "mount %s %s" % (iso_folder, mnt_path) + cmd(mnt) + + kernel = os.path.join(mnt_path, "vmlinuz") + initrd = os.path.join(mnt_path, "initrd.img") + cp = "cp -f %s %s/" % (kernel, copy_to) + cmd(cp) + cp = "cp -f %s %s/" % (initrd, copy_to) + cmd(cp) + finally: + umnt = "umount %s" % mnt_path + cmd(umnt, False) + rm = "rm -r %s" % mnt_path + cmd(rm, False) + return 0 + except Exception, e: + print e + return 1 + +if __name__ == "__main__": + if len(sys.argv) < 3: + print "Usage: prepare_kickstart_kerneal_initrd.py path_to_kernel_initrd_iso path_kernel_initrd_copy_to" + sys.exit(1) + + (iso_folder, copy_to) = sys.argv[1:] + sys.exit(prepare()) + diff --git a/scripts/storage/qcow2/get_domr_kernel.sh b/scripts/storage/qcow2/get_domr_kernel.sh old mode 100644 new mode 100755 diff --git a/scripts/storage/qcow2/managevolume.sh b/scripts/storage/qcow2/managevolume.sh old mode 100644 new mode 100755 diff --git a/scripts/storage/qcow2/modifyvlan.sh b/scripts/storage/qcow2/modifyvlan.sh old mode 100644 new mode 100755 diff --git a/scripts/storage/qcow2/resizevolume.sh b/scripts/storage/qcow2/resizevolume.sh new file mode 100755 index 00000000000..d15513e250f --- /dev/null +++ b/scripts/storage/qcow2/resizevolume.sh @@ -0,0 +1,253 @@ +#!/usr/bin/env bash +# 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. + + + +# resizevolume.sh -- resize a volume + +usage() { + printf "Usage: %s: -c -s -p -v -t -r \n" $(basename $0) >&2 +} + +getdevmappername() { + local path=$1 + local devmappername=`readlink -f $path |cut -d/ -f3` + if [[ $devmappername =~ "dm-" ]] + then + dmname=$devmappername + return 0 + else + return 1; + fi +} + +getdevmappersize() { + local dm=$1 + if [ ! -e "/sys/block/${dm}/size" ] + then + log "unable to find ${dm} in /sys/block" 1 + exit 1 + fi + actualsize=$((`cat /sys/block/${dm}/size`*512)); + + if [[ -z "$actualsize" ]] + then + log "unable to find actual size of ${dm}" 1 + exit 1 + fi + return 0 +} + +# log "message" 1 <-- prints to stdout as well as log, to pass error up to cloudstack +# log "message" prints only to log file +# variable shouldwelog controls whether we print to log file +log() { + local d=`date` + local msg=${1} + local stdout=${2} + + if [ ! -z "$stdout" ] + then + echo $1 + fi + + if [ $shouldwelog -eq 1 ] + then + echo "$d - $1" >> /var/log/cloud/agent/resizevolume.log + fi +} + +failshrink() { + # if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking + if [ $actualsize -gt $newsize ] + then + if [ "$shrink" == "false" ] + then + log "result would shrink the volume from $actualsize to $newsize, but confirmation to shrink wasn't passed. Shrink='$shrink'" 1 + exit 1 + fi + fi +} + +notifyqemu() { + #move this back into cloudstack libvirt calls once the libvirt java bindings support block resize + #we try to inform hypervisor of new size, but don't fail if we can't + if `virsh help 2>/dev/null | grep -q blockresize` + then + if `virsh domstate $vmname >/dev/null 2>&1` + then + sizeinkb=$(($newsize/1024)) + virsh blockresize --domain $vmname --path $path --size $sizeinkb >/dev/null 2>&1 + retval=$? + if [ -z $retval ] || [ $retval -ne 0 ] + then + log "failed to live resize $path to size of $sizeinkb kb" 1 + else + liveresize='true' + fi + fi + fi +} + +resizelvm() { + local dmname='' + local actualsize='' + local liveresize='false' + + ##### sanity checks ##### + if ! `lvresize --version > /dev/null 2>&1` + then + log "unable to resolve executable 'lvresize'" 1 + exit 1 + fi + + if ! `virsh --version > /dev/null 2>&1` + then + log "unable to resolve executable 'virsh'" 1 + exit 1 + fi + ##### end sanity ##### + + if ! getdevmappername $path + then + log "unable to resolve a device mapper dev from $path" 1 + exit 1 + fi + + getdevmappersize $dmname + + if [ $actualsize -ne $currentsize ] + then + log "disk isn't the size we think it is: cloudstack said $currentsize, disk said $actualsize." + fi + + # if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking + failshrink + + output=`lvresize -f -L ${newsize}B $path 2>&1` + retval=$? + + if [ -z $retval ] || [ $retval -ne 0 ] + then + log "lvresize failed: $output " 1 + exit 1 + fi + + #move this back into cloudstack libvirt calls once the libvirt java bindings support block resize + #we try to inform hypervisor of new size, but don't fail if we can't + notifyqemu + + log "performed successful resize - dm:$dmname currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink" +} + +resizeqcow2() { + + ##### sanity checks ##### + if [ ! -e "$path" ] + then + log "unable to find file $path" 1 + exit 1 + fi + + if ! `qemu-img info /dev/null > /dev/null 2>&1` + then + log "unable to resolve executable 'qemu-img'" 1 + exit 1 + fi + + if ! `virsh --version > /dev/null 2>&1` + then + log "unable to resolve executable 'virsh'" 1 + exit 1 + fi + ##### end sanity ##### + + actualsize=`qemu-img info $path | grep "virtual size" | sed -re 's/^.*\(([0-9]+).*$/\1/g'` + + if [ $actualsize -ne $currentsize ] + then + log "disk isn't the size we think it is: cloudstack said $currentsize, disk said $actualsize." + fi + + # if this is a shrink operation, fail if commands will shrink the volume and we haven't signed of on shrinking + failshrink + + output=`qemu-img resize $path $newsize 2>&1` + retval=$? + + if [ -z $retval ] || [ $retval -ne 0 ] + then + log "qemu-img resize failed: $output" 1 + exit 1 + fi + + #move this back into cloudstack libvirt calls once the libvirt java bindings support block resize + #we try to inform hypervisor of new size, but don't fail if we can't + notifyqemu + + log "performed successful resize - currentsize:$currentsize newsize:$newsize path:$path type:$ptype vmname:$vmname live:$liveresize shrink:$shrink" +} + +sflag= +cflag= +pflag= +vflag= +tflag= +rflag= + +while getopts 'c:s:v:p:t:r:' OPTION +do + case $OPTION in + s) sflag=1 + newsize="$OPTARG" + ;; + c) cflag=1 + currentsize="$OPTARG" + ;; + v) vflag=1 + vmname="$OPTARG" + ;; + p) dflag=1 + path="$OPTARG" + ;; + t) tflag=1 + ptype="$OPTARG" + ;; + r) rflag=1 + shrink="$OPTARG" + ;; + ?) usage + exit 2 + ;; + esac +done + +shouldwelog=1 #set this to 1 while debugging to get output in /var/log/cloud/agent/resizevolume.log + +if [ "$ptype" == "CLVM" ] +then + resizelvm +elif [ "$ptype" == "QCOW2" ] +then + resizeqcow2 +else + echo "unsupported type $ptype" + exit 1; +fi + +exit 0 diff --git a/scripts/storage/secondary/cloud-install-sys-tmplt b/scripts/storage/secondary/cloud-install-sys-tmplt index 63a04d8cb07..2172b287848 100755 --- a/scripts/storage/secondary/cloud-install-sys-tmplt +++ b/scripts/storage/secondary/cloud-install-sys-tmplt @@ -20,7 +20,7 @@ usage() { - printf "Usage: %s: -m -f [-h ] [ -s ][-u ] [-F ] [-e