diff --git a/LICENSE b/LICENSE
index 73bc738391f..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,14 +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/
+ ScriptRunner.java from http://code.google.com/p/mybatis/
+
diff --git a/NOTICE b/NOTICE
index 5cdd9fcee19..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
@@ -76,4 +75,4 @@
Inspiration from jQuery color animation plugin by John Resig.
- Released under the MIT license by Ole Laursen, October 2009.
\ No newline at end of file
+ Released under the MIT license by Ole Laursen, October 2009.
diff --git a/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/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/core/src/com/cloud/vm/VirtualEnvironment.java b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
similarity index 56%
rename from core/src/com/cloud/vm/VirtualEnvironment.java
rename to api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
index 79d4a59bbfc..478987d993b 100644
--- a/core/src/com/cloud/vm/VirtualEnvironment.java
+++ b/api/src/com/cloud/agent/api/CreateVMSnapshotCommand.java
@@ -14,33 +14,29 @@
// 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.agent.api;
import java.util.List;
-/**
- *
- * be an information carrier within one thread only.
- *
- */
-public class VirtualEnvironment {
- /**
- * The actual machine
- */
- public VirtualMachine machine;
+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;
+ }
- /**
- * 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;
}
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/server/src/com/cloud/baremetal/DhcpServerResponse.java b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
similarity index 53%
rename from server/src/com/cloud/baremetal/DhcpServerResponse.java
rename to api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
index db46ccd1a1d..8f4ecad3d80 100644
--- a/server/src/com/cloud/baremetal/DhcpServerResponse.java
+++ b/api/src/com/cloud/agent/api/DeleteVMSnapshotAnswer.java
@@ -14,22 +14,36 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.baremetal;
+package com.cloud.agent.api;
-import org.apache.cloudstack.api.ApiConstants;
-import org.apache.cloudstack.api.BaseResponse;
-import com.cloud.serializer.Param;
-import com.google.gson.annotations.SerializedName;
+import java.util.List;
-public class DhcpServerResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the ID of the Dhcp server")
- private String id;
+import com.cloud.agent.api.to.VolumeTO;
- public String getId() {
- return id;
+public class DeleteVMSnapshotAnswer extends Answer {
+ private List volumeTOs;
+
+ public DeleteVMSnapshotAnswer() {
}
- public void setId(String id) {
- this.id = id;
+ 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/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/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 a8846b96261..4cbe82b357b 100644
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@ -124,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/configuration/ConfigurationService.java b/api/src/com/cloud/configuration/ConfigurationService.java
index a9595fe7574..e63fcece525 100644
--- a/api/src/com/cloud/configuration/ConfigurationService.java
+++ b/api/src/com/cloud/configuration/ConfigurationService.java
@@ -264,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/event/EventTypes.java b/api/src/com/cloud/event/EventTypes.java
index 0dd97cb438c..0087edca743 100755
--- a/api/src/com/cloud/event/EventTypes.java
+++ b/api/src/com/cloud/event/EventTypes.java
@@ -331,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";
diff --git a/api/src/com/cloud/exception/RequestLimitException.java b/api/src/com/cloud/exception/RequestLimitException.java
index 0142f8e8726..ebaac802649 100644
--- a/api/src/com/cloud/exception/RequestLimitException.java
+++ b/api/src/com/cloud/exception/RequestLimitException.java
@@ -21,7 +21,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
/**
* Exception thrown if number of requests is over api rate limit set.
- * @author minc
*
*/
public class RequestLimitException extends CloudRuntimeException {
diff --git a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
index d52c36b12f5..aff81b0018d 100644
--- a/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
+++ b/api/src/com/cloud/hypervisor/HypervisorCapabilities.java
@@ -46,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/Network.java b/api/src/com/cloud/network/Network.java
index 2bf7b7f8000..e584e8de925 100644
--- a/api/src/com/cloud/network/Network.java
+++ b/api/src/com/cloud/network/Network.java
@@ -138,6 +138,7 @@ public interface Network extends ControlledEntity, StateObject, I
// 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);
private String name;
private boolean isExternal;
@@ -283,12 +284,21 @@ public interface Network extends ControlledEntity, StateObject, I
String getGateway();
+ // "cidr" is the Cloudstack managed address space, all CloudStack managed vms get IP address from "cidr",
+ // In general "cidr" also serves as the network CIDR
+ // But in case IP reservation is configured for a Guest network, "networkcidr" is the Effective network CIDR for that network,
+ // "cidr" will still continue to be the effective address space for CloudStack managed vms in that Guest network
String getCidr();
+ // "networkcidr" is the network CIDR of the guest network which uses IP reservation.
+ // It is the summation of "cidr" and the reservedIPrange(the address space used for non CloudStack purposes).
+ // For networks not configured with IP reservation, "networkcidr" is always null
+ String getNetworkCidr();
+
String getIp6Gateway();
-
+
String getIp6Cidr();
-
+
long getDataCenterId();
long getNetworkOfferingId();
diff --git a/api/src/com/cloud/network/NetworkModel.java b/api/src/com/cloud/network/NetworkModel.java
index 783e5cc9c85..9731a61667d 100644
--- a/api/src/com/cloud/network/NetworkModel.java
+++ b/api/src/com/cloud/network/NetworkModel.java
@@ -255,4 +255,6 @@ public interface NetworkModel {
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 37d46ac8395..2f56645139c 100644
--- a/api/src/com/cloud/network/NetworkProfile.java
+++ b/api/src/com/cloud/network/NetworkProfile.java
@@ -38,6 +38,7 @@ public class NetworkProfile implements Network {
private TrafficType trafficType;
private String gateway;
private String cidr;
+ private String networkCidr;
private String ip6Gateway;
private String ip6Cidr;
private long networkOfferingId;
@@ -65,6 +66,7 @@ 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();
@@ -162,6 +164,11 @@ public class NetworkProfile implements Network {
return cidr;
}
+ @Override
+ public String getNetworkCidr() {
+ return networkCidr;
+ }
+
@Override
public long getNetworkOfferingId() {
return networkOfferingId;
diff --git a/api/src/com/cloud/network/NetworkService.java b/api/src/com/cloud/network/NetworkService.java
index ace1bb6c45e..95bcc42b17a 100755
--- a/api/src/com/cloud/network/NetworkService.java
+++ b/api/src/com/cloud/network/NetworkService.java
@@ -66,10 +66,8 @@ public interface NetworkService {
IpAddress getIp(long id);
-
Network updateGuestNetwork(long networkId, String name, String displayText, Account callerAccount, User callerUser,
- String domainSuffix, Long networkOfferingId, Boolean changeCidr);
-
+ String domainSuffix, Long networkOfferingId, Boolean changeCidr, String guestVmCidr);
PhysicalNetwork createPhysicalNetwork(Long zoneId, String vnetRange, String networkSpeed,
List isolationMethods, String broadcastDomainRange, Long domainId, List tags, String name);
diff --git a/api/src/com/cloud/network/vpc/VpcService.java b/api/src/com/cloud/network/vpc/VpcService.java
index cc66b58fe64..9bf1beea5f0 100644
--- a/api/src/com/cloud/network/vpc/VpcService.java
+++ b/api/src/com/cloud/network/vpc/VpcService.java
@@ -41,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);
@@ -246,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/offering/ServiceOffering.java b/api/src/com/cloud/offering/ServiceOffering.java
index 4d715898a75..d6c215f42f0 100755
--- a/api/src/com/cloud/offering/ServiceOffering.java
+++ b/api/src/com/cloud/offering/ServiceOffering.java
@@ -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/resource/ResourceService.java b/api/src/com/cloud/resource/ResourceService.java
index 1e77cc8a4e2..08e2585d1a7 100755
--- a/api/src/com/cloud/resource/ResourceService.java
+++ b/api/src/com/cloud/resource/ResourceService.java
@@ -71,7 +71,7 @@ public interface ResourceService {
boolean deleteCluster(DeleteClusterCmd cmd);
- Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate);
+ Cluster updateCluster(Cluster cluster, String clusterType, String hypervisor, String allocationState, String managedstate,Float memoryOvercommitRatio, Float cpuOvercommitRatio);
List extends Host> discoverHosts(AddHostCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
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/Snapshot.java b/api/src/com/cloud/storage/Snapshot.java
index 3f6b8f5a8e4..f71265cd230 100644
--- a/api/src/com/cloud/storage/Snapshot.java
+++ b/api/src/com/cloud/storage/Snapshot.java
@@ -19,7 +19,6 @@ package com.cloud.storage;
import java.util.Date;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
-import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
@@ -55,28 +54,13 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
}
public enum State {
+ Allocated,
Creating,
CreatedOnPrimary,
BackingUp,
BackedUp,
Error;
- private final static StateMachine2 s_fsm = new StateMachine2();
-
- public static StateMachine2 getStateMachine() {
- return s_fsm;
- }
-
- static {
- s_fsm.addTransition(null, Event.CreateRequested, Creating);
- s_fsm.addTransition(Creating, Event.OperationSucceeded, CreatedOnPrimary);
- s_fsm.addTransition(Creating, Event.OperationNotPerformed, BackedUp);
- s_fsm.addTransition(Creating, Event.OperationFailed, Error);
- s_fsm.addTransition(CreatedOnPrimary, Event.BackupToSecondary, BackingUp);
- s_fsm.addTransition(BackingUp, Event.OperationSucceeded, BackedUp);
- s_fsm.addTransition(BackingUp, Event.OperationFailed, Error);
- }
-
public String toString() {
return this.name();
}
@@ -107,7 +91,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
Date getCreated();
- Type getType();
+ Type getRecurringType();
State getState();
diff --git a/api/src/com/cloud/storage/StoragePool.java b/api/src/com/cloud/storage/StoragePool.java
index f517927eac1..091eef182cc 100644
--- a/api/src/com/cloud/storage/StoragePool.java
+++ b/api/src/com/cloud/storage/StoragePool.java
@@ -99,10 +99,7 @@ public interface StoragePool extends Identity, InternalIdentity {
/**
* @return
*/
- String getStorageProvider();
-
- /**
- * @return
- */
- String getStorageType();
+ Long getStorageProviderId();
+
+ boolean isInMaintenance();
}
diff --git a/api/src/com/cloud/storage/StoragePoolStatus.java b/api/src/com/cloud/storage/StoragePoolStatus.java
index 94dd686a8f0..a35f706d702 100644
--- a/api/src/com/cloud/storage/StoragePoolStatus.java
+++ b/api/src/com/cloud/storage/StoragePoolStatus.java
@@ -17,11 +17,6 @@
package com.cloud.storage;
public enum StoragePoolStatus {
- Creating,
- 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 bd7dfd3a67a..63c5023ee91 100644
--- a/api/src/com/cloud/storage/StorageService.java
+++ b/api/src/com/cloud/storage/StorageService.java
@@ -22,17 +22,10 @@ import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaint
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.ResizeVolumeCmd;
-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{
/**
@@ -51,37 +44,6 @@ public interface StorageService{
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
UnknownHostException, ResourceUnavailableException;
- /**
- * Creates the database object for a volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
- * name)
- * @return the volume object
- * @throws PermissionDeniedException
- */
- Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
-
- /**
- * Creates the volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
- * name)
- * @return the volume object
- */
- Volume createVolume(CreateVolumeCmd cmd);
-
-
- /**
- * Resizes the volume based on the given criteria
- *
- * @param cmd
- * the API command wrapping the criteria
- * @return the volume object
- */
- Volume resizeVolume(ResizeVolumeCmd cmd);
-
/**
* Delete the storage pool
*
@@ -120,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/Volume.java b/api/src/com/cloud/storage/Volume.java
index 284c83d9e93..4903594f0af 100755
--- a/api/src/com/cloud/storage/Volume.java
+++ b/api/src/com/cloud/storage/Volume.java
@@ -39,9 +39,12 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
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"),
+ 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");
+ 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;
@@ -70,12 +73,15 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
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);
@@ -83,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);
}
}
@@ -110,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
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/template/TemplateService.java b/api/src/com/cloud/template/TemplateService.java
index 11475d46b8a..7e831fb0055 100755
--- a/api/src/com/cloud/template/TemplateService.java
+++ b/api/src/com/cloud/template/TemplateService.java
@@ -25,6 +25,7 @@ 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.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;
@@ -32,6 +33,8 @@ 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 {
@@ -87,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/vm/UserVmService.java b/api/src/com/cloud/vm/UserVmService.java
index fb574fa5848..ea89eda89d2 100755
--- a/api/src/com/cloud/vm/UserVmService.java
+++ b/api/src/com/cloud/vm/UserVmService.java
@@ -23,7 +23,6 @@ import javax.naming.InsufficientResourcesException;
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
import org.apache.cloudstack.api.command.admin.vm.RecoverVMCmd;
-import org.apache.cloudstack.api.command.user.template.CreateTemplateCmd;
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;
@@ -103,24 +102,6 @@ public interface UserVmService {
*/
UserVm resetVMSSHKey(ResetVMSSHKeyCmd cmd) throws ResourceUnavailableException, InsufficientCapacityException;
- /**
- * Attaches the specified volume to the specified VM
- *
- * @param cmd
- * - the command specifying volumeId and vmId
- * @return the Volume object if attach worked successfully.
- */
- Volume attachVolumeToVM(AttachVolumeCmd cmd);
-
- /**
- * Detaches the specified volume from the VM it is currently attached to.
- *
- * @param cmd
- * - the command specifying volumeId
- * @return the Volume object if detach worked successfully.
- */
- Volume detachVolumeFromVM(DetachVolumeCmd cmmd);
-
UserVm startVirtualMachine(StartVMCmd cmd) throws StorageUnavailableException, ExecutionException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException,
ResourceAllocationException;
@@ -151,28 +132,6 @@ public interface UserVmService {
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.
diff --git a/api/src/com/cloud/vm/VirtualMachine.java b/api/src/com/cloud/vm/VirtualMachine.java
index 248b98247e3..4300dd548c1 100755
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@ -112,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;
@@ -174,7 +174,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
OperationFailedToError,
OperationRetry,
AgentReportShutdowned,
- AgentReportMigrated
+ AgentReportMigrated,
+ RevertRequested,
+ SnapshotRequested
};
public enum Type {
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 0fab4436807..33a9171e732 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -136,4 +136,10 @@ public interface VirtualMachineProfile {
BootloaderType getBootLoaderType();
Map getParameters();
+
+ Float getCpuOvercommitRatio();
+
+ Float getMemoryOvercommitRatio();
+
+
}
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
new file mode 100644
index 00000000000..f0ee7ee7e8a
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshot.java
@@ -0,0 +1,110 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.vm.snapshot;
+
+import java.util.Date;
+
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import com.cloud.utils.fsm.StateMachine2;
+import com.cloud.utils.fsm.StateObject;
+
+public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity,StateObject {
+
+ enum State {
+ Allocated("The VM snapshot is allocated but has not been created yet."),
+ Creating("The VM snapshot is being created."),
+ Ready("The VM snapshot is ready to be used."),
+ Reverting("The VM snapshot is being used to revert"),
+ Expunging("The volume is being expunging"),
+ Removed("The volume is destroyed, and can't be recovered."),
+ Error ("The volume is in error state, and can't be recovered");
+
+ String _description;
+
+ private State(String description) {
+ _description = description;
+ }
+
+ public static StateMachine2 getStateMachine() {
+ return s_fsm;
+ }
+
+ public String getDescription() {
+ return _description;
+ }
+
+ private final static StateMachine2 s_fsm = new StateMachine2();
+ static {
+ s_fsm.addTransition(Allocated, Event.CreateRequested, Creating);
+ s_fsm.addTransition(Creating, Event.OperationSucceeded, Ready);
+ s_fsm.addTransition(Creating, Event.OperationFailed, Error);
+ s_fsm.addTransition(Ready, Event.RevertRequested, Reverting);
+ s_fsm.addTransition(Reverting, Event.OperationSucceeded, Ready);
+ s_fsm.addTransition(Reverting, Event.OperationFailed, Ready);
+ s_fsm.addTransition(Ready, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Error, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.ExpungeRequested, Expunging);
+ s_fsm.addTransition(Expunging, Event.OperationSucceeded, Removed);
+ }
+ }
+
+ enum Type{
+ Disk, DiskAndMemory
+ }
+
+ enum Event {
+ CreateRequested,
+ OperationFailed,
+ OperationSucceeded,
+ RevertRequested,
+ ExpungeRequested,
+ }
+
+ long getId();
+
+ public String getName();
+
+ public Long getVmId();
+
+ public State getState();
+
+ public Date getCreated();
+
+ public String getDescription();
+
+ public String getDisplayName();
+
+ public Long getParent();
+
+ public Boolean getCurrent();
+
+ public Type getType();
+
+ public long getUpdatedCount();
+
+ public void incrUpdatedCount();
+
+ public Date getUpdated();
+
+ public Date getRemoved();
+
+ public long getAccountId();
+}
diff --git a/api/src/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
new file mode 100644
index 00000000000..83f86bc90db
--- /dev/null
+++ b/api/src/com/cloud/vm/snapshot/VMSnapshotService.java
@@ -0,0 +1,48 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package com.cloud.vm.snapshot;
+
+import java.util.List;
+
+import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
+
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InsufficientServerCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.VirtualMachine;
+
+public interface VMSnapshotService {
+
+ List extends VMSnapshot> listVMSnapshots(ListVMSnapshotCmd cmd);
+
+ VMSnapshot getVMSnapshotById(Long id);
+
+ VMSnapshot creatVMSnapshot(Long vmId, Long vmSnapshotId);
+
+ VMSnapshot allocVMSnapshot(Long vmId, String vsDisplayName, String vsDescription, Boolean snapshotMemory)
+ throws ResourceAllocationException;
+
+ boolean deleteVMSnapshot(Long vmSnapshotId);
+
+ UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityException, InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException;
+
+ VirtualMachine getVMBySnapshotId(Long id);
+}
diff --git a/api/src/org/apache/cloudstack/api/ApiConstants.java b/api/src/org/apache/cloudstack/api/ApiConstants.java
index d29408e66f2..8b4bb98e06c 100755
--- a/api/src/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/org/apache/cloudstack/api/ApiConstants.java
@@ -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";
@@ -119,6 +120,7 @@ public class ApiConstants {
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MEMORY = "memory";
+ public static final String MEMORY_OVERCOMMIT_RATIO="memoryovercommitratio";
public static final String MODE = "mode";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
@@ -218,6 +220,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";
@@ -438,6 +441,15 @@ public class ApiConstants {
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 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
index ee28fa05878..69bd0284cef 100644
--- a/api/src/org/apache/cloudstack/api/ApiErrorCode.java
+++ b/api/src/org/apache/cloudstack/api/ApiErrorCode.java
@@ -18,7 +18,6 @@ package org.apache.cloudstack.api;
/**
* Enum class for various API error code used in CloudStack
- * @author minc
*
*/
public enum ApiErrorCode {
diff --git a/api/src/org/apache/cloudstack/api/BaseCmd.java b/api/src/org/apache/cloudstack/api/BaseCmd.java
index a9ac489671b..816b6deed77 100644
--- a/api/src/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/org/apache/cloudstack/api/BaseCmd.java
@@ -62,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;
@@ -69,8 +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.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());
@@ -101,6 +102,7 @@ public abstract class BaseCmd {
@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;
@@ -128,6 +130,7 @@ public abstract class BaseCmd {
@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;
diff --git a/api/src/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
index 0dc85de1647..267238af37b 100644
--- a/api/src/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/org/apache/cloudstack/api/ResponseGenerator.java
@@ -88,6 +88,7 @@ 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;
@@ -163,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);
@@ -381,5 +383,6 @@ public interface ResponseGenerator {
UsageRecordResponse createUsageResponse(Usage usageRecord);
- TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
+ 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 682e5b7e774..4b0fae58548 100644
--- a/api/src/org/apache/cloudstack/api/ServerApiException.java
+++ b/api/src/org/apache/cloudstack/api/ServerApiException.java
@@ -43,7 +43,7 @@ public class ServerApiException extends CloudRuntimeException {
super(description, cause);
_errorCode = errorCode;
_description = description;
- if (cause instanceof CloudRuntimeException || cause instanceof CloudException ) {
+ if (cause instanceof CloudRuntimeException) {
CloudRuntimeException rt = (CloudRuntimeException) cause;
ArrayList idList = rt.getIdProxyList();
if (idList != null) {
@@ -52,6 +52,15 @@ public class ServerApiException extends CloudRuntimeException {
}
}
setCSErrorCode(rt.getCSErrorCode());
+ } else if (cause instanceof CloudException) {
+ CloudException rt = (CloudException) cause;
+ ArrayList idList = rt.getIdProxyList();
+ if (idList != null) {
+ for (int i = 0; i < idList.size(); i++) {
+ addProxyObject(idList.get(i));
+ }
+ }
+ setCSErrorCode(rt.getCSErrorCode());
}
}
diff --git a/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java b/api/src/org/apache/cloudstack/api/command/admin/cluster/AddClusterCmd.java
index 912c396bf4f..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,6 +20,10 @@ 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;
@@ -81,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;
}
@@ -147,9 +157,26 @@ public class AddClusterCmd extends BaseCmd {
this.allocationState = allocationState;
}
+ public Float getCpuOvercommitRatio (){
+ if(cpuovercommitRatio != null){
+ return Float.parseFloat(cpuovercommitRatio);
+ }
+ return 1.0f;
+ }
+
+ public Float getMemoryOvercommitRaito (){
+ if (memoryovercommitratio != null){
+ return Float.parseFloat(memoryovercommitratio);
+ }
+ return 1.0f;
+ }
+
@Override
public void execute(){
try {
+ if ((getMemoryOvercommitRaito().compareTo(1f) < 0) | (getCpuOvercommitRatio().compareTo(1f) < 0)) {
+ throw new InvalidParameterValueException("Cpu and ram overcommit ratios should not be less than 1");
+ }
List extends Cluster> result = _resourceService.discoverCluster(this);
ListResponse response = new ListResponse();
List clusterResponses = new ArrayList();
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 058c7ebc952..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
@@ -54,6 +54,13 @@ public class UpdateClusterCmd extends BaseCmd {
@Parameter(name=ApiConstants.MANAGED_STATE, type=CommandType.STRING, description="whether this cluster is managed by cloudstack")
private String managedState;
+ @Parameter(name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of cpu overcommit ratio")
+ private String cpuovercommitratio;
+
+ @Parameter(name=ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, description = "Value of ram overcommit ratio")
+ private String memoryovercommitratio;
+
+
public String getClusterName() {
return clusterName;
}
@@ -100,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());
@@ -107,7 +128,11 @@ 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());
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 fbe8ab000e6..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
@@ -31,6 +31,7 @@ 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/offering/CreateServiceOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/offering/CreateServiceOfferingCmd.java
index ee1e1b20bfc..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
@@ -59,6 +59,9 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Parameter(name=ApiConstants.LIMIT_CPU_USE, type=CommandType.BOOLEAN, description="restrict the CPU usage to committed service offering")
private Boolean limitCpuUse;
+ @Parameter(name=ApiConstants.IS_VOLATILE, type=CommandType.BOOLEAN, description="true if the virtual machine needs to be volatile so that on every reboot of VM, original root disk is dettached then destroyed and a fresh root disk is created and attached to VM")
+ private Boolean isVolatile;
+
@Parameter(name=ApiConstants.STORAGE_TYPE, type=CommandType.STRING, description="the storage type of the service offering. Values are local and shared.")
private String storageType;
@@ -106,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() {
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 c2cde163eba..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
@@ -22,8 +22,8 @@ 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.DomainRouterResponse;
+import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.log4j.Logger;
import com.cloud.network.router.VirtualRouter;
@@ -42,7 +42,7 @@ public class UpgradeRouterCmd extends BaseCmd {
required=true, description="The ID of the router")
private Long id;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType = ServiceOfferingResponse.class,
required=true, description="the service offering ID to apply to the domain router")
private Long serviceOfferingId;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/CreateStoragePoolCmd.java
index a3497a89f98..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
@@ -36,6 +36,7 @@ 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 {
@@ -70,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 ///////////////////////
@@ -102,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///////////////////
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 a70d927f020..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
@@ -23,7 +23,7 @@ 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;
@@ -48,7 +48,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
required=true, description="The ID of the system vm")
private Long id;
- @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=DiskOfferingResponse.class,
+ @Parameter(name=ApiConstants.SERVICE_OFFERING_ID, type=CommandType.UUID, entityType=ServiceOfferingResponse.class,
required=true, description="the service offering ID to apply to the system vm")
private Long serviceOfferingId;
diff --git a/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java b/api/src/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java
index f08cb16b23d..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,7 +16,7 @@
// under the License.
package org.apache.cloudstack.api.command.admin.vpc;
-import java.util.List;
+import java.util.*;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@@ -52,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 ///////////////////////
/////////////////////////////////////////////////////
@@ -68,10 +72,33 @@ 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());
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 ecfd8df0ceb..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
@@ -26,7 +26,7 @@ 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;
@@ -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;
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 a4a37c8fd58..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
@@ -88,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 ///////////////////////
@@ -140,6 +144,10 @@ public class RegisterIsoCmd extends BaseCmd {
public String getChecksum() {
return checksum;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
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 5ec7cefb052..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
@@ -268,10 +268,6 @@ public class CreateNetworkCmd extends BaseCmd {
@Override
// an exception thrown by createNetwork() will be caught by the dispatcher.
public void execute() throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException{
- if (getStartIpv6() != null && getStartIp() != null) {
- throw new InvalidParameterValueException("Cannot support dualstack at this moment!");
- }
-
Network result = _networkService.createGuestNetwork(this);
if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result);
diff --git a/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java b/api/src/org/apache/cloudstack/api/command/user/network/UpdateNetworkCmd.java
index 67774075774..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
@@ -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) {
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 91728ee9cf6..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
@@ -53,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,
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 33f2574d3e1..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
@@ -54,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;
/////////////////////////////////////////////////////
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 84fa197d12c..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
@@ -240,7 +240,7 @@ import com.cloud.user.UserContext;
@Override
public void create() throws ResourceAllocationException {
VirtualMachineTemplate template = null;
- template = _userVmService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
+ template = this._templateService.createPrivateTemplateRecord(this, _accountService.getAccount(getEntityOwnerId()));
if (template != null) {
this.setEntityId(template.getId());
this.setEntityUuid(template.getUuid());
@@ -255,7 +255,7 @@ import com.cloud.user.UserContext;
public void execute() {
UserContext.current().setEventDetails("Template Id: "+getEntityId()+((getSnapshotId() == null) ? " from volume Id: " + getVolumeId() : " from snapshot Id: " + getSnapshotId()));
VirtualMachineTemplate template = null;
- template = _userVmService.createPrivateTemplate(this);
+ template = this._templateService.createPrivateTemplate(this);
if (template != null){
List templateResponses;
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 3e98ca624ab..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
@@ -110,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;
@@ -189,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()) {
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 70a263d06d2..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
@@ -306,9 +306,6 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
if (requestedIpv6 != null) {
requestedIpv6 = requestedIpv6.toLowerCase();
}
- if (requestedIpv6 != null) {
- throw new InvalidParameterValueException("Cannot support specified IPv6 address!");
- }
IpAddresses addrs = new IpAddresses(requestedIp, requestedIpv6);
ipToNetworkMap.put(networkId, addrs);
}
@@ -388,7 +385,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
- s_logger.trace(ex);
+ s_logger.info(ex.getMessage(), ex);
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
}
} else {
@@ -407,10 +404,6 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException{
try {
- if (getIp6Address() != null) {
- throw new InvalidParameterValueException("Cannot support specified IPv6 address!");
- }
-
//Verify that all objects exist before passing them to the service
Account owner = _accountService.getActiveAccountById(getEntityOwnerId());
@@ -477,7 +470,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
}
} catch (InsufficientCapacityException ex) {
s_logger.info(ex);
- s_logger.trace(ex);
+ s_logger.trace(ex.getMessage(), ex);
throw new ServerApiException(ApiErrorCode.INSUFFICIENT_CAPACITY_ERROR, ex.getMessage());
} catch (ResourceUnavailableException ex) {
s_logger.warn("Exception: ", ex);
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 e98c2f2eddc..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
@@ -22,6 +22,7 @@ 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;
@@ -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;
@@ -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/vmsnapshot/CreateVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
new file mode 100644
index 00000000000..f0dbf16b250
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/CreateVMSnapshotCmd.java
@@ -0,0 +1,125 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCreateCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "createVMSnapshot", description = "Creates snapshot for a vm.", responseObject = VMSnapshotResponse.class)
+public class CreateVMSnapshotCmd extends BaseAsyncCreateCmd {
+
+ public static final Logger s_logger = Logger
+ .getLogger(CreateVMSnapshotCmd.class.getName());
+ private static final String s_name = "createvmsnapshotresponse";
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, required = true, entityType=UserVmResponse.class, description = "The ID of the vm")
+ private Long vmId;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_DESCRIPTION, type = CommandType.STRING, required = false, description = "The discription of the snapshot")
+ private String description;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_DISPLAYNAME, type = CommandType.STRING, required = false, description = "The display name of the snapshot")
+ private String displayName;
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_MEMORY, type = CommandType.BOOLEAN, required = false, description = "snapshot memory if true")
+ private Boolean snapshotMemory;
+
+ public Boolean snapshotMemory() {
+ if (snapshotMemory == null) {
+ return false;
+ } else {
+ return snapshotMemory;
+ }
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ @Override
+ public void create() throws ResourceAllocationException {
+ VMSnapshot vmsnapshot = _vmSnapshotService.allocVMSnapshot(getVmId(),getDisplayName(),getDescription(),snapshotMemory());
+ if (vmsnapshot != null) {
+ this.setEntityId(vmsnapshot.getId());
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
+ "Failed to create vm snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "creating snapshot for VM: " + getVmId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_CREATE;
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("VM Id: " + getVmId());
+ VMSnapshot result = _vmSnapshotService.creatVMSnapshot(getVmId(),getEntityId());
+ if (result != null) {
+ VMSnapshotResponse response = _responseGenerator
+ .createVMSnapshotResponse(result);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(
+ ApiErrorCode.INTERNAL_ERROR,
+ "Failed to create vm snapshot due to an internal error creating snapshot for vm "
+ + getVmId());
+ }
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ UserVm userVM = _userVmService.getUserVm(vmId);
+ return userVM.getAccountId();
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
new file mode 100644
index 00000000000..a2b2c08b381
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/DeleteVMSnapshotCmd.java
@@ -0,0 +1,85 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+import org.apache.log4j.Logger;
+
+import com.cloud.event.EventTypes;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name="deleteVMSnapshot", description = "Deletes a vmsnapshot.", responseObject = SuccessResponse.class)
+public class DeleteVMSnapshotCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(DeleteVMSnapshotCmd.class.getName());
+ private static final String s_name = "deletevmsnapshotresponse";
+
+ @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class,
+ required=true, description="The ID of the VM snapshot")
+ private Long id;
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getId());
+ if (vmSnapshot != null) {
+ return vmSnapshot.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() {
+ UserContext.current().setEventDetails("vmsnapshot id: " + getId());
+ boolean result = _vmSnapshotService.deleteVMSnapshot(getId());
+ if (result) {
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete vm snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Delete VM snapshot: " + getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_DELETE;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
new file mode 100644
index 00000000000..936d348950d
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/ListVMSnapshotCmd.java
@@ -0,0 +1,89 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name="listVMSnapshot", description = "List virtual machine snapshot by conditions", responseObject = VMSnapshotResponse.class)
+public class ListVMSnapshotCmd extends BaseListTaggedResourcesCmd {
+
+ private static final String s_name = "listvmsnapshotresponse";
+
+ @Parameter(name=ApiConstants.VM_SNAPSHOT_ID, type=CommandType.UUID, entityType=VMSnapshotResponse.class,
+ description="The ID of the VM snapshot")
+ private Long id;
+
+ @Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="state of the virtual machine snapshot")
+ private String state;
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType=UserVmResponse.class, description = "the ID of the vm")
+ private Long vmId;
+
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "lists snapshot by snapshot name or display name")
+ private String vmSnapshotName;
+
+ public String getState() {
+ return state;
+ }
+
+ public String getVmSnapshotName() {
+ return vmSnapshotName;
+ }
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ @Override
+ public void execute() {
+ List extends VMSnapshot> result = _vmSnapshotService
+ .listVMSnapshots(this);
+ ListResponse response = new ListResponse();
+ List snapshotResponses = new ArrayList();
+ for (VMSnapshot r : result) {
+ VMSnapshotResponse vmSnapshotResponse = _responseGenerator
+ .createVMSnapshotResponse(r);
+ vmSnapshotResponse.setObjectName("vmSnapshot");
+ snapshotResponses.add(vmSnapshotResponse);
+ }
+ response.setResponses(snapshotResponses);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
new file mode 100644
index 00000000000..d7b4599d6c4
--- /dev/null
+++ b/api/src/org/apache/cloudstack/api/command/user/vmsnapshot/RevertToSnapshotCmd.java
@@ -0,0 +1,92 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+package org.apache.cloudstack.api.command.user.vmsnapshot;
+
+import java.util.logging.Logger;
+
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.api.response.VMSnapshotResponse;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.user.Account;
+import com.cloud.user.UserContext;
+import com.cloud.uservm.UserVm;
+import com.cloud.vm.snapshot.VMSnapshot;
+
+@APICommand(name = "revertToSnapshot",description = "Revert VM from a vmsnapshot.", responseObject = UserVmResponse.class)
+public class RevertToSnapshotCmd extends BaseAsyncCmd {
+ public static final Logger s_logger = Logger
+ .getLogger(RevertToSnapshotCmd.class.getName());
+ private static final String s_name = "reverttosnapshotresponse";
+
+ @Parameter(name = ApiConstants.VM_SNAPSHOT_ID, type = CommandType.UUID, required = true,entityType=VMSnapshotResponse.class,description = "The ID of the vm snapshot")
+ private Long vmSnapShotId;
+
+ public Long getVmSnapShotId() {
+ return vmSnapShotId;
+ }
+
+ @Override
+ public String getCommandName() {
+ return s_name;
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ VMSnapshot vmSnapshot = _entityMgr.findById(VMSnapshot.class, getVmSnapShotId());
+ if (vmSnapshot != null) {
+ return vmSnapshot.getAccountId();
+ }
+ return Account.ACCOUNT_ID_SYSTEM;
+ }
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ResourceAllocationException, ConcurrentOperationException {
+ UserContext.current().setEventDetails(
+ "vmsnapshot id: " + getVmSnapShotId());
+ UserVm result = _vmSnapshotService.revertToSnapshot(getVmSnapShotId());
+ if (result != null) {
+ UserVmResponse response = _responseGenerator.createUserVmResponse(
+ "virtualmachine", result).get(0);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
+ } else {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,"Failed to revert VM snapshot");
+ }
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Revert from VM snapshot: " + getVmSnapShotId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_SNAPSHOT_REVERT;
+ }
+
+}
diff --git a/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java b/api/src/org/apache/cloudstack/api/command/user/volume/AttachVolumeCmd.java
index 4d82534c2b2..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
@@ -119,7 +119,7 @@ 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());
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 2f77862b3b9..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
@@ -153,7 +153,7 @@ 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());
@@ -165,7 +165,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCmd {
@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
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 39c3de3fac9..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
@@ -80,7 +80,7 @@ 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);
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 6153e17448b..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
@@ -130,7 +130,7 @@ 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");
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 d43ad5500e1..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
@@ -92,7 +92,7 @@ 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());
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
index 52863444507..955727a7d82 100644
--- a/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
@@ -133,7 +133,7 @@ public class ResizeVolumeCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Volume Id: " + getEntityId() + " to size " + getSize() + "G");
- Volume volume = _storageService.resizeVolume(this);
+ Volume volume = _volumeService.resizeVolume(this);
if (volume != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(volume);
//FIXME - have to be moved to ApiResponseHelper
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 107d938b106..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
@@ -67,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 ///////////////////////
@@ -99,6 +103,10 @@ public class UploadVolumeCmd extends BaseAsyncCmd {
public String getChecksum() {
return checksum;
}
+
+ public String getImageStoreUuid() {
+ return this.imageStoreUuid;
+ }
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
@@ -110,7 +118,7 @@ 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());
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 71d134bb149..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
@@ -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 /////////////////////
diff --git a/api/src/org/apache/cloudstack/api/response/AccountResponse.java b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
index 0277d5b6fe9..9a98a356492 100644
--- a/api/src/org/apache/cloudstack/api/response/AccountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/AccountResponse.java
@@ -132,6 +132,24 @@ public class AccountResponse extends BaseResponse {
@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/ClusterResponse.java b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
index 551e530cc38..a90acde6145 100644
--- a/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ClusterResponse.java
@@ -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/LDAPConfigResponse.java b/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java
index aa10229f2bd..bbeec630d81 100644
--- a/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/LDAPConfigResponse.java
@@ -30,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/NetworkResponse.java b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
index 7b29efbf4d9..cd32dede3c8 100644
--- a/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/NetworkResponse.java
@@ -52,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;
@@ -289,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;
}
diff --git a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
index 9d4f6c5aad2..a7fbbf2630b 100644
--- a/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ResourceCountResponse.java
@@ -40,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 beead247b23..b444e7a68a7 100644
--- a/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/ResourceLimitResponse.java
@@ -36,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/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/query/QueryService.java b/api/src/org/apache/cloudstack/query/QueryService.java
index bfe7b855c81..c3f86aabb7f 100644
--- a/api/src/org/apache/cloudstack/query/QueryService.java
+++ b/api/src/org/apache/cloudstack/query/QueryService.java
@@ -58,7 +58,6 @@ import com.cloud.exception.PermissionDeniedException;
/**
* Service used for list api query.
- * @author minc
*
*/
public interface QueryService {
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 7836b6d6e8e..71004977d89 100644
--- a/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
+++ b/api/test/org/apache/cloudstack/api/agent/test/BackupSnapshotCommandTest.java
@@ -133,15 +133,15 @@ public class BackupSnapshotCommandTest {
}
@Override
- public String getStorageProvider() {
+ public Long getStorageProviderId() {
// TODO Auto-generated method stub
return null;
}
@Override
- public String getStorageType() {
+ public boolean isInMaintenance() {
// TODO Auto-generated method stub
- return null;
+ return false;
};
};
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 3545d0f1c29..767d7c37c5e 100644
--- a/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
+++ b/api/test/org/apache/cloudstack/api/agent/test/SnapshotCommandTest.java
@@ -115,16 +115,16 @@ public class SnapshotCommandTest {
}
@Override
- public String getStorageProvider() {
+ public Long getStorageProviderId() {
// TODO Auto-generated method stub
return null;
}
- @Override
- public String getStorageType() {
- // TODO Auto-generated method stub
- return null;
- };
+ @Override
+ public boolean isInMaintenance() {
+ // TODO Auto-generated method stub
+ return false;
+ };
};
SnapshotCommand ssc = new SnapshotCommand(pool,
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
index 7f5540fa4d3..852e52b1b86 100644
--- a/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
+++ b/api/test/src/com/cloud/agent/api/test/ResizeVolumeCommandTest.java
@@ -134,15 +134,15 @@ public class ResizeVolumeCommandTest {
}
@Override
- public String getStorageProvider() {
+ public Long getStorageProviderId() {
// TODO Auto-generated method stub
return null;
}
@Override
- public String getStorageType() {
+ public boolean isInMaintenance() {
// TODO Auto-generated method stub
- return null;
+ return false;
};
};
diff --git a/awsapi/pom.xml b/awsapi/pom.xml
index 5a0ad7b0cb4..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
diff --git a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
index 5d151bac7e4..29a002cebaf 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2RestServlet.java
@@ -707,12 +707,20 @@ public class EC2RestServlet extends HttpServlet {
else break;
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
- if ( null != fromPort && 0 < fromPort.length)
- perm.setFromPort( Integer.parseInt( fromPort[0]));
+ if ( null != fromPort && 0 < fromPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpType( fromPort[0] ) ;
+ else
+ perm.setFromPort( Integer.parseInt( fromPort[0]) );
+ }
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
- if ( null != toPort && 0 < toPort.length)
- perm.setToPort( Integer.parseInt( toPort[0]));
+ if ( null != toPort && 0 < toPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpCode( toPort[0] );
+ else
+ perm.setToPort( Integer.parseInt( toPort[0]) );
+ }
// -> list: IpPermissions.n.IpRanges.m.CidrIp
mCount = 1;
@@ -780,12 +788,20 @@ public class EC2RestServlet extends HttpServlet {
else break;
String[] fromPort = request.getParameterValues( "IpPermissions." + nCount + ".FromPort" );
- if ( null != fromPort && 0 < fromPort.length)
- perm.setFromPort( Integer.parseInt( fromPort[0]));
+ if ( null != fromPort && 0 < fromPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpType( fromPort[0] ) ;
+ else
+ perm.setFromPort( Integer.parseInt( fromPort[0]) );
+ }
String[] toPort = request.getParameterValues( "IpPermissions." + nCount + ".ToPort" );
- if ( null != toPort && 0 < toPort.length)
- perm.setToPort( Integer.parseInt( toPort[0]));
+ if ( null != toPort && 0 < toPort.length ) {
+ if ( protocol[0].equalsIgnoreCase("icmp") )
+ perm.setIcmpCode( toPort[0] );
+ else
+ perm.setToPort( Integer.parseInt( toPort[0]) );
+ }
// -> list: IpPermissions.n.IpRanges.m.CidrIp
int mCount = 1;
@@ -1142,14 +1158,26 @@ public class EC2RestServlet extends HttpServlet {
else { response.sendError(530, "Missing ImageId parameter" ); return; }
String[] minCount = request.getParameterValues( "MinCount" );
- if ( null != minCount && 0 < minCount.length )
- EC2request.setMinCount( Integer.parseInt( minCount[0] ));
- else { response.sendError(530, "Missing MinCount parameter" ); return; }
+ if ( minCount == null || minCount.length < 1) {
+ response.sendError(530, "Missing MinCount parameter" );
+ return;
+ } else if ( Integer.parseInt(minCount[0]) < 1) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Value of parameter MinCount should be greater than 0");
+ } else {
+ EC2request.setMinCount( Integer.parseInt( minCount[0]) );
+ }
String[] maxCount = request.getParameterValues( "MaxCount" );
- if ( null != maxCount && 0 < maxCount.length )
- EC2request.setMaxCount( Integer.parseInt( maxCount[0] ));
- else { response.sendError(530, "Missing MaxCount parameter" ); return; }
+ if ( maxCount == null || maxCount.length < 1) {
+ response.sendError(530, "Missing MaxCount parameter" );
+ return;
+ } else if ( Integer.parseInt(maxCount[0]) < 1) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Value of parameter MaxCount should be greater than 0");
+ } else {
+ EC2request.setMaxCount( Integer.parseInt( maxCount[0]) );
+ }
String[] instanceType = request.getParameterValues( "InstanceType" );
if ( null != instanceType && 0 < instanceType.length )
@@ -1257,6 +1285,11 @@ public class EC2RestServlet extends HttpServlet {
}
if (0 == count) { response.sendError(530, "Missing InstanceId parameter" ); return; }
+ String[] force = request.getParameterValues("Force");
+ if ( force != null) {
+ EC2request.setForce( Boolean.parseBoolean(force[0]));
+ }
+
// -> execute the request
StopInstancesResponse EC2response = EC2SoapServiceImpl.toStopInstancesResponse( ServiceProvider.getInstance().getEC2Engine().stopInstances( EC2request ));
serializeResponse(response, EC2response);
@@ -1899,10 +1932,14 @@ public class EC2RestServlet extends HttpServlet {
String paramName = (String) params.nextElement();
// exclude the signature string obviously. ;)
if (paramName.equalsIgnoreCase("Signature")) continue;
+ // URLEncoder performs application/x-www-form-urlencoded-type encoding and not Percent encoding
+ // according to RFC 3986 as required by Amazon, we need to Percent-encode (URL Encode)
+ String encodedValue = URLEncoder.encode(request.getParameter(paramName), "UTF-8")
+ .replace("+", "%20").replace("*", "%2A");
if (queryString == null)
- queryString = paramName + "=" + URLEncoder.encode(request.getParameter(paramName), "UTF-8");
+ queryString = paramName + "=" + encodedValue;
else
- queryString = queryString + "&" + paramName + "=" + URLEncoder.encode(request.getParameter(paramName), "UTF-8");
+ queryString = queryString + "&" + paramName + "=" + encodedValue;
}
}
}
diff --git a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
index bf3c13eda9c..cebac0b159e 100644
--- a/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
+++ b/awsapi/src/com/cloud/bridge/service/EC2SoapServiceImpl.java
@@ -41,6 +41,7 @@ import com.cloud.bridge.service.core.ec2.EC2DescribeAvailabilityZones;
import com.cloud.bridge.service.core.ec2.EC2DescribeAvailabilityZonesResponse;
import com.cloud.bridge.service.core.ec2.EC2DescribeImageAttribute;
+import com.cloud.bridge.service.core.ec2.EC2AvailabilityZone;
import com.cloud.bridge.service.core.ec2.EC2DescribeImages;
import com.cloud.bridge.service.core.ec2.EC2DescribeImagesResponse;
import com.cloud.bridge.service.core.ec2.EC2DescribeInstances;
@@ -730,8 +731,17 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
EC2RunInstances request = new EC2RunInstances();
request.setTemplateId(rit.getImageId());
- request.setMinCount(rit.getMinCount());
- request.setMaxCount(rit.getMaxCount());
+
+ if (rit.getMinCount() < 1) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Value of parameter MinCount should be greater than 0");
+ } else request.setMinCount( rit.getMinCount() );
+
+ if (rit.getMaxCount() < 1) {
+ throw new EC2ServiceException(ClientError.InvalidParameterValue,
+ "Value of parameter MaxCount should be greater than 0");
+ } else request.setMaxCount(rit.getMaxCount());
+
if (null != type) request.setInstanceType(type);
if (null != prt) request.setZoneName(prt.getAvailabilityZone());
if (null != userData) request.setUserData(userData.getData());
@@ -763,6 +773,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
public StopInstancesResponse stopInstances(StopInstances stopInstances) {
EC2StopInstances request = new EC2StopInstances();
StopInstancesType sit = stopInstances.getStopInstances();
+ Boolean force = sit.getForce();
// -> toEC2StopInstances
InstanceIdSetType iist = sit.getInstancesSet();
@@ -770,6 +781,8 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
if (null != items) { // -> should not be empty
for( int i=0; i < items.length; i++ ) request.addInstanceId( items[i].getInstanceId());
}
+
+ if (force) request.setForce(sit.getForce());
return toStopInstancesResponse( engine.stopInstances( request ));
}
@@ -1289,7 +1302,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
param5.setInstanceId(vol.getInstanceId().toString());
String devicePath = engine.cloudDeviceIdToDevicePath( vol.getHypervisor(), vol.getDeviceId());
param5.setDevice( devicePath );
- param5.setStatus( toVolumeAttachmentState( vol.getInstanceId(), vol.getVMState()));
+ param5.setStatus(vol.getAttachmentState());
if (vol.getAttached() == null) {
param5.setAttachTime( cal );
} else {
@@ -1545,25 +1558,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
else if (cloudState.equalsIgnoreCase( "Expunging" )) return new String( "terminated");
else return new String( "running" );
}
-
- /**
- * We assume a state for the volume based on what its associated VM is doing.
- *
- * @param vmId
- * @param vmState
- * @return
- */
- public static String toVolumeAttachmentState(String instanceId, String vmState ) {
- if (null == instanceId || null == vmState) return "detached";
-
- if (vmState.equalsIgnoreCase( "Destroyed" )) return "detached";
- else if (vmState.equalsIgnoreCase( "Stopped" )) return "attached";
- else if (vmState.equalsIgnoreCase( "Running" )) return "attached";
- else if (vmState.equalsIgnoreCase( "Starting" )) return "attaching";
- else if (vmState.equalsIgnoreCase( "Stopping" )) return "attached";
- else if (vmState.equalsIgnoreCase( "Error" )) return "detached";
- else return "detached";
- }
+
public static StopInstancesResponse toStopInstancesResponse(EC2StopInstancesResponse engineResponse) {
StopInstancesResponse response = new StopInstancesResponse();
@@ -1775,14 +1770,18 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
DescribeAvailabilityZonesResponse response = new DescribeAvailabilityZonesResponse();
DescribeAvailabilityZonesResponseType param1 = new DescribeAvailabilityZonesResponseType();
AvailabilityZoneSetType param2 = new AvailabilityZoneSetType();
-
- String[] zones = engineResponse.getZoneSet();
- for (String zone : zones) {
+
+ EC2AvailabilityZone[] zones = engineResponse.getAvailabilityZoneSet();
+ for (EC2AvailabilityZone zone : zones) {
AvailabilityZoneItemType param3 = new AvailabilityZoneItemType();
- AvailabilityZoneMessageSetType param4 = new AvailabilityZoneMessageSetType();
- param3.setZoneName( zone );
+ param3.setZoneName( zone.getName() );
param3.setZoneState( "available" );
param3.setRegionName( "" );
+
+ AvailabilityZoneMessageSetType param4 = new AvailabilityZoneMessageSetType();
+ AvailabilityZoneMessageType param5 = new AvailabilityZoneMessageType();
+ param5.setMessage(zone.getMessage());
+ param4.addItem(param5);
param3.setMessageSet( param4 );
param2.addItem( param3 );
}
@@ -1803,10 +1802,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
param1.setVolumeId( engineResponse.getId().toString());
param1.setInstanceId( engineResponse.getInstanceId().toString());
param1.setDevice( engineResponse.getDevice());
- if ( null != engineResponse.getState())
- param1.setStatus( engineResponse.getState());
- else param1.setStatus( "" ); // ToDo - throw an Soap Fault
-
+ param1.setStatus(engineResponse.getAttachmentState());
param1.setAttachTime( cal );
param1.setRequestId( UUID.randomUUID().toString());
@@ -1823,10 +1819,7 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
param1.setVolumeId( engineResponse.getId().toString());
param1.setInstanceId( (null == engineResponse.getInstanceId() ? "" : engineResponse.getInstanceId().toString()));
param1.setDevice( (null == engineResponse.getDevice() ? "" : engineResponse.getDevice()));
- if ( null != engineResponse.getState())
- param1.setStatus( engineResponse.getState());
- else param1.setStatus( "" ); // ToDo - throw an Soap Fault
-
+ param1.setStatus(engineResponse.getAttachmentState());
param1.setAttachTime( cal );
param1.setRequestId( UUID.randomUUID().toString());
@@ -1912,7 +1905,10 @@ public class EC2SoapServiceImpl implements AmazonEC2SkeletonInterface {
param3.setStartTime( cal );
param3.setOwnerId(ownerId);
- param3.setVolumeSize( snap.getVolumeSize().toString());
+ if ( snap.getVolumeSize() == null )
+ param3.setVolumeSize("0");
+ else
+ param3.setVolumeSize( snap.getVolumeSize().toString() );
param3.setDescription( snap.getName());
param3.setOwnerAlias( snap.getAccountName() );
diff --git a/server/src/com/cloud/baremetal/PxeServerResponse.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZone.java
similarity index 54%
rename from server/src/com/cloud/baremetal/PxeServerResponse.java
rename to awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZone.java
index 32fcc7fb5b9..457c6efd069 100644
--- a/server/src/com/cloud/baremetal/PxeServerResponse.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZone.java
@@ -14,22 +14,42 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-package com.cloud.baremetal;
+package com.cloud.bridge.service.core.ec2;
-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 EC2AvailabilityZone {
-public class PxeServerResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="the ID of the PXE server")
- private String id;
+ private String id;
+ private String name;
+ private String message;
- public String getId() {
- return id;
+ public EC2AvailabilityZone() {
+ id = null;
+ name = null;
+ message = null;
+ }
+
+ public void setId( String id ) {
+ this.id = id;
}
- public void setId(String id) {
- this.id = id;
+ public String getId() {
+ return this.id;
}
+
+ public void setName( String name ) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setMessage( String message ) {
+ this.message = message;
+ }
+
+ public String getMessage() {
+ return this.message;
+ }
+
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
index 994b721203a..aa3897a4bf6 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2AvailabilityZonesFilterSet.java
@@ -36,6 +36,7 @@ public class EC2AvailabilityZonesFilterSet {
public EC2AvailabilityZonesFilterSet() {
// -> use these values to check that the proper filter is passed to this type of filter set
filterTypes.put( "zone-name", "String" );
+ filterTypes.put( "message", "String");
}
public void addFilter( EC2Filter param ) {
@@ -55,13 +56,14 @@ public class EC2AvailabilityZonesFilterSet {
return filterSet.toArray(new EC2Filter[0]);
}
- public List evaluate( EC2DescribeAvailabilityZonesResponse availabilityZones) throws ParseException {
- List resultList = new ArrayList();
+ public EC2DescribeAvailabilityZonesResponse evaluate( EC2DescribeAvailabilityZonesResponse availabilityZones)
+ throws ParseException {
+ EC2DescribeAvailabilityZonesResponse resultList = new EC2DescribeAvailabilityZonesResponse();
boolean matched;
EC2Filter[] filterSet = getFilterSet();
- for ( String availableZone : availabilityZones.getZoneSet() ) {
+ for ( EC2AvailabilityZone availableZone : availabilityZones.getAvailabilityZoneSet() ) {
matched = true;
if (filterSet != null) {
for (EC2Filter filter : filterSet) {
@@ -71,19 +73,22 @@ public class EC2AvailabilityZonesFilterSet {
}
}
}
- if (matched == true)
- resultList.add(availableZone);
+ if (matched)
+ resultList.addAvailabilityZone(availableZone);
}
return resultList;
}
- private boolean filterMatched( String availableZone, EC2Filter filter ) throws ParseException {
+ private boolean filterMatched( EC2AvailabilityZone availableZone, EC2Filter filter ) throws ParseException {
String filterName = filter.getName();
String[] valueSet = filter.getValueSet();
if ( filterName.equalsIgnoreCase("zone-name")) {
- return containsString(availableZone, valueSet);
- }
+ return containsString(availableZone.getName(), valueSet);
+ }
+ else if (filterName.equalsIgnoreCase("message")) {
+ return containsString(availableZone.getMessage(), valueSet);
+ }
return false;
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2DescribeAvailabilityZonesResponse.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2DescribeAvailabilityZonesResponse.java
index ae0c233f83f..f9bc6b66d83 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2DescribeAvailabilityZonesResponse.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2DescribeAvailabilityZonesResponse.java
@@ -20,31 +20,17 @@ import java.util.ArrayList;
import java.util.List;
public class EC2DescribeAvailabilityZonesResponse {
+ private List availabilityZoneSet = new ArrayList();
- private List zoneIds = new ArrayList();
- private List zoneNames = new ArrayList();
+ public EC2DescribeAvailabilityZonesResponse() {
+ }
+
+ public void addAvailabilityZone( EC2AvailabilityZone param ) {
+ availabilityZoneSet.add( param );
+ }
+
+ public EC2AvailabilityZone[] getAvailabilityZoneSet() {
+ return availabilityZoneSet.toArray(new EC2AvailabilityZone[0]);
+ }
- public EC2DescribeAvailabilityZonesResponse() {
- }
-
- public void addZone(String id, String name) {
- zoneIds.add(id);
- zoneNames.add(name);
- }
-
- /**
- * The Amazon API only cares about the names of zones not their ID value.
- *
- * @return an array containing a set of zone names
- */
- public String[] getZoneSet() {
- return zoneNames.toArray(new String[0]);
- }
-
- public String getZoneIdAt(int index) {
- if (zoneIds.isEmpty() || index >= zoneIds.size()) {
- return null;
- }
- return zoneIds.get(index);
- }
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
index b729f778ed3..e92f845f2b1 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Engine.java
@@ -25,9 +25,12 @@ import java.security.SignatureException;
import java.sql.SQLException;
import java.text.ParseException;
import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
+import java.util.Set;
import java.util.UUID;
import javax.inject.Inject;
@@ -443,25 +446,35 @@ public class EC2Engine extends ManagerBase {
*/
public EC2DescribeSnapshotsResponse handleRequest( EC2DescribeSnapshots request )
{
- EC2DescribeVolumesResponse volumes = new EC2DescribeVolumesResponse();
EC2SnapshotFilterSet sfs = request.getFilterSet();
EC2TagKeyValue[] tagKeyValueSet = request.getResourceTagSet();
try {
- // -> query to get the volume size for each snapshot
EC2DescribeSnapshotsResponse response = listSnapshots( request.getSnapshotSet(),
getResourceTags(tagKeyValueSet));
if (response == null) {
return new EC2DescribeSnapshotsResponse();
}
EC2Snapshot[] snapshots = response.getSnapshotSet();
- for (EC2Snapshot snap : snapshots) {
- volumes = listVolumes(snap.getVolumeId(), null, volumes, null);
- EC2Volume[] volSet = volumes.getVolumeSet();
- if (0 < volSet.length) snap.setVolumeSize(volSet[0].getSize());
- volumes.reset();
+ // -> query to get the volume size for each snapshot
+ HashMap volumeIdSize = new HashMap();
+ for( EC2Snapshot snap : snapshots ) {
+ Boolean duplicateVolume = false;
+ Long size = null;
+ if ( volumeIdSize.containsKey(snap.getVolumeId()) ) {
+ size = volumeIdSize.get(snap.getVolumeId());
+ duplicateVolume = true;
+ break;
+ }
+ if ( !duplicateVolume ) {
+ EC2DescribeVolumesResponse volumes = new EC2DescribeVolumesResponse();
+ volumes = listVolumes(snap.getVolumeId(), null, volumes, null);
+ EC2Volume[] volumeSet = volumes.getVolumeSet();
+ if (volumeSet.length > 0) size = volumeSet[0].getSize();
+ volumeIdSize.put(snap.getVolumeId(), size);
+ }
+ snap.setVolumeSize(size);
}
-
if ( null == sfs )
return response;
else return sfs.evaluate( response );
@@ -1060,12 +1073,8 @@ public class EC2Engine extends ManagerBase {
EC2AvailabilityZonesFilterSet azfs = request.getFilterSet();
if ( null == azfs )
return availableZones;
- else {
- List matchedAvailableZones = azfs.evaluate(availableZones);
- if (matchedAvailableZones.isEmpty())
- return new EC2DescribeAvailabilityZonesResponse();
- return listZones(matchedAvailableZones.toArray(new String[0]), null);
- }
+ else
+ return azfs.evaluate(availableZones);
} catch( EC2ServiceException error ) {
logger.error( "EC2 DescribeAvailabilityZones - ", error);
throw error;
@@ -1129,6 +1138,7 @@ public class EC2Engine extends ManagerBase {
resp.setState(vol.getState());
resp.setType(vol.getVolumeType());
resp.setVMState(vol.getVirtualMachineState());
+ resp.setAttachmentState(mapToAmazonVolumeAttachmentState(vol.getVirtualMachineState()));
resp.setZoneName(vol.getZoneName());
return resp;
}
@@ -1215,6 +1225,7 @@ public class EC2Engine extends ManagerBase {
resp.setState(vol.getState());
resp.setType(vol.getVolumeType());
resp.setVMState(vol.getVirtualMachineState());
+ resp.setAttachmentState("detached");
resp.setZoneName(vol.getZoneName());
return resp;
}
@@ -1412,47 +1423,53 @@ public class EC2Engine extends ManagerBase {
// now actually deploy the vms
for( int i=0; i < createInstances; i++ ) {
- CloudStackUserVm resp = getApi().deployVirtualMachine(svcOffering.getId(),
- request.getTemplateId(), zoneId, null, null, null, null,
- null, null, null, request.getKeyName(), null, (network != null ? network.getId() : null),
- null, constructList(request.getGroupSet()), request.getSize().longValue(), request.getUserData());
- EC2Instance vm = new EC2Instance();
- vm.setId(resp.getId().toString());
- vm.setName(resp.getName());
- vm.setZoneName(resp.getZoneName());
- vm.setTemplateId(resp.getTemplateId().toString());
- if (resp.getSecurityGroupList() != null && resp.getSecurityGroupList().size() > 0) {
- List securityGroupList = resp.getSecurityGroupList();
- for (CloudStackSecurityGroup securityGroup : securityGroupList) {
- EC2SecurityGroup param = new EC2SecurityGroup();
- param.setId(securityGroup.getId());
- param.setName(securityGroup.getName());
- vm.addGroupName(param);
+ try{
+ CloudStackUserVm resp = getApi().deployVirtualMachine(svcOffering.getId(),
+ request.getTemplateId(), zoneId, null, null, null, null,
+ null, null, null, request.getKeyName(), null, (network != null ? network.getId() : null),
+ null, constructList(request.getGroupSet()), request.getSize().longValue(), request.getUserData());
+ EC2Instance vm = new EC2Instance();
+ vm.setId(resp.getId().toString());
+ vm.setName(resp.getName());
+ vm.setZoneName(resp.getZoneName());
+ vm.setTemplateId(resp.getTemplateId().toString());
+ if (resp.getSecurityGroupList() != null && resp.getSecurityGroupList().size() > 0) {
+ List securityGroupList = resp.getSecurityGroupList();
+ for (CloudStackSecurityGroup securityGroup : securityGroupList) {
+ EC2SecurityGroup param = new EC2SecurityGroup();
+ param.setId(securityGroup.getId());
+ param.setName(securityGroup.getName());
+ vm.addGroupName(param);
+ }
}
- }
- vm.setState(resp.getState());
- vm.setCreated(resp.getCreated());
- List nicList = resp.getNics();
- for (CloudStackNic nic : nicList) {
- if (nic.getIsDefault()) {
- vm.setPrivateIpAddress(nic.getIpaddress());
- break;
+ vm.setState(resp.getState());
+ vm.setCreated(resp.getCreated());
+ List nicList = resp.getNics();
+ for (CloudStackNic nic : nicList) {
+ if (nic.getIsDefault()) {
+ vm.setPrivateIpAddress(nic.getIpaddress());
+ break;
+ }
}
+ vm.setIpAddress(resp.getIpAddress());
+ vm.setAccountName(resp.getAccountName());
+ vm.setDomainId(resp.getDomainId());
+ vm.setHypervisor(resp.getHypervisor());
+ vm.setServiceOffering( svcOffering.getName());
+ vm.setKeyPairName(resp.getKeyPairName());
+ instances.addInstance(vm);
+ countCreated++;
+ }catch(Exception e){
+ logger.error("Failed to deploy VM number: "+ (i+1) +" due to error: "+e.getMessage());
+ break;
}
- vm.setIpAddress(resp.getIpAddress());
- vm.setAccountName(resp.getAccountName());
- vm.setDomainId(resp.getDomainId());
- vm.setHypervisor(resp.getHypervisor());
- vm.setServiceOffering( svcOffering.getName());
- vm.setKeyPairName(resp.getKeyPairName());
- instances.addInstance(vm);
- countCreated++;
}
if (0 == countCreated) {
// TODO, we actually need to destroy left-over VMs when the exception is thrown
- throw new EC2ServiceException(ServerError.InsufficientInstanceCapacity, "Insufficient Instance Capacity" );
+ throw new EC2ServiceException(ServerError.InternalError, "Failed to deploy instances" );
}
+ logger.debug("Could deploy "+ countCreated + " VM's successfully");
return instances;
} catch( Exception e ) {
@@ -1514,6 +1531,7 @@ public class EC2Engine extends ManagerBase {
// -> first determine the current state of each VM (becomes it previous state)
try {
String[] instanceSet = request.getInstancesSet();
+ Boolean forced = request.getForce();
EC2DescribeInstancesResponse previousState = listVirtualMachines( instanceSet, null, null );
virtualMachines = previousState.getInstanceSet();
@@ -1535,7 +1553,7 @@ public class EC2Engine extends ManagerBase {
instances.addInstance(vm);
continue;
}
- resp = getApi().stopVirtualMachine(vm.getId(), false);
+ resp = getApi().stopVirtualMachine(vm.getId(), forced);
if(logger.isDebugEnabled())
logger.debug("Stopping VM " + vm.getId() + " job " + resp.getJobId());
}
@@ -1643,11 +1661,16 @@ public class EC2Engine extends ManagerBase {
ec2Vol.setSize(vol.getSize());
ec2Vol.setType(vol.getVolumeType());
- if(vol.getVirtualMachineId() != null)
+ if(vol.getVirtualMachineId() != null) {
ec2Vol.setInstanceId(vol.getVirtualMachineId());
+ if (vol.getVirtualMachineState() != null) {
+ ec2Vol.setVMState(vol.getVirtualMachineState());
+ ec2Vol.setAttachmentState(mapToAmazonVolumeAttachmentState(vol.getVirtualMachineState()));
+ }
+ } else {
+ ec2Vol.setAttachmentState("detached");
+ }
- if(vol.getVirtualMachineState() != null)
- ec2Vol.setVMState(vol.getVirtualMachineState());
ec2Vol.setZoneName(vol.getZoneName());
List resourceTags = vol.getTags();
@@ -1691,9 +1714,11 @@ public class EC2Engine extends ManagerBase {
zones = listZones(interestedZones, domainId);
- if (zones == null || zones.getZoneIdAt( 0 ) == null)
+ if (zones == null || zones.getAvailabilityZoneSet().length == 0)
throw new EC2ServiceException(ClientError.InvalidParameterValue, "Unknown zoneName value - " + zoneName);
- return zones.getZoneIdAt(0);
+
+ EC2AvailabilityZone[] zoneSet = zones.getAvailabilityZoneSet();
+ return zoneSet[0].getId();
}
@@ -1768,24 +1793,31 @@ public class EC2Engine extends ManagerBase {
*
* @return EC2DescribeAvailabilityZonesResponse
*/
- private EC2DescribeAvailabilityZonesResponse listZones(String[] interestedZones, String domainId) throws Exception
- {
+ private EC2DescribeAvailabilityZonesResponse listZones(String[] interestedZones, String domainId)
+ throws Exception {
EC2DescribeAvailabilityZonesResponse zones = new EC2DescribeAvailabilityZonesResponse();
List cloudZones = getApi().listZones(true, domainId, null, null);
-
- if(cloudZones != null) {
+ if(cloudZones != null && cloudZones.size() > 0) {
for(CloudStackZone cloudZone : cloudZones) {
- if ( null != interestedZones && 0 < interestedZones.length ) {
- for( int j=0; j < interestedZones.length; j++ ) {
- if (interestedZones[j].equalsIgnoreCase( cloudZone.getName())) {
- zones.addZone(cloudZone.getId().toString(), cloudZone.getName());
+ boolean matched = false;
+ if (interestedZones.length > 0) {
+ for (String zoneName : interestedZones){
+ if (zoneName.equalsIgnoreCase( cloudZone.getName())) {
+ matched = true;
break;
}
}
- } else {
- zones.addZone(cloudZone.getId().toString(), cloudZone.getName());
+ } else {
+ matched = true;
}
+ if (!matched) continue;
+ EC2AvailabilityZone ec2Zone = new EC2AvailabilityZone();
+ ec2Zone.setId(cloudZone.getId().toString());
+ ec2Zone.setMessage(cloudZone.getAllocationState());
+ ec2Zone.setName(cloudZone.getName());
+
+ zones.addAvailabilityZone(ec2Zone);
}
}
return zones;
@@ -1952,7 +1984,7 @@ public class EC2Engine extends ManagerBase {
* @throws ParserConfigurationException
* @throws ParseException
*/
- public EC2DescribeSecurityGroupsResponse listSecurityGroups( String[] interestedGroups ) throws Exception {
+ private EC2DescribeSecurityGroupsResponse listSecurityGroups( String[] interestedGroups ) throws Exception {
try {
EC2DescribeSecurityGroupsResponse groupSet = new EC2DescribeSecurityGroupsResponse();
@@ -2399,6 +2431,25 @@ public class EC2Engine extends ManagerBase {
return "error";
}
+ /**
+ * Map CloudStack VM state to Amazon volume attachment state
+ *
+ * @param CloudStack VM state
+ * @return Amazon Volume attachment state
+ */
+ private String mapToAmazonVolumeAttachmentState (String vmState) {
+ if ( vmState.equalsIgnoreCase("Running") || vmState.equalsIgnoreCase("Stopping") ||
+ vmState.equalsIgnoreCase("Stopped") ) {
+ return "attached";
+ }
+ else if (vmState.equalsIgnoreCase("Starting")) {
+ return "attaching";
+ }
+ else { // VM state is 'destroyed' or 'error' or other
+ return "detached";
+ }
+ }
+
/**
* Map Amazon resourceType to CloudStack resourceType
*
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
index e0aae7364d9..b5b7c7840df 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2InstanceFilterSet.java
@@ -50,6 +50,7 @@ public class EC2InstanceFilterSet {
filterTypes.put( "group-id", "string" );
filterTypes.put( "tag-key", "string" );
filterTypes.put( "tag-value", "string" );
+ filterTypes.put( "dns-name", "string" );
}
@@ -184,6 +185,8 @@ public class EC2InstanceFilterSet {
}
}
return false;
+ }else if (filterName.equalsIgnoreCase( "dns-name" )){
+ return containsString( vm.getName(), valueSet );
}
else return false;
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2StopInstances.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2StopInstances.java
index 13e23d1a51f..be140008019 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2StopInstances.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2StopInstances.java
@@ -23,6 +23,7 @@ public class EC2StopInstances {
private List instancesSet = new ArrayList(); // a list of strings identifying instances
private boolean destroyInstances; // we are destroying the instances rather than stopping them
+ private Boolean force = false;
public EC2StopInstances() {
destroyInstances = false;
@@ -43,5 +44,13 @@ public class EC2StopInstances {
public boolean getDestroyInstances() {
return this.destroyInstances;
}
+
+ public void setForce( Boolean force ) {
+ this.force = force;
+ }
+
+ public Boolean getForce() {
+ return this.force;
+ }
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Volume.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Volume.java
index 23d6d701646..79bc6e88911 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Volume.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2Volume.java
@@ -35,6 +35,7 @@ public class EC2Volume {
private String hypervisor;
private String created;
private String attached;
+ private String attachmentState;
private List tagsSet;
public EC2Volume() {
@@ -50,6 +51,7 @@ public class EC2Volume {
hypervisor = null;
created = null;
attached = null;
+ attachmentState = null;
tagsSet = new ArrayList();
}
@@ -236,6 +238,20 @@ public class EC2Volume {
this.attached = attached;
}
+ /**
+ * @param state of the attached VM to set
+ */
+ public void setAttachmentState(String attachedState) {
+ this.attachmentState = attachedState;
+ }
+
+ /**
+ * @return state of the vm
+ */
+ public String getAttachmentState() {
+ return attachmentState;
+ }
+
public void addResourceTag( EC2TagKeyValue param ) {
tagsSet.add( param );
}
diff --git a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
index 0594231413e..b8021f3d4ba 100644
--- a/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
+++ b/awsapi/src/com/cloud/bridge/service/core/ec2/EC2VolumeFilterSet.java
@@ -43,7 +43,7 @@ public class EC2VolumeFilterSet {
filterTypes.put( "attachment.delete-on-termination", "null" );
filterTypes.put( "attachment.device", "string" );
filterTypes.put( "attachment.instance-id", "string" );
- filterTypes.put( "attachment.status", "null" );
+ filterTypes.put( "attachment.status", "set:attached|attaching|detached|detaching" );
filterTypes.put( "availability-zone", "string" );
filterTypes.put( "create-time", "xsd:dateTime" );
filterTypes.put( "size", "integer" );
@@ -136,6 +136,9 @@ public class EC2VolumeFilterSet {
return containsDevice(vol.getDeviceId(), valueSet );
else if (filterName.equalsIgnoreCase( "attachment.instance-id" ))
return containsString(String.valueOf(vol.getInstanceId()), valueSet );
+ else if ( filterName.equalsIgnoreCase( "attachment.status" ) ) {
+ return containsString(vol.getAttachmentState(), valueSet );
+ }
else if (filterName.equalsIgnoreCase("tag-key"))
{
EC2TagKeyValue[] tagSet = vol.getResourceTags();
diff --git a/client/WEB-INF/classes/resources/messages.properties b/client/WEB-INF/classes/resources/messages.properties
index 9c4fcb35554..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
@@ -1410,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.
diff --git a/client/WEB-INF/web.xml b/client/WEB-INF/web.xml
index 0d75165659e..626305b82fa 100644
--- a/client/WEB-INF/web.xml
+++ b/client/WEB-INF/web.xml
@@ -19,6 +19,14 @@
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
diff --git a/client/pom.xml b/client/pom.xml
index 3651b79bbb3..d532a4248b1 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
@@ -90,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
@@ -229,9 +239,12 @@
-XX:MaxPermSize=512m -Xmx2g
- /client
${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/
+
@@ -255,6 +268,12 @@
+
+
+
+
+
+
@@ -267,13 +286,8 @@
-
-
-
-
-
+
+
@@ -368,8 +382,8 @@
test
+ match="classpath:componentContext.xml"
+ replace="classpath:nonossComponentContext.xml" byline="true" />
@@ -392,14 +406,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/commands.properties.in b/client/tomcatconf/commands.properties.in
index d70649bf318..f03e8d50adb 100644
--- a/client/tomcatconf/commands.properties.in
+++ b/client/tomcatconf/commands.properties.in
@@ -537,3 +537,12 @@ 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
index fc6c3e346c0..5f77cdab25c 100644
--- a/client/tomcatconf/componentContext.xml.in
+++ b/client/tomcatconf/componentContext.xml.in
@@ -44,7 +44,6 @@
-
@@ -53,6 +52,11 @@
+
+
+
+
+
@@ -186,7 +197,14 @@
-
+
+
+
+
@@ -210,10 +228,18 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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
index 57f7ad5516f..d862d4eab0b 100644
--- a/client/tomcatconf/nonossComponentContext.xml.in
+++ b/client/tomcatconf/nonossComponentContext.xml.in
@@ -58,18 +58,25 @@
-
+
+
+
+
+
-
-
+
+
-
-
+
+
+
+
+
@@ -136,6 +143,10 @@
+
+
+
+
@@ -201,10 +212,14 @@
-
+
+
+
+
+
@@ -232,11 +247,10 @@
-
+
-
@@ -282,14 +296,6 @@
-
-
-
-
-
-
-
-
@@ -298,6 +304,10 @@
+
+
+
+
diff --git a/client/tomcatconf/tomcat6-nonssl.conf.in b/client/tomcatconf/tomcat6-nonssl.conf.in
index d69d6ed94c0..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=256M"
+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 ecb93b23abc..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=256M"
+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/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/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/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/SnapshotVO.java b/core/src/com/cloud/storage/SnapshotVO.java
index 68336cb97ec..78b96ec9779 100644
--- a/core/src/com/cloud/storage/SnapshotVO.java
+++ b/core/src/com/cloud/storage/SnapshotVO.java
@@ -117,7 +117,7 @@ public class SnapshotVO implements Snapshot {
this.snapshotType = snapshotType;
this.typeDescription = typeDescription;
this.size = size;
- this.state = State.Creating;
+ this.state = State.Allocated;
this.prevSnapshotId = 0;
this.hypervisorType = hypervisorType;
this.version = "2.2";
@@ -175,7 +175,7 @@ public class SnapshotVO implements Snapshot {
}
@Override
- public Type getType() {
+ public Type getRecurringType() {
if (snapshotType < 0 || snapshotType >= Type.values().length) {
return null;
}
@@ -248,6 +248,7 @@ public class SnapshotVO implements Snapshot {
return state;
}
+
public void setState(State state) {
this.state = state;
}
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/StoragePoolVO.java b/core/src/com/cloud/storage/StoragePoolVO.java
deleted file mode 100644
index af6e4e2905c..00000000000
--- a/core/src/com/cloud/storage/StoragePoolVO.java
+++ /dev/null
@@ -1,346 +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.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.Id;
-import javax.persistence.Table;
-import javax.persistence.TableGenerator;
-import javax.persistence.Temporal;
-import javax.persistence.TemporalType;
-import javax.persistence.Transient;
-
-import com.cloud.storage.Storage.StoragePoolType;
-import com.cloud.utils.db.GenericDao;
-
-@Entity
-@Table(name="storage_pool")
-public class StoragePoolVO implements StoragePool {
- @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;
-
- @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)
- Date created;
-
- @Column(name=GenericDao.REMOVED_COLUMN)
- private Date removed;
-
- @Column(name="update_time", updatable=true)
- @Temporal(value=TemporalType.TIMESTAMP)
- private Date updateTime;
-
- @Column(name="data_center_id", updatable=true, nullable=false)
- private long dataCenterId;
-
- @Column(name="pod_id", updatable=true)
- private Long podId;
-
- @Column(name="available_bytes", updatable=true, nullable=true)
- private long availableBytes;
-
- @Column(name="capacity_bytes", updatable=true, nullable=true)
- private long capacityBytes;
-
- @Column(name="status", updatable=true, nullable=false)
- @Enumerated(value=EnumType.STRING)
- private StoragePoolStatus status;
-
- // TODO, disable persisency of storageProvider and storageType, javelin new code not
- // sync with the schema!
-
- // @Column(name="storage_provider", updatable=true, nullable=false)
- @Transient private String storageProvider;
-
- // Column(name="storage_type", nullable=false)
- @Transient private String storageType;
-
- @Override
- public long getId() {
- return id;
- }
-
- @Override
- public StoragePoolStatus getStatus() {
- return status;
- }
-
- public StoragePoolVO() {
- // TODO Auto-generated constructor stub
- }
-
- @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 String getStorageProvider() {
- return storageProvider;
- }
-
- public void setStorageProvider(String provider) {
- storageProvider = provider;
- }
-
- @Override
- public String getStorageType() {
- return storageType;
- }
-
- public void setStorageType(String type) {
- storageType = type;
- }
-
- @Override
- public long getCapacityBytes() {
- return capacityBytes;
- }
-
- public void setAvailableBytes(long available) {
- availableBytes = available;
- }
-
- public void setCapacityBytes(long capacity) {
- capacityBytes = capacity;
- }
-
- @Column(name="host_address")
- private String hostAddress;
-
- @Column(name="path")
- private String path;
-
- @Column(name="port")
- private int port;
-
- @Column(name="user_info")
- private String userInfo;
-
- @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;
- }
-
- @Override
- public String getUserInfo() {
- return userInfo;
- }
-
- public StoragePoolVO(long poolId, String name, String uuid, StoragePoolType type,
- long dataCenterId, Long podId, long availableBytes, long capacityBytes, String hostAddress, int port, String hostPath) {
- this.name = name;
- this.id = poolId;
- this.uuid = uuid;
- this.poolType = type;
- this.dataCenterId = dataCenterId;
- this.availableBytes = availableBytes;
- this.capacityBytes = capacityBytes;
- this.hostAddress = hostAddress;
- this.path = hostPath;
- this.port = port;
- this.podId = podId;
- this.setStatus(StoragePoolStatus.Creating);
- }
-
- 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.Creating);
- 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.Creating);
- this.uuid = UUID.randomUUID().toString();
- }
-
- 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;
- }
-
- 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;
- }
-
- @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
- 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();
- }
-
- @Override
- public String toString() {
- return new StringBuilder("Pool[").append(id).append("|").append(poolType).append("]").toString();
- }
-}
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 defc841e1e3..a287c26348b 100755
--- a/core/src/com/cloud/storage/VolumeVO.java
+++ b/core/src/com/cloud/storage/VolumeVO.java
@@ -32,11 +32,9 @@ 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")
@@ -69,7 +67,7 @@ public class VolumeVO implements Volume {
Long deviceId = null;
@Column(name = "size")
- long size;
+ Long size;
@Column(name = "folder")
String folder;
@@ -257,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;
}
diff --git a/core/src/com/cloud/vm/VirtualNetwork.java b/core/src/com/cloud/vm/VirtualNetwork.java
deleted file mode 100644
index ace3b80769f..00000000000
--- a/core/src/com/cloud/vm/VirtualNetwork.java
+++ /dev/null
@@ -1,72 +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.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;
-}
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/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/developer/developer-prefill.sql b/developer/developer-prefill.sql
index 8713d731645..6300d35df64 100644
--- a/developer/developer-prefill.sql
+++ b/developer/developer-prefill.sql
@@ -18,25 +18,25 @@
-- Add a default ROOT domain
use cloud;
-INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner, region_id) VALUES
- (1, UUID(), 'ROOT', NULL, '/', 2, 1);
+INSERT INTO `cloud`.`domain` (id, uuid, name, parent, path, owner) VALUES
+ (1, UUID(), 'ROOT', NULL, '/', 2);
-- Add system and admin accounts
-INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state, region_id) VALUES
- (1, UUID(), 'system', 1, 1, 'enabled', 1);
+INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES
+ (1, UUID(), 'system', 1, 1, 'enabled');
-INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state, region_id) VALUES
- (2, UUID(), 'admin', 1, 1, 'enabled', 1);
+INSERT INTO `cloud`.`account` (id, uuid, account_name, type, domain_id, state) VALUES
+ (2, UUID(), 'admin', 1, 1, 'enabled');
-- Add system user
INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname,
- lastname, email, state, created, region_id) VALUES (1, UUID(), 'system', RAND(),
- '1', 'system', 'cloud', NULL, 'enabled', NOW(), 1);
+ lastname, email, state, created) VALUES (1, UUID(), 'system', RAND(),
+ '1', 'system', 'cloud', NULL, 'enabled', NOW());
-- Add system user with encrypted password=password
INSERT INTO `cloud`.`user` (id, uuid, username, password, account_id, firstname,
- lastname, email, state, created, region_id) VALUES (2, UUID(), 'admin', '5f4dcc3b5aa765d61d8327deb882cf99',
- '2', 'Admin', 'User', 'admin@mailprovider.com', 'enabled', NOW(), 1);
+ lastname, email, state, created) VALUES (2, UUID(), 'admin', '5f4dcc3b5aa765d61d8327deb882cf99',
+ '2', 'Admin', 'User', 'admin@mailprovider.com', 'enabled', NOW());
-- Add configurations
INSERT INTO `cloud`.`configuration` (category, instance, component, name, value)
diff --git a/developer/pom.xml b/developer/pom.xml
index dba7b383d69..ff47b143093 100644
--- a/developer/pom.xml
+++ b/developer/pom.xml
@@ -18,7 +18,7 @@
org.apache.cloudstack
cloudstack
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
@@ -27,7 +27,12 @@
5.1.21
runtime
-
+
+ org.apache.cloudstack
+ cloud-plugin-hypervisor-simulator
+ ${project.version}
+ compile
+
install
@@ -130,7 +135,7 @@
- process-test-resources
+ process-resources
create-schema
java
@@ -152,10 +157,6 @@
${basedir}/target/db/create-schema.sql
${basedir}/target/db/create-schema-premium.sql
-
- ${basedir}/target/db/create-schema-view.sql
-
- ${basedir}/target/db/4.1-new-db-schema.sql
${basedir}/target/db/templates.sql
@@ -182,115 +183,9 @@
catalina.home
${project.parent.basedir}/utils
-
-
-
-
-
-
-
-
-
- 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
- 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-test-resources
- create-schema
-
- java
-
-
-
-
- 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-simulator.sql
- ${basedir}/target/db/templates.simulator.sql
-
- com.cloud.upgrade.DatabaseUpgradeChecker
- --database=simulator
- --rootpassword=${db.root.password}
-
-
-
- catalina.home
- ${project.parent.basedir}/utils
+ paths.script
+ ${basedir}/target/db
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/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/console-proxy.xml b/docs/en-US/console-proxy.xml
index 3dd7b9fd692..697ee2e2146 100644
--- a/docs/en-US/console-proxy.xml
+++ b/docs/en-US/console-proxy.xml
@@ -24,11 +24,11 @@
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
+ 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.
- .
+ 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.
diff --git a/docs/en-US/creating-network-offerings.xml b/docs/en-US/creating-network-offerings.xml
index 0269ce024cb..1f79fb166ce 100644
--- a/docs/en-US/creating-network-offerings.xml
+++ b/docs/en-US/creating-network-offerings.xml
@@ -22,146 +22,208 @@
under the License.
-->
- 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 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
- 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
-
-
- 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 .
- 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 System Service Offerings.
- 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 the 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.
-
-
-
+ 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/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/firewall-rules.xml b/docs/en-US/firewall-rules.xml
index 01d072bbcc4..837a4c6f9d0 100644
--- a/docs/en-US/firewall-rules.xml
+++ b/docs/en-US/firewall-rules.xml
@@ -3,53 +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.
-
- 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.
-
+ 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.
+
+
+ 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/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/ip-forwarding-firewalling.xml b/docs/en-US/ip-forwarding-firewalling.xml
index c154b078da3..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.
-
-
+ 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/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..242249040b1 100644
--- a/docs/en-US/management-server-install-db-local.xml
+++ b/docs/en-US/management-server-install-db-local.xml
@@ -98,12 +98,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.”
@@ -118,7 +123,7 @@ binlog-format = 'ROW'
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/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/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 b71e67f4199..c346bfb64e3 100644
--- a/docs/en-US/plugin-niciranvp-features.xml
+++ b/docs/en-US/plugin-niciranvp-features.xml
@@ -22,12 +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
+ In &PRODUCT; 4.0.0-incubating only the XenServer hypervisor is supported for use in
combination with Nicira NVP.
- In CloudStack 4.1.0-incubating both KVM and XenServer hypervisors are
+ In &PRODUCT; 4.1.0-incubating both KVM and XenServer hypervisors are
supported.
- In CloudStack 4.0.0-incubating the UI components for this plugin are not complete,
+ 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 86b795ccd0b..762c941fd13 100644
--- a/docs/en-US/plugin-niciranvp-preparations.xml
+++ b/docs/en-US/plugin-niciranvp-preparations.xml
@@ -23,7 +23,7 @@
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.
+ &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.
@@ -33,6 +33,6 @@
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-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/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/site-to-site-vpn.xml b/docs/en-US/site-to-site-vpn.xml
index 6570aabe0bd..a5899eac4f1 100644
--- a/docs/en-US/site-to-site-vpn.xml
+++ b/docs/en-US/site-to-site-vpn.xml
@@ -55,6 +55,9 @@
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.
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/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/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/working-with-system-vm.xml b/docs/en-US/working-with-system-vm.xml
index 97459f947bf..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.
-
-
-
-
-
+ 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.
+
+ 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/pot/verifying-source.pot b/docs/pot/verifying-source.pot
index 9c1effe6bf5..9b2d586aacf 100644
--- a/docs/pot/verifying-source.pot
+++ b/docs/pot/verifying-source.pot
@@ -40,7 +40,7 @@ msgstr ""
#. Tag: para
#, no-c-format
-msgid "To enable you to verify the GPG signature, you will need to download the KEYS file."
+msgid "To enable you to verify the GPG signature, you will need to download the KEYS file."
msgstr ""
#. Tag: para
diff --git a/engine/api/pom.xml b/engine/api/pom.xml
index cbb83e46add..7fc612f5d6c 100644
--- a/engine/api/pom.xml
+++ b/engine/api/pom.xml
@@ -16,7 +16,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
@@ -32,7 +32,7 @@
org.apache.cloudstack
- cloud-framework-ipc
+ cloud-framework-api
${project.version}
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
index 50d5444233b..fce7d82cb99 100644
--- 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
@@ -21,11 +21,11 @@ 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;
+ private Long clusterId;
+ private Long podId;
+ private Long zoneId;
- public ClusterScope(long clusterId, long podId, long zoneId) {
+ public ClusterScope(Long clusterId, Long podId, Long zoneId) {
this.clusterId = clusterId;
this.podId = podId;
this.zoneId = zoneId;
@@ -37,15 +37,15 @@ public class ClusterScope implements Scope {
}
@Override
- public long getScopeId() {
+ public Long getScopeId() {
return this.clusterId;
}
- public long getPodId() {
+ public Long getPodId() {
return this.podId;
}
- public long getZoneId() {
+ public Long getZoneId() {
return this.zoneId;
}
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
index 100fd4edba3..571a77c3786 100644
--- 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
@@ -18,14 +18,22 @@
*/
package org.apache.cloudstack.engine.subsystem.api.storage;
+import com.cloud.agent.api.Answer;
+
public class CopyCommandResult extends CommandResult {
private final String path;
- public CopyCommandResult(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/DataObject.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObject.java
index 812db48cf8c..0827cf6b674 100644
--- 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
@@ -28,4 +28,5 @@ public interface DataObject {
public DataObjectType getType();
public DiskFormat getFormat();
public String getUuid();
+ public void processEvent(ObjectInDataStoreStateMachine.Event event);
}
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.java
similarity index 51%
rename from engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeManager.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.java
index f27753dd2d7..32ea996e638 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeManager.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataObjectInStore.java
@@ -16,30 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.volume;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeProfile;
-import org.apache.cloudstack.storage.volume.db.VolumeVO;
+import com.cloud.utils.fsm.StateObject;
-import com.cloud.storage.Volume;
-import com.cloud.storage.Volume.Event;
-import com.cloud.storage.Volume.State;
-import com.cloud.utils.fsm.NoTransitionException;
-import com.cloud.utils.fsm.StateMachine2;
-public interface VolumeManager {
- VolumeVO allocateDuplicateVolume(VolumeVO oldVol);
-
- VolumeVO processEvent(Volume vol, Volume.Event event) throws NoTransitionException;
-
- VolumeProfile getProfile(long volumeId);
-
- VolumeVO getVolume(long volumeId);
-
- VolumeVO updateVolume(VolumeVO volume);
-
- /**
- * @return
- */
- StateMachine2 getStateMachine();
+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/DataStore.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStore.java
index 03f2b0408ae..f101f243047 100644
--- 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
@@ -20,6 +20,9 @@ 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
index 4aba9bfdbff..cf5759b2924 100644
--- 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
@@ -30,4 +30,5 @@ public interface DataStoreDriver {
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
index ef578a7b0d8..95e3d0b2ef8 100644
--- 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
@@ -20,23 +20,23 @@ 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 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();
-
- public boolean cancelMaintain();
-
- public boolean deleteDataStore();
+ public boolean maintain(long storeId);
+ public boolean cancelMaintain(long storeId);
+ public boolean deleteDataStore(long storeId);
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
similarity index 79%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManager.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
index 829be506ccc..15e49e133fb 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManager.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreManager.java
@@ -16,14 +16,16 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.datastore;
+package org.apache.cloudstack.engine.subsystem.api.storage;
+import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreRole;
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/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProvider.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java
similarity index 83%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProvider.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java
index 0d38f34f1c7..d29c4828713 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProvider.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProvider.java
@@ -16,12 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.datastore.provider;
+package org.apache.cloudstack.engine.subsystem.api.storage;
import java.util.Map;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreDriver;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreLifeCycle;
public interface DataStoreProvider {
public DataStoreLifeCycle getLifeCycle();
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManager.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.java
similarity index 90%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManager.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.java
index cbe045c5bc8..94998133196 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/provider/DataStoreProviderManager.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreProviderManager.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.datastore.provider;
+package org.apache.cloudstack.engine.subsystem.api.storage;
import java.util.List;
@@ -26,5 +26,6 @@ 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/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
similarity index 94%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
index 23551e4d0ac..2388795410c 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreStatus.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/DataStoreStatus.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.datastore;
+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/HostScope.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/HostScope.java
index da36e439376..71d1952c625 100644
--- 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
@@ -21,8 +21,8 @@ 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) {
+ private Long hostId;
+ public HostScope(Long hostId) {
this.hostId = hostId;
}
@Override
@@ -31,7 +31,7 @@ public class HostScope implements Scope {
}
@Override
- public long getScopeId() {
+ 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/storage/src/org/apache/cloudstack/storage/image/ImageDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java
similarity index 84%
rename from engine/storage/src/org/apache/cloudstack/storage/image/ImageDataFactory.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java
index 7c7c2a8c530..f0d69887c7d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageDataFactory.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageDataFactory.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.image;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
public interface ImageDataFactory {
TemplateInfo getTemplate(long templateId, DataStore store);
+ TemplateInfo getTemplate(DataObject obj, DataStore store);
+ TemplateInfo getTemplate(long templateId);
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.java
similarity index 77%
rename from engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.java
index 319406d5001..119f3b1d32f 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/ImageService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ImageService.java
@@ -16,13 +16,14 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.image;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.CommandResult;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
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/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
similarity index 94%
rename from engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
index d0530d1934a..726ce0821c5 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/ObjectInDataStoreStateMachine.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/ObjectInDataStoreStateMachine.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.volume;
+package org.apache.cloudstack.engine.subsystem.api.storage;
import com.cloud.utils.fsm.StateObject;
@@ -49,6 +49,8 @@ public interface ObjectInDataStoreStateMachine extends StateObject callback);
+ 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
index ec87cb5aa01..3497f7a894f 100644
--- 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
@@ -19,21 +19,19 @@
package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.datacenter.entity.api.DataCenterResourceEntity;
import org.apache.cloudstack.engine.subsystem.api.storage.disktype.DiskFormat;
-import com.cloud.hypervisor.Hypervisor.HypervisorType;
-public interface PrimaryDataStoreInfo {
+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 long getCapacity();
- public long getAvailableCapacity();
- public long getId();
public String getUuid();
- public DataCenterResourceEntity.State getManagedState();
- public String getName();
- public String getType();
+
+ public StoragePoolType getPoolType();
public PrimaryDataStoreLifeCycle getLifeCycle();
}
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
index a9601a138bf..c1596d4f5f7 100644
--- 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
@@ -20,5 +20,5 @@ package org.apache.cloudstack.engine.subsystem.api.storage;
public interface Scope {
public ScopeType getScopeType();
- public long getScopeId();
+ public Long getScopeId();
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java
similarity index 83%
rename from engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java
index 22d328f4932..1ff3ff25065 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotDataFactory.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotDataFactory.java
@@ -16,10 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.snapshot;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
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/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
similarity index 79%
rename from engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
index 755531d99b2..b90404c5667 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotInfo.java
@@ -14,13 +14,15 @@
// 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;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import com.cloud.storage.Snapshot;
-public interface SnapshotInfo extends DataObject {
+
+public interface SnapshotInfo extends DataObject, Snapshot {
public SnapshotInfo getParent();
public SnapshotInfo getChild();
public VolumeInfo getBaseVolume();
+ Long getDataCenterId();
+ public Long getPrevSnapshotId();
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
similarity index 75%
rename from engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
index 4e311862e50..e9492c4afc6 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/snapshot/SnapshotStrategy.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/SnapshotStrategy.java
@@ -14,10 +14,14 @@
// 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;
+
+package org.apache.cloudstack.engine.subsystem.api.storage;
+
public interface SnapshotStrategy {
- public boolean takeSnapshot(SnapshotInfo snapshot);
+ 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);
- public boolean deleteSnapshot(SnapshotInfo snapshot);
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEvent.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java
similarity index 93%
rename from engine/storage/src/org/apache/cloudstack/storage/image/TemplateEvent.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java
index 44d0005ac80..c677166b39a 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateEvent.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateEvent.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.image;
+package org.apache.cloudstack.engine.subsystem.api.storage;
public enum TemplateEvent {
CreateRequested,
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java
similarity index 78%
rename from engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java
index d91be6c62e8..8e03503911e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateInfo.java
@@ -16,12 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.image;
-
-import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-
-import com.cloud.utils.fsm.NoTransitionException;
+package org.apache.cloudstack.engine.subsystem.api.storage;
public interface TemplateInfo extends DataObject {
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateState.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.java
similarity index 93%
rename from engine/storage/src/org/apache/cloudstack/storage/image/TemplateState.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.java
index c5981e38ac0..ef2488080f8 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/image/TemplateState.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/TemplateState.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.image;
+package org.apache.cloudstack.engine.subsystem.api.storage;
public enum TemplateState {
Allocated,
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/VolumeDataFactory.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java
similarity index 82%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/VolumeDataFactory.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java
index 0cffc055ee4..1518fd2eb43 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/VolumeDataFactory.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeDataFactory.java
@@ -16,11 +16,11 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.datastore;
+package org.apache.cloudstack.engine.subsystem.api.storage;
-import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
-import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
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
index bedb9e72e07..349325af45d 100644
--- 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
@@ -18,6 +18,13 @@
*/
package org.apache.cloudstack.engine.subsystem.api.storage;
-public interface VolumeInfo extends DataObject {
+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/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java
similarity index 63%
rename from engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
rename to engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java
index 19a4c3a881c..102c47174b1 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/volume/VolumeService.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeService.java
@@ -16,17 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cloudstack.storage.volume;
+package org.apache.cloudstack.engine.subsystem.api.storage;
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.EndPoint;
-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;
import org.apache.cloudstack.framework.async.AsyncCallFuture;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.storage.image.TemplateInfo;
+
+import com.cloud.exception.ConcurrentOperationException;
+
public interface VolumeService {
@@ -40,10 +36,6 @@ public interface VolumeService {
return this.volume;
}
}
- /**
- *
- */
- VolumeEntity allocateVolumeInDb(long size, VolumeType type, String volName, Long templateId);
/**
* Creates the volume based on the given criteria
@@ -52,7 +44,7 @@ public interface VolumeService {
*
* @return the volume object
*/
- AsyncCallFuture createVolumeAsync(VolumeInfo volume, long dataStoreId);
+ AsyncCallFuture createVolumeAsync(VolumeInfo volume, DataStore store);
/**
* Delete volume
@@ -61,7 +53,7 @@ public interface VolumeService {
* @return
* @throws ConcurrentOperationException
*/
- AsyncCallFuture deleteVolumeAsync(VolumeInfo volume);
+ AsyncCallFuture expungeVolumeAsync(VolumeInfo volume);
/**
*
@@ -71,21 +63,18 @@ public interface VolumeService {
/**
*
*/
- boolean createVolumeFromSnapshot(long volumeId, long snapshotId);
+ AsyncCallFuture createVolumeFromSnapshot(VolumeInfo volume, DataStore store, SnapshotInfo snapshot);
- /**
- *
- */
- String grantAccess(VolumeInfo volume, EndPoint endpointId);
-
- TemplateOnPrimaryDataStoreInfo grantAccess(TemplateOnPrimaryDataStoreInfo template, EndPoint endPoint);
-
- /**
- *
- */
- boolean rokeAccess(long volumeId, long endpointId);
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
index 7f211f4f9e9..ac277af36de 100644
--- 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
@@ -21,9 +21,9 @@ package org.apache.cloudstack.engine.subsystem.api.storage;
public class ZoneScope implements Scope {
private ScopeType type = ScopeType.ZONE;
- private long zoneId;
+ private Long zoneId;
- public ZoneScope(long zoneId) {
+ public ZoneScope(Long zoneId) {
this.zoneId = zoneId;
}
@@ -33,7 +33,7 @@ public class ZoneScope implements Scope {
}
@Override
- public long getScopeId() {
+ public Long getScopeId() {
return this.zoneId;
}
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java
similarity index 100%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDao.java
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java
similarity index 100%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderDaoImpl.java
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java
similarity index 100%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/DataStoreProviderVO.java
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
similarity index 65%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
index 24a5c790688..1530ced30fd 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
@@ -21,23 +21,23 @@ package org.apache.cloudstack.storage.datastore.db;
import java.util.List;
import java.util.Map;
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus;
import com.cloud.utils.db.GenericDao;
-public interface PrimaryDataStoreDao extends GenericDao {
+public interface PrimaryDataStoreDao extends GenericDao {
/**
* @param datacenterId
* -- the id of the datacenter (availability zone)
*/
- List listByDataCenterId(long datacenterId);
+ List listByDataCenterId(long datacenterId);
/**
* @param datacenterId
* -- the id of the datacenter (availability zone)
*/
- List listBy(long datacenterId, long podId, Long clusterId);
+ List listBy(long datacenterId, long podId, Long clusterId);
/**
* Set capacity of storage pool in bytes
@@ -59,7 +59,7 @@ public interface PrimaryDataStoreDao extends GenericDao details);
+ StoragePoolVO persist(StoragePoolVO pool, Map details);
/**
* Find pool by name.
@@ -68,7 +68,7 @@ public interface PrimaryDataStoreDao extends GenericDao findPoolByName(String name);
+ List findPoolByName(String name);
/**
* Find pools by the pod that matches the details.
@@ -79,9 +79,9 @@ public interface PrimaryDataStoreDao extends GenericDao findPoolsByDetails(long dcId, long podId, Long clusterId, Map details);
+ List findPoolsByDetails(long dcId, long podId, Long clusterId, Map details);
- List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
+ List findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared);
/**
* Find pool by UUID.
@@ -90,13 +90,13 @@ public interface PrimaryDataStoreDao extends GenericDao listByStorageHost(String hostFqdnOrIp);
+ List listByStorageHost(String hostFqdnOrIp);
- PrimaryDataStoreVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
+ StoragePoolVO findPoolByHostPath(long dcId, Long podId, String host, String path, String uuid);
- List listPoolByHostPath(String host, String path);
+ List listPoolByHostPath(String host, String path);
void updateDetails(long poolId, Map details);
@@ -104,13 +104,13 @@ public interface PrimaryDataStoreDao extends GenericDao searchForStoragePoolDetails(long poolId, String value);
- List findIfDuplicatePoolsExistByUUID(String uuid);
+ List findIfDuplicatePoolsExistByUUID(String uuid);
- List listByStatus(DataStoreStatus status);
+ List listByStatus(DataStoreStatus status);
long countPoolsByStatus(DataStoreStatus... statuses);
- List listByStatusInZone(long dcId, DataStoreStatus status);
+ List listByStatusInZone(long dcId, DataStoreStatus status);
- List listPoolsByCluster(long clusterId);
+ List listPoolsByCluster(long clusterId);
}
\ No newline at end of file
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
similarity index 77%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index faca54b569a..023b42bda9d 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -29,7 +29,7 @@ import java.util.Map;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreStatus;
import org.springframework.stereotype.Component;
import com.cloud.utils.db.DB;
@@ -43,12 +43,12 @@ 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;
+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;
@@ -99,73 +99,73 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase findPoolByName(String name) {
- SearchCriteria sc = AllFieldSearch.create();
+ public List findPoolByName(String name) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("name", name);
return listIncludingRemovedBy(sc);
}
@Override
- public PrimaryDataStoreVO findPoolByUUID(String uuid) {
- SearchCriteria sc = AllFieldSearch.create();
+ 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();
+ 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();
+ public List listByDataCenterId(long datacenterId) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("datacenterId", datacenterId);
return listBy(sc);
}
@Override
public void updateAvailable(long id, long available) {
- PrimaryDataStoreVO pool = createForUpdate(id);
+ StoragePoolVO pool = createForUpdate(id);
pool.setAvailableBytes(available);
update(id, pool);
}
@Override
public void updateCapacity(long id, long capacity) {
- PrimaryDataStoreVO pool = createForUpdate(id);
+ StoragePoolVO pool = createForUpdate(id);
pool.setCapacityBytes(capacity);
update(id, pool);
}
@Override
- public List listByStorageHost(String hostFqdnOrIp) {
- SearchCriteria sc = AllFieldSearch.create();
+ 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();
+ 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();
+ public List listByStatusInZone(long dcId, DataStoreStatus status) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("status", status);
sc.setParameters("datacenterId", dcId);
return listBy(sc);
}
@Override
- public PrimaryDataStoreVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {
- SearchCriteria sc = AllFieldSearch.create();
+ 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);
@@ -176,16 +176,16 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase listBy(long datacenterId, long podId, Long clusterId) {
+ public List listBy(long datacenterId, long podId, Long clusterId) {
if (clusterId != null) {
- SearchCriteria sc = DcPodSearch.create();
+ SearchCriteria sc = DcPodSearch.create();
sc.setParameters("datacenterId", datacenterId);
sc.setParameters("podId", podId);
sc.setParameters("cluster", clusterId);
return listBy(sc);
} else {
- SearchCriteria sc = DcPodAnyClusterSearch.create();
+ SearchCriteria sc = DcPodAnyClusterSearch.create();
sc.setParameters("datacenterId", datacenterId);
sc.setParameters("podId", podId);
return listBy(sc);
@@ -193,16 +193,16 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase listPoolByHostPath(String host, String path) {
- SearchCriteria sc = AllFieldSearch.create();
+ public List listPoolByHostPath(String host, String path) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("hostAddress", host);
sc.setParameters("path", path);
return listBy(sc);
}
- public PrimaryDataStoreVO listById(Integer id) {
- SearchCriteria sc = AllFieldSearch.create();
+ public StoragePoolVO listById(Integer id) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("id", id);
return findOneIncludingRemovedBy(sc);
@@ -210,7 +210,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase details) {
+ public StoragePoolVO persist(StoragePoolVO pool, Map details) {
Transaction txn = Transaction.currentTxn();
txn.start();
pool = super.persist(pool);
@@ -226,7 +226,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase findPoolsByDetails(long dcId, long podId, Long clusterId, Map details) {
+ 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 (");
@@ -248,7 +248,7 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase pools = new ArrayList();
+ List pools = new ArrayList();
while (rs.next()) {
pools.add(toEntityBean(rs, false));
}
@@ -267,8 +267,8 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase findPoolsByTags(long dcId, long podId, Long clusterId, String[] tags, Boolean shared) {
- List storagePools = null;
+ 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 {
@@ -279,8 +279,8 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase filteredStoragePools = new ArrayList(storagePools);
- for (PrimaryDataStoreVO pool : storagePools) {
+ List filteredStoragePools = new ArrayList(storagePools);
+ for (StoragePoolVO pool : storagePools) {
/*
* if (shared != pool.isShared()) {
* filteredStoragePools.remove(pool); }
@@ -351,8 +351,8 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase listPoolsByCluster(long clusterId) {
- SearchCriteria sc = AllFieldSearch.create();
+ public List listPoolsByCluster(long clusterId) {
+ SearchCriteria sc = AllFieldSearch.create();
sc.setParameters("clusterId", clusterId);
return listBy(sc);
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
similarity index 100%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailVO.java
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
similarity index 95%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
index 906742bb3f0..c2b109a959e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDao.java
@@ -18,7 +18,6 @@ package org.apache.cloudstack.storage.datastore.db;
import java.util.Map;
-import com.cloud.storage.StoragePoolDetailVO;
import com.cloud.utils.db.GenericDao;
public interface PrimaryDataStoreDetailsDao extends GenericDao {
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
similarity index 100%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDetailsDaoImpl.java
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
similarity index 64%
rename from engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java
rename to engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
index 3e37ec7abe8..1782f16a4c1 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreVO.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/StoragePoolVO.java
@@ -1,24 +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.
- */
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF 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.Date;
+import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
@@ -30,15 +29,15 @@ 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.ScopeType;
-import org.apache.cloudstack.storage.datastore.DataStoreStatus;
+import com.cloud.storage.Storage.StoragePoolType;
+import com.cloud.storage.StoragePoolStatus;
import com.cloud.utils.db.GenericDao;
@Entity
-@Table(name = "storage_pool")
-public class PrimaryDataStoreVO implements Identity {
+@Table(name="storage_pool")
+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)
@@ -51,7 +50,8 @@ public class PrimaryDataStoreVO implements Identity {
private String uuid = null;
@Column(name = "pool_type", updatable = false, nullable = false, length = 32)
- private String poolType;
+ @Enumerated(value = EnumType.STRING)
+ private StoragePoolType poolType;
@Column(name = GenericDao.CREATED_COLUMN)
Date created;
@@ -77,7 +77,7 @@ public class PrimaryDataStoreVO implements Identity {
@Column(name = "status", updatable = true, nullable = false)
@Enumerated(value = EnumType.STRING)
- private DataStoreStatus status;
+ private StoragePoolStatus status;
@Column(name = "storage_provider_id", updatable = true, nullable = false)
private Long storageProviderId;
@@ -105,28 +105,57 @@ public class PrimaryDataStoreVO implements Identity {
return id;
}
- public DataStoreStatus getStatus() {
+ public StoragePoolStatus getStatus() {
return status;
}
- public PrimaryDataStoreVO() {
- this.status = DataStoreStatus.Initial;
+ public StoragePoolVO() {
+ this.status = StoragePoolStatus.Initial;
}
+
+ public StoragePoolVO(long poolId, String name, String uuid, StoragePoolType type,
+ long dataCenterId, Long podId, long availableBytes, long capacityBytes, String hostAddress, int port, String hostPath) {
+ this.name = name;
+ this.id = poolId;
+ this.uuid = uuid;
+ this.poolType = type;
+ this.dataCenterId = dataCenterId;
+ this.availableBytes = availableBytes;
+ this.capacityBytes = capacityBytes;
+ this.hostAddress = hostAddress;
+ this.path = hostPath;
+ this.port = port;
+ this.podId = podId;
+ 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.Initial);
+ this.uuid = UUID.randomUUID().toString();
+ }
+
public String getName() {
return name;
}
- @Override
public String getUuid() {
return uuid;
}
- public String getPoolType() {
+ public StoragePoolType getPoolType() {
return poolType;
}
- public void setPoolType(String protocol) {
+ public void setPoolType(StoragePoolType protocol) {
this.poolType = protocol;
}
@@ -194,7 +223,7 @@ public class PrimaryDataStoreVO implements Identity {
return userInfo;
}
- public void setStatus(DataStoreStatus status) {
+ public void setStatus(StoragePoolStatus status) {
this.status = status;
}
@@ -248,10 +277,10 @@ public class PrimaryDataStoreVO implements Identity {
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof PrimaryDataStoreVO) || obj == null) {
+ if (!(obj instanceof StoragePoolVO) || obj == null) {
return false;
}
- PrimaryDataStoreVO that = (PrimaryDataStoreVO) obj;
+ StoragePoolVO that = (StoragePoolVO) obj;
return this.id == that.id;
}
@@ -264,4 +293,12 @@ public class PrimaryDataStoreVO implements Identity {
public String toString() {
return new StringBuilder("Pool[").append(id).append("|").append(poolType).append("]").toString();
}
-}
\ No newline at end of file
+
+ 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
index a4f8a44fa2a..6d6ad4d14b9 100644
--- a/engine/components-api/pom.xml
+++ b/engine/components-api/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
diff --git a/engine/compute/pom.xml b/engine/compute/pom.xml
index 8fb3ab4fb2b..0875bb63f39 100644
--- a/engine/compute/pom.xml
+++ b/engine/compute/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
diff --git a/engine/network/pom.xml b/engine/network/pom.xml
index 3396a42321c..60cb7e950ec 100644
--- a/engine/network/pom.xml
+++ b/engine/network/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
diff --git a/engine/orchestration/pom.xml b/engine/orchestration/pom.xml
index 95426eae9dd..c98373aa353 100755
--- a/engine/orchestration/pom.xml
+++ b/engine/orchestration/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
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
old mode 100644
new mode 100755
index b91a2cabd62..552aba43cca
--- 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
@@ -20,7 +20,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.UUID;
import javax.inject.Inject;
@@ -28,6 +27,7 @@ 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;
@@ -42,25 +42,22 @@ 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.StoragePoolVO;
+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.Account;
-import com.cloud.user.User;
import com.cloud.user.dao.AccountDao;
import com.cloud.user.dao.UserDao;
import com.cloud.utils.component.ComponentContext;
-import com.cloud.utils.exception.CloudRuntimeException;
import com.cloud.vm.VMInstanceVO;
import com.cloud.vm.VirtualMachineManager;
-import com.cloud.vm.VirtualMachineProfile;
import com.cloud.vm.VirtualMachineProfileImpl;
import com.cloud.vm.dao.VMInstanceDao;
@@ -104,6 +101,8 @@ public class VMEntityManagerImpl implements VMEntityManager {
@Inject
protected StoragePoolDao _storagePoolDao;
+ @Inject
+ DataStoreManager dataStoreMgr;
@Override
public VMEntityVO loadVirtualMachine(String vmId) {
@@ -134,7 +133,8 @@ public class VMEntityManagerImpl implements VMEntityManager {
List vols = _volsDao.findReadyRootVolumesByInstance(vm.getId());
if(!vols.isEmpty()){
VolumeVO vol = vols.get(0);
- StoragePoolVO pool = _storagePoolDao.findById(vol.getPoolId());
+ StoragePool pool = (StoragePool)this.dataStoreMgr.getPrimaryDataStore(vol.getPoolId());
+
if (!pool.isInMaintenance()) {
long rootVolDcId = pool.getDataCenterId();
Long rootVolPodId = pool.getPodId();
@@ -169,10 +169,13 @@ public class VMEntityManagerImpl implements VMEntityManager {
//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();
- for(Volume vo : dest.getStorageForDisks().keySet()){
- volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
+
+ if (vm.getHypervisorType() != HypervisorType.BareMetal) {
+ for(Volume vo : dest.getStorageForDisks().keySet()){
+ volumeReservationMap.put(vo.getId(), dest.getStorageForDisks().get(vo).getId());
+ }
+ vmReservation.setVolumeReservation(volumeReservationMap);
}
- vmReservation.setVolumeReservation(volumeReservationMap);
vmEntityVO.setVmReservation(vmReservation);
_vmEntityDao.persist(vmEntityVO);
diff --git a/engine/pom.xml b/engine/pom.xml
index 9a5f6d57987..1a3d896d50d 100644
--- a/engine/pom.xml
+++ b/engine/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloudstack
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
diff --git a/engine/schema/pom.xml b/engine/schema/pom.xml
index 3e38a840571..da40d9cc4a3 100644
--- a/engine/schema/pom.xml
+++ b/engine/schema/pom.xml
@@ -24,7 +24,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../pom.xml
diff --git a/engine/service/pom.xml b/engine/service/pom.xml
index 38ff81591f2..47c0edcefc0 100644
--- a/engine/service/pom.xml
+++ b/engine/service/pom.xml
@@ -23,7 +23,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
cloud-engine-service
war
diff --git a/engine/storage/backup/pom.xml b/engine/storage/backup/pom.xml
index 8b4fd277055..019e09c7204 100644
--- a/engine/storage/backup/pom.xml
+++ b/engine/storage/backup/pom.xml
@@ -16,7 +16,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../../pom.xml
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
index e4cb0c7031e..67924d2ce73 100644
--- a/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupService.java
+++ b/engine/storage/backup/src/org/apache/cloudstack/storage/backup/BackupService.java
@@ -18,7 +18,7 @@
*/
package org.apache.cloudstack.storage.backup;
-import org.apache.cloudstack.storage.snapshot.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
public interface BackupService {
public boolean backupSnapshot(SnapshotInfo snapshot, long backupStoreId);
diff --git a/engine/storage/image/pom.xml b/engine/storage/image/pom.xml
index c05714b9b54..c4cf14ca9b5 100644
--- a/engine/storage/image/pom.xml
+++ b/engine/storage/image/pom.xml
@@ -16,7 +16,7 @@
org.apache.cloudstack
cloud-engine
- 4.1.0-SNAPSHOT
+ 4.2.0-SNAPSHOT
../../pom.xml
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
index b6a45b5f6bb..616e4789a27 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageDataFactoryImpl.java
@@ -20,38 +20,74 @@ 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.storage.datastore.DataStoreManager;
+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.db.ObjectInDataStoreVO;
-import org.apache.cloudstack.storage.image.db.ImageDataDao;
-import org.apache.cloudstack.storage.image.db.ImageDataVO;
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
- ImageDataDao imageDataDao;
+ VMTemplateDao imageDataDao;
@Inject
ObjectInDataStoreManager objMap;
@Inject
DataStoreManager storeMgr;
+ @Inject
+ VMTemplatePoolDao templatePoolDao;
@Override
public TemplateInfo getTemplate(long templateId, DataStore store) {
- ImageDataVO templ = imageDataDao.findById(templateId);
+ VMTemplateVO templ = imageDataDao.findById(templateId);
if (store == null) {
TemplateObject tmpl = TemplateObject.getTemplate(templ, null);
return tmpl;
}
- ObjectInDataStoreVO obj = objMap.findObject(templateId, DataObjectType.TEMPLATE, store.getId(), store.getRole());
- if (obj == 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/ImageServiceImpl.java b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
index 82d0d71db9c..5898b1b0794 100644
--- a/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
+++ b/engine/storage/image/src/org/apache/cloudstack/storage/image/ImageServiceImpl.java
@@ -22,15 +22,21 @@ 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.db.ObjectInDataStoreVO;
import org.apache.cloudstack.storage.image.store.TemplateObject;
-import org.apache.cloudstack.storage.volume.ObjectInDataStoreStateMachine.Event;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -41,21 +47,25 @@ 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 TemplateInfo templateOnStore;
+ final DataStore store;
final AsyncCallFuture future;
- final ObjectInDataStoreVO obj;
+ final DataObject templateOnStore;
+
public CreateTemplateContext(AsyncCompletionCallback callback, TemplateInfo srcTemplate,
- TemplateInfo templateOnStore,
AsyncCallFuture future,
- ObjectInDataStoreVO obj) {
+ DataStore store,
+ DataObject templateOnStore
+ ) {
super(callback);
this.srcTemplate = srcTemplate;
- this.templateOnStore = templateOnStore;
this.future = future;
- this.obj = obj;
+ this.store = store;
+ this.templateOnStore = templateOnStore;
}
}
@@ -74,31 +84,15 @@ public class ImageServiceImpl implements ImageService {
return future;
}
- ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(template.getId(), template.getType(), store.getId(), store.getRole());
- TemplateInfo templateOnStore = null;
- if (obj == null) {
- templateOnStore = (TemplateInfo)objectInDataStoreMgr.create(template, store);
- obj = objectInDataStoreMgr.findObject(template.getId(), template.getType(), store.getId(), store.getRole());
- } else {
- CommandResult result = new CommandResult();
- result.setResult("duplicate template on the storage");
- future.complete(result);
- return future;
- }
+ DataObject templateOnStore = store.create(template);
+ templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.CreateOnlyRequested);
- try {
- objectInDataStoreMgr.update(obj, Event.CreateOnlyRequested);
- } catch (NoTransitionException e) {
- s_logger.debug("failed to transit", e);
- CommandResult result = new CommandResult();
- result.setResult(e.toString());
- future.complete(result);
- return future;
- }
CreateTemplateContext context = new CreateTemplateContext(null,
- template, templateOnStore,
+ template,
future,
- obj);
+ store,
+ templateOnStore
+ );
AsyncCallbackDispatcher caller = AsyncCallbackDispatcher.create(this);
caller.setCallback(caller.getTarget().createTemplateCallback(null, null))
.setContext(context);
@@ -108,42 +102,25 @@ public class ImageServiceImpl implements ImageService {
protected Void createTemplateCallback(AsyncCallbackDispatcher callback,
CreateTemplateContext context) {
-
- TemplateInfo templateOnStore = context.templateOnStore;
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 {
- objectInDataStoreMgr.update(templateOnStore, Event.OperationFailed);
+ templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.OperationFailed);
+ template.stateTransit(TemplateEvent.OperationFailed);
} catch (NoTransitionException e) {
- s_logger.debug("failed to transit state", e);
+ s_logger.debug("Failed to update template state", e);
}
result.setResult(callbackResult.getResult());
future.complete(result);
return null;
}
- ObjectInDataStoreVO obj = objectInDataStoreMgr.findObject(templateOnStore.getId(), templateOnStore.getType(), templateOnStore.getDataStore().getId(), templateOnStore.getDataStore().getRole());
- obj.setInstallPath(callbackResult.getPath());
-
- if (callbackResult.getSize() != null) {
- obj.setSize(callbackResult.getSize());
- }
try {
- objectInDataStoreMgr.update(obj, Event.OperationSuccessed);
- } catch (NoTransitionException e) {
- s_logger.debug("Failed to transit state", e);
- result.setResult(e.toString());
- future.complete(result);
- return null;
- }
-
- template.setImageStoreId(templateOnStore.getDataStore().getId());
- template.setSize(callbackResult.getSize());
- try {
+ templateOnStore.processEvent(ObjectInDataStoreStateMachine.Event.OperationSuccessed);
template.stateTransit(TemplateEvent.OperationSucceeded);
} catch (NoTransitionException e) {
s_logger.debug("Failed to transit state", e);
@@ -162,4 +139,18 @@ public class ImageServiceImpl implements ImageService {
// 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
index adb247afd0f..af572d49a5e 100644
--- 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
@@ -18,7 +18,7 @@
*/
package org.apache.cloudstack.storage.image.downloader;
-import org.apache.cloudstack.storage.image.TemplateInfo;
+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