From f02a0de5cab09594059cef3d5b9c638fff44032f Mon Sep 17 00:00:00 2001 From: Andrei Veselov Date: Tue, 5 Sep 2017 15:57:19 +0200 Subject: [PATCH] Add create action for Image --- .../openstack/cloud_manager/template.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/app/models/manageiq/providers/openstack/cloud_manager/template.rb b/app/models/manageiq/providers/openstack/cloud_manager/template.rb index 722ed7065..0fd4e1f84 100644 --- a/app/models/manageiq/providers/openstack/cloud_manager/template.rb +++ b/app/models/manageiq/providers/openstack/cloud_manager/template.rb @@ -72,4 +72,23 @@ def has_proxy? def requires_storage_for_scan? false end + + def self.raw_create_image(ext_management_system, create_options) + ext_management_system.with_provider_connection(:service => 'Compute') do |service| + service.images.create(create_options) + end + rescue => err + _log.error("image=[#{name}], error=[#{err}]") + raise MiqException::MiqOpenstackApiRequestError, err.to_s, err.backtrace + end + + def self.validate_create_image(ext_management_system, _options = {}) + if ext_management_system + {:available => true, :message => nil} + else + {:available => false, + :message => _("The Image is not connected to an active %{table}") % + {:table => ui_lookup(:table => "ext_management_system")}} + end + end end