deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@redhat.com
Subject Another take on machine creation
Date Thu, 07 Feb 2013 20:32:41 GMT

These patches represent another take on machine creation from what Michal
posted earlier - I've had them lying around for a while, and should have
sent them earlier.

There are a myriad ways in which an object can be created, especially for
machines; I introduced a new 'ref' keyword to the model DSL to indicate
that an object can be a reference to an existing object plus local
overrides.

All the gyrations of machine creations aren't implemented in this yet,
mostly because our unit test setup is too weak to write tests
effectively. These are some of the variations of what the machine template
inside a machine create ca nlook like:

(1) By reference only:

  <machineTemplate href="..."/>

(2) By value:

  <machineTemplate>
    <machineConfig href="..."/>
    <machineImage href="..."/>
  </machineTemplate>

(3) By reference with overrides:

  <machineTemplate href="...">
    <machineConfig>
      <cpu>42</cpu>
    </machineConfig>
    <machineImage href="..."/>
  </machineTemplate>

(4) by value with overrides

  <machineTemplate>
    <machineConfig href="...">
      <cpu>42</cpu>
    </machineConfig>
    <machineImage href="..."/>
  </machineTemplate>

.. and I think there are lots more variations on how to mix and match
references and value overrides.

To make this work in a sane way, the implicitly generated
MachineTemplateRef class would need to do the following upon
deserialization:

  * if href is provided look up and load the referenced template
  * if there are any overrides in the body, modify the
    loaded template accordingly

This two-step behavior can cascade down to the entities enclosed in the
machine template. Hence the need for a common mechanism to do this.

The problems with our tests is that we don't have a convenient way to do
the lookups needed to instantiate all the templates listed above.

David

Mime
View raw message