deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Koper, Dies" <di...@fast.au.fujitsu.com>
Subject how does create_xxx_url work?
Date Mon, 20 May 2013 04:45:12 GMT
Hi Michal, all

I've started on the implementation of system import/export, advertising
the operations on the collections and resources.
The export operation seems to work: I can expose the url in a system, it
shows up when I retrieve the system, and when I do a POST on that url,
my driver's export_system method is invoked.

https://github.com/dkoper/deltacloud-core/commit/e93def6de7b1a088d230b32
842a349059f12e88c

I'm having problems with the import operation.
I'm following the add operation as example.

The add operation seems to be processed in two locations:
Base.rb:
    def self.list(ctx)
...
      params[:add_url] = create_url(ctx)
      if model_class == CIMI::Model::System
        params[:system] = id
      end
      model_class.list(id, entries,
params).select_by(ctx.params['$select']).filter_by(ctx.params['$filter']
)

with create_url:
    def self.create_url(ctx)
      cimi_create = "create_#{model_name}_url"
      dcloud_create = ctx.deltacloud_create_method_for(model_name)
      if(ctx.respond_to?(cimi_create) &&
         ctx.driver.respond_to?(dcloud_create)) || provides?(model_name)
        ctx.send(cimi_create)
      end
    end

Collections.rb:
...
      params[:entries] = entries
      params[:count] = params[:entries].size
      if params[:add_url]
        params[:operations] ||= []
        params[:operations] << { :rel => "add", :href =>
params.delete(:add_url) }
      end
      collection_class.new(params)
...


So I have added similar code for import (see url above), but
ctx.respond_to?(cimi_import) in my self.import_url returns nil for me.
Should I be doing this differently? Or do I need to add other code
elsewhere for this operation to work?

...
I just noticed that I didn't require_relative the import and export
classes in service.rb. When I add that, I get an error:

18 cloud providers loaded.
d:/sources/OSS/cloud/deltacloud-core/server/lib/cimi/service/base.rb:34:
in `const_get': uninitialized constant CIMI::Model::SystemTemplateImport
(NameError)
        from
d:/sources/OSS/cloud/deltacloud-core/server/lib/cimi/service/base.rb:34:
in `model_class'
        from
d:/sources/OSS/cloud/deltacloud-core/server/lib/cimi/service/base.rb:47:
in `inherited'
        from
d:/sources/OSS/cloud/deltacloud-core/server/lib/cimi/service/system_temp
late_import.rb:16:in `<top (required)>'

What am I missing?

Thanks,
Dies Koper




Mime
View raw message