123 Commits

Author SHA1 Message Date
Min Chen
3dabd5fbf3 Clean up ApiServer, ApiServlet and ApiDispatcher flow to handle various CloudRuntimeException
and CloudException in one place, and Introduced ApiErrorCode to handle CloudStack API error
code to standard Http code mapping.

Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-16 22:36:34 -08:00
Min Chen
8608925216 Consolidate RuntimeCloudException and CloudRuntimeException into one
class CloudRuntimeException, and removed RuntimeCloudException to avoid
confusion.
2013-01-15 18:07:08 -08:00
Rohit Yadav
bca2c928e8 PluggableService: Fix interface definition
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-14 19:01:26 -08:00
Alex Huang
1294cdc701 pulled from master 2013-01-10 16:01:01 -08:00
Rohit Yadav
c4e890c55d PluggableService: Refactor method to return map of key value pairs
- Makes plugins self contained so they decide their properties file format
- PluggableService creates the contract that implementing entity will return a
  properties map which is apiname:rolemask (both are strings)

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-10 15:55:02 -08:00
Alex Huang
fac2270240 more files changed 2013-01-10 15:29:14 -08:00
Alex Huang
56e5fbdee2 removed import of componentlocator and inject from all files 2013-01-10 11:44:47 -08:00
Prasanna Santhanam
b18c03a006 simulator: formatting changes
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-01-09 15:13:12 +05:30
Rohit Yadav
077f47193d
Sync changes: Merge branch 'master' into api_refactoring
Conflicts:
	plugins/network-elements/dns-notifier/pom.xml

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-08 20:36:17 -08:00
Noa Resare
4f98d879f6 maven: remove explicit submodule versions from module pom.xml
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-08 20:25:58 -08:00
Rohit Yadav
d235859168 Fix PluggableService to provide interface for ACL adapters etc. to get configs
- Fix interface to return array of strings, or filenames
- Fix StaticRoleBased ACL adapter to process config files by going through all pluggable services
- Refactor interface names

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-02 16:29:39 -08:00
Rohit Yadav
774cb29b0c api: Annotate all remaining cmd classes with APICommand name field
Automates name field filling using following python program which reads from
various *commands.properties.in files and populates name fields based on the
name cmd class mapping defined in them.

import os
search_pattern = "@APICommand("
pattern_len = len(search_pattern)
prop_files = [
"client/tomcatconf/cisconexusvsm_commands.properties.in",
"client/tomcatconf/f5bigip_commands.properties.in",
"client/tomcatconf/junipersrx_commands.properties.in",
"client/tomcatconf/netapp_commands.properties.in",
"client/tomcatconf/netscalerloadbalancer_commands.properties.in",
"client/tomcatconf/nicira-nvp_commands.properties.in",
"client/tomcatconf/simulator_commands.properties.in",]
file_prefixes = [
"plugins/hypervisors/vmware/src/",
"plugins/network-elements/f5/src/",
"plugins/network-elements/juniper-srx/src/",
"plugins/file-systems/netapp/src/",
"plugins/network-elements/netscaler/src/",
"plugins/network-elements/nicira-nvp/src/",
"plugins/hypervisors/simulator/src/",]
counter = 0
for prop_file in prop_files:
    f = open(prop_file, 'r')
    data = f.read()
    f.close()
    file_prefix = file_prefixes[counter]
    apis = filter(lambda x: x.strip()!='' and (not x.startswith('#')), data.split('\n'))
    for api in apis:
        api_name = api.split('=')[0].strip()
        cmd_name = file_prefix + api.split('=')[1].split(';')[0].replace('.', '/').strip() + ".java"
        if not os.path.exists(cmd_name):
            print cmd_name, api_name
        f = open(cmd_name, 'r')
        d = f.read()
        f.close()
        idx = d.find(search_pattern) + pattern_len
        new_str = d[:idx] + "name = \"%s\", " % api_name + d[idx:]
        f = open(cmd_name, 'w')
        f.write(new_str)
        f.close()
    counter += 1

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-28 01:28:47 -08:00
Prasanna Santhanam
539fca3520 Simulator: Fixing the listTemplatesCommand
Should return the ListTemplatesAnswer and ListVolumes returns
ListVolumesAnswer

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2012-12-26 19:22:17 -08:00
Prasanna Santhanam
39db3be294 Simulator: Fixing the listTemplatesCommand
Should return the ListTemplatesAnswer and ListVolumes returns
ListVolumesAnswer

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2012-12-26 19:20:32 -08:00
Rohit Yadav
7a7fe583e0 Rename Implementation annotation to APICommand
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-26 15:55:34 -08:00
Rohit Yadav
057ac12d23 Enforce InternalIdentity interface on all VO classes that impls long getId()
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-26 15:09:44 -08:00
Rohit Yadav
78d70d349b Merge branch 'master' into api_refactoring
- Applies Isaac Chian'gs fix (CLOUDSTACK-648) to allow user change their password
- TODO: Fix response, only partially applied

Conflicts:
	api/src/org/apache/cloudstack/api/response/UserResponse.java
	client/tomcatconf/commands.properties.in
	server/src/com/cloud/api/ApiResponseHelper.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-25 09:51:17 -08:00
Prasanna Santhanam
1f1a13448f simulator: resurrect simulator hypervisor as plugin
Multiple fixes:
1. changes to the mvn configuration
    a. include simulator to client.war
    b. activate simulator by profile
2. templates for simulator
3. developer prefill for simulator
    a. Use deplydb-simulator to setup simulator db
4. Inherit components-simulator.xml from components.xml
5. ListVolumesCommand missed for MockStorageManager
6. Include simulator properties into utils/db.properties

TODO:
 Secondary storage VMs don't come up because ComponentLocator doesn't
retain a unique set of adapaters by name. Fix this in subsequent
checkin.
2012-12-23 19:28:57 -08:00
Rohit Yadav
296b49c2f8 Merge branch 'master' into test-merge-api
Conflicts:
	api/src/com/cloud/agent/api/BackupSnapshotCommand.java
	api/src/com/cloud/agent/api/storage/PrimaryStorageDownloadCommand.java
	api/src/com/cloud/agent/api/to/PortForwardingRuleTO.java
	api/src/com/cloud/network/NetworkService.java
	api/src/com/cloud/resource/ResourceService.java
	api/src/org/apache/cloudstack/api/ApiConstants.java
	api/src/org/apache/cloudstack/api/ResponseGenerator.java
	api/src/org/apache/cloudstack/api/response/SSHKeyPairResponse.java
	client/tomcatconf/commands.properties.in
	core/src/com/cloud/storage/SnapshotVO.java
	pom.xml
	server/src/com/cloud/api/ApiDispatcher.java
	server/src/com/cloud/api/ApiResponseHelper.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/configuration/ConfigurationManagerImpl.java
	server/src/com/cloud/network/NetworkManagerImpl.java
	server/src/com/cloud/network/rules/RulesManagerImpl.java
	server/src/com/cloud/offerings/NetworkOfferingVO.java
	server/src/com/cloud/resource/ResourceManagerImpl.java
	server/src/com/cloud/upgrade/dao/Upgrade40to41.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	server/test/com/cloud/vpc/MockNetworkManagerImpl.java
	setup/db/create-schema.sql
	setup/db/db/schema-40to410.sql

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-23 13:54:46 -08:00
Prasanna Santhanam
f0c3b4c62a simulator:Using the priority to decide b/w MASTER/BACKUP
BootArgs carry router priority for master and backup and simulator will
reuse the priority to decide RvR status. Deprecating the odd/even logic.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2012-12-22 14:09:59 -08:00
Prasanna Santhanam
ed25ec0500 simulator: simulator maintenance mode and simulator latency per command
Detail:
To induce latency for a command you have to use an API call like so
http://localhost:8096/client/api?command=configureSimulator&zoneid=1&podid=1&name=CheckRouterCommand&value=wait:80|timeout:0

(This is a hidden API command just for the simulator)

You will see the configuration effected in the mockconfiguration table of
simulator db. You can introduce the latency at runtime without restarting
management server.

mysql> select * from mockconfiguration;
+----+----------------+--------+------------+---------+--------------------+-------------------+
| id | data_center_id | pod_id | cluster_id | host_id | name               | values            |
+----+----------------+--------+------------+---------+--------------------+-------------------+
|  1 |              1 |      1 |       NULL |    NULL | CheckRouterCommand | wait:80|timeout:0 |
+----+----------------+--------+------------+---------+--------------------+-------------------+
1 row in set (0.00 sec)

By providing the optional zoneid, podid, clusterid, hostid you can induce the
latency at various levels. This delay will happen before the command is
processed and post-execution return Command's Answer back to management
server.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2012-12-22 13:57:13 -08:00
Prasanna Santhanam
beff1f45b1 Simulator: components-simulator.xml resource
The extended simulator component including the Simulator Managers and
Discoverers
2012-12-22 13:55:32 -08:00
Prasanna Santhanam
d6083ce51d Simulator: moving hypervisor simulator into plugin
Simulator just like any hypervisor should be a plugin.
resurrecting it to aid api refactoring tests. WIP

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2012-12-22 13:02:57 -08:00