deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Lutterkort <lut...@redhat.com>
Subject Re: POC: DataMapper support for CIMI attributes
Date Tue, 20 Nov 2012 00:57:10 GMT
Hi Michal,

excellent ! It's good to finally get this off the ground. For the state
we store, at a minimum, we should store the basic attributes that all
entities have (name, description, ...) plus the properties map.

On Tue, 2012-11-13 at 12:54 +0100, Michal Fojtik wrote:
> The horrible looking 'uuid' field is SHA1 hash composed from 
> credentials, driver name and provider string, so different clients will 
> not override their properties.

We should not hash these things together - it makes understanding
anything in the database much much harder. Instead, we need to have a
provider table, akin to:

        class Provider
            include DataMapper::Resource
        
            property :id,       Serial
            property :driver,   String
            property :provider, String
            property :user,     String
        
            validates_uniqueness_of :user, :scope => [ :driver, :provider ]
        end

and then reference that provider in the EntityProperty with
belongs_to :provider.

For my money, it would be enough to have one row for each entity, not
one for each property. I'd be happy with something like

        class Entity
          belongs_to :provider
          property :id, Serial
          property :be_type, String
          property :be_id, String
          property :properties, Json
          property :name, String
          property :description, String
        end

The idea is that we identify resources at the level of internal Instance
etc. classes, so that be_type would be 'instance' and be_id would be
'inst42' ('be' is short for 'backend')

We should then be able to first look up the provider we are currently
working with, and then the proper entity given the backend model and its
id. We can then mix basic attributes like name and description in, as
well as the properties map (for now, storing that as JSON should be
fine) I am wondering if we shouldn't store base attributes as JSON, too.

> http://tracker.deltacloud.org/set/123

This makes tracker very unhappy - but the patch you attached was good
enough. I'll try and send a more detailed review later.

David



Mime
View raw message