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
Create OvsVifDriver to deal with openvswitch specifics for plugging
intefaces
Create a parameter to set the bridge type to use in
LibvirtComputingResource.
Create several functions to get bridge information from openvswitch
Add a check to detect the libvirt version and throw an exception when
the version is to low ( < 0.9.11 )
Fix classpath loading in Script.findScript to deal with missing path
separators at the end.
Add notification to the BridgeVifDriver that lswitch broadcast type is
not supported.
Due to generic programming, most classes declare Daos with ID as Long, so they
get the getUuid(Long) definition, it has to be getUuid(String), uuid is not
gonna be anything else. Fix GenericDaoBase and GenericDao.
Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
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>
- 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>
If you update your build to build a version with a name not ending in -SNAPSHOT,
you are required to declare versions on all your depdendencies. There is already
a cs.mysql.version property, this patch makes sure it is used where appropriate.
Signed-off-by: Chip Childers <chip.childers@gmail.com>
- 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>
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.