diff --git a/lib/fog/cloudstack/compute.rb b/lib/fog/cloudstack/compute.rb index 6c0a33110..8623a9b69 100644 --- a/lib/fog/cloudstack/compute.rb +++ b/lib/fog/cloudstack/compute.rb @@ -120,6 +120,7 @@ module Fog request :recover_virtual_machine request :register_ssh_key_pair request :register_user_keys + request :register_template request :remove_from_load_balancer_rule request :reset_password_for_virtual_machine request :revoke_security_group_ingress @@ -364,7 +365,9 @@ module Fog "domain" => "ROOT", "domainid" => "6023b6fe-5bef-4358-bc76-9f4e75afa52f", "isextractable" => true, - "checksum" => "905cec879afd9c9d22ecc8036131a180"}}, + "checksum" => "905cec879afd9c9d22ecc8036131a180", + "hypervisor" => "Xen" + }}, :flavors => { flavor_id => { "id" => flavor_id, "name" => "Medium Instance", diff --git a/lib/fog/cloudstack/requests/compute/register_template.rb b/lib/fog/cloudstack/requests/compute/register_template.rb new file mode 100644 index 000000000..f67201a78 --- /dev/null +++ b/lib/fog/cloudstack/requests/compute/register_template.rb @@ -0,0 +1,35 @@ +module Fog + module Compute + class Cloudstack + class Real + + # Registers an existing template into the cloud. + # + # {CloudStack API Reference}[http://download.cloud.com/releases/3.0.0/api_3.0.0/user/registerTemplate.html] + def register_template(options={}) + options.merge!( + 'command' => 'registerTemplate' + ) + + request(options) + end + + end # Real + + class Mock + def register_template(options={}) + mock_template_id = self.data[:images].keys.first + registered_template = self.data[:images][mock_template_id] + + { + 'registertemplateresponse' => + { + 'count' => 1, + 'template' => [registered_template] + } + } + end + end # Mock + end # Cloudstack + end # Compute +end #Fog