<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>In developing Nova's instance snapshots, I've run into a little snag</div>
<div>revolving around somed design decisions in both Nova and Glance. I have a</div>
<div>plan that I'd like to move forward with ASAP, so please, if you see any</div>
<div>problems or have any objections, raise them now.</div>
<div><br>
</div>
<div>Problem</div>
<div>=======</div>
<div><br>
</div>
<div>OpenStack's API divides calls into a "top-half" which returns quickly</div>
<div>(compute/api.py) and a fire-and-forget "bottom-half" (compute/manager.py)</div>
<div>which is long-running.</div>
<div><br>
</div>
<div>The problems is that the image-create OpenStack API call (which maps to</div>
<div>instance-snapshot) requires the image-metadata (id, name, status, etc) be</div>
<div>returned up front. The current implementation, however, doesn't create the</div>
<div>image in Glance until the snapshot is actually being uploaded which happens</div>
<div>well after the OpenStack API "top-half" has returned.</div>
<div><br>
</div>
<div>(* Aside: To facilitate caching, Glance treats image data as immutable, that</div>
<div>is one reason we wanted to hold off on creating the Image record in Glance</div>
<div>until the data was actually present. *)</div>
<div><br>
</div>
<div>Since we cannot change the OpenStack API (yet), we'll need to modify both Nova and</div>
<div>Glance to allow Images to exist *before* their data is available.</div>
<div><br>
</div>
<div>Proposed Solution</div>
<div>=================</div>
<div><br>
</div>
<div>Here is my suggestion:</div>
<div><br>
</div>
<div> * Glance images are given a status of 'queued', 'saving', 'active', or</div>
<div> 'killed'. This field already exists-- I'm noting the statuses here because</div>
<div> we're going to start using them to enforce state. (Note: CloudServers has</div>
<div> a 'preparing' state which is no longer needed in the Nova-Glance</div>
<div> implementation)</div>
<div><br>
</div>
<div> * We modify Glance to allow the client to omit the image data on</div>
<div> image-create (aka POST). When Glance detects this, it creates a record</div>
<div> for the image in the registry, puts it into the 'queued' state, and then</div>
<div> returns the image metadata.</div>
<div><br>
</div>
<div> * We modify Glance to allow data to be uploaded in a subsequent PUT request.</div>
<div> While the data is being uploaded, the image will be in the 'saving' state;</div>
<div> if the operation completes sucessfully, it will go to 'active', otherwise,</div>
<div> it will go to 'killed'. Note, since we have an immutability constraint on</div>
<div> images, we should not allow image data to be updated once it exists, so,</div>
<div> once the image goes 'active', subsequent PUT requests should fail with a</div>
<div> 409 Conflict (or something similar). Also note, this is at odds somewhat</div>
<div> with ReSTful semantics since a PUT in this case (when image data is</div>
<div> present in the request body) is no longer idempotent. If we can think of</div>
<div> a better way, I'm all ears, however, for now I think the tradeoff is worth</div>
<div> it.</div>
<div><br>
</div>
<div> * We modify OpenStack API image-create "top-half" to call</div>
<div> ImageService.create which will POST to Glance without the image data. We</div>
<div> will then return the image-metadata (with the image in a 'queued' state)</div>
<div> to the callee. The "top-half" will then pass the "image_id" to the</div>
<div> "bottom-half" which can upload the data into the specified image.</div>
<div><br>
</div>
<div> * Modify Glance XenServer plugin to accept the image_id as an argument and</div>
<div> to PUT to that resource.</div>
<div><br>
</div>
<div><br>
</div>
<div>This is the bare-minimum that will need to change for now, down the road,</div>
<div>we'll need to consider:</div>
<div><br>
</div>
<div> * Creating a monitor task that timeouts images that hang out in the 'queued'</div>
<div> and 'saving' state for too long, and a task that deletes images in the</div>
<div> 'killed' status.</div>
<div><br>
</div>
<div>Also, Glance now has Python bindings in the form of its 'client.py'. As part</div>
<div>of this effort, I'm planning on modifying ImageService::Glance to use the new</div>
<div>Glance client. This will mean that Nova will require that Glance be installed</div>
<div>on the same machine running nova-api in order to use the Glance service.</div>
<div><br>
</div>
<div>Thoughts?</div>
<div><br>
</div>
<div><br>
</div>
<div>-Rick</div>
<div><br>
</div>
</div>
<PRE>
Confidentiality Notice: This e-mail message (including any attached or
embedded documents) is intended for the exclusive and confidential use of the
individual or entity to which this message is addressed, and unless otherwise
expressly indicated, is confidential and privileged information of Rackspace.
Any dissemination, distribution or copying of the enclosed material is prohibited.
If you receive this transmission in error, please notify us immediately by e-mail
at abuse@rackspace.com, and delete the original message.
Your cooperation is appreciated.
</PRE></body>
</html>