388 Commits

Author SHA1 Message Date
frank
bd47cd104c CloudStack CS-14475
Atomatic addition of Apache license header broke lots of mysql files

fix DB upgrade cleanup script not get executed issue.

add "#" as comment signature in ScriptRunner.java
2012-04-13 15:34:59 -07:00
Alex Huang
7c6932ef80 some reformatting and a new way to get vos into the system 2012-04-12 11:04:38 -07:00
David Nalley
91fadc4a0d fixing line ends in utils 2012-04-09 20:05:41 -04:00
frank
2f634c0913 Switch to Apache license 2012-04-03 04:50:05 -07:00
Vijayendra Bhamidipati
005ba5e2b5 Bug 13127: API error text refer to database ids instead of uuids
Description:

	Adding overloaded addProxyObject() function to CloudException
	and RuntimeCloudException classes and using this function
	to stuff exceptions with IDs, to reduce code footprint.
2012-03-15 16:27:52 -07:00
Vijayendra Bhamidipati
6ac79c4be2 Bug 13127: API error text refer to database ids instead of uuids
Description:

	Adding a new class AnnotationHelper, that provides routines
	to read annotations from a VO class.

	Cloudstack does the mapping between cloudstack java VO objects
	and the database tables using cglib. cglib creates proxy objects
	as the maps between VO objects and the database.  A VO (value
	object) class is populated after querying from the MYSQL database.

	Ideally, a getAnnotation() issued on a cglib proxy object should
	get a list of all the annotations in all classes in the inheritence
	chain. However, this functionality seems to be currently broken
	in cglib.  Hence, when querying for annotations given the object
	of a VO class, we need to get to the corresponding VO class of that
	cglib proxy class and issue a getAnnotation() on that class. To get
	the VO class, we simply need to get the super class of the proxy
	object. Also, we need to recurse to the root VO class in case the
	VO class extends another VO class.

	Note that the cache used by CS is ehcache.
2012-03-08 17:34:28 -08:00
Vijayendra Bhamidipati
96f8111558 Bug 14060: Include a CloudStack error code in an Exception Response
Description:

	Missed fully qualifying ServerApiException in hashmap.
	Fixing it with this commit.
2012-03-08 11:19:13 -08:00
Vijayendra Bhamidipati
57c54e23d6 Bug 14060: Include a CloudStack error code in an Exception Response
Bug 13127: API error text refer to database ids instead of uuids

Code-Reviewers: Ewan Mellor, Kelven Yang

Description:

	1. A new class CSExceptionErrorCode has been added to utils.
	   It contains a list of error codes for each type of
	   Exception class. Use fully qualified package paths for
	   Exceptions in CSExceptionErrorCode.  We log any exception
	   name not found in the list of error codes for exceptions.

	2. Whenever we throw an exception exobj anywhere in the
	   CS code, the CSErrorCode is set in the base class
	   constructor.

	3. We add a new field csErrorCode in classes CloudException,
	   RuntimeCloudException, ExecutionException and
	   ExceptionResponse.

	4. Two places in ApiServer.java were wrongly modified when
	   putting in changes for bug 13127 to not throw an exception.
	   This has been corrected in this commit.
2012-03-05 17:39:09 -08:00
Vijayendra Bhamidipati
59631452b9 Bug 13127: API error text refer to database ids instead of uuids
Description:

	Modify Exception handling to enable addition of multiple
	uuids in a single exception thrown by API functions. Both
	XML and JSON outputs will store all uuids and Fieldnames.
	This will make it easier to provide more information when
	an exception occurs - for example, a zone id, a cluster id,
	host id, and then a specific property id.
2012-02-27 17:55:03 -08:00
Vijayendra Bhamidipati
bfe1122bc6 Bug 13127: API error text refer to database ids instead of uuids
Description:

	Added a field name for the db id in the IdentityProxy class, and
	modified setProxyObject() to take an additional id name parameter.
	This will let us know the name of the uuid that we are returning.
	E.g.- domainId, zoneId, etc. The client can view this field in
	the json/xml output. Modified the JSON/XML serialization routines
	to append this new parameter to the serialized output for Exception
	Responses.
2012-02-27 17:55:01 -08:00
Vijayendra Bhamidipati
c3fbe29cf8 Bug 13127: API error text refer to database ids instead of uuids
Description:

	1) Added a setProxyObject() method to CloudException and RuntimeCloudException
	2) Modified a bunch of throw exceptions in NetworkManagerImpl.java to call setProxyObject() before throwing an exception.
	3) Changed scope of ProxyIdentity attribute to protected.
	4) Added routines to ServerApiException to get/set IdentityProxy object, and
	   routine in RuntimeCloudException to get the Idproxy object.
	5) Modified the exception handling around the dispatcher and handlerequest()
	   to copy over the IdentityProxy information before rethrowing an exception
	   eventually back to handle().
	6) Removed duplicate IdentityProxy object in ServerApiException.
	   It was extending RuntimeCloudException which already had an
	   IdentityProxy object.
2012-02-27 17:54:56 -08:00
Vijayendra Bhamidipati
768d7a2a26 Bug 13127: API error text refer to database ids instead of uuids
Description:

1)	Moved RuntimeCloudException from api/ to utils/.

	Added simple constructor to RuntimeCloudException.

	Modified all classes that extended RuntimeException
	to extend RuntimeCloudException. These classes
	are listed below:

		ServerApiException
		CloudAuthenticationException
		CloudExecutionException
		AsyncCommandQueued
		HypervisorVersionChangedException
		RuntimeCloudException

2)	Added overloaded constructed to CloudException.
	Modified all classes that extend Exception to extend CloudException instead.
	These classes are listed below:

		ConcurrentOperationException
                ConflictingNetworkSettingsException
                ConnectionException
                DiscoveryException
                InsufficientCapacityException
                ManagementServerException
                ResourceUnavailableException
                VirtualMachineMigrationException
                AgentControlChannelException
                OperationTimedoutException.java
                UnsupportedVersionException.java
                UsageServerException.java
                UnableDeleteHostException.java
                AgentAuthnException.java
                HttpCallException.java
                ActiveFencingException.java
                ClusterInvalidSessionException.java
                GreTunnelException.java
                OvsVlanExhaustedException.java
2012-02-27 17:54:53 -08:00
U-CITRITE\vijayendra1
698c1ebe12 Bug 13127: API error text refer to database ids instead of uuids
Description:

1)	Adding two new classes, CloudException and RunTimeCloudException.
	The former extends Exception and the latter RunTimeException.
	These will be used by classes that formerly directly extended
	Exception and RuntimeException. These two classes have an attribute
	of type IdentityProxy to enable exceptions fill in db ids in separate
	attribute fields rather than in a string. Doing so will allow the
	serialization module (GSON for JSON and other for XML) to kick in
	and convert this db id to a uuid in ApiServer.java just before the
	JSON/XML responses are sent out.

2)	Moving IdentityProxy.java from api/ to utils/ since
	both CloudException and RuntimeCloudException refer to it.

3)	Changing references to IdentityProxy class from api/ to utils/.

4)	While rebasing to master, a new file was added, merging
	api/src/com/cloud/api/response/IsoVmResponse.java to this diff.
2012-02-27 17:54:50 -08:00
frank
e0072edf4b Bug 13962 - CloudRuntimeException: Failed to update keypairs on disk: cannot create key file null/.ssh/id_rsa
using a flag instead of calculating timeout value. The monitor thread may have inaccurate execution time which
 may cause script forever hang

 status 13962: resolved fixed
 reviewed-by: Alex, Edison
2012-02-23 14:11:53 -08:00
frank
d9019b3f70 Bug 13962 - CloudRuntimeException: Failed to update keypairs on disk: cannot create key file null/.ssh/id_rsa
Changes for Script.java:
1. Even the script is non-timeout one, set default timeout to one hour. This avoid a wrongn script forever hang
2. When InterruptedException happens, check if timeout is really reached, if not, continue

status 13962: resolved fixed
reviewed-by: Alex, Edison
2012-02-23 13:43:10 -08:00
kishan
9c5fb5f199 Bug 13741: Added new Config category Secure. Any config in secure category will encrypted along with the Hidden category configs
Status 13741: resolved fixed
Reviewed-By: Nitin
2012-02-17 16:42:32 +05:30
Edison Su
1ab89dd436 add cert chain in db, and also open the api to upload a cert chain 2012-02-09 14:56:40 -08:00
kishan
1fab4d1f72 Bug 13384: Added utility to change MS and DB secret key. Both database and db.properties are updated.
Status 13384: resolved fixed
Reviewed-By: Nitin
2012-02-07 20:03:06 +05:30
Alex Huang
c42f50c4b0 Used a different way to allocate guest ip address. not in used yet. 2012-01-30 16:10:10 -08:00
frank
f449cd7350 Bug 12771 - management-server.log displays ipmi related credentials in plain text
status 12771: resolved fixed
2012-01-09 14:42:01 -08:00
Kelven Yang
323a07d7e2 bug 12709: incremental fix - profiling management server clustering heartbeat activities 2012-01-05 14:59:45 -08:00
Alena Prokharchyk
0731dac370 bug 12399: introduced periodic thread that expires Project invitations
status 12399: resolved fixed
2011-12-09 12:21:41 -08:00
Edison Su
08ae2bc9ff fix loading agent in ssvm 2011-12-07 15:02:57 -08:00
frank
88e4cdc458 Bug 11939 - unify components.xml and components-premium.xml into components.xml
status 11939: resolved fixed
2011-12-07 11:34:57 -08:00
prachi
0769a3b3f3 API Server changes needed to read a properties file present within a jar provided in classpath. 2011-11-29 18:02:19 -08:00
Alena Prokharchyk
ecd7004f15 bug 11978: don't allow passing -, + and spaces for instance.name config param
status 11978: resolved fixed
2011-11-28 11:52:46 -08:00
kishan
e86b03c2e6 bug 12187 : Handle empty strings while encrypting and decrypting
status 12187 : resolved fixed
reviewed-by: Abhi
2011-11-28 22:20:44 +05:30
Alex Huang
3d6a87867a print out the statement on closing for better debugging output 2011-11-18 14:29:05 -08:00
Sheng Yang
257836284a bug 11904: Fix regression caused by OpenJDK 1.6.0 security fix
It’s due to an security fix of OpenJDK 1.6.0 added by Redhat. Here is excerpt
of [RHSA-2011:1380-01] Critical: java-1.6.0-openjdk security update(
https://www.redhat.com/archives/rhsa-announce/2011-October/msg00011.html)

    A flaw was found in the way the SSL 3 and TLS 1.0 protocols used block
    ciphers in cipher-block chaining (CBC) mode. An attacker able to perform a
    chosen plain text attack against a connection mixing trusted and untrusted
    data could use this flaw to recover portions of the trusted data sent over
    the connection. (CVE-2011-3389)

    Note: This update mitigates the CVE-2011-3389 issue by splitting the first
    application data record byte to a separate SSL/TLS protocol record. This
    mitigation may cause compatibility issues with some SSL/TLS implementations
    and can be disabled using the jsse.enableCBCProtection boolean property.
    This can be done on the command line by appending the flag
    "-Djsse.enableCBCProtection=false" to the java command.

To our knowledge, there are two condition need to be met to trigger this bug:
1.    Using old keystore generated by mgmt. server 2.2.8, which is signed with
SHA1withDSA. Any version later than 2.2.8 would generate keystore signed with
SHA1withRSA. RSA one seems fine with us so far.
2.    Use OpenJDK >=1.6.0.

The reason is, due to the security fix above, the assumption that one packet
would contain only one SSL record is broken. The decrypted data maybe only
contained the first byte of original application data. Then result in buffer
underflow when mgmt server want to read more from it.

To workaround it, according to the message above, add
"-Djsse.enableCBCProtection=false" to tomcat6.conf JAVA_OPTS line would work.
Notice the parameter would only work with latest version of OpenJDK, so simply
add it to the all setup would not work.

This patch provided a fix for it.

status 11904: resolved fixed
2011-11-16 18:40:14 -08:00
Kelven Yang
bf4076b559 Fix the problem in retrieving default host IP on windows platform 2011-11-14 11:33:51 -08:00
Alex Huang
ddbcd01f56 fixed up unit test 2011-11-11 14:15:13 -08:00
Alex Huang
f6fcaa49ec Merge complete except for virtualnetworkappliancemanager 2011-11-10 15:18:16 -08:00
alena
a32c4f1ec6 Fixed unit tests 2011-11-03 14:02:53 -07:00
Kelven Yang
924e556c95 bug 6745: Using UUID instead of integers - for all commands 2011-11-03 07:34:00 -07:00
frank
cef30956e9 Merge branch 'newagentmgr'
Conflicts:
	agent-simulator/src/com/cloud/api/commands/ConfigureSimulator.java
	ovm/src/com/cloud/ovm/hypervisor/OvmDiscoverer.java
	server/src/com/cloud/agent/manager/AgentManagerImpl.java
	server/src/com/cloud/capacity/CapacityManagerImpl.java
	server/src/com/cloud/network/F5BigIpManagerImpl.java
	server/src/com/cloud/network/JuniperSrxManagerImpl.java
	server/src/com/cloud/resource/ResourceManagerImpl.java
	server/src/com/cloud/server/ManagementServerImpl.java
	server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
	server/src/com/cloud/vm/UserVmManagerImpl.java
	server/src/com/cloud/vm/VirtualMachineManagerImpl.java
	utils/src/com/cloud/utils/db/GenericDao.java
2011-10-27 11:09:56 -07:00
Edison Su
92eaf49f29 Add storage migration 2011-10-24 15:59:47 -07:00
kishan
8487803f5a bug 5822, 10783: Security enhancements initial checkin. Added encryption support to db.properties and some DB values. 2011-10-24 18:02:31 +05:30
Abhinandan Prateek
ed2816051a bug 11354: enabled cache for listBy Dao calls and specifically for listBySecurityGroup 2011-10-24 10:50:44 +05:30
kishan
83b4d2f7f9 bug 5822, 10783: Security enhancements initial checkin. Added encryption support to db.properties and some DB values. 2011-10-24 10:26:02 +05:30
Abhinandan Prateek
bd774ab7a7 bug 11354: query cache option is being enabled at DAO level. To use the cache sql paramter query_cache_type should be set to 2 and query_cache_size should be set to a value greated than 40kb. These can be set in my.ini. There are more tuning paramters which can be fine tuned and they are mentioned here http://dev.mysql.com/doc/refman/5.5/en/query-cache-configuration.html 2011-10-20 13:23:14 +05:30
prachi
8570b25506 NAAS: APIServer changes to introduce framework to read commands from pluggable components having separate commands.properties file
Changes:
- Added a new interface 'PluggableService'
- Any component that can be packaged separately from cloudstack, can implement this interface and provide its own property file listing the API commands the component supports
- As an example have made VirtualNetworkApplianceService pluggable and a new configureRouter command is added
- ComponentLocator reads all the pluggable service from componentLibrary or from components.xml and instantiates the services.
- As an example, DefaultComponentLibrary adds the pluggable service 'VirtualNetworkApplianceService'
- Also components.xml.in has an entry to show how a pluggable service can be added, but it is commented out.
- APIServer now reads the commands for each pluggable service and when a command for such a service is called, APIServer sets the required instance of the pluggable service in the coomand.
- To do this a new annotation '@PlugService' is added that is processed by APIServer. This eliminates the dependency on the BaseCmd to instantiate the service instances.
2011-10-11 17:34:57 -07:00
alena
1c02374708 Fixed the bug in random seq allocator code - always do "+1" because .netxInt(10) method can return 0, and the id in this case will be equal the id already present in the DB. 2011-10-11 12:40:51 +05:30
kishan
7de5153d74 bug 11561: Added new Dao RandomlyIncreasing, which will increase the Vm Id by 1-10 randomly
status 11561: resolved fixed
2011-10-11 12:40:50 +05:30
frank
88b863d6e3 Bug 11522 - New agent manager
Initialize unit test case for resource manager
2011-10-07 15:51:24 -07:00
frank
0f5384d086 Bug 11522 - New agent manager
move findxxx interface from HostDao to Managers
2011-10-06 11:56:17 -07:00
frank
24b82a7a89 Bug 11522 - New agent manager
call SearchCriteriaService interface instead of SearchCriteria2 instance
2011-10-06 10:32:07 -07:00
frank
2b0afe505d Bug 11522 - New agent manager
refine SearchCirteria2
2011-10-05 16:49:47 -07:00
frank
89e04458b6 Bug 11522 - New agent manager
move all listxxx interface from HostDao to managers(ResourceManager, SecondaryStorageVmManager etc) with decent name using SearchCriteria2
or direct call SearchCriteria2 on demand
2011-10-04 14:35:26 -07:00
Edison Su
ae83246acb bug 11600: aquirelock before deleting a volume, which can be aquired by snapshot manager
status 11600: resolved fixed
2011-10-03 16:43:47 -07:00
frank
683113cc38 Bug 11522 - New agent manager
get rid of all secondary storage interface from HostDao, instead, put them in
SecondaryStorageVmManager using SearchCriteria2 with decent name
2011-10-03 11:21:34 -07:00