Merge lp://qastaging/~justin-fathomdb/nova/add-xsd into lp://qastaging/~hudson-openstack/nova/trunk

Proposed by justinsb
Status: Work in progress
Proposed branch: lp://qastaging/~justin-fathomdb/nova/add-xsd
Merge into: lp://qastaging/~hudson-openstack/nova/trunk
Diff against target: 3420 lines (+3363/-0)
11 files modified
nova/api/openstack/schemas/v1.0/xsd/actions.xsd (+256/-0)
nova/api/openstack/schemas/v1.0/xsd/backup.xsd (+374/-0)
nova/api/openstack/schemas/v1.0/xsd/common.xsd (+51/-0)
nova/api/openstack/schemas/v1.0/xsd/faults.xsd (+480/-0)
nova/api/openstack/schemas/v1.0/xsd/flavor.xsd (+144/-0)
nova/api/openstack/schemas/v1.0/xsd/image.xsd (+263/-0)
nova/api/openstack/schemas/v1.0/xsd/ipgroup.xsd (+215/-0)
nova/api/openstack/schemas/v1.0/xsd/limits.xsd (+354/-0)
nova/api/openstack/schemas/v1.0/xsd/rackspace.xsd (+141/-0)
nova/api/openstack/schemas/v1.0/xsd/server.xsd (+913/-0)
nova/api/openstack/schemas/v1.0/xsd/version.xsd (+172/-0)
To merge this branch: bzr merge lp://qastaging/~justin-fathomdb/nova/add-xsd
Reviewer Review Type Date Requested Status
Jay Pipes (community) Approve
Soren Hansen (community) Abstain
Brian Lamar (community) Disapprove
Devin Carlen (community) Approve
termie (community) Approve
Thierry Carrez (community) ffe Approve
Vish Ishaya ptl Pending
Review via email: mp+54418@code.qastaging.launchpad.net

Description of the change

Import of Rackspace CloudServers API v1.0 XSD files.

This is needed so that we can test against them.

To post a comment you must log in.
Revision history for this message
Jay Pipes (jaypipes) wrote :

Now *this* is what metadata is.

Revision history for this message
justinsb (justin-fathomdb) wrote :

I hope you've reviewed it in detail Jay, knowing how much you love XML :-)

We've had a couple of issues with typing of data and some questions over XML
support, so I think importing the existing XML schema is the right first
step. We'll probably have to create a second XML schema for OpenStack v1.1
to the extent that it's different. I'm going to bring this up in the "any
other business" at the end of our weekly meeting.

Revision history for this message
justinsb (justin-fathomdb) wrote :

I was able to generate a JAXB Java binding to this schema, so I think it's complete now...

Revision history for this message
Jesse Andrews (anotherjesse) wrote :

We shouldn't use rackspace product names in the XSD...

 * Cloud Servers -> OpenStack Compute or Nova?
 * cloudServersFault -> computeFault

...

Revision history for this message
justinsb (justin-fathomdb) wrote :

True, but this is for compatibility with v1.0.

I am on the lookout for an OpenStack-ified v1.1 XSD, if anyone sees one
hanging around...

Revision history for this message
Thierry Carrez (ttx) wrote :

If you want this into Cactus rather than wait for Diablo, could you provide a quick benefit vs. risk of regression rationale, then request a specific FFe review from me ? This looks rather self-contained so I think it should be able to get in.

Revision history for this message
Thierry Carrez (ttx) :
review: Needs Information (ffe)
Revision history for this message
justinsb (justin-fathomdb) wrote :

Sure! Technically though, this one isn't subject to FF, because this is not a Feature, this is to support a bugfix for Bug #740576. It was linked, but 'someone' unlinked it ;-) The bug is that our XML API isn't to spec. This is the spec :-)

Risks:
I do believe there's as close to zero risk as is possible - these files aren't even referenced. If they are referenced in future, they'll likely initially be referenced only by tests (validating our XML against the schema). If they are referenced by non-tests, it will be because it's the most efficient way to deliver a correct XML API.

Benefits:
By having the spec in the codebase, we're able to validate against it.

I was planning on writing tests using the Java bindings.

Revision history for this message
termie (termie) wrote :

I don't like the idea of adding another root dir, can we dump these under the nova/api/openstack dir?

review: Needs Information
Revision history for this message
justinsb (justin-fathomdb) wrote :

Fine with me, except we might want to have schemas for other APIs (EC2?), or
even schema for internal protocols (e.g. the glance protocol, or maybe our
message format in the multi-zones case).

How about nova/api/schema or nova/schema?

The downside of putting them under nova is that they're not code (well, not
Python code).

Revision history for this message
termie (termie) wrote :

my thoughts on this are that I am trying to move for better encapsulation of the concerns of the sections of the project, with some hope of being able to physically separate them in the future, so if there are schemas specific to the implementation of this API I think they should live under it.

Revision history for this message
Thierry Carrez (ttx) wrote :

Agreed this is part of the bugfix and doesn't require FFe. For clarity I'll set an approve here.

review: Approve (ffe)
Revision history for this message
termie (termie) wrote :

i'll take your word for it that all this gibberish makes sense ;) I'm happy enough with the location of it.

review: Approve
Revision history for this message
Devin Carlen (devcamcar) wrote :

i admit. i didn't read every piece of this. :)

review: Approve
Revision history for this message
Soren Hansen (soren) wrote :

Now, if this was accompanied by some tests that actually used it, I could see its value. As is, it's an XML Schema that *something else* (the existing Rackspace Cloud Servers) validates against. I think having this in the tree while we're not even sure we validate against it is confusing, and I don't think I understand its value.

If you can add some tests that actually use it, I'd be happy to accept it even much later in the cycle. Alternativaly, (much less idealy) if you could document that you've used some external tool to validate our stuff against this schema and it actually passes, I think it'll make much mose sense to have this in the tree as some kind of documentation.

review: Disapprove
Revision history for this message
justinsb (justin-fathomdb) wrote :

Hi Soren - it's a fair concern. I was trying to keep my patches fairly
self-contained; I originally proposed in a separate patch incorporating a
Java binding which actually uses this schema, but it looks like that doesn't
belong in core. I don't really have experience of using schemas in Python.

The fact is, we are supposed to be supporting this API. This is the spec
for our "v1.0" endpoint. While XML can be fugly, it does have the benefit
of being an excellent spec for the wire format, which it's easy to test
against. Most of the specs carry across to our JSON output. If we want our
API to be compatible with the many existing tools out there that talk to the
CS API, this is the spec we have to validate against.

I'm also trying to track down the v1.1 bindings, for exactly the same
reason. However, apparently they might still be in flux...?

I did originally have tests, but it looks like someone that knows Python +
XML better is going to have to do it for language reasons. My tests did
find that we're not even putting in a namespace declaration, so everything
failed immediately. I'm working on the fix for that in the parallel branch.
 Once the namespace declaration is included, basic functionality works, but
that's as far as my testing got so far. The discussion on the namespace
branch also showed up additional problems with our output (JSON & XML) when
it comes to limits. So we're drawing benefits from this work even now, and
I think in core we'll derive even more.

I think the right thing to do is to merge these specs, on the ground that
they are the best specs we've got for what we're supposed to be targeting.
 Even if we don't have tests immediately, it's helpful to have this in our
source tree, rather than on some website. Other languages can use this to
test our API, and hopefully someone that knows Python can e.g. add an output
filter to validate the XML as it is returned or add it to our unit
tests. The first step is to add these schemas though - otherwise we'll
never break the chicken & egg stalemate.

Revision history for this message
Soren Hansen (soren) wrote :

2011/3/31 justinsb <email address hidden>:
> The fact is, we are supposed to be supporting this API.

Right. So this should be referenced from a blueprint or something.

Documentation should document how things *are*, not how we wish they were.

> This is the spec
> for our "v1.0" endpoint.  While XML can be fugly, it does have the benefit
> of being an excellent spec for the wire format, which it's easy to test
> against.  Most of the specs carry across to our JSON output.  If we want our
> API to be compatible with the many existing tools out there that talk to the
> CS API, this is the spec we have to validate against.

I completely agree, so if these schemas were used for this validation,
I'd be perfectly happy with it.

> I think the right thing to do is to merge these specs, on the ground that
> they are the best specs we've got for what we're supposed to be targeting

Revision history for this message
Soren Hansen (soren) wrote :

Hmm... I got cut off, somehow..

> I think the right thing to do is to merge these specs, on the ground that
> they are the best specs we've got for what we're supposed to be targeting.

"supposed to be" are the operative words for me here.

If you would stick the files in a directory named
"schemas_that_we_ought_to_be_following_but_are_not",
"wishful_thinking" or even "somebody_elses_schema" that would help
immensely. :)

Revision history for this message
Brian Lamar (blamar) wrote :

> Now, if this was accompanied by some tests that actually used it, I could see
> its value. As is, it's an XML Schema that *something else* (the existing
> Rackspace Cloud Servers) validates against. I think having this in the tree
> while we're not even sure we validate against it is confusing, and I don't
> think I understand its value.
>
> If you can add some tests that actually use it, I'd be happy to accept it even
> much later in the cycle. Alternativaly, (much less idealy) if you could
> document that you've used some external tool to validate our stuff against
> this schema and it actually passes, I think it'll make much mose sense to have
> this in the tree as some kind of documentation.

Absolutely agree. Adding this right now is just bloat IMO and doesn't address the issue/bug. I'd rather see it added a little a time with corresponding tests rather than get added all at once with no tests.

review: Disapprove
Revision history for this message
justinsb (justin-fathomdb) wrote :

I totally agree that we should have been validating against this since day 1, and that we should have tests that pass.

We didn't do that, and everything is broken. Let's move forwards.

This is the best schema we've got for the OpenStack API (JSON or XML). There's a parallel branch that makes validation not fail completely. There was a test branch that wasn't wanted in core because it used Java, so was rejected. If I write a test, it'll fail, which will mean it can't be merged, because I tried proposing tests that "fail due to known bugs" and that was rejected. If I sit down for two hours and fix the XML output in one big patch that fixes everything, then the patch will be too big and will be rejected. So I have to do it one step at a time, over the course of two releases instead of two hours. Fine. But let's at least take the first step.

Vish: as PTL, can you please make the call here.

Revision history for this message
Brian Lamar (blamar) wrote :

Wouldn't it be possible to merge just the "flavors" XSD and tests for flavor XML responses? Then move to images, servers, and so on? I agree that it won't get merged if you do one big patch which tests everything, but piecemeal is way to go here IMO.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Now that the blocking branch is going in I think we can take the step-by-step approach. Btw, validation in python is pretty simple:

    schema = etree.XMLSchema(file=os.path.join(os.path.dirname(__file__),
                                               '../../schema/nrml.xsd'))
    parser = etree.parse(StringIO(str(xml)))
    if not schema.validate(parser):
        raise exceptions.ValidationError("Invalid NRML document.")

I have a feeling that as we will be running into bugs in each section, so this will keep it manageable.

On Apr 6, 2011, at 10:45 AM, Brian Lamar wrote:

> Wouldn't it be possible to merge just the "flavors" XSD and tests for flavor XML responses? Then move to images, servers, and so on? I agree that it won't get merged if you do one big patch which tests everything, but piecemeal is way to go here IMO.
> --
> https://code.launchpad.net/~justin-fathomdb/nova/add-xsd/+merge/54418
> You are requested to review the proposed merge of lp:~justin-fathomdb/nova/add-xsd into lp:nova.

Revision history for this message
justinsb (justin-fathomdb) wrote :

My preferred option is one mega-patch which just adds the XML schema and
fixes all the output to be schema-compliant; that's probably about 2 hours
work. The way we're doing it, as a sequence of atomic patches and debating
over each one, we can stretch that out over 2 releases. But I think
breaking this up further into even smaller patches is a bad idea if we want
well-formed output this year.

Schemas are allowed to cross-reference each other, so it's not clear a
priori that we can do so. I don't really see the upside in doing so.

Revision history for this message
justinsb (justin-fathomdb) wrote :

Vish - messages "crossed in the mail"! Thanks for that example; I'll take
that code and add warnings whenever we output non-compliant XML. I'll do
that in a derived branch from this one.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Warnings on non-compliance are a great idea, and might even be enough to convince Soren and Brian that this should go in!

On Apr 6, 2011, at 11:03 AM, justinsb wrote:

> Vish - messages "crossed in the mail"! Thanks for that example; I'll take
> that code and add warnings whenever we output non-compliant XML. I'll do
> that in a derived branch from this one.
>
> --
> https://code.launchpad.net/~justin-fathomdb/nova/add-xsd/+merge/54418
> You are requested to review the proposed merge of lp:~justin-fathomdb/nova/add-xsd into lp:nova.

Revision history for this message
justinsb (justin-fathomdb) wrote :

Validation of XML output against this schema is now available in the derived branch:
https://code.launchpad.net/~justin-fathomdb/nova/check-xsd/+merge/56658

Revision history for this message
Thierry Carrez (ttx) wrote :

Small governance note:

Though the Nova PTL can make a final call on difficult decisions, he is not there to bypass the normal nova-core branch review process, and should be called as a last measure only. He shouldn't overrule the nova-core decision, but only have a casting vote in the case nova-core members can't reach an agreement. Otherwise let's just say Vish reviews branches and give other nova-core members some vacation.

Revision history for this message
Vish Ishaya (vishvananda) wrote :

Sorem, Brian:

Do you still feel this is a disapprove now that we have a branch with tests? I'm leaning toward getting this in so we can start fixing the issues that the tests expose. I'm not concerned about this making it into cactus specifically, but it seems like there is a reason for this to be there now.

Revision history for this message
Brian Lamar (blamar) wrote :

Vish, I agree this could help us expose and squash a good number of API-formatting-related bugs but in my opinion it's a feature branch and thus needs to wait until Diablo opens up. Also I believe that Justin and Brian Waldon have agreed we should talk a lot of this out at the dev conference.

I'm a disapprove for Cactus still, but I'm more than ready to get better testing frameworks/methods in place for future releases.

Revision history for this message
justinsb (justin-fathomdb) wrote :

I think we should discuss all of this at the design conference, but
the schema that we're supporting should have been part of our test
suite on day 1. Let's fix that in Cactus, not in D/E/F.

Right now, we only have one usable API, and it's EC2. I think getting
a working CloudServers / OS v1.0 API is worth delaying Cactus over
alone, never mind the many other issues.

Revision history for this message
Soren Hansen (soren) wrote :

As long as we keep this as an internal checking thing, then it's fine. If it ends up being something people might consider documentation, it's not so fine. I'm very, very tired right now, so can't really judge either way. I'll look at it tomorrow when I'm capable of more coherent thought.

review: Abstain
Revision history for this message
Jay Pipes (jaypipes) wrote :

I'm cool with this. And yes, Justin, even though I'm not a huge fan of XML, I do see the value of this ;)

review: Approve
Revision history for this message
Sandy Walsh (sandy-walsh) wrote :

Who is the owner of the schema? Is it Rackspace or OpenStack?

For 1.0 it seems it's Rackspace. Since it's a Rackspace resource I think we should just point the documentation to the Rackspace site with a note "You can get the XSD here [URL]". Just like the the RS API docs live on the RAX site.

Later, when it's an OpenStack API, under our control, it could get brought under our source control (with tests).

$0.02

Unmerged revisions

847. By justinsb

Moved CloudServers v1.0 under nova/api/openstack/schemas

846. By justinsb

Moved rackspace.xsd so that the relative URLs work

845. By justinsb

Added common.xsd that I had missed

844. By justinsb

Import of Rackspace CloudServers API v1.0 XSD

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.