Skip to content

Commit

Permalink
Merge pull request #14269 from xlab-si/add_aws_bucket
Browse files Browse the repository at this point in the history
Support operation `create` on CloudObjectStoreContainer
  • Loading branch information
agrare authored Mar 13, 2017
2 parents bfad747 + a6665cf commit 5794cec
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
30 changes: 30 additions & 0 deletions app/models/cloud_object_store_container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,34 @@ class CloudObjectStoreContainer < ApplicationRecord

supports_not :delete, :reason => N_("Delete operation is not supported.")
supports_not :cloud_object_store_container_clear

def self.cloud_object_store_container_create_queue(userid, ext_management_system, options = {})
task_opts = {
:action => "creating Cloud Object Store Container for user #{userid}",
:userid => userid
}
queue_opts = {
:class_name => "CloudObjectStoreContainer",
:method_name => 'cloud_object_store_container_create',
:role => 'ems_operations',
:zone => ext_management_system.my_zone,
:args => [ext_management_system.id, options]
}
MiqTask.generic_action_with_callback(task_opts, queue_opts)
end

def self.cloud_object_store_container_create(ems_id, options)
raise ArgumentError, _("ems_id cannot be nil") if ems_id.nil?
ext_management_system = ExtManagementSystem.find(ems_id)
raise ArgumentError, _("ext_management_system cannot be found") if ext_management_system.nil?

klass = ext_management_system.class::CloudObjectStoreContainer
created_container = klass.raw_cloud_object_store_container_create(ext_management_system, options)

klass.create(created_container)
end

def self.raw_cloud_object_store_container_create(_ext_management_system, _options)
raise NotImplementedError, _("must be implemented in subclass")
end
end
1 change: 1 addition & 0 deletions app/models/manageiq/providers/storage_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class StorageManager < ManageIQ::Providers::BaseManager
supports_not :smartstate_analysis
supports_not :block_storage
supports_not :object_storage
supports_not :cloud_object_store_container_create

belongs_to :parent_manager,
:foreign_key => :parent_ems_id,
Expand Down
3 changes: 2 additions & 1 deletion app/models/mixins/supports_feature_mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ module SupportsFeatureMixin
# FIXME: this is just a internal helper and should be refactored
:control => 'Basic control operations',
:cloud_tenant_mapping => 'CloudTenant mapping',
:cloud_object_store_container_clear => 'Clear Object Store Container',
:cloud_object_store_container_create => 'Create Object Store Container',
:cloud_object_store_container_clear => 'Clear Object Store Container',
:create => 'Creation',
:backup_create => 'CloudVolume backup creation',
:backup_restore => 'CloudVolume backup restore',
Expand Down
4 changes: 4 additions & 0 deletions db/fixtures/miq_product_features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@
:feature_type: admin
:identifier: cloud_object_store_container_admin
:children:
- :name: Create
:description: Create Cloud Object Store Container
:feature_type: admin
:identifier: cloud_object_store_container_new
- :name: Delete
:description: Delete Object Store Containers
:feature_type: admin
Expand Down

0 comments on commit 5794cec

Please sign in to comment.