Merge branch 'master' into gslb-wip

Conflicts:
	api/src/org/apache/cloudstack/api/ApiConstants.java
	api/src/org/apache/cloudstack/api/ResponseGenerator.java
	client/tomcatconf/commands.properties.in
	server/src/com/cloud/api/ApiResponseHelper.java
	server/src/com/cloud/configuration/Config.java
	setup/db/create-schema.sql
This commit is contained in:
Murali Reddy 2013-03-11 14:28:26 +05:30
commit fea98fa66b
1774 changed files with 96239 additions and 33854 deletions

View File

@ -51,19 +51,21 @@ Apache CloudStack uses some ports, make sure at least those used by the manageme
server are available and not blocked by any local firewall. Following ports are
used by Apache CloudStack and its entities:
8787: Apache CloudStack (Tomcat) debug socket
9090, 8250, 8080: Apache CloudStack Management Server, User/Client API
8096: User/Client to CloudStack Management Server (unauthenticated)
7080: AWS API Server
3306: MySQL Server
3922, 8250, 80/443, 111/2049, 53: Secondary Storage VM
3922, 8250, 53: Console Proxy VM
3922, 8250, 53: Virtual Router
8080: API Server (authenticated), browser or CLI client to management server
8096: API Server (unauthenticated), browser or CLI client to management server
8787: Remote java debug debugging port, from IDE to management server
9090: Management server to management server (cluster)
7080: AWS API Server to which an AWS client can connect
80/443: HTTP client to Secondary Storage VM (template download)
111/2049: Secondary Storage to NFS server
3922: Port used to ssh/scp into system vms (SSVM, CPVM, VR)
8250: Agent (SSVM, CPVM, VR) to management server
22, 80, 443: XenServer, XAPI
22: KVM
443: vCenter
DNS: 53
NFS: 111/2049
53: DNS
111/2049: NFS
3306: MySQL Server to which the management server connects
### Configuring MySQL Server
@ -93,8 +95,7 @@ For example, for master:
Clean and build:
$ mvn clean
$ mvn install
$ mvn clean install -P systemvm,developer
In case you want support for VMWare, SRX and other non-Apache (referred to as nonoss)
compliant libs, you may download the following jar artifacts from respective vendors:
@ -112,9 +113,9 @@ Install them to ~/.m2 so maven can get them as dependencies:
$ cd deps
$ ./install-non-oss.sh
And build them with the nonoss flag:
To build with nonoss components, use the build command with the nonoss flag:
$ mvn install -Dnonoss
$ mvn clean install -P systemvm,developer -Dnonoss
Clear old database (if any) and deploy the database schema:
@ -122,7 +123,7 @@ Clear old database (if any) and deploy the database schema:
Export the following variable if you need to run and debug the management server:
$ export MAVEN_OPTS="-Xmx1024m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
$ export MAVEN_OPTS="-Xmx1024m -XX:MaxPermSize=500m -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
Start the management server:

210
LICENSE
View File

@ -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/

49
NOTICE
View File

@ -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.
Released under the MIT license by Ole Laursen, October 2009.

View File

@ -79,4 +79,4 @@ domr.scripts.dir=scripts/network/domr/kvm
# be overridden here.
# native = com.cloud.hypervisor.kvm.resource.BridgeVifDriver
# openvswitch = com.cloud.hypervisor.kvm.resource.OvsBridgeDriver
#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver
#libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.BridgeVifDriver

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
@ -35,8 +35,6 @@
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-utils</artifactId>
<version>${project.version}</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
</dependencies>
<build>
@ -83,7 +81,7 @@
<filterreader
classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile"
value="${basedir}/../build/replace.properties" />
value="${cs.replace.properties}" />
</filterreader>
</filterchain>
</copy>
@ -97,7 +95,7 @@
<filterreader
classname="org.apache.tools.ant.filters.ReplaceTokens">
<param type="propertiesfile"
value="${basedir}/../build/replace.properties" />
value="${cs.replace.properties}" />
</filterreader>
</filterchain>
</copy>
@ -106,6 +104,24 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/dependencies</outputDirectory>
<includeScope>runtime</includeScope>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -48,6 +48,7 @@ import com.cloud.agent.dao.StorageComponent;
import com.cloud.agent.dao.impl.PropertiesStorage;
import com.cloud.host.Host;
import com.cloud.resource.ServerResource;
import com.cloud.utils.LogUtils;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.ProcessUtil;
import com.cloud.utils.PropertiesUtil;
@ -552,6 +553,9 @@ public class AgentShell implements IAgentShell {
public void start() {
try {
/* By default we only search for log4j.xml */
LogUtils.initLog4j("log4j-cloud.xml");
System.setProperty("java.net.preferIPv4Stack", "true");
String instance = getProperty(null, "instance");

View File

@ -26,6 +26,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLConnection;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@ -77,7 +78,7 @@ import com.google.gson.Gson;
* server.
*
*/
public abstract class ConsoleProxyResource extends ServerResourceBase implements
public class ConsoleProxyResource extends ServerResourceBase implements
ServerResource {
static final Logger s_logger = Logger.getLogger(ConsoleProxyResource.class);
@ -489,4 +490,26 @@ public abstract class ConsoleProxyResource extends ServerResourceBase implements
}
}
}
@Override
public void setName(String name) {
}
@Override
public void setConfigParams(Map<String, Object> params) {
}
@Override
public Map<String, Object> getConfigParams() {
return new HashMap<String, Object>();
}
@Override
public int getRunLevel() {
return 0;
}
@Override
public void setRunLevel(int level) {
}
}

View File

@ -30,7 +30,7 @@ public class TestAgentShell extends TestCase {
File file = null;
try {
file = File.createTempFile("wget", ".html");
AgentShell.wget("http://www.google.com/", file);
AgentShell.wget("http://www.apache.org/", file);
if (s_logger.isDebugEnabled()) {
s_logger.debug("file saved to " + file.getAbsolutePath());

View File

@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId>
<version>4.1.0-SNAPSHOT</version>
<version>4.2.0-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>

View File

@ -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<VolumeTO> volumeTOs;
private VMSnapshotTO vmSnapshotTo;
public List<VolumeTO> getVolumeTOs() {
return volumeTOs;
}
public void setVolumeTOs(List<VolumeTO> 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<VolumeTO> volumeTOs) {
super(cmd, true, "");
this.vmSnapshotTo = vmSnapshotTo;
this.volumeTOs = volumeTOs;
}
}

View File

@ -0,0 +1,42 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
import java.util.List;
import com.cloud.agent.api.to.VolumeTO;
import com.cloud.vm.VirtualMachine;
public class CreateVMSnapshotCommand extends VMSnapshotBaseCommand {
public CreateVMSnapshotCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> 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;
}
}

View File

@ -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.
*/

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,49 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
import java.util.List;
import com.cloud.agent.api.to.VolumeTO;
public class DeleteVMSnapshotAnswer extends Answer {
private List<VolumeTO> volumeTOs;
public DeleteVMSnapshotAnswer() {
}
public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd, boolean result,
String message) {
super(cmd, result, message);
}
public DeleteVMSnapshotAnswer(DeleteVMSnapshotCommand cmd,
List<VolumeTO> volumeTOs) {
super(cmd, true, "");
this.volumeTOs = volumeTOs;
}
public List<VolumeTO> getVolumeTOs() {
return volumeTOs;
}
public void setVolumeTOs(List<VolumeTO> volumeTOs) {
this.volumeTOs = volumeTOs;
}
}

View File

@ -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<VolumeTO> volumeTOs, String guestOSType) {
super( vmName, snapshot, volumeTOs, guestOSType);
}
}

View File

@ -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<VolumeTO> 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<VolumeTO> volumeTOs,
VirtualMachine.State vmState) {
super(cmd, true, "");
this.volumeTOs = volumeTOs;
this.vmState = vmState;
}
public VirtualMachine.State getVmState() {
return vmState;
}
public List<VolumeTO> getVolumeTOs() {
return volumeTOs;
}
public void setVolumeTOs(List<VolumeTO> volumeTOs) {
this.volumeTOs = volumeTOs;
}
public void setVmState(VirtualMachine.State vmState) {
this.vmState = vmState;
}
}

View File

@ -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<VolumeTO> volumeTOs, String guestOSType) {
super(vmName, snapshot, volumeTOs, guestOSType);
}
}

View File

@ -5,21 +5,24 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
//
// Automatically generated by addcopyright.py at 01/29/2013
package com.cloud.baremetal.database;
import com.cloud.utils.db.GenericDao;
public interface BaremetalCmdbDao extends GenericDao<BaremetalCmdbVO, Long> {
}
package com.cloud.agent.api;
public class ScaleVmAnswer extends Answer {
protected ScaleVmAnswer() {
}
public ScaleVmAnswer(ScaleVmCommand cmd, boolean result, String detail) {
super(cmd, result, detail);
}
}

View File

@ -0,0 +1,113 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.agent.api;
import com.cloud.agent.api.to.VirtualMachineTO;
public class ScaleVmCommand extends Command {
VirtualMachineTO vm;
String vmName;
int cpus;
Integer speed;
long minRam;
long maxRam;
public VirtualMachineTO getVm() {
return vm;
}
public void setVm(VirtualMachineTO vm) {
this.vm = vm;
}
public int getCpus() {
return cpus;
}
public ScaleVmCommand(String vmName, int cpus,
Integer speed, long minRam, long maxRam) {
super();
this.vmName = vmName;
this.cpus = cpus;
//this.speed = speed;
this.minRam = minRam;
this.maxRam = maxRam;
this.vm = new VirtualMachineTO(1L, vmName, null, cpus, null, minRam, maxRam, null, null, false, false, null);
/*vm.setName(vmName);
vm.setCpus(cpus);
vm.setRam(minRam, maxRam);*/
}
public void setCpus(int cpus) {
this.cpus = cpus;
}
public Integer getSpeed() {
return speed;
}
public void setSpeed(Integer speed) {
this.speed = speed;
}
public long getMinRam() {
return minRam;
}
public void setMinRam(long minRam) {
this.minRam = minRam;
}
public long getMaxRam() {
return maxRam;
}
public void setMaxRam(long maxRam) {
this.maxRam = maxRam;
}
public String getVmName() {
return vmName;
}
public void setVmName(String vmName) {
this.vmName = vmName;
}
public VirtualMachineTO getVirtualMachine() {
return vm;
}
@Override
public boolean executeInSequence() {
return true;
}
protected ScaleVmCommand() {
}
public ScaleVmCommand(VirtualMachineTO vm) {
this.vm = vm;
}
public boolean getLimitCpuUse() {
// TODO Auto-generated method stub
return false;
}
}

View File

@ -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<VolumeTO> volumeTOs;
protected VMSnapshotTO target;
protected String vmName;
protected String guestOSType;
public VMSnapshotBaseCommand(String vmName, VMSnapshotTO snapshot, List<VolumeTO> volumeTOs, String guestOSType) {
this.vmName = vmName;
this.target = snapshot;
this.volumeTOs = volumeTOs;
this.guestOSType = guestOSType;
}
public List<VolumeTO> getVolumeTOs() {
return volumeTOs;
}
public void setVolumeTOs(List<VolumeTO> 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;
}
}

View File

@ -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;
}
}

View File

@ -31,6 +31,7 @@ public class DhcpEntryCommand extends NetworkElementCommand {
String vmIp6Address;
String ip6Gateway;
String duid;
private boolean isDefault;
protected DhcpEntryCommand() {
@ -46,6 +47,7 @@ public class DhcpEntryCommand extends NetworkElementCommand {
this.vmIpAddress = vmIpAddress;
this.vmName = vmName;
this.vmIp6Address = vmIp6Address;
this.setDefault(true);
}
public DhcpEntryCommand(String vmMac, String vmIpAddress, String vmName, String vmIp6Address, String dns, String gateway, String ip6Gateway) {
@ -129,4 +131,12 @@ public class DhcpEntryCommand extends NetworkElementCommand {
public void setVmIp6Address(String ip6Address) {
this.vmIp6Address = ip6Address;
}
public boolean isDefault() {
return isDefault;
}
public void setDefault(boolean isDefault) {
this.isDefault = isDefault;
}
}

View File

@ -28,7 +28,20 @@ public class VirtualMachineTO {
private BootloaderType bootloader;
Type type;
int cpus;
/**
'speed' is still here since 4.0.X/4.1.X management servers do not support
the overcommit feature yet.
The overcommit feature sends minSpeed and maxSpeed
So this is here for backwards compatibility with 4.0.X/4.1.X management servers
and newer agents.
*/
Integer speed;
Integer minSpeed;
Integer maxSpeed;
long minRam;
long maxRam;
String hostName;
@ -62,6 +75,22 @@ public class VirtualMachineTO {
this.vncPassword = vncPassword;
}
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer minSpeed, Integer maxSpeed, long minRam, long maxRam, BootloaderType bootloader, String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
this.id = id;
this.name = instanceName;
this.type = type;
this.cpus = cpus;
this.minSpeed = minSpeed;
this.maxSpeed = maxSpeed;
this.minRam = minRam;
this.maxRam = maxRam;
this.bootloader = bootloader;
this.os = os;
this.enableHA = enableHA;
this.limitCpuUse = limitCpuUse;
this.vncPassword = vncPassword;
}
protected VirtualMachineTO() {
}
@ -105,6 +134,13 @@ public class VirtualMachineTO {
return speed;
}
public Integer getMinSpeed() {
return minSpeed;
}
public Integer getMaxSpeed() {
return maxSpeed;
}
public boolean getLimitCpuUse() {
return limitCpuUse;
}

View File

@ -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() {

View File

@ -30,4 +30,5 @@ public interface Alert extends Identity, InternalIdentity {
Date getCreatedDate();
Date getLastSent();
Date getResolved();
boolean getArchived();
}

View File

@ -264,6 +264,8 @@ public interface ConfigurationService {
boolean removeLDAP(LDAPRemoveCmd cmd);
LDAPConfigCmd listLDAPConfig(LDAPConfigCmd cmd);
/**
* @param offering
* @return

View File

@ -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;

View File

@ -38,6 +38,16 @@ public interface EntityManager {
*/
public <T, K extends Serializable> T findById(Class<T> entityType, K id);
/**
* Finds an entity by its id including removed.
* @param <T> class of the entity you're trying to find.
* @param <K> class of the id that the entity uses.
* @param entityType Type of the entity.
* @param id id value
* @return T if found; null if not.
*/
public <T, K extends Serializable> T findByIdIncludingRemoved(Class<T> entityType, K id);
/**
* Finds a unique entity by uuid string
* @param <T> entity class

View File

@ -37,6 +37,10 @@ public interface DataCenter extends InfrastructureEntity, Grouping, Identity, In
String getDns2();
String getIp6Dns1();
String getIp6Dns2();
String getGuestNetworkCidr();
String getName();

View File

@ -40,4 +40,5 @@ public interface Event extends ControlledEntity, Identity, InternalIdentity {
String getLevel();
long getStartId();
String getParameters();
boolean getArchived();
}

View File

@ -337,6 +337,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";

View File

@ -32,6 +32,10 @@ public class PermissionDeniedException extends CloudRuntimeException {
super(message);
}
public PermissionDeniedException(String message, Throwable cause){
super(message, cause);
}
protected PermissionDeniedException() {
super();
}

View File

@ -17,14 +17,12 @@
package com.cloud.exception;
import com.cloud.utils.SerialVersionUID;
import com.cloud.utils.exception.CloudRuntimeException;
/**
* Exception thrown if number of requests is over api rate limit set.
* @author minc
*
*/
public class RequestLimitException extends CloudRuntimeException {
public class RequestLimitException extends PermissionDeniedException {
private static final long serialVersionUID = SerialVersionUID.AccountLimitException;

View File

@ -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();
}

View File

@ -87,4 +87,7 @@ public interface IpAddress extends ControlledEntity, Identity, InternalIdentity
* @param vpcId
*/
void setVpcId(Long vpcId);
String getVmIp();
void setVmIp(String vmIp);
}

View File

@ -135,7 +135,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
public static final Provider None = new Provider("None", false);
public static final Provider NiciraNvp = new Provider("NiciraNvp", true);
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider MidokuraMidonet = new Provider("MidokuraMidonet", true);
private String name;
@ -282,12 +283,21 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, 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();

View File

@ -24,6 +24,7 @@ import java.util.Set;
import com.cloud.dc.Vlan;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
@ -249,5 +250,11 @@ public interface NetworkModel {
boolean isNetworkInlineMode(Network network);
Vlan getVlanForNetwork(long networkId);
boolean isIP6AddressAvailableInNetwork(long networkId);
boolean isIP6AddressAvailableInVlan(long vlanId);
void checkIp6Parameters(String startIPv6, String endIPv6, String ip6Gateway, String ip6Cidr) throws InvalidParameterValueException;
void checkRequestedIpAddresses(long networkId, String ip4, String ip6) throws InvalidParameterValueException;
}

View File

@ -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;

View File

@ -19,9 +19,10 @@ package com.cloud.network;
import java.util.List;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficTypeImplementorsCmd;
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
import org.apache.cloudstack.api.command.user.network.CreateNetworkCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworksCmd;
import org.apache.cloudstack.api.command.user.network.RestartNetworkCmd;
import org.apache.cloudstack.api.command.user.vm.ListNicsCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientAddressCapacityException;
@ -33,6 +34,8 @@ import com.cloud.network.Networks.TrafficType;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.Pair;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
/**
* The NetworkService interface is the "public" api to entities that make requests to the orchestration engine
@ -66,10 +69,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<String> isolationMethods, String broadcastDomainRange, Long domainId, List<String> tags, String name);
@ -155,5 +156,13 @@ public interface NetworkService {
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String vlan,
String startIp, String endIP, String gateway, String netmask, long networkOwnerId, Long vpcId)
throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
/* Requests an IP address for the guest nic */
String allocateSecondaryGuestIP(Account account, long zoneId, Long nicId,
Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
boolean releaseSecondaryIpFromNic(long ipAddressId);
/* lists the nic informaton */
List<? extends Nic> listNics(ListNicsCmd listNicsCmd);
}

View File

@ -14,22 +14,24 @@
// 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.network;
import java.util.List;
import com.cloud.baremetal.PxeServerManager.PxeServerType;
import com.cloud.deploy.DeployDestination;
import com.cloud.host.Host;
import com.cloud.uservm.UserVm;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.UserVmVO;
import com.cloud.vm.VirtualMachineProfile;
public interface PxeServerService extends Adapter {
public Host addPxeServer(PxeServerProfile profile);
public boolean prepare(VirtualMachineProfile<UserVmVO> profile, DeployDestination dest, ReservationContext context, Long pxeServerId);
import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd;
import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficMonitorCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficMonitorsCmd;
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import com.cloud.utils.component.Manager;
public interface NetworkUsageService extends Manager {
Host addTrafficMonitor(AddTrafficMonitorCmd cmd);
boolean deleteTrafficMonitor(DeleteTrafficMonitorCmd cmd);
List<? extends Host> listTrafficMonitors(ListTrafficMonitorsCmd cmd);
public boolean prepareCreateTemplate(Long pxeServerId, UserVm vm, String templateUrl);
}

View File

@ -14,29 +14,23 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.resource;
package com.cloud.network;
import com.cloud.storage.VolumeVO;
import com.cloud.template.VirtualMachineTemplate.BootloaderType;
import com.cloud.utils.component.Adapter;
import com.cloud.network.Networks.TrafficType;
/**
* DiskMounter mounts and unmounts disk for VMs
* to consume.
*
/* User can provide a Label, while configuring a zone, to specify
* a physical network that is to be used for a traffic type defined
* by CloudStack. See the enum data type TrafficType. This label is
* called Traffic label. This might encapsulate physical network
* specific properties like VLAN ID, name of virtual network object or more.
* The name of virtual network object is dependent on type of hypervisor.
* For example it is name of xenserver bridge in case of XenServer and
* name of virtual switch in case of VMware hypervisor
*/
public interface DiskPreparer extends Adapter {
/**
* Mounts a volumeVO and returns a path.
*
* @param vol
* @return
*/
public String mount(String vmName, VolumeVO vol, BootloaderType type);
/**
* Unmounts
*/
public boolean unmount(String path);
public interface TrafficLabel {
public TrafficType getTrafficType();
public String getNetworkLabel();
}

View File

@ -25,6 +25,7 @@ import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public interface RulesService {
Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId, Long projectId, boolean isRecursive, boolean listAll);
@ -43,7 +44,7 @@ public interface RulesService {
* @throws NetworkRuleConflictException
* if conflicts in the network rules are detected.
*/
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, boolean openFirewall) throws NetworkRuleConflictException;
PortForwardingRule createPortForwardingRule(PortForwardingRule rule, Long vmId, Ip vmIp, boolean openFirewall) throws NetworkRuleConflictException;
/**
* Revokes a port forwarding rule
@ -66,7 +67,7 @@ public interface RulesService {
boolean applyPortForwardingRules(long ipAdddressId, Account caller) throws ResourceUnavailableException;
boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm) throws NetworkRuleConflictException, ResourceUnavailableException;
boolean enableStaticNat(long ipAddressId, long vmId, long networkId, boolean isSystemVm, String vmGuestIp) throws NetworkRuleConflictException, ResourceUnavailableException;
PortForwardingRule getPortForwardigRule(long ruleId);

View File

@ -41,7 +41,7 @@ public interface VpcService {
public VpcOffering getVpcOffering(long vpcOfferingId);
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices);
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> 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);
}

View File

@ -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
*/

View File

@ -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;

View File

@ -29,6 +29,8 @@ import org.apache.cloudstack.api.command.admin.domain.UpdateDomainCmd;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListAlertsCmd;
import org.apache.cloudstack.api.command.admin.resource.ListCapacityCmd;
import org.apache.cloudstack.api.command.admin.resource.UploadCustomCertificateCmd;
@ -40,12 +42,12 @@ import org.apache.cloudstack.api.command.admin.systemvm.UpgradeSystemVMCmd;
import org.apache.cloudstack.api.command.admin.vlan.ListVlanIpRangesCmd;
import org.apache.cloudstack.api.command.user.address.ListPublicIpAddressesCmd;
import org.apache.cloudstack.api.command.user.config.ListCapabilitiesCmd;
import org.apache.cloudstack.api.command.user.event.ArchiveEventsCmd;
import org.apache.cloudstack.api.command.user.event.DeleteEventsCmd;
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCategoriesCmd;
import org.apache.cloudstack.api.command.user.guest.ListGuestOsCmd;
import org.apache.cloudstack.api.command.user.iso.ListIsosCmd;
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.command.user.offering.ListDiskOfferingsCmd;
import org.apache.cloudstack.api.command.user.offering.ListServiceOfferingsCmd;
import org.apache.cloudstack.api.command.user.ssh.CreateSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.DeleteSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
@ -55,12 +57,10 @@ import org.apache.cloudstack.api.command.user.template.UpdateTemplateCmd;
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
import org.apache.cloudstack.api.command.user.zone.ListZonesByCmd;
import com.cloud.alert.Alert;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
@ -72,8 +72,6 @@ import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.IpAddress;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.storage.GuestOS;
import com.cloud.storage.GuestOsCategory;
@ -194,6 +192,34 @@ public interface ManagementService {
*/
Pair<List<? extends Alert>, Integer> searchForAlerts(ListAlertsCmd cmd);
/**
* Archive alerts
* @param cmd
* @return True on success. False otherwise.
*/
boolean archiveAlerts(ArchiveAlertsCmd cmd);
/**
* Delete alerts
* @param cmd
* @return True on success. False otherwise.
*/
boolean deleteAlerts(DeleteAlertsCmd cmd);
/**
* Archive events
* @param cmd
* @return True on success. False otherwise.
*/
boolean archiveEvents(ArchiveEventsCmd cmd);
/**
* Delete events
* @param cmd
* @return True on success. False otherwise.
*/
boolean deleteEvents(DeleteEventsCmd cmd);
/**
* list all the capacity rows in capacity operations table
*

View File

@ -37,7 +37,8 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
Project,
Vpc,
NetworkACL,
StaticRoute
StaticRoute,
VMSnapshot
}
/**

View File

@ -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<State, Event, Snapshot> s_fsm = new StateMachine2<State, Event, Snapshot>();
public static StateMachine2<State, Event, Snapshot> 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();

View File

@ -99,10 +99,7 @@ public interface StoragePool extends Identity, InternalIdentity {
/**
* @return
*/
String getStorageProvider();
/**
* @return
*/
String getStorageType();
Long getStorageProviderId();
boolean isInMaintenance();
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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

View File

@ -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);
}

View File

@ -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<String> listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd);
boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd);
VirtualMachineTemplate createPrivateTemplateRecord(CreateTemplateCmd cmd,
Account templateOwner) throws ResourceAllocationException;
VirtualMachineTemplate createPrivateTemplate(CreateTemplateCmd command)
throws CloudRuntimeException;
}

View File

@ -62,7 +62,7 @@ public interface AccountService {
* @return the user if created successfully, null otherwise
*/
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType, Long domainId, String networkDomain,
Map<String, String> details, String accountUUID, String userUUID, Integer regionId);
Map<String, String> details);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@ -77,7 +77,7 @@ public interface AccountService {
User getSystemUser();
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID, Integer regionId);
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId);
boolean isAdmin(short accountType);

View File

@ -27,7 +27,7 @@ import com.cloud.utils.Pair;
public interface DomainService {
Domain createDomain(String name, Long parentId, String networkDomain, String domainUUID, Integer regionId);
Domain createDomain(String name, Long parentId, String networkDomain);
Domain getDomain(long id);

View File

@ -151,4 +151,5 @@ public interface Nic extends Identity, InternalIdentity {
String getIp6Cidr();
String getIp6Address();
boolean getSecondaryIp();
}

View File

@ -50,6 +50,8 @@ public class NicProfile implements InternalIdentity {
Integer deviceId;
String dns1;
String dns2;
String ip6Dns1;
String ip6Dns2;
Integer networkRate;
boolean isSecurityGroupEnabled;
String name;
@ -332,4 +334,20 @@ public class NicProfile implements InternalIdentity {
this.requestedIpv6 = requestedIpv6;
}
public String getIp6Dns1() {
return ip6Dns1;
}
public void setIp6Dns1(String ip6Dns1) {
this.ip6Dns1 = ip6Dns1;
}
public String getIp6Dns2() {
return ip6Dns2;
}
public void setIp6Dns2(String ip6Dns2) {
this.ip6Dns2 = ip6Dns2;
}
}

View File

@ -16,31 +16,21 @@
// under the License.
package com.cloud.vm;
import java.util.List;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
/**
*
* be an information carrier within one thread only.
*
* Nic represents one nic on the VM.
*/
public class VirtualEnvironment {
public interface NicSecondaryIp extends ControlledEntity, Identity, InternalIdentity {
/**
* The actual machine
* @return id in the CloudStack database
*/
public VirtualMachine machine;
/**
* Disks to assign to the machine in order.
*/
public List<VirtualDisk> disks;
/**
* Networks to assign to the machine.
*/
public List<VirtualNetwork> networks;
/**
* Boot options to assign to the machine.
*/
public String bootOptions;
long getId();
long getNicId();
String getIp4Address();
long getNetworkId();
long getVmId();
}

View File

@ -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.

View File

@ -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 {

View File

@ -136,4 +136,10 @@ public interface VirtualMachineProfile<T extends VirtualMachine> {
BootloaderType getBootLoaderType();
Map<Param, Object> getParameters();
Float getCpuOvercommitRatio();
Float getMemoryOvercommitRatio();
}

View File

@ -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<VMSnapshot.State> {
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<State, Event, VMSnapshot> getStateMachine() {
return s_fsm;
}
public String getDescription() {
return _description;
}
private final static StateMachine2<State, Event, VMSnapshot> s_fsm = new StateMachine2<State, Event, VMSnapshot>();
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();
}

View File

@ -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);
}

View File

@ -17,7 +17,6 @@
package org.apache.cloudstack.acl;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.RequestLimitException;
import com.cloud.user.User;
import com.cloud.utils.component.Adapter;
@ -27,5 +26,5 @@ public interface APIChecker extends Adapter {
// If true, apiChecker has checked the operation
// If false, apiChecker is unable to handle the operation or not implemented
// On exception, checkAccess failed don't allow
boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException, RequestLimitException;
boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
}

View File

@ -22,10 +22,14 @@ import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
@Retention(RetentionPolicy.RUNTIME)
@Target({ FIELD })
public @interface ACL {
AccessType accessType() default AccessType.ListEntry;
boolean checkKeyAccess() default false;
boolean checkValueAccess() default false;
}

View File

@ -46,6 +46,7 @@ public class ApiConstants {
public static final String COMPONENT = "component";
public static final String CPU_NUMBER = "cpunumber";
public static final String CPU_SPEED = "cpuspeed";
public static final String CPU_OVERCOMMIT_RATIO="cpuovercommitratio";
public static final String CREATED = "created";
public static final String CUSTOMIZED = "customized";
public static final String DESCRIPTION = "description";
@ -58,6 +59,8 @@ public class ApiConstants {
public static final String DISPLAY_TEXT = "displaytext";
public static final String DNS1 = "dns1";
public static final String DNS2 = "dns2";
public static final String IP6_DNS1 = "ip6dns1";
public static final String IP6_DNS2 = "ip6dns2";
public static final String DOMAIN = "domain";
public static final String DOMAIN_ID = "domainid";
public static final String DURATION = "duration";
@ -123,6 +126,7 @@ public class ApiConstants {
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MEMORY = "memory";
public static final String MEMORY_OVERCOMMIT_RATIO="memoryovercommitratio";
public static final String MODE = "mode";
public static final String NAME = "name";
public static final String METHOD_NAME = "methodname";
@ -222,6 +226,7 @@ public class ApiConstants {
public static final String VM_LIMIT = "vmlimit";
public static final String VM_TOTAL = "vmtotal";
public static final String VNET = "vnet";
public static final String IS_VOLATILE = "isvolatile";
public static final String VOLUME_ID = "volumeid";
public static final String ZONE_ID = "zoneid";
public static final String ZONE_NAME = "zonename";
@ -360,7 +365,10 @@ public class ApiConstants {
public static final String CUSTOM_DISK_OFF_MAX_SIZE = "customdiskofferingmaxsize";
public static final String DEFAULT_ZONE_ID = "defaultzoneid";
public static final String GUID = "guid";
public static final String VSWITCH_TYPE_GUEST_TRAFFIC = "guestvswitchtype";
public static final String VSWITCH_TYPE_PUBLIC_TRAFFIC = "publicvswitchtype";
public static final String VSWITCH_NAME_GUEST_TRAFFIC = "guestvswitchname";
public static final String VSWITCH_NAME_PUBLIC_TRAFFIC = "publicvswitchname";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_STATE = "vsmdevicestate";
@ -379,9 +387,8 @@ public class ApiConstants {
public static final String VSM_CONFIG_STATE = "vsmconfigstate";
public static final String VSM_DEVICE_STATE = "vsmdevicestate";
public static final String ADD_VSM_FLAG = "addvsmflag";
public static final String END_POINT = "endpoint";
public static final String REGION_ID = "regionid";
public static final String IS_PROPAGATE = "ispropagate";
public static final String END_POINT = "endpoint";
public static final String REGION_ID = "regionid";
public static final String VPC_OFF_ID = "vpcofferingid";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
@ -446,6 +453,21 @@ public class ApiConstants {
public static final String GSLB_PROVIDER = "gslbprovider";
public static final String GSLB_PROVIDER_PUBLIC_IP = "gslbproviderpublicip";
public static final String GSLB_PROVIDER_PRIVATE_IP = "gslbproviderprivateip";
public static final String VM_SNAPSHOT_DESCRIPTION = "description";
public static final String VM_SNAPSHOT_DISPLAYNAME = "name";
public static final String VM_SNAPSHOT_ID = "vmsnapshotid";
public static final String VM_SNAPSHOT_DISK_IDS = "vmsnapshotdiskids";
public static final String VM_SNAPSHOT_MEMORY = "snapshotmemory";
public static final String IMAGE_STORE_UUID = "imagestoreuuid";
public static final String GUEST_VM_CIDR = "guestvmcidr";
public static final String NETWORK_CIDR = "networkcidr";
public static final String RESERVED_IP_RANGE = "reservediprange";
public static final String UCS_MANAGER_ID = "ucsmanagerid";
public static final String UCS_PROFILE_DN = "profiledn";
public static final String UCS_BLADE_DN = "bladedn";
public static final String UCS_BLADE_ID = "bladeid";
public static final String VM_GUEST_IP = "vmguestip";
public static final String OLDER_THAN = "olderthan";
public enum HostDetails {
all, capacity, events, stats, min;

View File

@ -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();
}
}
}

View File

@ -18,7 +18,6 @@ package org.apache.cloudstack.api;
/**
* Enum class for various API error code used in CloudStack
* @author minc
*
*/
public enum ApiErrorCode {

View File

@ -29,6 +29,7 @@ import javax.inject.Inject;
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.region.RegionService;
import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
@ -43,6 +44,7 @@ import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.NetworkService;
import com.cloud.network.NetworkUsageService;
import com.cloud.network.StorageNetworkService;
import com.cloud.network.VpcVirtualNetworkApplianceService;
import com.cloud.network.as.AutoScaleService;
@ -60,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;
@ -67,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());
@ -99,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;
@ -124,6 +128,9 @@ public abstract class BaseCmd {
@Inject public Site2SiteVpnService _s2sVpnService;
@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;

View File

@ -16,6 +16,91 @@
// under the License.
package org.apache.cloudstack.api;
import java.text.DecimalFormat;
import java.util.EnumSet;
import java.util.List;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
import org.apache.cloudstack.api.command.user.job.QueryAsyncJobResultCmd;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.api.response.AutoScalePolicyResponse;
import org.apache.cloudstack.api.response.AutoScaleVmGroupResponse;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.CapacityResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.CreateCmdResponse;
import org.apache.cloudstack.api.response.DiskOfferingResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
import org.apache.cloudstack.api.response.EventResponse;
import org.apache.cloudstack.api.response.ExtractResponse;
import org.apache.cloudstack.api.response.FirewallResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
import org.apache.cloudstack.api.response.IPAddressResponse;
import org.apache.cloudstack.api.response.InstanceGroupResponse;
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.LDAPConfigResponse;
import org.apache.cloudstack.api.response.LoadBalancerResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.NicResponse;
import org.apache.cloudstack.api.response.NicSecondaryIpResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.PrivateGatewayResponse;
import org.apache.cloudstack.api.response.ProjectAccountResponse;
import org.apache.cloudstack.api.response.ProjectInvitationResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.ProviderResponse;
import org.apache.cloudstack.api.response.RegionResponse;
import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse;
import org.apache.cloudstack.api.response.S3Response;
import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.ServiceResponse;
import org.apache.cloudstack.api.response.Site2SiteCustomerGatewayResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnConnectionResponse;
import org.apache.cloudstack.api.response.Site2SiteVpnGatewayResponse;
import org.apache.cloudstack.api.response.SnapshotPolicyResponse;
import org.apache.cloudstack.api.response.SnapshotResponse;
import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import org.apache.cloudstack.api.response.TrafficTypeResponse;
import org.apache.cloudstack.api.response.UsageRecordResponse;
import org.apache.cloudstack.api.response.UserResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VMSnapshotResponse;
import org.apache.cloudstack.api.response.VirtualRouterProviderResponse;
import org.apache.cloudstack.api.response.VlanIpRangeResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.usage.Usage;
import com.cloud.async.AsyncJob;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
@ -58,6 +143,9 @@ import com.cloud.user.User;
import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.snapshot.VMSnapshot;
import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
import org.apache.cloudstack.api.ApiConstants.VMDetails;
@ -285,4 +373,12 @@ public interface ResponseGenerator {
GuestOSResponse createGuestOSResponse(GuestOS os);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
UsageRecordResponse createUsageResponse(Usage usageRecord);
TrafficMonitorResponse createTrafficMonitorResponse(Host trafficMonitor);
VMSnapshotResponse createVMSnapshotResponse(VMSnapshot vmSnapshot);
NicSecondaryIpResponse createSecondaryIPToNicResponse(String ip,
Long nicId, Long networkId);
public NicResponse createNicResponse(Nic result);
}

View File

@ -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<String> 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<String> idList = rt.getIdProxyList();
if (idList != null) {
for (int i = 0; i < idList.size(); i++) {
addProxyObject(idList.get(i));
}
}
setCSErrorCode(rt.getCSErrorCode());
}
}

View File

@ -78,19 +78,7 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map<String, String> details;
//@Parameter(name = ApiConstants.REGION_DETAILS, type = CommandType.MAP, description = "details for account used to store region specific parameters")
//private Map<String, String> regionDetails;
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.STRING, description="Account UUID, required for adding account from another Region")
private String accountUUID;
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
private String userUUID;
@Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the account")
private Integer regionId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -145,18 +133,6 @@ public class CreateAccountCmd extends BaseCmd {
return params;
}
public String getAccountUUID() {
return accountUUID;
}
public String getUserUUID() {
return userUUID;
}
public Integer getRegionId() {
return regionId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -174,8 +150,8 @@ public class CreateAccountCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(), getDomainId(), getNetworkDomain(), getDetails(),
getAccountUUID(), getUserUUID(), getRegionId());
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
getDomainId(), getNetworkDomain(), getDetails());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());

View File

@ -48,11 +48,8 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
required=true, description="Account id")
private Long id;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -62,10 +59,6 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
return id;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -103,7 +96,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Account Id: "+getId());
boolean result = _regionService.deleteUserAccount(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());

View File

@ -58,11 +58,8 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.LOCK, type=CommandType.BOOLEAN, required=true, description="If true, only lock the account; else disable the account")
private Boolean lockRequested;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -79,14 +76,10 @@ public class DisableAccountCmd extends BaseAsyncCmd {
return domainId;
}
public Boolean getIsPropagate() {
return isPropagate;
}
public Boolean getLockRequested() {
return lockRequested;
}
return lockRequested;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -124,7 +117,7 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException{
UserContext.current().setEventDetails("Account Name: "+getAccountName()+", Domain Id:"+getDomainId());
Account result = _regionService.disableAccount(this);
Account result = _regionService.disableAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());

View File

@ -50,11 +50,8 @@ public class EnableAccountCmd extends BaseCmd {
description="Enables specified account in this domain.")
private Long domainId;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -71,10 +68,6 @@ public class EnableAccountCmd extends BaseCmd {
return domainId;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -101,7 +94,7 @@ public class EnableAccountCmd extends BaseCmd {
@Override
public void execute(){
Account result = _regionService.enableAccount(this);
Account result = _regionService.enableAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());

View File

@ -63,11 +63,8 @@ public class UpdateAccountCmd extends BaseCmd{
@Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
private Map details;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -102,10 +99,6 @@ public class UpdateAccountCmd extends BaseCmd{
return params;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -131,7 +124,7 @@ public class UpdateAccountCmd extends BaseCmd{
@Override
public void execute(){
Account result = _regionService.updateAccount(this);
Account result = _regionService.updateAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(result);
response.setResponseName(getCommandName());

View File

@ -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,40 @@ public class AddClusterCmd extends BaseCmd {
@Parameter(name = ApiConstants.VSM_IPADDRESS, type = CommandType.STRING, required = false, description = "the ipaddress of the VSM associated with this cluster")
private String vsmipaddress;
@Parameter (name=ApiConstants.CPU_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false , description = "value of the cpu overcommit ratio, defaults to 1")
private String cpuovercommitRatio;
@Parameter(name = ApiConstants.MEMORY_OVERCOMMIT_RATIO, type = CommandType.STRING, required = false ,description = "value of the default ram overcommit ratio, defaults to 1")
private String memoryovercommitratio;
@Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for guest traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypeGuestTraffic;
@Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypePublicTraffic;
@Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNameGuestTraffic;
@Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNamePublicTraffic;
public String getVSwitchTypeGuestTraffic() {
return vSwitchTypeGuestTraffic;
}
public String getVSwitchTypePublicTraffic() {
return vSwitchTypePublicTraffic;
}
public String getVSwitchNameGuestTraffic() {
return vSwitchNameGuestTraffic;
}
public String getVSwitchNamePublicTraffic() {
return vSwitchNamePublicTraffic;
}
public String getVSMIpaddress() {
return vsmipaddress;
}
@ -147,9 +185,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<ClusterResponse> response = new ListResponse<ClusterResponse>();
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();

View File

@ -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());

View File

@ -49,12 +49,6 @@ public class CreateDomainCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for networks in the domain")
private String networkDomain;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.STRING, description="Domain UUID, required for adding domain from another Region")
private String domainUUID;
@Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the Domain")
private Integer regionId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -71,14 +65,6 @@ public class CreateDomainCmd extends BaseCmd {
return networkDomain;
}
public String getDomainUUID() {
return domainUUID;
}
public Integer getRegionId() {
return regionId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -96,7 +82,7 @@ public class CreateDomainCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("Domain Name: "+getDomainName()+((getParentDomainId()!=null)?", Parent DomainId :"+getParentDomainId():""));
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain(), getDomainUUID(), getRegionId());
Domain domain = _domainService.createDomain(getDomainName(), getParentDomainId(), getNetworkDomain());
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());

View File

@ -50,11 +50,8 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.CLEANUP, type=CommandType.BOOLEAN, description="true if all domain resources (child domains, accounts) have to be cleaned up, false otherwise")
private Boolean cleanup;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean propagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -67,10 +64,6 @@ public class DeleteDomainCmd extends BaseAsyncCmd {
return cleanup;
}
public Boolean isPropagate() {
return propagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -52,11 +52,8 @@ public class UpdateDomainCmd extends BaseCmd {
@Parameter(name=ApiConstants.NETWORK_DOMAIN, type=CommandType.STRING, description="Network domain for the domain's networks; empty string will update domainName with NULL value")
private String networkDomain;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -73,10 +70,6 @@ public class UpdateDomainCmd extends BaseCmd {
return networkDomain;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -95,7 +88,7 @@ public class UpdateDomainCmd extends BaseCmd {
public void execute(){
UserContext.current().setEventDetails("Domain Id: "+getId());
Domain domain = _regionService.updateDomain(this);
if (domain != null) {
DomainResponse response = _responseGenerator.createDomainResponse(domain);
response.setResponseName(getCommandName());

View File

@ -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();

View File

@ -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() {

View File

@ -0,0 +1,100 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.resource;
import java.util.Date;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AlertResponse;
import org.apache.cloudstack.api.response.ConditionResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
@APICommand(name = "archiveAlerts", description = "Archive one or more alerts.", responseObject = SuccessResponse.class)
public class ArchiveAlertsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(ArchiveAlertsCmd.class.getName());
private static final String s_name = "archivealertsresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class,
description = "the IDs of the alerts")
private List<Long> ids;
@Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="archive alerts older than this date (use format \"yyyy-MM-dd\")")
private Date olderThan;
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "archive by alert type")
private String type;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public List<Long> getIds() {
return ids;
}
public Date getOlderThan() {
return olderThan;
}
public String getType() {
return type;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() {
if(ids == null && type == null && olderThan == null) {
throw new InvalidParameterValueException("either ids, type or olderthan must be specified");
}
boolean result = _mgr.archiveAlerts(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to archive Alerts, one or more parameters has invalid values");
}
}
}

View File

@ -0,0 +1,99 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.resource;
import java.util.Date;
import java.util.List;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AlertResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.user.Account;
@APICommand(name = "deleteAlerts", description = "Delete one or more alerts.", responseObject = SuccessResponse.class)
public class DeleteAlertsCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteAlertsCmd.class.getName());
private static final String s_name = "deletealertsresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.IDS, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = AlertResponse.class,
description = "the IDs of the alerts")
private List<Long> ids;
@Parameter(name=ApiConstants.OLDER_THAN, type=CommandType.DATE, description="delete alerts older than (including) this date (use format \"yyyy-MM-dd\")")
private Date olderThan;
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "delete by alert type")
private String type;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public List<Long> getIds() {
return ids;
}
public Date getOlderThan() {
return olderThan;
}
public String getType() {
return type;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() {
if(ids == null && type == null && olderThan == null) {
throw new InvalidParameterValueException("either ids, type or olderthan must be specified");
}
boolean result = _mgr.deleteAlerts(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Unable to delete Alerts, one or more parameters has invalid values");
}
}
}

View File

@ -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;

View File

@ -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 {
@ -48,7 +49,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.CLUSTER_ID, type=CommandType.UUID, entityType = ClusterResponse.class,
required=true, description="the cluster ID for the storage pool")
description="the cluster ID for the storage pool")
private Long clusterId;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the storage pool")
@ -58,7 +59,7 @@ public class CreateStoragePoolCmd extends BaseCmd {
private String storagePoolName;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType = PodResponse.class,
required=true, description="the Pod ID for the storage pool")
description="the Pod ID for the storage pool")
private Long podId;
@Parameter(name=ApiConstants.TAGS, type=CommandType.STRING, description="the tags for the storage pool")
@ -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///////////////////

View File

@ -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;

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
package org.apache.cloudstack.api.command.admin.usage;
import javax.inject.Inject;
@ -30,7 +30,6 @@ import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.network.NetworkUsageManager;
import com.cloud.user.Account;
import com.cloud.utils.exception.CloudRuntimeException;
@ -38,7 +37,6 @@ import com.cloud.utils.exception.CloudRuntimeException;
public class AddTrafficMonitorCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddTrafficMonitorCmd.class.getName());
private static final String s_name = "addtrafficmonitorresponse";
@Inject NetworkUsageManager networkUsageMgr;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -94,8 +92,8 @@ public class AddTrafficMonitorCmd extends BaseCmd {
@Override
public void execute(){
try {
Host trafficMonitor = networkUsageMgr.addTrafficMonitor(this);
TrafficMonitorResponse response = networkUsageMgr.getApiResponse(trafficMonitor);
Host trafficMonitor = _networkUsageService.addTrafficMonitor(this);
TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor);
response.setObjectName("trafficmonitor");
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
package org.apache.cloudstack.api.command.admin.usage;
import javax.inject.Inject;
@ -29,14 +29,12 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.NetworkUsageManager;
import com.cloud.user.Account;
@APICommand(name = "deleteTrafficMonitor", description="Deletes an traffic monitor host.", responseObject = SuccessResponse.class)
public class DeleteTrafficMonitorCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteTrafficMonitorCmd.class.getName());
private static final String s_name = "deletetrafficmonitorresponse";
@Inject NetworkUsageManager _networkUsageMgr;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -71,7 +69,7 @@ public class DeleteTrafficMonitorCmd extends BaseCmd {
@Override
public void execute(){
try {
boolean result = _networkUsageMgr.deleteTrafficMonitor(this);
boolean result = _networkUsageService.deleteTrafficMonitor(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
response.setResponseName(getCommandName());

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
package org.apache.cloudstack.api.command.admin.usage;
import java.util.Date;
@ -24,7 +24,6 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.SuccessResponse;
import com.cloud.server.ManagementServerExt;
import com.cloud.user.Account;
@APICommand(name = "generateUsageRecords", description="Generates usage records. This will generate records only if there any records to be generated, i.e if the scheduled usage job was not run or failed", responseObject=SuccessResponse.class)
@ -79,8 +78,7 @@ public class GenerateUsageRecordsCmd extends BaseCmd {
@Override
public void execute(){
ManagementServerExt _mgrExt = (ManagementServerExt)_mgr;
boolean result = _mgrExt.generateUsageRecords(this);
boolean result = _usageService.generateUsageRecords(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);

View File

@ -0,0 +1,126 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.usage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.UsageRecordResponse;
import org.apache.cloudstack.usage.Usage;
import org.apache.log4j.Logger;
@APICommand(name = "listUsageRecords", description="Lists usage records for accounts", responseObject=UsageRecordResponse.class)
public class GetUsageRecordsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(GetUsageRecordsCmd.class.getName());
private static final String s_name = "listusagerecordsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING, description="List usage records for the specified user.")
private String accountName;
@Parameter(name=ApiConstants.DOMAIN_ID, type=CommandType.UUID, entityType = DomainResponse.class,
description="List usage records for the specified domain.")
private Long domainId;
@Parameter(name=ApiConstants.END_DATE, type=CommandType.DATE, required=true, description="End date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-03.")
private Date endDate;
@Parameter(name=ApiConstants.START_DATE, type=CommandType.DATE, required=true, description="Start date range for usage record query. Use yyyy-MM-dd as the date format, e.g. startDate=2009-06-01.")
private Date startDate;
@Parameter(name=ApiConstants.ACCOUNT_ID, type=CommandType.UUID, entityType = AccountResponse.class,
description="List usage records for the specified account")
private Long accountId;
@Parameter(name=ApiConstants.PROJECT_ID, type=CommandType.UUID, entityType = ProjectResponse.class,
description="List usage records for specified project")
private Long projectId;
@Parameter(name=ApiConstants.TYPE, type=CommandType.LONG, description="List usage records for the specified usage type")
private Long usageType;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getAccountName() {
return accountName;
}
public Long getDomainId() {
return domainId;
}
public Date getEndDate() {
return endDate;
}
public Date getStartDate() {
return startDate;
}
public Long getAccountId() {
return accountId;
}
public Long getUsageType() {
return usageType;
}
public Long getProjectId() {
return projectId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public void execute(){
List<? extends Usage> usageRecords = _usageService.getUsageRecords(this);
ListResponse<UsageRecordResponse> response = new ListResponse<UsageRecordResponse>();
List<UsageRecordResponse> usageResponses = new ArrayList<UsageRecordResponse>();
for(Usage usageRecord: usageRecords){
UsageRecordResponse usageResponse = _responseGenerator.createUsageResponse(usageRecord);
usageResponse.setObjectName("usagerecord");
usageResponses.add(usageResponse);
}
response.setResponses(usageResponses);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
package org.apache.cloudstack.api.command.admin.usage;
import java.util.ArrayList;
import java.util.List;
@ -32,7 +32,6 @@ import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.host.Host;
import com.cloud.network.NetworkUsageManager;
@APICommand(name = "listTrafficMonitors", description="List traffic monitor Hosts.", responseObject = TrafficMonitorResponse.class)
@ -40,7 +39,6 @@ public class ListTrafficMonitorsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListServiceOfferingsCmd.class.getName());
private static final String s_name = "listtrafficmonitorsresponse";
@Inject NetworkUsageManager networkUsageMgr;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@ -68,12 +66,12 @@ public class ListTrafficMonitorsCmd extends BaseListCmd {
@Override
public void execute(){
List<? extends Host> trafficMonitors = networkUsageMgr.listTrafficMonitors(this);
List<? extends Host> trafficMonitors = _networkUsageService.listTrafficMonitors(this);
ListResponse<TrafficMonitorResponse> listResponse = new ListResponse<TrafficMonitorResponse>();
List<TrafficMonitorResponse> responses = new ArrayList<TrafficMonitorResponse>();
for (Host trafficMonitor : trafficMonitors) {
TrafficMonitorResponse response = networkUsageMgr.getApiResponse(trafficMonitor);
TrafficMonitorResponse response = _responseGenerator.createTrafficMonitorResponse(trafficMonitor);
response.setObjectName("trafficmonitor");
response.setResponseName(getCommandName());
responses.add(response);

View File

@ -14,7 +14,7 @@
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.commands;
package org.apache.cloudstack.api.command.admin.usage;
import java.util.List;
@ -23,7 +23,6 @@ import org.apache.log4j.Logger;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.server.ManagementServerExt;
import org.apache.cloudstack.api.response.UsageTypeResponse;
import com.cloud.user.Account;
@ -43,8 +42,7 @@ public class ListUsageTypesCmd extends BaseCmd {
@Override
public void execute() {
ManagementServerExt _mgrExt = (ManagementServerExt)_mgr;
List<UsageTypeResponse> result = _mgrExt.listUsageTypes();
List<UsageTypeResponse> result = _usageService.listUsageTypes();
ListResponse<UsageTypeResponse> response = new ListResponse<UsageTypeResponse>();
response.setResponses(result);
response.setResponseName(getCommandName());

View File

@ -65,12 +65,6 @@ public class CreateUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.USERNAME, type=CommandType.STRING, required=true, description="Unique username.")
private String username;
@Parameter(name=ApiConstants.USER_ID, type=CommandType.STRING, description="User UUID, required for adding account from another Region")
private String userUUID;
@Parameter(name=ApiConstants.REGION_ID, type=CommandType.INTEGER, description="Id of the Region creating the User")
private Integer regionId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -107,14 +101,6 @@ public class CreateUserCmd extends BaseCmd {
return username;
}
public String getUserUUID() {
return userUUID;
}
public Integer getRegionId() {
return regionId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -146,7 +132,7 @@ public class CreateUserCmd extends BaseCmd {
@Override
public void execute(){
UserContext.current().setEventDetails("UserName: "+getUserName()+", FirstName :"+getFirstName()+", LastName: "+getLastName());
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId(), getUserUUID(), getRegionId());
User user = _accountService.createUser(getUserName(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimezone(), getAccountName(), getDomainId());
if (user != null) {
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());

View File

@ -45,11 +45,8 @@ public class DeleteUserCmd extends BaseCmd {
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=UserResponse.class, required=true, description="Deletes a user")
private Long id;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -58,10 +55,6 @@ public class DeleteUserCmd extends BaseCmd {
return id;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////

View File

@ -49,11 +49,8 @@ public class DisableUserCmd extends BaseAsyncCmd {
required=true, description="Disables user by user ID.")
private Long id;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -62,10 +59,6 @@ public class DisableUserCmd extends BaseAsyncCmd {
return id;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -100,7 +93,7 @@ public class DisableUserCmd extends BaseAsyncCmd {
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
UserAccount user = _regionService.disableUser(this);
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());

View File

@ -46,11 +46,8 @@ public class EnableUserCmd extends BaseCmd {
required=true, description="Enables user by user ID.")
private Long id;
@Parameter(name=ApiConstants.IS_PROPAGATE, type=CommandType.BOOLEAN, description="True if command is sent from another Region")
private Boolean isPropagate;
@Inject RegionService _regionService;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -59,10 +56,6 @@ public class EnableUserCmd extends BaseCmd {
return id;
}
public Boolean getIsPropagate() {
return isPropagate;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -86,7 +79,7 @@ public class EnableUserCmd extends BaseCmd {
public void execute(){
UserContext.current().setEventDetails("UserId: "+getId());
UserAccount user = _regionService.enableUser(this);
if (user != null){
UserResponse response = _responseGenerator.createUserResponse(user);
response.setResponseName(getCommandName());

Some files were not shown because too many files have changed in this diff Show More