<?xml version="1.0"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>bcwaldon.cc</title>
    <link>http://bcwaldon.cc/</link>
    <atom:link href="http://bcwaldon.cc/rss.xml" rel="self" type="application/rss+xml" />
    <description>bcwaldon.cc</description>
    <language>en-us</language>
    <pubDate>Fri, 09 Nov 2012 09:06:05 -0800</pubDate>
    <lastBuildDate>Fri, 09 Nov 2012 09:06:05 -0800</lastBuildDate>

    
    <item>
      <title>OpenStack Image Service - Grizzly Planning</title>
      <link>http://bcwaldon.cc/2012/11/06/openstack-image-service-grizzly.html</link>
      <pubDate>Tue, 06 Nov 2012 00:00:00 -0800</pubDate>
      <author>bcwaldon@gmail.com (Brian Waldon)</author>
      <guid>http://bcwaldon.cc/2012/11/06/openstack-image-service-grizzly</guid>
      <description>&lt;h2&gt;So what is Glance?&lt;/h2&gt;

&lt;p&gt;As there has been some discussion about what Glance's place is in the OpenStack lineup, the first thing that should be made clear is what Glance intends to provide to its consumers. The primary objective of Glance is to publish a catalog of virtual machine images. Rather than own users' image data, Glance simply tracks where that data resides. Glance owns the metadata provided by users.&lt;/p&gt;

&lt;p&gt;An important use case of Glance up until now has been the ability to stream image data through the Glance HTTP service. Glance will continue to support this to keep compatibility with the v1 and v2 API specifications, but the feature will not be supported in any future major versions of the API. Glance should not stand in the way of a user booting an image on a cloud - if a user prefers to stash an image in Swift and boot directly from that URI, it should be possible!&lt;/p&gt;

&lt;h2&gt;Grizzly Planning&lt;/h2&gt;

&lt;p&gt;The Glance team has a lot to tackle during the next release cycle. The major pieces have been outlined below...&lt;/p&gt;

&lt;h3&gt;Multiple Image Locations&lt;/h3&gt;

&lt;p&gt;In the interest of being more flexible with the storage locations of image data, Glance will allow users to provide several sources of image data for a single image record. An example use case would be for a cloud operator to dump a high-traffic image on an ephemeral volume for quick cloning at boot time, but keep a copy in a more persistent data store such as Swift in the case that the volume is lost.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/multiple-image-locations&quot;&gt;https://blueprints.launchpad.net/glance/+spec/multiple-image-locations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://etherpad.openstack.org/GrizzlyMultipleImageLocations&quot;&gt;https://etherpad.openstack.org/GrizzlyMultipleImageLocations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Image Workers&lt;/h3&gt;

&lt;p&gt;Asynchronous image processing can be quite taxing to the API nodes, so Glance will provide a framework for offloading these processes to some type of worker. Glance already allows asynchronous image upload through the use of a 'copy_from' parameter, which will be the first process to be offloaded into this new framework. Two major features that have been discussed at previous design summits are image data conversion and inremental image coalescing - both of which can also be tackled once we develop this framework.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://etherpad.openstack.org/GrizzlyImageWorkers&quot;&gt;https://etherpad.openstack.org/GrizzlyImageWorkers&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Incremental Images&lt;/h3&gt;

&lt;p&gt;In order to minimize data duplication and unnecessary network traffic, Glance will support the upload of 'incremental images.' An incremental image is a representation of the changed blocks of a disk with a link back to original image from which it was created.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/hierarchical-images&quot;&gt;https://blueprints.launchpad.net/glance/+spec/hierarchical-images&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://etherpad.openstack.org/GrizzlyImageHierarchy&quot;&gt;https://etherpad.openstack.org/GrizzlyImageHierarchy&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Image Property Protection&lt;/h3&gt;

&lt;p&gt;Nova cares about several 'magic' properties of images in order to properly boot them - some of the major ones being block_device_mapping, kernel_id, ramdisk_id, instance_uuid and image_type. The problem with this is that the owner of an image can modify those properties at will, possibly rendering it un-bootable. Glance will allow trusted privileged clients such as Nova or the cloud Admin to set specific properties on images that are write- or read-protected from the image owner.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/api-v2-property-protection&quot;&gt;https://blueprints.launchpad.net/glance/+spec/api-v2-property-protection&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;OpenStack Images API v2.1&lt;/h3&gt;

&lt;p&gt;The v2.0 OpenStack Images API was released with Folsom, yet it lacks a few major features:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Image Sharing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It was decided that the image sharing capabilities (also known as 'image membership') of the v1 Images API needed to be revisited for the v2 API, but that design work was not completed by the time Folsom, and therefore the v2.0 API, was released. This will be tackled in the Grizzly timeframe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create From Location &amp;amp; Copy-From&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Images can not yet be created from an explicit backend store location - this will be enabled based on the work for Multiple Image Locations. Additionally, the asynchronous image upload process will be added to the v2.1 API.&lt;/p&gt;

&lt;h3&gt;Domain Object Model&lt;/h3&gt;

&lt;p&gt;Glance has suffered a bit of a mis-balance between new code and refactoring the existing code. We plan to completely overhaul the internals of Glance with a domain object model that should help re-align the codebase.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/glance-domain-logic-layer&quot;&gt;https://blueprints.launchpad.net/glance/+spec/glance-domain-logic-layer&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;glance-registry vs glance-api&lt;/h3&gt;

&lt;p&gt;The v1 and v2 Images APIs were implemented with seperate paths to the Glance database. The first of which proxies queries through a subsequent HTTP service (glance-registry) while the second talks directly to the database. As these two APIs should be talking to an equivalent system, we will be realigning their internal paths to talk through the service layer (created with the domain object model) directly to the database, effectively deprecating the glance-registry service.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Upgrading OpenStack Glance - Essex to Folsom</title>
      <link>http://bcwaldon.cc/2012/09/05/glance-essex-to-folsom-upgrade.html</link>
      <pubDate>Wed, 05 Sep 2012 00:00:00 -0700</pubDate>
      <author>bcwaldon@gmail.com (Brian Waldon)</author>
      <guid>http://bcwaldon.cc/2012/09/05/glance-essex-to-folsom-upgrade</guid>
      <description>&lt;p&gt;As Glance consists of only two services, the upgrade process is pretty straightforward. This post walks through what I did to upgrade an Essex Glance deployment to Folsom.&lt;/p&gt;

&lt;p&gt;Full disclosure - everything on my system has been installed from source.&lt;/p&gt;

&lt;h2&gt;Backup&lt;/h2&gt;

&lt;p&gt;This isn't a required step, but it's always good to keep a backup of config files. I moved all of my config and paste files from &lt;code&gt;/etc/glance/&lt;/code&gt; to &lt;code&gt;/etc/glance.essex/&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;etc/
    glance.essex/
        glance-api.conf
        glance-api-paste.ini
        glance-registry.conf
        glance-registry-paste.ini
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Don't worry about backing up your actual image data - Folsom will be able to pick up right where Essex left off.&lt;/p&gt;

&lt;h2&gt;Configuration&lt;/h2&gt;

&lt;p&gt;The biggest pain of the upgrade is dealing with the paste configuration files. Thankfully, this should be the last release that you have to go through this process!&lt;/p&gt;

&lt;p&gt;Copy the essex config files (not paste files) into a newly-created  &lt;code&gt;/etc/glance&lt;/code&gt; directory:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;etc/
    glance/
        glance-api.conf
        glance-registry.conf
    glance.essex/
        glance-api.conf
        glance-api-paste.ini
        glance-registry.conf
        glance-registry-paste.ini
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Copy the paste files provided by the glance source into the new config directory - not your old essex paste files!&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;etc/
    glance/
        glance-api.conf
        glance-api-paste.ini
        glance-registry.conf
        glance-registry-paste.ini
    glance.essex/
        glance-api.conf
        glance-api-paste.ini
        glance-registry.conf
        glance-registry-paste.ini
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you have any custom paste pipelines, now would be the time to copy them into your new paste files. I'm not going to cover this process since I assume you know what you're doing if you wrote your own pipelines.&lt;/p&gt;

&lt;h3&gt;Auth Paste Configuration&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;NOTE: Skip this step if you aren't using Keystone.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Move all of the &lt;code&gt;auth_*&lt;/code&gt; and &lt;code&gt;admin_*&lt;/code&gt; attributes in the &lt;code&gt;[filter:authtoken]&lt;/code&gt; sections out of your paste files into new &lt;code&gt;[keystone_authtoken]&lt;/code&gt; sections of the corresponding configuration files.&lt;/p&gt;

&lt;p&gt;For example, I took the &lt;code&gt;auth\_*&lt;/code&gt; and &lt;code&gt;admin_*&lt;/code&gt; values out of &lt;code&gt;/etc/glance.essex/glance-api-paste.ini&lt;/code&gt;, which looked something like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[filter:authtoken]
paste.filter_factory = keystone.middleware.auth_token:filter_factory
service_protocol = http
service_host = 127.0.0.1
service_port = 5000
auth_host = 10.0.2.15
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = secrete
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And put them at the bottom of &lt;code&gt;/etc/glance/glance-api.conf&lt;/code&gt; in a new &lt;code&gt;[keystone_authtoken]&lt;/code&gt; section, which then looked like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[keystone_authtoken]
auth_host = 10.0.2.15
auth_port = 35357
auth_protocol = http
admin_tenant_name = service
admin_user = glance
admin_password = secrete
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I did the same thing for &lt;code&gt;/etc/glance.essex/glance-registry-paste.ini&lt;/code&gt; and &lt;code&gt;/etc/glance/glance-registry.conf&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;v2 API Configuration&lt;/h3&gt;

&lt;p&gt;With the Folsom release comes a new HTTP API, the OpenStack Images API v2.0. You must decide to either leave it on and configure it, or turn it off completely.&lt;/p&gt;

&lt;p&gt;To enable the v2 API, simply copy your sql-related glance-registry configuration into your glance-api configuration file. The relevant bits of my &lt;code&gt;/etc/glance/glance-api.conf&lt;/code&gt; looked like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[DEFAULT]
enable_v2_api = true
sql_connection = mysql://root:secrete@localhost/glance?charset=utf8
sql_idle_timeout = 1800
sql_max_retries = 10
sql_retry_interval = 1
db_auto_create = false
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To turn it off, simply set the &lt;code&gt;enable_v2_api&lt;/code&gt; flag to 'false'.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[DEFAULT]
enable_v2_api = false
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Update Keystone&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;NOTE: Skip this step if you aren't using Keystone.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Since Glance depends on importing a piece of middleware owned by Keystone, you must update your local Keystone code to Folsom.&lt;/p&gt;

&lt;p&gt;Since this walkthrough is aimed at Glance, I won't dive into what it takes to upgrade a full Keystone deployment. Here's what I did to make the latest Keystone code available to Glance:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ pip install keystone --upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Update Other Dependencies&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;pip-requires&lt;/code&gt; file that ships with the Glance source code to determine what you should install or update. I ended up asking pip to install everything for me so I didn't miss any updated version requirements:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ pip install -r tools/pip-requires --upgrade
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I do want to highlight that there are two completely new dependencies that may or may not be packaged on your platform, &lt;code&gt;jsonschema&lt;/code&gt; and &lt;code&gt;python-swiftclient&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;Stop Services&lt;/h2&gt;

&lt;p&gt;Now stop glance-api and glance-registry.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ glance-control api stop
Stopping glance-api  pid: 29451  signal: 15

$ glance-control registry stop
Stopping glance-registry  pid: 29447  signal: 15
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Upgrade Database&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;glance-manage db_sync&lt;/code&gt; to upgrade your database - it should end up at version 15:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ glance-manage db_sync
2012-09-06 00:14:20     INFO [migrate.versioning.api] 13 -&amp;gt; 14... 
2012-09-06 00:14:20     INFO [glance.db.sqlalchemy.migrate_repo.schema] creating
table image_tags
2012-09-06 00:14:20     INFO [migrate.versioning.api] done
2012-09-06 00:14:20     INFO [migrate.versioning.api] 14 -&amp;gt; 15... 
2012-09-06 00:14:20     INFO [migrate.versioning.api] done

$ glance-manage db_version
15
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Start Services&lt;/h2&gt;

&lt;p&gt;Now start glance-api and glance-registry&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ glance-control registry start
Starting glance-registry

$ glance-control api start
Starting glance-api
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>OpenStack Folsom &amp; Glance</title>
      <link>http://bcwaldon.cc/2012/08/20/openstack-folsom-glance-overview.html</link>
      <pubDate>Mon, 20 Aug 2012 00:00:00 -0700</pubDate>
      <author>bcwaldon@gmail.com (Brian Waldon)</author>
      <guid>http://bcwaldon.cc/2012/08/20/openstack-folsom-glance-overview</guid>
      <description>&lt;p&gt;As we are coming up on the Folsom OpenStack release, I thought it would be a good idea to cover what landed in Glance over the last several months. It is becoming increasingly difficult to keep up with all of our projects, so I hope this overview helps!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update 2012-09-12:&lt;/strong&gt; Updated High-Profile Bugs to reflect bugs fixed in folsom-rc1&lt;/p&gt;

&lt;h2&gt;Python Client Rewrite&lt;/h2&gt;

&lt;p&gt;A new client library, &lt;a href=&quot;http://github.com/openstack/python-glanceclient&quot;&gt;python-glanceclient&lt;/a&gt;, was created during the Folsom release cycle to replace the client that currently lives in the Glance repository. This new client has already been integrated into Nova, Cinder, Horizon and Devstack.&lt;/p&gt;

&lt;p&gt;As a &lt;a href=&quot;http://wiki.openstack.org/ProjectTypes&quot;&gt;library project&lt;/a&gt;, python-glanceclient does not follow the same release cycle as core projects such as Glance. It uses a three-part versioning mechanism and is distributed through OpenStack-supporting distros, &lt;a href=&quot;http://pypi.python.org/pypi/python-glanceclient&quot;&gt;pypi&lt;/a&gt;, and &lt;a href=&quot;http://github.com/openstack/python-glanceclient&quot;&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The importance bit is that the (now considered 'legacy') client code in Glance is officially deprecated in favor of this new client. It will still ship with Folsom, but it prints warnings to stderr when used from the command-line and raises &lt;code&gt;UserWarning&lt;/code&gt; when imported directly in python. Expect the legacy client code to be removed from the Glance repository sometime early in the Grizzly release cycle.&lt;/p&gt;

&lt;p&gt;The new client does maintain 100% CLI compatibility for interactions with the v1 Images API, but that legacy usage will never be updated to work with the v2 API. The python interface does not maintain compatibility with the legacy client, however, the python module does not conflict with that installed by the Glance source. Expect to see more about python-glanceclient in a subsequent post.&lt;/p&gt;

&lt;h2&gt;OpenStack Images API v2.0&lt;/h2&gt;

&lt;p&gt;Version 2.0 of the OpenStack Images API is largely defined based on the work that was finished in the Folsom release of Glance. Expect a separate post covering the v2.0 API spec itself.&lt;/p&gt;

&lt;p&gt;Two new configuration options were added to control the availability of specific API versions: enable_v1_api and enable_v2_api. These are boolean flags that control whether an API should be deployed with glance-api. If you want to prevent users from accessing the new v2 API, just set enable_v2_api to False (it defaults to True).&lt;/p&gt;

&lt;p&gt;I want to specifically thank Mark Washenberger, Alex Meade, Iccha Sethi and Nikhil Komawar of Rackspace for their outstanding work on the v2.0 API implementation!&lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/api-2&quot;&gt;super-blueprint on launchpad&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;High-Profile Bugs&lt;/h2&gt;

&lt;p&gt;Features are always awesome, but the biggest request of the OpenStack community has been to work on stabilization and bug-fixing. The following is a list of major bugs that were fixed in the Folsom release cycle, many more lower-priority bugs were fixed and can be seen on launchpad. Bugs that affect stable/essex have been backported accordingly.&lt;/p&gt;

&lt;h3&gt;Keystone Integration&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1010519&quot;&gt;1010519&lt;/a&gt;: Use a case-insensitive check when determining if a user has admin privileges&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Swift Integration&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/979745&quot;&gt;979745&lt;/a&gt;: Actually delete images from swift when using Keystone authentication.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1002791&quot;&gt;1002791&lt;/a&gt;: Replace usage of &lt;code&gt;swift.client&lt;/code&gt; with &lt;code&gt;swiftclient&lt;/code&gt; - swift dependency replaced with python-swiftclient.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/994296&quot;&gt;994296&lt;/a&gt;: Allow swift account name to contain the '@' character.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/997658&quot;&gt;997658&lt;/a&gt;: S3 store backend now works with Swift's S3 compatibility middleware (Swift3) - use s3_store_bucket_url_format=path.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;SSL&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1032451&quot;&gt;1032451&lt;/a&gt;: Allow server to validate client certificate using CA cert specified in &lt;code&gt;ca_file&lt;/code&gt; config option.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1007093&quot;&gt;1007093&lt;/a&gt;: Images less than 4 KB in size are now uploaded only once; data is no longer duplicated.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Database&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1012823&quot;&gt;1012823&lt;/a&gt;: Prevent database auto-creation - configurable using &lt;code&gt;db_auto_create&lt;/code&gt; config option.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/975651&quot;&gt;975651&lt;/a&gt;: Update all image id references in db migration 12; image properties were being ignored.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Policy&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1036193&quot;&gt;1036193&lt;/a&gt;: New image policy added to cover downloading image data: 'download_image'.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1043482&quot;&gt;1043482&lt;/a&gt;: Missing policy files don't cause server to crash - a default set of rules is now used instead.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;Miscellaneous&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1038994&quot;&gt;1038994&lt;/a&gt;: Maximum image size is now configurable using &lt;code&gt;image_size_cap&lt;/code&gt; (default 1 TB) and chunked transfer-encoding HTTP requests are now properly validated.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/978130&quot;&gt;978130&lt;/a&gt;, &lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1042823&quot;&gt;1042823&lt;/a&gt;: Multiprocess-enabled servers now respect SIGINT and SIGHUP&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1036193&quot;&gt;1036193&lt;/a&gt;: Individual workers now get a personal database connection rather than sharing one.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1019421&quot;&gt;1019421&lt;/a&gt;: Glance will clean up partially stored images if filesystem fills up - only applies to the filesystem store driver.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1031842&quot;&gt;1031842&lt;/a&gt;: Partially-cached images are removed when a client connection is prematurely closed.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1021054&quot;&gt;1021054&lt;/a&gt;, &lt;a href=&quot;https://bugs.launchpad.net/glance/+bug/1021740&quot;&gt;1021740&lt;/a&gt;: Admins can now share images regardless of ownership or existing sharing permissions.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;Show me the Features!&lt;/h2&gt;

&lt;h3&gt;Tenant-Specific Storage Locations in Swift&lt;/h3&gt;

&lt;p&gt;The ability to store image data in the image owner-specific locations has always been an interesting feature on our backlog as storing all users' images in a single account is a no-go for some deployers. We ended up with a solution that is only implemented for Swift, but done in such a way that we can expand it easily during Grizzly.&lt;/p&gt;

&lt;p&gt;The implementation adds a couple of configuration options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;swift_store_multi_tenant&lt;/code&gt;: this must be set to 'True' to enable this feature (it defaults to 'False').&lt;/li&gt;
&lt;li&gt;&lt;code&gt;swift_store_admin_tenants&lt;/code&gt;: this is a list of tenants, referenced by id, that should be granted read and write access to all swift containers created by Glance.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Assuming you configured 'swift' as your &lt;code&gt;default_store&lt;/code&gt; and you enable this feature as described above, images will be stored in a swift endpoint pulled from the authenticated user's service_catalog. The created image data will only be accessible through Glance by the tenant that owns it and any tenants defined in &lt;code&gt;swift_store_admin_tenants&lt;/code&gt; that are identified as having admin-level accounts.&lt;/p&gt;

&lt;p&gt;Special thanks to Dan Prince of RedHat for tackling this feature!&lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/swift-tenant-specific-storage&quot;&gt;blueprint on launchpad&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Image Replication Tool&lt;/h3&gt;

&lt;p&gt;At the Folsom OpenStack Design Summit, we decided that the best first-run at image replication would be to write a simple python script that could talk to multiple Glance endpoints and sync images between them. During this release cycle, we developed the &lt;code&gt;glance-replicator&lt;/code&gt; tool.&lt;/p&gt;

&lt;p&gt;It is currently only available through &lt;a href=&quot;http://github.com/openstack/glance/tree/master/bin/glance-replicator&quot;&gt;GitHub&lt;/a&gt;, but we hope to develop a better distribution method in Grizzly.&lt;/p&gt;

&lt;p&gt;Once you have it installed, you should run the help command to determine specific usage: &lt;code&gt;glance-replicator help&lt;/code&gt;. The tool already has a great list of features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replicate binary image data along with metadata

&lt;ul&gt;
&lt;li&gt;Local replication will download image data to a local directory&lt;/li&gt;
&lt;li&gt;Live replication can circumvent local disk access&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Compare Glance endpoints to see what images need to be replicated&lt;/li&gt;
&lt;li&gt;Determine the effective size of a Glance endpoint&lt;/li&gt;
&lt;li&gt;Prevent replication of specific metadata attributes&lt;/li&gt;
&lt;li&gt;Provide separate authentication tokens for master and slave endpoints&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Thanks a ton to Michael Still of Canonical for his fantastic work on this tool!&lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/image-replication&quot;&gt;blueprint on launchpad&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Database Driver Pluggability&lt;/h3&gt;

&lt;p&gt;The internal pythonic interface used to interact with sqlalchemy models, a.k.a. the database driver, has limited deployers and developers to using only the backends that sqlalchemy itself supported (MySQL, PostgreSQL, SQLite, etc.).&lt;/p&gt;

&lt;p&gt;The database driver has been made pluggable using the &lt;code&gt;data_api&lt;/code&gt; configuration option. A deployer of Glance can use the default sqlalchemy API, or one could specify any python module path that implements the same interface.&lt;/p&gt;

&lt;p&gt;The in-memory database driver, referred to as the 'simple' driver, has been promoted from a test helper to the first sqlalchemy alternative. It should only be used for testing and in extremely rare deployment configurations. It doesn't write anything to the local filesystem, so expect your data to be lost if you restart your services. It cannot share between services, so you are limited to a single glance-registry and glance-api process (the &lt;code&gt;workers&lt;/code&gt; config must be 0). Additionally, data will not be shared between the v1 and v2 APIs.&lt;/p&gt;

&lt;p&gt;If you are interested in writing a driver for your favorite backend, you can use the test suite defined in &lt;a href=&quot;http://github.com/openstack/glance/tree/master/glance/tests/functional/db/__init__.py&quot;&gt;glance/tests/functional/db/__init__.py&lt;/a&gt;. See the test modules &lt;a href=&quot;https://github.com/openstack/glance/blob/master/glance/tests/functional/db/test_simple.py&quot;&gt;test_simple&lt;/a&gt; and &lt;a href=&quot;https://github.com/openstack/glance/blob/master/glance/tests/functional/db/test_sqlalchemy.py&quot;&gt;test_sqlalchemy&lt;/a&gt; in that same directory for an example of how to integrate with the tests. Unfortunately, the testing suite is incomplete and cannot yet guarantee complete interface compliance. The sqlalchemy api is the de facto standard as of now, but that responsibility will transition to the test suite in the Grizzly timeframe.&lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/refactor-db-layer&quot;&gt;blueprint on launchpad&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Store Driver Pluggability&lt;/h3&gt;

&lt;p&gt;Similar to how the database driver was made pluggable, the list of available image store drivers has been pushed into a configuration option &lt;code&gt;known_stores&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;known_stores = 
    glance.store.filesystem.Store,
    glance.store.http.Store,
    glance.store.rbd.Store,
    glance.store.s3.Store,
    glance.store.swift.Store,
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you want to write an additional store driver, you can implement the interface defined by the base class in &lt;code&gt;glance.store.base.Store&lt;/code&gt; and append the pythonic path of your store class to the &lt;code&gt;known_store&lt;/code&gt; option. Feel free to use that base class as your super class and define the methods that raise &lt;code&gt;NotImplementedError&lt;/code&gt;, or write your own from scratch.&lt;/p&gt;

&lt;p&gt;Testing is not as straightforward at the moment, so please refer to the &lt;a href=&quot;https://github.com/openstack/glance/tree/master/glance/tests/functional/v1&quot;&gt;files here&lt;/a&gt; for reference.&lt;/p&gt;

&lt;p&gt;Thanks to Josh Harlow of Yahoo for making this happen!&lt;/p&gt;

&lt;p&gt;See the &lt;a href=&quot;https://blueprints.launchpad.net/glance/+spec/import-dynamic-stores&quot;&gt;blueprint on launchpad&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;What about Grizzly?&lt;/h2&gt;

&lt;p&gt;While plans are far from being solidified for the next release cycle, I can throw a few teasers out there:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Protected Properties&lt;/strong&gt;: Deployers will be able to set read/write permissions on individual image properties.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Privileged Services&lt;/strong&gt;: Glance endpoints should be able to identify trusted clients (like Nova, Cinder or Horizon) and respond with additional information.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Domain Objects&lt;/strong&gt;: The internal APIs of Glance have never been well-defined. We hope to create a proper domain object layer to help minimize code repetition in the API controllers and database drivers.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Images API v2.1+&lt;/strong&gt;: Image sharing will make its way into the v2 API, along with several other yet-to-be finalized features.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    
    <item>
      <title>Using Warlock &amp; JSON Schemas</title>
      <link>http://bcwaldon.cc/2012/08/19/using-warlock-and-json-schemas.html</link>
      <pubDate>Sun, 19 Aug 2012 00:00:00 -0700</pubDate>
      <author>bcwaldon@gmail.com (Brian Waldon)</author>
      <guid>http://bcwaldon.cc/2012/08/19/using-warlock-and-json-schemas</guid>
      <description>&lt;p&gt;The &lt;code&gt;warlock&lt;/code&gt; &lt;a href=&quot;http://github.com/bcwaldon/warlock&quot;&gt;python library&lt;/a&gt; was created out of a need to interact with &lt;a href=&quot;http://json-schema.org&quot;&gt;JSON schemas&lt;/a&gt; in a pythonic way. It is designed to generate self-validating python classes that conform to a JSON schema definition.&lt;/p&gt;

&lt;h2&gt;Installing warlock&lt;/h2&gt;

&lt;p&gt;Install it on Ubuntu 12.10:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ apt-get install python-warlock
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Install it using pip:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ pip install python-warlock
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Pull it from GitHub:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;$ git clone http://github.com/bcwaldon/warlock
$ cd warlock/
$ python setup.py install
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Using warlock v0.4.0&lt;/h2&gt;

&lt;p&gt;The first thing you'll need is a JSON schema. The following is a simple example, but warlock can support any valid JSON schema you throw at it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; schema = {
    'name': 'Country',
    'properties': {
        'name': {'type': 'string'},
        'population': {'type': 'integer'},
    },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Creating a new warlock model is easy:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; import warlock
&amp;gt;&amp;gt;&amp;gt; Country = warlock.model_factory(schema)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;model_factory&lt;/code&gt; call returns your self-validating warlock model. Create a new instance of your model by passing in the necessary data:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sweden = Country(name='Sweden', population=9453000)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Get and set attributes using dot-syntax or dict-syntax:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sweden['name']
'Sweden'
&amp;gt;&amp;gt;&amp;gt; sweden.population = 9782000
&amp;gt;&amp;gt;&amp;gt; sweden['population']
9782000
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The power of warlock is in the automatic validation. Trying to change an attribute of &lt;code&gt;sweden&lt;/code&gt; to something the schema won't allow results in raising a &lt;code&gt;warlock.core.InvalidOperation&lt;/code&gt; exception:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sweden.population = 'N/A'
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;warlock/core.py&quot;, line 63, in __setattr__
    self.__setitem__(key, value)
  File &quot;warlock/core.py&quot;, line 58, in __setitem__
    raise InvalidOperation()
warlock.core.InvalidOperation
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Attempting to create an instance of Country with a bad value for &lt;code&gt;name&lt;/code&gt; raises a &lt;code&gt;ValueError&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; Country(name=None, population=10)
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;warlock/core.py&quot;, line 37, in __init__
    raise ValueError()
ValueError
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Accessing an attribute that doesn't exist raises an &lt;code&gt;AttributeError&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; sweden.abbreviation
Traceback (most recent call last):
  File &quot;&amp;lt;stdin&amp;gt;&quot;, line 1, in &amp;lt;module&amp;gt;
  File &quot;warlock/core.py&quot;, line 47, in __getattr__
    raise AttributeError(key)
AttributeError: abbreviation
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;changes&lt;/code&gt; attribute of your model instance returns a dictionary containing only the modified attributes:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; norway = Country(name='Norway', population=4952000)
&amp;gt;&amp;gt;&amp;gt; norway.changes
{}
&amp;gt;&amp;gt;&amp;gt;norway.population = 5013000
&amp;gt;&amp;gt;&amp;gt; norway.changes
{'population': 5013000}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Client-side magic&lt;/h2&gt;

&lt;p&gt;The use case that drove the creation of warlock was to be able to automagically verify client-side modifications to an entity before sending it back to a REST-like API. The &lt;a href=&quot;http://github.com/openstack/python-glanceclient&quot;&gt;python client&lt;/a&gt; we provide for v2 of the OpenStack Images API downloads a JSON schema and createa a warlock model representing a virtual image. The following shows how a user can download and modify an image using that python library:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt;import glanceclient
&amp;gt;&amp;gt;&amp;gt;client = glanceclient.Client(…)

# An instance of a warlock model is returned below after retrieving
# the JSON schema and specific image data over HTTP
&amp;gt;&amp;gt;&amp;gt;image = client.images.get('12')

# Sample changes a client might make
&amp;gt;&amp;gt;&amp;gt; image.tags.append('ubuntu')
&amp;gt;&amp;gt;&amp;gt; image['min_ram'] = 512

&amp;gt;&amp;gt;&amp;gt;client.images.update(image)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The actual &lt;code&gt;glanceclient&lt;/code&gt; code to fetch and update the image using &lt;code&gt;warlock&lt;/code&gt; is as simple as this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import warlock
import http

schema = http.get_schema('image')
model = warlock.model_factory(schema)

def get(image_id):
    image = http.get_image(image_id)
    return model(image)

def update(image):
    http.update_image(image.changes)
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Future of warlock&lt;/h2&gt;

&lt;p&gt;There are a couple of major things on my wishlist at the moment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Deleted Attributes:&lt;/strong&gt; the 'changes' feature doesn't allow a user to remove attributes from an image. This is absolutely necessary when modifying entities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cleaner Exceptions:&lt;/strong&gt; the mix of warlock-specific and standard python exceptions isn't a great experience. The code should use standard exceptions as much as possible and ensure it is returning the proper information.&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    

  </channel> 
</rss>
