146 Commits

Author SHA1 Message Date
Hugo Trippaers
d57796b94f Fix XML validation errors 2013-08-13 08:25:45 +02:00
frank
ed97a03762 add license header to ProcessUtilTest.java 2013-08-12 18:08:20 -07:00
Laszlo Hornyak
f081092b80 ProcessUtil cleanup
- possible resource leak closed
- file content read uses now commons-lang FileUtils
- Added unit tests
2013-08-12 14:50:09 -07:00
John Burwell
1ae682de78 - CLOUDSTACK-3229: Properly serialize the https property to the s3Xen
plugin
  - Extracts the duplicated serializeProperties methods to
    ReflectUtils#flattenProperties
  - Adds unit tests for ReflectUtils#flattenProperties
2013-08-01 00:14:43 -04:00
Alex Huang
f5e5b39c9b Moved the DB layer code into framework-db and change only the necessary projects to refer to it. Cut down on the dependencies introduced with all the code in utils. 2013-07-26 15:02:10 -07:00
Prasanna Santhanam
2c5388afac For some reason cat is under /bin on some linuses
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit b8129d6a8e6634f6a101e09d8f0a9620a2379d67)
2013-07-25 19:18:21 +05:30
Laszlo Hornyak
76e283687f test for Script
a unit test for the most frequently used methods in the Script class

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-07-25 16:46:10 +05:30
Min Chen
d423a755f5 CLOUDSTACK-3274: API Refactoring: secretkey and accesskey of the backing
store is found in plaintext in the logs.

Conflicts:
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/api/ApiServlet.java
2013-07-20 18:01:49 -07:00
Alex Huang
b18c72626b Moved the SprintUtils which is for testing only to be in test directory. Changed pom.xml for different projects to use the utils test-jar. Removed some @Component annotations. Moved majority of the dependencies from cloudstack pom to utils pom 2013-07-18 21:53:51 -07:00
Prasanna Santhanam
168fb29d69 add some logging to NioTest
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-06-19 09:28:16 +05:30
Laszlo Hornyak
c88d8fb3a2 use commons-lang StringUtils
commons-lang is already a transitive dependency of the utils project, which allows removing some duplicated functionality.
This patch replaces StringUtils.join(String, Object...) with it's commons-lang counterpart.
It also replaces calls to String join(Iterable<? extends Object>, String) in cases where an array is already exist and it is only wrapped into a List.

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-06-17 19:17:22 +01:00
Laszlo Hornyak
564013bec0 String instantiation is not needed
Removed a String instntiation, test case added

Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2013-06-17 19:17:22 +01:00
Hugo Trippaers
b0ea02e65a Allow DSA public keys.
DSA can't be used for encryption with the bouncycastle library, so make
sure this situation is properly handled.
2013-06-17 10:04:59 -07:00
Sheng Yang
fbe6b273e3 CLOUDSTACK-1170: Redundant Router: Ensure MACs are same on other than first public nic 2013-06-13 16:05:15 -07:00
Chiradeep Vittal
971c40d98e Fix RAT check broken by a1a68ed0c4b722 2013-06-10 20:38:24 -07:00
Alex Huang
a1a68ed0c4 Review 11752 applied 2013-06-10 16:07:05 -07:00
Saksham Srivastava
5dc7387d3b CLOUDSTACK-1647: IP Reservation should not happen if the guest-vm cidr and network cidr is not same but their start ip and end ip are same.
Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>
2013-06-07 16:54:40 +05:30
Sheng Yang
9c9e2ec9cc PVLAN: Add pvlan in createNetworkCommand 2013-05-01 13:23:08 -07:00
Brian Spindler
469c4dd139 Removing ^M's from code.
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-04-04 00:53:20 +05:30
Kelven Yang
3ab744d100 CLOUDSTACK-1795: implement custom AOP to fully support legacy CloudStack AOP semantcis
Signed-off-by: Chip Childers <chip.childers@gmail.com>
2013-03-29 11:12:36 -07:00
Kelven Yang
0b84958a66 Fix an out-dated unit test assertion 2013-03-05 19:47:37 -05:00
Sheng Yang
a0762bc4a7 CLOUDSTACK-1303: Fix NPE when extend vlan with ipv4 only 2013-02-21 18:02:50 -08:00
Min Chen
5147fb16ac CLOUDSTACK-1253: Remove @author tag. 2013-02-15 10:42:06 -08:00
Sheng Yang
fda8ec3c59 IPv6: CLOUDSTACK-1153: Fix integer overflow on IPv6 address calcuation
Use BigInteger, which is 128 bits long.
2013-02-05 17:41:37 -08:00
Sheng Yang
f89dd9050c IPv6: CLOUDSTACK-1113: Fix the mechanism to find the usable IP in the IPv6
The new policy is:
1. Generate a random IP.
2. Find the next available IP, start from the generated IP.
3. If we cannot find an available IP after certain times(10000 by default,
network.ipv6.search.retry.max) retry, give up.
2013-02-05 14:31:12 -08:00
Sheng Yang
2e236a8322 IPv6: Fix ip address in range check 2013-02-05 14:31:06 -08:00
Rohit Yadav
c9e764818b rat: Fix license headers on ucs plugin etc.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-02 08:57:16 -08:00
Kelven Yang
7bd8bec68a Sync javelin with master up to 894cb8f7d9fc8b5561754a9fa541fef8f235148a 2013-01-31 17:20:19 -08:00
frank
8416d81b99 Merge branch 'ucs' into javelin
Conflicts:
	api/src/org/apache/cloudstack/api/ApiConstants.java
	plugins/pom.xml
	utils/src/com/cloud/utils/exception/CloudRuntimeException.java
	utils/src/com/cloud/utils/exception/RuntimeCloudException.java
2013-01-31 14:44:07 -08:00
Sheng Yang
f9a68e7f15 IPv6: Add vlan overlap checking 2013-01-29 22:01:38 -08:00
Sheng Yang
0b62fc4c17 IPv6: Verify if requested IPv4/IPv6 addresses are valid
Also rename NetUtils.isValidIPv6() to NetUtils.isValidIpv6()
2013-01-29 19:08:09 -08:00
Sheng Yang
fa00ddf07e IPv6: Fix getIp6FromRange() 2013-01-27 19:07:44 -08:00
Sheng Yang
bd4bc025d1 IPv6: Accept IPv6 parameter for createNetworkCmd
Also ass public_ipv6_address for ipv6 address management.

Extend nics and vlans for ipv6 address.

Add dependency to com.googlecode.ipv6(java-ipv6).

Modify dhcpcommand for ipv6.
2013-01-26 23:14:15 -08:00
Alex Huang
1567a112fa unit test works again 2013-01-24 14:36:44 -08:00
Kelven Yang
2c5859dbd4 Bring javelin back to the status of being able to start System VMs after another round of master branch merge 2013-01-18 19:15:32 -08:00
frank
fb050894f5 CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

able to dump xmlobject
2013-01-17 16:11:15 -08:00
Alex Huang
cbb7ff1c32 added missing files 2013-01-17 06:50:59 -08:00
Alex Huang
9759ad57f2 Commit the current changes to unit tests 2013-01-17 06:50:11 -08:00
frank
53473c07b9 CloudStack CLOUDSTACK-723
Enhanced baremetal servers support on Cisco UCS

introduce an python etree like xml helper.
Ok, this is not a new wheel. Frankly speaking, all Java XML API just suc**.
there are two popular types of XML API in java, one class is for data binding, JAXB,
XStream fall into this category. Another class is tree based, like JDOM, XOM ...

for XML api call, data binding library is painful as you have to specify the schema
that how xml stream converts to java object, which means you have to pre-define all
schemas(xsd file for JAXB, java object for XStream ...). This is not productive, because you
must add new schema when XML document grows.

Tree based library shines in this case, for it's able to dynamically create an object tree
from xml stream without any knowledge of its structure. However, all tree based
XML API library fall into below convention:

Element e = root.getChildElement("child1").getChildElement("child2").getChildElement("child3")...getChildElement("childN")

anything wrong with it???

the sadness is if there is no "child2", you will get a NPE with above code, which means you have to judge
before getting.

And, why so verbose?? why not:

Element e = root.child1.child2.child3...childN ???

Ok I am joking, it's impossible in Java the world knows Java is a static language.

but you can actually do:

Element e = root.get("child1.child2.child3");

or

List<Element> e = root.getAsList("child1.child2.child3")

this is known as XPath style(though XPATH use '/'), python etree has supported it.

so I did this toy for my UCS xml api call, it's quite like etree which is easy to use, for example:

<components.xml>
    <system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
        <checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
        <checker name="EncryptionSecretKeyChecker" class="com.cloud.utils.crypt.EncryptionSecretKeyChecker"/>
        <checker name="DatabaseIntegrityChecker" class="com.cloud.upgrade.DatabaseIntegrityChecker"/>
        <checker name="DatabaseUpgradeChecker" class="com.cloud.upgrade.PremiumDatabaseUpgradeChecker"/>
    </system-integrity-checker>
</components.xml>

XmlObject xo = XmlObjectParser.parseFromFile("~/components.xml.in");
List<XmlObject> checkers = xo.getAsList("system-integrity-checker.checker");

then you get a list of XmlObject which represent each 'checker' element:

XmlObject firstChecker = checkers.get(0);
// firstChecker.get("name") == "ManagementServerNode"
// firstChecker.get("class") == "com.cloud.cluster.ManagementServerNode"
// firstChecker.getTag() == "checker"
// firstChecker.getText() == "" if it's <checker/>xxx</checker>, then getText() == "xxx"

example 2:
<checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
    <system-integrity-checker class="com.cloud.upgrade.DatabaseUpgradeChecker">
        <checker name="ManagementServerNode" class="com.cloud.cluster.ManagementServerNode"/>
    </system-integrity-checker>
</components.xml>

yout can do:

XmlObject xo = XmlObjectParser.parseFromFile("~/components.xml.in");
XmlObject checker = xo.get("system-integrity-checker.checker");

then it returns a single object as we only have one "checker" in xml stream,

or you still do

List<XmlObject> checkers = xo.getAsList("system-integrity-checker.checker");

it returns a list which only contains one element of "checker"

if you do:

XmlObject checker = xo.get("system-integrity-checker.checker.this_middle_element_doesnt_exist.some_element");

it returns a null without any exception, so you don't have to worry if a parent element is missing when getting a leaf element

again it's not a new wheel, I just hate JAVA xml api
2013-01-16 16:27:21 -08:00
Rohit Yadav
ea3f5ecb54 Fix license for xml files in javelin
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-12 06:31:47 -08:00
Rohit Yadav
38eaa04b98 Pull changes from master into javelin
- Disables simulator plugin, breaks build, available via simulator profile
- Fixes spring injections
- Fix api,acl plugins, ApiServer, ApiDispatcher
- Fix other merge conflicts

Conflicts:
	docs/en-US/external-firewalls-and-load-balancers.xml
	plugins/acl/static-role-based/src/org/apache/cloudstack/acl/StaticRoleBasedAPIAccessChecker.java
	server/src/com/cloud/api/ApiDispatcher.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java
	utils/test/com/cloud/utils/log/CglibThrowableRendererTest.java

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-01-12 06:02:54 -08:00
Noa Resare
1033200b0b CLOUDSTACK-933: CglibThrowableRendererTest writing stack traces...
Improve CglibThrowableRenderer test case

Log to a separate Logger instead of the default one to avoid spurious
stack traces in test run output.

Actually verify that registering CglibThrowableRenderer with the
alternative log hierarchy actually removes call trace lines that
contains the string <generated>
2013-01-11 17:09:44 -05:00
Alex Huang
f922c6fc03 Keep removing 2013-01-10 14:46:52 -08:00
Alex Huang
56e5fbdee2 removed import of componentlocator and inject from all files 2013-01-10 11:44:47 -08:00
Alex Huang
f40e7b7511 removed componentlocator and inject 2013-01-10 11:05:20 -08:00
Alex Huang
cf8de7ee17 Removed all the .project files 2013-01-08 14:11:00 -08:00
Alex Huang
30f2565d98 Merge branch 'api_refactoring' into javelin 2013-01-08 12:36:04 -08:00
Chip Childers
bec00cce46 CLOUDSTACK-505: Converted regex expressions to pre-compiled Pattern objects
This was done for performance reasons.

I also refined the regex strings and added more test cases for different
string scenarios.

Signed-off-by: Chip Childers <chip.childers@gmail.com>
2012-12-17 23:01:19 -05:00
Chip Childers
44da7b1841 CLOUDSTACK-505: Reworked approach to cleaning request / response strings
As noted in the bug, several of the API command in question
are async calls.  I've added a simple regex-based string cleaning
function, and have the request and response strings running through
it prior to being appended to the audit log.

Unit tests added for the new cleaning function as well.

The call to skip logging the createSSHKeyPair response remains intact
for now, although it should probably be scrubbed similarly to the
password fields.

Signed-off-by: Chip Childers <chip.childers@gmail.com>
2012-12-17 14:11:09 -05:00
Kelven Yang
d79f1f6fdc Replace Adapters and PluggableServices, use Spring to load them 2012-11-07 15:03:24 -08:00