Removing ovirt provider

This commit is contained in:
Ori Rabin 2017-08-08 13:16:18 +03:00
parent 5855885d2e
commit 134945fe59
96 changed files with 1 additions and 2766 deletions

View File

@ -73,9 +73,6 @@ namespace :test do
task :openvz do
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/openvz")
end
task :ovirt do
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/ovirt")
end
task :cloudstack do
sh("export FOG_MOCK=#{mock} && bundle exec shindont tests/cloudstack")
end

View File

@ -67,6 +67,7 @@ Gem::Specification.new do |s|
s.add_dependency("fog-joyent")
s.add_dependency("fog-local")
s.add_dependency("fog-openstack")
s.add_dependency("fog-ovirt")
s.add_dependency("fog-powerdns", ">= 0.1.1")
s.add_dependency("fog-profitbricks")
s.add_dependency("fog-rackspace")
@ -90,7 +91,6 @@ Gem::Specification.new do |s|
s.add_development_dependency("opennebula")
s.add_development_dependency("pry")
s.add_development_dependency("rake")
s.add_development_dependency("rbovirt", "0.1.3")
s.add_development_dependency("rbvmomi")
s.add_development_dependency("rubocop", "0.41.2")
s.add_development_dependency("shindo", "~> 0.3.4")

View File

@ -1,28 +0,0 @@
class Ovirt < Fog::Bin
class << self
def class_for(key)
case key
when :compute
Fog::Compute::Ovirt
else
raise ArgumentError, "Unrecognized service: #{key}"
end
end
def [](service)
@@connections ||= Hash.new do |hash, key|
hash[key] = case key
when :compute
Fog::Compute.new(:provider => 'Ovirt')
else
raise ArgumentError, "Unrecognized service: #{key.inspect}"
end
end
@@connections[service]
end
def services
Fog::Ovirt.services
end
end
end

View File

@ -1,155 +0,0 @@
require 'fog/ovirt/core'
module Fog
module Compute
class Ovirt < Fog::Service
requires :ovirt_username, :ovirt_password
recognizes :ovirt_url, :ovirt_server, :ovirt_port, :ovirt_api_path, :ovirt_datacenter,
:ovirt_filtered_api,
:ovirt_ca_cert_store, :ovirt_ca_cert_file, :ovirt_ca_no_verify
model_path 'fog/ovirt/models/compute'
model :server
collection :servers
model :template
collection :templates
model :instance_type
collection :instance_types
model :cluster
collection :clusters
model :interface
collection :interfaces
model :volume
collection :volumes
model :quota
collection :quotas
model :affinity_group
collection :affinity_groups
request_path 'fog/ovirt/requests/compute'
request :vm_action
request :vm_start_with_cloudinit
request :destroy_vm
request :create_vm
request :update_vm
request :datacenters
request :storage_domains
request :list_virtual_machines
request :get_virtual_machine
request :list_templates
request :get_template
request :list_instance_types
request :get_instance_type
request :list_clusters
request :get_cluster
request :add_interface
request :destroy_interface
request :update_interface
request :list_vm_interfaces
request :list_template_interfaces
request :list_networks
request :vm_ticket
request :list_vm_volumes
request :list_template_volumes
request :list_volumes
request :add_volume
request :destroy_volume
request :update_volume
request :attach_volume
request :detach_volume
request :activate_volume
request :deactivate_volume
request :get_api_version
request :list_quotas
request :get_quota
request :list_affinity_groups
request :get_affinity_group
request :list_affinity_group_vms
request :create_affinity_group
request :destroy_affinity_group
request :add_to_affinity_group
request :remove_from_affinity_group
module Shared
# converts an OVIRT object into an hash for fog to consume.
def ovirt_attrs obj
opts = {:raw => obj}
obj.instance_variables.each do |v|
key = v.to_s.gsub("@","").to_sym
value = obj.instance_variable_get(v)
#ignore nil values
next if value.nil?
opts[key] = case value
when OVIRT::Link
value.id
when OVIRT::TemplateVersion
value
when Array
value
when Hash
value
else
value.to_s.strip
end
end
opts
end
end
class Mock
include Shared
def initialize(options={})
require 'rbovirt'
end
private
def client
return @client if defined?(@client)
end
#read mocks xml
def read_xml(file_name)
file_path = File.join(File.dirname(__FILE__),"requests","compute","mock_files",file_name)
File.read(file_path)
end
end
class Real
include Shared
def initialize(options={})
require 'rbovirt'
username = options[:ovirt_username]
password = options[:ovirt_password]
server = options[:ovirt_server]
port = options[:ovirt_port] || 8080
api_path = options[:ovirt_api_path] || '/api'
url = options[:ovirt_url] || "#{@scheme}://#{server}:#{port}#{api_path}"
connection_opts = {}
connection_opts[:datacenter_id] = options[:ovirt_datacenter]
connection_opts[:ca_cert_store] = options[:ovirt_ca_cert_store]
connection_opts[:ca_cert_file] = options[:ovirt_ca_cert_file]
connection_opts[:ca_no_verify] = options[:ovirt_ca_no_verify]
connection_opts[:filtered_api] = options[:ovirt_filtered_api]
@client = OVIRT::Client.new(username, password, url, connection_opts)
end
def api_version
client.api_version
end
private
def client
@client
end
end
end
end
end

View File

@ -1,16 +0,0 @@
require 'fog/core'
require 'fog/xml'
module Fog
module Ovirt
extend Fog::Provider
module Errors
class ServiceError < Fog::Errors::Error; end
class SecurityError < ServiceError; end
class NotFound < ServiceError; end
end
service(:compute, 'Compute')
end
end

View File

@ -1,25 +0,0 @@
module Fog
module Compute
class Ovirt
class AffinityGroup < Fog::Model
identity :id
attribute :name
attribute :positive
attribute :enforcing
def vms
id.nil? ? [] : service.list_affinity_group_vms(id)
end
def destroy
service.destroy_affinity_group(id)
end
def to_s
name
end
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/affinity_group'
module Fog
module Compute
class Ovirt
class AffinityGroups < Fog::Collection
model Fog::Compute::Ovirt::AffinityGroup
def all(filters = {})
load service.list_affinity_groups(filters)
end
def get(id)
new service.get_affinity_group(id)
end
end
end
end
end

View File

@ -1,20 +0,0 @@
module Fog
module Compute
class Ovirt
class Cluster < Fog::Model
identity :id
attribute :name
attribute :raw
def networks
service.list_networks(id)
end
def to_s
name
end
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/cluster'
module Fog
module Compute
class Ovirt
class Clusters < Fog::Collection
model Fog::Compute::Ovirt::Cluster
def all(filters = {})
load service.list_clusters(filters)
end
def get(id)
new service.get_cluster(id)
end
end
end
end
end

View File

@ -1,39 +0,0 @@
module Fog
module Compute
class Ovirt
class InstanceType < Fog::Model
identity :id
attr_accessor :raw
attribute :name
attribute :description
attribute :memory
attribute :cores
attribute :creation_time
attribute :os
attribute :ha
attribute :ha_priority
attribute :display
attribute :usb
attribute :migration_downtime
attribute :type
attribute :status
attribute :cpu_shares
attribute :boot_menu
attribute :origin
attribute :stateless
attribute :delete_protected
attribute :sso
attribute :timezone
attribute :migration
attribute :io_threads
attribute :memory_garanteed
def to_s
name
end
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/instance_type'
module Fog
module Compute
class Ovirt
class InstanceTypes < Fog::Collection
model Fog::Compute::Ovirt::InstanceType
def all(filters = {})
load service.list_instance_types(filters)
end
def get(id)
new service.get_instance_type(id)
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Interface < Fog::Model
attr_accessor :raw
identity :id
attribute :name
attribute :network
attribute :interface
attribute :mac
def to_s
name
end
end
end
end
end

View File

@ -1,29 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/interface'
module Fog
module Compute
class Ovirt
class Interfaces < Fog::Collection
model Fog::Compute::Ovirt::Interface
attr_accessor :vm
def all(filters = {})
requires :vm
if vm.is_a? Fog::Compute::Ovirt::Server
load service.list_vm_interfaces(vm.id)
elsif vm.is_a? Fog::Compute::Ovirt::Template
load service.list_template_interfaces(vm.id)
else
raise 'interfaces should have vm or template'
end
end
def get(id)
new service.get_interface(id)
end
end
end
end
end

View File

@ -1,16 +0,0 @@
module Fog
module Compute
class Ovirt
class Quota < Fog::Model
identity :id
attribute :name
attribute :description
def to_s
name
end
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/quota'
module Fog
module Compute
class Ovirt
class Quotas < Fog::Collection
model Fog::Compute::Ovirt::Quota
def all(filters = {})
load service.list_quotas(filters)
end
def get(id)
new service.get_quota(id)
end
end
end
end
end

View File

@ -1,175 +0,0 @@
require 'fog/compute/models/server'
module Fog
module Compute
class Ovirt
class Server < Fog::Compute::Server
# This will be the instance uuid which is globally unique across
# a oVirt deployment.
identity :id
attribute :name
attribute :comment
attribute :description
attribute :profile
attribute :display
attribute :storage, :aliases => 'disk_size'
attribute :creation_time
attribute :os
attribute :ip
attribute :status
attribute :cores, :aliases => 'cpus'
attribute :memory
attribute :host
attribute :cluster
attribute :template
attribute :instance_type
attribute :interfaces
attribute :volumes
attribute :raw
attribute :quota
attribute :ips
attribute :ha
attribute :ha_priority
attribute :clone
attribute :disks
def ready?
!(status =~ /down/i)
end
def locked?
@volumes = nil # force reload volumes
!!(status =~ /locked/i) || (attributes[:volumes]=nil) || volumes.any?{|v| !!(v.status =~ /locked/i)}
end
def stopped?
status.downcase == 'down'
end
def mac
interfaces.first.mac unless interfaces.empty?
end
def interfaces
@interfaces ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
:service => service,
:vm => self
)
end
def add_interface attrs
wait_for { stopped? } if attrs[:blocking]
service.add_interface(id, attrs)
end
def update_interface attrs
wait_for { stopped? } if attrs[:blocking]
service.update_interface(id, attrs)
end
def destroy_interface attrs
wait_for { stopped? } if attrs[:blocking]
service.destroy_interface(id, attrs)
end
def volumes
@volumes ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
:service => service,
:vm => self
)
end
def add_volume attrs
wait_for { stopped? } if attrs[:blocking]
service.add_volume(id, attrs)
end
def destroy_volume attrs
wait_for { stopped? } if attrs[:blocking]
service.destroy_volume(id, attrs)
end
def update_volume attrs
wait_for { stopped? } if attrs[:blocking]
service.update_volume(id, attrs)
end
def attach_volume(attrs)
wait_for { stopped? } if attrs[:blocking]
service.attach_volume(id, attrs)
end
def detach_volume(attrs)
wait_for { stopped? } if attrs[:blocking]
service.detach_volume(id, attrs)
end
def add_to_affinity_group(attrs)
wait_for { stopped? } if attrs[:blocking]
service.add_to_affinity_group(id, attrs)
end
def remove_from_affinity_group(attrs)
wait_for { stopped? } if attrs[:blocking]
service.remove_from_affinity_group(id, attrs)
end
def start(options = {})
wait_for { !locked? } if options[:blocking]
service.vm_action(:id =>id, :action => :start)
reload
end
def start_with_cloudinit(options = {})
wait_for { !locked? } if options[:blocking]
user_data = Hash[YAML.load(options[:user_data]).map{|a| [a.first.to_sym, a.last]}]
service.vm_start_with_cloudinit(:id =>id, :user_data =>user_data)
reload
end
def stop(options = {})
service.vm_action(:id =>id, :action => :stop)
reload
end
def reboot(options = {})
unless stopped?
stop
wait_for { stopped? }
end
start options.merge(:blocking => true)
end
def suspend(options = {})
service.vm_action(:id =>id, :action => :suspend)
reload
end
def destroy(options = {})
(stop unless stopped?) rescue nil #ignore failure, destroy the machine anyway.
wait_for { stopped? }
service.destroy_vm(:id => id)
end
def ticket(options = {})
raise "Can not set console ticket, Server is not ready. Server status: #{status}" unless ready?
service.vm_ticket(id, options)
end
def save
if persisted?
service.update_vm(attributes)
else
self.id = service.create_vm(attributes).id
end
reload
end
def to_s
name
end
end
end
end
end

View File

@ -1,27 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/server'
module Fog
module Compute
class Ovirt
class Servers < Fog::Collection
model Fog::Compute::Ovirt::Server
def all(filters = {})
load service.list_virtual_machines(filters)
end
def get(id)
new service.get_virtual_machine(id)
end
def bootstrap(new_attributes = {})
server = create(new_attributes)
server.wait_for { stopped? }
server.start
server
end
end
end
end
end

View File

@ -1,58 +0,0 @@
module Fog
module Compute
class Ovirt
class Template < Fog::Model
identity :id
attr_accessor :raw
attribute :name
attribute :comment
attribute :description
attribute :profile
attribute :display
attribute :storage, :aliases => 'disk_size'
attribute :creation_time
attribute :os
attribute :status
attribute :cores, :aliases => 'cpus'
attribute :memory
attribute :cluster
attribute :interfaces
attribute :volumes
attribute :version
def interfaces
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
:service => service,
:vm => self
)
end
def volumes
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
:service => service,
:vm => self
)
end
def ready?
!(status =~ /down/i)
end
def destroy(options = {})
service.client.destroy_template(id)
end
def save
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
service.client.create_template(attributes)
end
def to_s
name
end
end
end
end
end

View File

@ -1,20 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/template'
module Fog
module Compute
class Ovirt
class Templates < Fog::Collection
model Fog::Compute::Ovirt::Template
def all(filters = {})
load service.list_templates(filters)
end
def get(id)
new service.get_template(id)
end
end
end
end
end

View File

@ -1,36 +0,0 @@
module Fog
module Compute
class Ovirt
class Volume < Fog::Model
attr_accessor :raw
DISK_SIZE_TO_GB = 1073741824
identity :id
attribute :storage_domain
attribute :size
attribute :disk_type
attribute :bootable
attribute :interface
attribute :format
attribute :sparse
attribute :size_gb
attribute :status
attribute :quota
attribute :alias
attribute :wipe_after_delete
def size_gb
attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
end
def size_gb= s
attributes[:size] = s.to_i * DISK_SIZE_TO_GB if s
end
def to_s
id
end
end
end
end
end

View File

@ -1,28 +0,0 @@
require 'fog/core/collection'
require 'fog/ovirt/models/compute/volume'
module Fog
module Compute
class Ovirt
class Volumes < Fog::Collection
model Fog::Compute::Ovirt::Volume
attr_accessor :vm
def all(filters = {})
if vm.is_a? Fog::Compute::Ovirt::Server
load service.list_vm_volumes(vm.id)
elsif vm.is_a? Fog::Compute::Ovirt::Template
load service.list_template_volumes(vm.id)
else
load service.list_volumes
end
end
def get(id)
new service.get_volume(id)
end
end
end
end
end

View File

@ -1,20 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def add_interface(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
client.add_interface(id, options)
end
end
class Mock
def add_interface(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
true
end
end
end
end
end

View File

@ -1,21 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def add_to_affinity_group(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
client.add_vm_to_affinity_group(options[:id], id)
end
end
class Mock
def add_to_affinity_group(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,21 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
DISK_SIZE_TO_GB = 1073741824
def add_volume(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
options[:size]=options[:size_gb].to_i*DISK_SIZE_TO_GB if options[:size_gb]
client.add_volume(id, options)
end
end
class Mock
def add_volume(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
true
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def attach_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
client.attach_volume(id, options[:id])
end
end
class Mock
def attach_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,18 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def create_affinity_group(attrs)
client.create_affinity_group(attrs)
end
end
class Mock
def create_affinity_group(attrs)
xml = read_xml('affinitygroup.xml')
OVIRT::AffinityGroup::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,18 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def create_vm(attrs)
client.create_vm(attrs)
end
end
class Mock
def create_vm(attrs)
xml = read_xml('vm.xml')
OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,20 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def datacenters filter={}
client.datacenters(filter).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def datacenters(filters = {})
xml = read_xml 'data_centers.xml'
Nokogiri::XML(xml).xpath('/data_centers/data_center').map do |dc|
ovirt_attrs OVIRT::DataCenter::new(self, dc)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def destroy_affinity_group(id)
raise ArgumentError, "instance id is a required parameter" unless id
client.destroy_affinity_group(id)
end
end
class Mock
def destroy_affinity_group(id)
raise ArgumentError, "instance id is a required parameter" unless id
true
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def destroy_interface(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
client.destroy_interface(id, options[:id])
end
end
class Mock
def destroy_interface(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def destroy_vm(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
client.destroy_vm(options[:id])
end
end
class Mock
def destroy_vm(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def destroy_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id
client.destroy_volume(id, options[:id])
end
end
class Mock
def destroy_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for destroy-volume" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def detach_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for detach-volume" unless options.key? :id
client.detach_volume(id, options[:id])
end
end
class Mock
def detach_volume(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "volume id is a required parameter for detach-volume" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,18 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_affinity_group(id)
ovirt_attrs client.affinity_group(id)
end
end
class Mock
def get_affinity_group(id)
xml = read_xml('affinitygroup.xml')
ovirt_attrs OVIRT::AffinityGroup::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,16 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def api_version
client.api_version
end
end
class Mock
def api_version
"3.1"
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_cluster(id)
ovirt_attrs client.cluster(id)
end
end
class Mock
def get_cluster(id)
xml = read_xml('cluster.xml')
ovirt_attrs OVIRT::Cluster::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_instance_type(id)
ovirt_attrs client.instance_type(id)
end
end
class Mock
def get_instance_type(id)
xml = read_xml 'instance_type.xml'
ovirt_attrs OVIRT::InstanceType::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_quota(id)
ovirt_attrs client.quota(id)
end
end
class Mock
def get_quota(id)
xml = read_xml('quota.xml')
ovirt_attrs OVIRT::Quota::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_template(id)
ovirt_attrs client.template(id)
end
end
class Mock
def get_template(id)
xml = read_xml 'template.xml'
ovirt_attrs OVIRT::Template::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def get_virtual_machine(id)
ovirt_attrs client.vm(id)
end
end
class Mock
def get_virtual_machine(id)
xml = read_xml 'vm.xml'
ovirt_attrs OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_affinity_group_vms(id)
client.affinity_group_vms(id).map {|vm| servers.get(vm.id)}
end
end
class Mock
def list_affinity_group_vms(id)
vms = []
Nokogiri::XML(read_xml('affinitygroup_vms.xml')).xpath('/vms/vm/@id').each do |id|
xml = Nokogiri::XML(read_xml('vms.xml')).xpath("/vms/vm[@id='%s']" % id.value).first
vms << ovirt_attrs(OVIRT::VM::new(self, xml))
end
vms
end
end
end
end
end

View File

@ -1,20 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_affinity_groups(filters = {})
client.affinity_groups(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_affinity_groups(filters = {})
xml = read_xml('affinitygroups.xml')
Nokogiri::XML(xml).xpath('/affinity_groups/affinity_group').map do |ag|
ovirt_attrs OVIRT::AffinityGroup::new(self, ag)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_clusters(filters = {})
client.clusters(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_clusters(filters = {})
xml = read_xml 'clusters.xml'
Nokogiri::XML(xml).xpath('/clusters/cluster').map do |cl|
ovirt_attrs OVIRT::Cluster::new(self, cl)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_instance_types(filters = {})
client.instance_types(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_instance_types(filters = {})
xml = read_xml 'instance_types.xml'
Nokogiri::XML(xml).xpath('/instance_types/instance_type').map do |t|
ovirt_attrs OVIRT::InstanceType::new(self, t)
end
end
end
end
end
end

View File

@ -1,16 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_networks(cluster_id)
client.networks(:cluster_id => cluster_id)
end
end
class Mock
def list_networks(cluster_id)
[]
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_quotas(filters = {})
client.quotas(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_quotas(filters = {})
xml = read_xml 'quotas.xml'
Nokogiri::XML(xml).xpath('/quotas/quota').map do |q|
ovirt_attrs OVIRT::Quotas::new(self, q)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_template_interfaces(vm_id)
client.template_interfaces(vm_id).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_template_interfaces(vm_id)
xml = read_xml 'nics.xml'
Nokogiri::XML(xml).xpath('/nics/nic').map do |nic|
ovirt_attrs OVIRT::Interface::new(self, nic)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_template_volumes(template_id)
client.template_volumes(template_id).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_template_volumes(template_id)
xml = read_xml 'volumes.xml'
Nokogiri::XML(xml).xpath('/disks/disk').map do |vol|
ovirt_attrs OVIRT::Volume::new(self, vol)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_templates(filters = {})
client.templates(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_templates(filters = {})
xml = read_xml 'templates.xml'
Nokogiri::XML(xml).xpath('/templates/template').map do |t|
ovirt_attrs OVIRT::Template::new(self, t)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_virtual_machines(filters = {})
client.vms(filters).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_virtual_machines(filters = {})
xml = read_xml 'vms.xml'
Nokogiri::XML(xml).xpath('/vms/vm').map do |vm|
ovirt_attrs OVIRT::VM::new(self, vm)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_vm_interfaces(vm_id)
client.vm_interfaces(vm_id).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_vm_interfaces(vm_id)
xml = read_xml 'nics.xml'
Nokogiri::XML(xml).xpath('/nics/nic').map do |nic|
ovirt_attrs OVIRT::Interface::new(self, nic)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_vm_volumes(vm_id)
client.vm_volumes(vm_id).map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_vm_volumes(vm_id)
xml = read_xml 'volumes.xml'
Nokogiri::XML(xml).xpath('/disks/disk').map do |vol|
ovirt_attrs OVIRT::Volume::new(self, vol)
end
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def list_volumes
client.disks.map {|ovirt_obj| ovirt_attrs ovirt_obj}
end
end
class Mock
def list_volumes
xml = read_xml 'disks.xml'
Nokogiri::XML(xml).xpath('/disks/disk').map do |vol|
ovirt_attrs OVIRT::Volume::new(self, vol)
end
end
end
end
end
end

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f" id="9aaec56b-e24d-4fce-82a1-21a7b642ab0f">
<name>test1_ag</name>
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f/vms" rel="vms"/>
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
<positive>true</positive>
<enforcing>false</enforcing>
</affinity_group>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vms>
<vm href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b" id="5ee86332-7b19-465b-8801-2a12ed0d6c1b">
<name>test-vm1</name>
</vm>
<vm href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1" id="349764bb-eba3-4466-abef-f18f4c40c9f1">
<name>fosdem</name>
</vm>
</vms>

View File

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<affinity_groups>
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/ff73a83f-10b2-44ae-8c98-a29b13ae0c19" id="ff73a83f-10b2-44ae-8c98-a29b13ae0c19">
<name>test2_ag</name>
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/ff73a83f-10b2-44ae-8c98-a29b13ae0c19/vms" rel="vms"/>
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
<positive>true</positive>
<enforcing>true</enforcing>
</affinity_group>
<affinity_group href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f" id="9aaec56b-e24d-4fce-82a1-21a7b642ab0f">
<name>test1_ag</name>
<link href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa/affinitygroups/9aaec56b-e24d-4fce-82a1-21a7b642ab0f/vms" rel="vms"/>
<cluster href="/api/clusters/a240aac1-d03a-4c69-923e-a295200539fa" id="a240aac1-d03a-4c69-923e-a295200539fa"/>
<positive>true</positive>
<enforcing>false</enforcing>
</affinity_group>
</affinity_groups>

View File

@ -1,20 +0,0 @@
<clusters>
<cluster href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc" id="9ce445e8-4c03-11e1-b3c8-5254009970cc">
<name>cluster1</name>
<link href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc/networks" rel="networks"/>
<link href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc/permissions" rel="permissions"/>
<cpu id="Intel Conroe Family"/>
<data_center href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc" id="c0645886-4b4b-11e1-a0ae-5254009970cc"/>
<memory_policy>
<overcommit percent="200"/>
<transparent_hugepages>
<enabled>true</enabled>
</transparent_hugepages>
</memory_policy>
<scheduling_policy/>
<version major="3" minor="0"/>
<error_handling>
<on_error>migrate_highly_available</on_error>
</error_handling>
</cluster>
</clusters>

View File

@ -1,39 +0,0 @@
<clusters>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95">
<name>Cluster1</name>
<description>The default server cluster</description>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/networks" rel="networks"/>
<link href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95/permissions" rel="permissions"/>
<cpu id="Intel Conroe Family"/>
<data_center href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc" id="c0645886-4b4b-11e1-a0ae-5254009970cc"/>
<memory_policy>
<overcommit percent="100"/>
<transparent_hugepages>
<enabled>true</enabled>
</transparent_hugepages>
</memory_policy>
<scheduling_policy/>
<version major="3" minor="0"/>
<error_handling>
<on_error>migrate</on_error>
</error_handling>
</cluster>
<cluster href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc" id="9ce445e8-4c03-11e1-b3c8-5254009970cc">
<name>Cluster2</name>
<link href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc/networks" rel="networks"/>
<link href="/api/clusters/9ce445e8-4c03-11e1-b3c8-5254009970cc/permissions" rel="permissions"/>
<cpu id="Intel Conroe Family"/>
<data_center href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc" id="c0645886-4b4b-11e1-a0ae-5254009970cc"/>
<memory_policy>
<overcommit percent="200"/>
<transparent_hugepages>
<enabled>true</enabled>
</transparent_hugepages>
</memory_policy>
<scheduling_policy/>
<version major="3" minor="0"/>
<error_handling>
<on_error>migrate_highly_available</on_error>
</error_handling>
</cluster>
</clusters>

View File

@ -1,17 +0,0 @@
<data_centers>
<data_center href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc" id="c0645886-4b4b-11e1-a0ae-5254009970cc">
<name>Datacenter1</name>
<description>The first Data Center</description>
<link href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc/storagedomains" rel="storagedomains"/>
<link href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc/permissions" rel="permissions"/>
<storage_type>nfs</storage_type>
<storage_format>v1</storage_format>
<version major="3" minor="0"/>
<supported_versions>
<version major="3" minor="0"/>
</supported_versions>
<status>
<state>up</state>
</status>
</data_center>
</data_centers>

View File

@ -1,58 +0,0 @@
<disks>
<disk href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05" id="4d1abf9a-da81-4de2-bf20-f5f060018e05">
<actions>
<link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/export" rel="export"/>
<link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/move" rel="move"/>
<link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/copy" rel="copy"/>
</actions>
<name>Disk 2</name>
<link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/permissions" rel="permissions"/>
<link href="/api/disks/4d1abf9a-da81-4de2-bf20-f5f060018e05/statistics" rel="statistics"/>
<alias>Disk 2</alias>
<image_id>d6034a90-39fa-46ee-888f-208a76f3baa4</image_id>
<storage_domains>
<storage_domain id="a23a4329-33b9-4246-a393-4f91071825b6"/>
</storage_domains>
<size>4294967296</size>
<provisioned_size>4294967296</provisioned_size>
<actual_size>1073741824</actual_size>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>cow</format>
<sparse>true</sparse>
<bootable>false</bootable>
<shareable>false</shareable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
</disk>
<disk href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863" id="cfebdac5-cefb-488a-8b55-f5f273a1e863">
<actions>
<link href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863/export" rel="export"/>
<link href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863/move" rel="move"/>
<link href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863/copy" rel="copy"/>
</actions>
<name>Disk 3</name>
<link href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863/permissions" rel="permissions"/>
<link href="/api/disks/cfebdac5-cefb-488a-8b55-f5f273a1e863/statistics" rel="statistics"/>
<alias>Disk 3</alias>
<image_id>3d7edbe9-54e1-484c-a77c-3d170f1906bb</image_id>
<storage_domains>
<storage_domain id="c8431bb5-f57b-4ce8-8ba0-17c1859bc767"/>
</storage_domains>
<size>21474836480</size>
<provisioned_size>21474836480</provisioned_size>
<actual_size>1073741824</actual_size>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>cow</format>
<sparse>true</sparse>
<bootable>false</bootable>
<shareable>false</shareable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
</disk>
</disks>

View File

@ -1,42 +0,0 @@
<instance_types>
<instance_type href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa" id="00000009-0009-0009-0009-0000000002fa">
<name>Large</name>
<description>Large instance type</description>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/nics" rel="nics"/>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/graphicsconsoles" rel="graphicsconsoles"/>
<memory>8589934592</memory>
<cpu>
<topology sockets="2" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>8589934592</guaranteed>
<ballooning>false</ballooning>
</memory_policy>
</instance_type>
</instance_types>

View File

@ -1,197 +0,0 @@
<instance_types>
<instance_type href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa" id="00000009-0009-0009-0009-0000000002fa">
<name>Large</name>
<description>Large instance type</description>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/nics" rel="nics"/>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/00000009-0009-0009-0009-0000000002fa/graphicsconsoles" rel="graphicsconsoles"/>
<memory>8589934592</memory>
<cpu>
<topology sockets="2" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>8589934592</guaranteed>
</memory_policy>
</instance_type>
<instance_type href="/api/instancetypes/00000007-0007-0007-0007-000000000210" id="00000007-0007-0007-0007-000000000210">
<name>Medium</name>
<description>Medium instance type</description>
<link href="/api/instancetypes/00000007-0007-0007-0007-000000000210/nics" rel="nics"/>
<link href="/api/instancetypes/00000007-0007-0007-0007-000000000210/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/00000007-0007-0007-0007-000000000210/graphicsconsoles" rel="graphicsconsoles"/>
<memory>4294967296</memory>
<cpu>
<topology sockets="2" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>4294967296</guaranteed>
</memory_policy>
</instance_type>
<instance_type href="/api/instancetypes/00000005-0005-0005-0005-000000000190" id="00000005-0005-0005-0005-000000000190">
<name>Small</name>
<description>Small instance type</description>
<link href="/api/instancetypes/00000005-0005-0005-0005-000000000190/nics" rel="nics"/>
<link href="/api/instancetypes/00000005-0005-0005-0005-000000000190/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/00000005-0005-0005-0005-000000000190/graphicsconsoles" rel="graphicsconsoles"/>
<memory>2147483648</memory>
<cpu>
<topology sockets="1" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>2147483648</guaranteed>
</memory_policy>
</instance_type>
<instance_type href="/api/instancetypes/00000003-0003-0003-0003-0000000000ce" id="00000003-0003-0003-0003-0000000000ce">
<name>Tiny</name>
<description>Tiny instance type</description>
<link href="/api/instancetypes/00000003-0003-0003-0003-0000000000ce/nics" rel="nics"/>
<link href="/api/instancetypes/00000003-0003-0003-0003-0000000000ce/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/00000003-0003-0003-0003-0000000000ce/graphicsconsoles" rel="graphicsconsoles"/>
<memory>536870912</memory>
<cpu>
<topology sockets="1" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
</instance_type>
<instance_type href="/api/instancetypes/0000000b-000b-000b-000b-000000000082" id="0000000b-000b-000b-000b-000000000082">
<name>XLarge</name>
<description>Extra Large instance type</description>
<link href="/api/instancetypes/0000000b-000b-000b-000b-000000000082/nics" rel="nics"/>
<link href="/api/instancetypes/0000000b-000b-000b-000b-000000000082/watchdogs" rel="watchdogs"/>
<link href="/api/instancetypes/0000000b-000b-000b-000b-000000000082/graphicsconsoles" rel="graphicsconsoles"/>
<memory>17179869184</memory>
<cpu>
<topology sockets="4" cores="1" threads="1"/>
</cpu>
<os>
<boot dev="hd"/>
</os>
<creation_time>2014-05-05T02:30:00.000+05:30</creation_time>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
<single_qxl_pci>false</single_qxl_pci>
<smartcard_enabled>false</smartcard_enabled>
</display>
<usb>
<enabled>false</enabled>
</usb>
<migration_downtime>-1</migration_downtime>
<migration>
<auto_converge>inherit</auto_converge>
<compressed>inherit</compressed>
</migration>
<io>
<threads>0</threads>
</io>
<memory_policy>
<guaranteed>17179869184</guaranteed>
</memory_policy>
</instance_type>
</instance_types>

View File

@ -1,10 +0,0 @@
<nics>
<nic href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/nics/af743262-ebcf-4b18-ab5d-7218d788bdf3" id="af743262-ebcf-4b18-ab5d-7218d788bdf3">
<name>nic1</name>
<link href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/nics/af743262-ebcf-4b18-ab5d-7218d788bdf3/statistics" rel="statistics"/>
<vm href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387" id="192cdd3f-3281-4e20-b81d-93bdc57ac387"/>
<network href="/api/networks/00000000-0000-0000-0000-000000000009" id="00000000-0000-0000-0000-000000000009"/>
<interface>virtio</interface>
<mac address="00:1a:4a:23:1b:8f"/>
</nic>
</nics>

View File

@ -1,7 +0,0 @@
<quotas>
<quota href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc/quotas/aae6e3f3-0798-4ef7-b4e4-c036f04a98d7" id="aae6e3f3-0798-4ef7-b4e4-c036f04a98d7">
<name>DefaultQuota-Datacenter1</name>
<description>Automatic generated Quota for Data Center Datacenter1</description>
<data_center href="/api/datacenters/c0645886-4b4b-11e1-a0ae-5254009970cc" id="c0645886-4b4b-11e1-a0ae-5254009970cc"/>
</quota>
</quotas>

View File

@ -1,36 +0,0 @@
<storage_domains>
<storage_domain href="/api/storagedomains/382ec55a-f886-4fa1-b880-0a9fa778aa5b" id="382ec55a-f886-4fa1-b880-0a9fa778aa5b">
<name>covirt</name>
<link href="/api/storagedomains/382ec55a-f886-4fa1-b880-0a9fa778aa5b/permissions" rel="permissions"/>
<link href="/api/storagedomains/382ec55a-f886-4fa1-b880-0a9fa778aa5b/files" rel="files"/>
<type>iso</type>
<status>
<state>unattached</state>
</status>
<master>false</master>
<storage>
<type>nfs</type>
<address>ovirt.server.com</address>
<path>/mnt/nfs</path>
</storage>
<available>0</available>
<used>0</used>
<committed>0</committed>
<storage_format>v1</storage_format>
</storage_domain>
<storage_domain href="/api/storagedomains/312f6445-79da-4ce4-907d-9a871125e3ca" id="312f6445-79da-4ce4-907d-9a871125e3ca">
<name>nfs</name>
<link href="/api/storagedomains/312f6445-79da-4ce4-907d-9a871125e3ca/permissions" rel="permissions"/>
<type>data</type>
<master>true</master>
<storage>
<type>nfs</type>
<address>storage.server.com</address>
<path>/volumes/path/for/ovirt</path>
</storage>
<available>40802189312</available>
<used>66571993088</used>
<committed>75161927680</committed>
<storage_format>v1</storage_format>
</storage_domain>
</storage_domains>

View File

@ -1,39 +0,0 @@
<templates>
<template href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323" id="2a08ba05-f3b1-4e5a-ade9-496466a8b323">
<name>hwp_small</name>
<description>hardware profile small</description>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/disks" rel="disks"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/nics" rel="nics"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/cdroms" rel="cdroms"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/permissions" rel="permissions"/>
<type>server</type>
<status>
<state>ok</state>
</status>
<memory>536870912</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<creation_time>2012-01-31T07:47:03.811Z</creation_time>
<origin>rhev</origin>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<stateless>false</stateless>
<usb>
<enabled>true</enabled>
</usb>
</template>
</templates>

View File

@ -1,110 +0,0 @@
<templates>
<template href="/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000">
<name>Blank</name>
<description>Blank template</description>
<link href="/api/templates/00000000-0000-0000-0000-000000000000/disks" rel="disks"/>
<link href="/api/templates/00000000-0000-0000-0000-000000000000/nics" rel="nics"/>
<link href="/api/templates/00000000-0000-0000-0000-000000000000/cdroms" rel="cdroms"/>
<link href="/api/templates/00000000-0000-0000-0000-000000000000/permissions" rel="permissions"/>
<type>desktop</type>
<status>
<state>ok</state>
</status>
<memory>536870912</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="hd"/>
</os>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<creation_time>2008-04-01T00:00:00.000+01:00</creation_time>
<origin>rhev</origin>
<high_availability>
<enabled>false</enabled>
<priority>0</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<stateless>false</stateless>
<usb>
<enabled>true</enabled>
</usb>
</template>
<template href="/api/templates/05a5144f-8ef7-4151-b7f9-5014510b489e" id="05a5144f-8ef7-4151-b7f9-5014510b489e">
<name>hwp_large</name>
<description>hardware profile large</description>
<link href="/api/templates/05a5144f-8ef7-4151-b7f9-5014510b489e/disks" rel="disks"/>
<link href="/api/templates/05a5144f-8ef7-4151-b7f9-5014510b489e/nics" rel="nics"/>
<link href="/api/templates/05a5144f-8ef7-4151-b7f9-5014510b489e/cdroms" rel="cdroms"/>
<link href="/api/templates/05a5144f-8ef7-4151-b7f9-5014510b489e/permissions" rel="permissions"/>
<type>server</type>
<status>
<state>ok</state>
</status>
<memory>1073741824</memory>
<cpu>
<topology sockets="4" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<creation_time>2012-01-31T07:53:19.047Z</creation_time>
<origin>rhev</origin>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<stateless>false</stateless>
<usb>
<enabled>true</enabled>
</usb>
</template>
<template href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323" id="2a08ba05-f3b1-4e5a-ade9-496466a8b323">
<name>hwp_small</name>
<description>hardware profile small</description>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/disks" rel="disks"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/nics" rel="nics"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/cdroms" rel="cdroms"/>
<link href="/api/templates/2a08ba05-f3b1-4e5a-ade9-496466a8b323/permissions" rel="permissions"/>
<type>server</type>
<status>
<state>ok</state>
</status>
<memory>536870912</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<creation_time>2012-01-31T07:47:03.811Z</creation_time>
<origin>rhev</origin>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<stateless>false</stateless>
<usb>
<enabled>true</enabled>
</usb>
</template>
</templates>

View File

@ -1,52 +0,0 @@
<vm href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c" id="52b9406e-cf66-4867-8655-719a094e324c">
<name>vm01</name>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/disks" rel="disks"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/nics" rel="nics"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/cdroms" rel="cdroms"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/snapshots" rel="snapshots"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/tags" rel="tags"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/permissions" rel="permissions"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/statistics" rel="statistics"/>
<type>server</type>
<status>
<state>down</state>
</status>
<memory>805306368</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<boot dev="hd"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<address>host</address>
<port>5900</port>
<secure_port>5901</secure_port>
<monitors>1</monitors>
</display>
<host href="/api/hosts/3690fafa-4b4c-11e1-8b7b-5254009970cc" id="3690fafa-4b4c-11e1-8b7b-5254009970cc"/>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<template href="/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<start_time>2012-02-05T11:00:33.222Z</start_time>
<creation_time>2012-01-31T07:21:10.667Z</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
<usb>
<enabled>true</enabled>
</usb>
</vm>

View File

@ -1,152 +0,0 @@
<vms>
<vm href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b" id="5ee86332-7b19-465b-8801-2a12ed0d6c1b">
<name>test-vm1</name>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/disks" rel="disks"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/nics" rel="nics"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/cdroms" rel="cdroms"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/snapshots" rel="snapshots"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/tags" rel="tags"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/permissions" rel="permissions"/>
<link href="/api/vms/5ee86332-7b19-465b-8801-2a12ed0d6c1b/statistics" rel="statistics"/>
<type>server</type>
<status>
<state>down</state>
</status>
<memory>1073741824</memory>
<cpu>
<topology sockets="1" cores="4"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<monitors>1</monitors>
</display>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<template href="/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<start_time>2012-02-06T10:47:32.214Z</start_time>
<creation_time>2012-01-31T07:45:13.068Z</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
<usb>
<enabled>true</enabled>
</usb>
</vm>
<vm href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1" id="349764bb-eba3-4466-abef-f18f4c40c9f1">
<name>fosdem</name>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/disks" rel="disks"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/nics" rel="nics"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/cdroms" rel="cdroms"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/snapshots" rel="snapshots"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/tags" rel="tags"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/permissions" rel="permissions"/>
<link href="/api/vms/349764bb-eba3-4466-abef-f18f4c40c9f1/statistics" rel="statistics"/>
<type>server</type>
<status>
<state>down</state>
</status>
<memory>536870912</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="hd"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<address>host</address>
<port>5902</port>
<secure_port>5903</secure_port>
<monitors>1</monitors>
</display>
<host href="/api/hosts/3690fafa-4b4c-11e1-8b7b-5254009970cc" id="3690fafa-4b4c-11e1-8b7b-5254009970cc"/>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<template href="/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<start_time>2012-02-05T11:04:39.217Z</start_time>
<creation_time>2012-02-05T10:53:30.484Z</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
<usb>
<enabled>true</enabled>
</usb>
</vm>
<vm href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c" id="52b9406e-cf66-4867-8655-719a094e324c">
<name>vm01</name>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/disks" rel="disks"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/nics" rel="nics"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/cdroms" rel="cdroms"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/snapshots" rel="snapshots"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/tags" rel="tags"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/permissions" rel="permissions"/>
<link href="/api/vms/52b9406e-cf66-4867-8655-719a094e324c/statistics" rel="statistics"/>
<type>server</type>
<status>
<state>down</state>
</status>
<memory>805306368</memory>
<cpu>
<topology sockets="1" cores="1"/>
</cpu>
<os type="unassigned">
<boot dev="network"/>
<boot dev="hd"/>
<kernel/>
<initrd/>
<cmdline/>
</os>
<high_availability>
<enabled>false</enabled>
<priority>1</priority>
</high_availability>
<display>
<type>spice</type>
<address>host</address>
<port>5900</port>
<secure_port>5901</secure_port>
<monitors>1</monitors>
</display>
<host href="/api/hosts/3690fafa-4b4c-11e1-8b7b-5254009970cc" id="3690fafa-4b4c-11e1-8b7b-5254009970cc"/>
<cluster href="/api/clusters/99408929-82cf-4dc7-a532-9d998063fa95" id="99408929-82cf-4dc7-a532-9d998063fa95"/>
<template href="/api/templates/00000000-0000-0000-0000-000000000000" id="00000000-0000-0000-0000-000000000000"/>
<start_time>2012-02-05T11:00:33.222Z</start_time>
<creation_time>2012-01-31T07:21:10.667Z</creation_time>
<origin>rhev</origin>
<stateless>false</stateless>
<placement_policy>
<affinity>migratable</affinity>
</placement_policy>
<memory_policy>
<guaranteed>536870912</guaranteed>
</memory_policy>
<usb>
<enabled>true</enabled>
</usb>
</vm>
</vms>

View File

@ -1,40 +0,0 @@
<disks>
<disk href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/9f68ecfd-218b-4f80-8e7a-e70b2ab054cd" id="9f68ecfd-218b-4f80-8e7a-e70b2ab054cd">
<name>Disk 2</name>
<link href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/9f68ecfd-218b-4f80-8e7a-e70b2ab054cd/statistics" rel="statistics"/>
<vm href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387" id="192cdd3f-3281-4e20-b81d-93bdc57ac387"/>
<storage_domains>
<storage_domain id="cba62b33-887a-410c-b367-e3d9229a72f7"/>
</storage_domains>
<size>5368709120</size>
<type>data</type>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>raw</format>
<sparse>true</sparse>
<bootable>false</bootable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
</disk>
<disk href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/e373b1a5-6c89-43f1-9a2d-cdf674412349" id="e373b1a5-6c89-43f1-9a2d-cdf674412349">
<name>Disk 1</name>
<link href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387/disks/e373b1a5-6c89-43f1-9a2d-cdf674412349/statistics" rel="statistics"/>
<vm href="/api/vms/192cdd3f-3281-4e20-b81d-93bdc57ac387" id="192cdd3f-3281-4e20-b81d-93bdc57ac387"/>
<storage_domains>
<storage_domain id="cba62b33-887a-410c-b367-e3d9229a72f7"/>
</storage_domains>
<size>8589934592</size>
<type>system</type>
<status>
<state>ok</state>
</status>
<interface>virtio</interface>
<format>cow</format>
<sparse>true</sparse>
<bootable>true</bootable>
<wipe_after_delete>false</wipe_after_delete>
<propagate_errors>false</propagate_errors>
</disk>
</disks>

View File

@ -1,21 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def remove_from_affinity_group(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "affinity group id is a required parameter for remove-from-affinity-group" unless options.key? :id
client.delete_vm_from_affinity_group(options[:id], id)
end
end
class Mock
def remove_from_affinity_group(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "affinity group id is a required parameter for remove-from-affinity-group" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,20 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def storage_domains filter={}
client.storagedomains(filter)
end
end
class Mock
def storage_domains(filters = {})
xml = read_xml 'storage_domains.xml'
Nokogiri::XML(xml).xpath('/storage_domains/storage_domain').map do |sd|
OVIRT::StorageDomain::new(self, sd)
end
end
end
end
end
end

View File

@ -1,35 +0,0 @@
module Fog
module Compute
class Ovirt
module Shared
def check_arguments(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "interface id is a required parameter for update-interface" unless options.key? :id
end
end
class Real
extend ::Fog::Compute::Ovirt::Shared
def update_interface(id, options)
check_arguments(id, options)
interface_id = options[:id]
options.delete(:id)
client.update_interface(id, interface_id, options)
end
end
class Mock
extend ::Fog::Compute::Ovirt::Shared
def update_interface(id, options)
check_arguments(id, options)
true
end
end
end
end
end

View File

@ -1,18 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def update_vm(attrs)
client.update_vm(attrs)
end
end
class Mock
def update_vm(attrs)
xml = read_xml('vm.xml')
OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
end
end
end
end

View File

@ -1,39 +0,0 @@
module Fog
module Compute
class Ovirt
module Shared
def check_arguments(id, options)
raise ArgumentError, "instance id is a required parameter" unless id
raise ArgumentError, "disk id is a required parameter for update-volume" unless options.has_key? :id
end
end
class Real
extend ::Fog::Compute::Ovirt::Shared
def update_volume(id, options)
check_arguments(id, options)
disk_id = options[:id]
options.delete(:id)
client.update_volume(id, disk_id, options)
true # If we come here, expect success and return true
end
end
class Mock
extend ::Fog::Compute::Ovirt::Shared
def update_volume(id, options)
check_arguments(id, options)
true
end
end
end
end
end

View File

@ -1,22 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def vm_action(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
raise ArgumentError, "action is a required parameter" unless options.key? :action
client.vm_action options[:id], options[:action]
end
end
class Mock
def vm_action(options = {})
raise ArgumentError, "id is a required parameter" unless options.key? :id
raise ArgumentError, "action is a required parameter" unless options.key? :action
true
end
end
end
end
end

View File

@ -1,19 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def vm_start_with_cloudinit(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
client.vm_start_with_cloudinit(options[:id], options[:user_data])
end
end
class Mock
def vm_start_with_cloudinit(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
true
end
end
end
end
end

View File

@ -1,17 +0,0 @@
module Fog
module Compute
class Ovirt
class Real
def vm_ticket(id, options = {})
client.set_ticket(id, options)
end
end
class Mock
def vm_ticket(id, options = {})
"Secret"
end
end
end
end
end

View File

@ -1,10 +0,0 @@
require "minitest/autorun"
require "fog"
require "fog/bin"
require "helpers/bin"
describe Ovirt do
include Fog::BinSpec
let(:subject) { Ovirt }
end

View File

@ -58,9 +58,6 @@ if Fog.mock?
:openstack_username => 'openstack_username',
:openstack_tenant => 'openstack_tenant',
:openstack_auth_url => 'http://openstack:35357/v2.0/tokens',
:ovirt_url => 'http://ovirt:8080/api',
:ovirt_username => 'admin@internal',
:ovirt_password => '123123',
:profitbricks_username => 'profitbricks_username',
:profitbricks_password => 'profitbricks_password',
:rackspace_api_key => 'rackspace_api_key',

View File

@ -1,25 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt]', ['ovirt']) do
compute = Fog::Compute[:ovirt]
tests("Compute attributes") do
%w{ ovirt_attrs }.each do |attr|
test("it should respond to #{attr}") { compute.respond_to? attr }
end
end
tests("Compute collections") do
%w{ servers templates clusters interfaces }.each do |collection|
test("it should respond to #{collection}") { compute.respond_to? collection }
end
end
tests("Compute requests") do
%w{ add_interface create_vm datacenters destroy_interface destroy_vm get_cluster get_template
get_virtual_machine list_clusters list_networks list_template_interfaces list_templates
list_virtual_machines list_vm_interfaces storage_domains update_interface update_vm vm_action
api_version update_volume}.each do |collection|
test("it should respond to #{collection}") { compute.respond_to? collection }
end
end
end

View File

@ -1,31 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | cluster model', ['ovirt']) do
clusters = Fog::Compute[:ovirt].clusters
cluster = clusters.last
tests('The cluster model should') do
tests('have the action') do
test('reload') { cluster.respond_to? 'reload' }
%w{ networks }.each do |action|
test(action) { cluster.respond_to? action }
end
end
tests('have attributes') do
model_attribute_hash = cluster.attributes
attributes = [ :id,
:name]
tests("The cluster model should respond to") do
attributes.each do |attribute|
test("#{attribute}") { cluster.respond_to? attribute }
end
end
tests("The attributes hash should have key") do
attributes.each do |attribute|
test("#{attribute}") { model_attribute_hash.key? attribute }
end
end
end
test('be a kind of Fog::Compute::Ovirt::Cluster') { cluster.kind_of? Fog::Compute::Ovirt::Cluster }
end
end

View File

@ -1,9 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | clusters collection', ['ovirt']) do
clusters = Fog::Compute[:ovirt].clusters
tests('The clusters collection') do
test('should be a kind of Fog::Compute::Ovirt::Clusters') { clusters.kind_of? Fog::Compute::Ovirt::Clusters }
end
end

View File

@ -1,27 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | interface model', ['ovirt']) do
interfaces = Fog::Compute[:ovirt].servers.last.interfaces
interface = interfaces.last
tests('The interface model should') do
tests('have the action') do
test('reload') { interface.respond_to? 'reload' }
end
tests('have attributes') do
model_attribute_hash = interface.attributes
attributes = [ :id, :name, :network]
tests("The interface model should respond to") do
attributes.each do |attribute|
test("#{attribute}") { interface.respond_to? attribute }
end
end
tests("The attributes hash should have key") do
attributes.each do |attribute|
test("#{attribute}") { model_attribute_hash.key? attribute }
end
end
end
test('be a kind of Fog::Compute::Ovirt::Interface') { interface.kind_of? Fog::Compute::Ovirt::Interface }
end
end

View File

@ -1,9 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | interfaces collection', ['ovirt']) do
interfaces = Fog::Compute[:ovirt].interfaces
tests('The interfaces collection') do
test('should be a kind of Fog::Compute::Ovirt::Interfaces') { interfaces.kind_of? Fog::Compute::Ovirt::Interfaces }
end
end

View File

@ -1,51 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | server model', ['ovirt']) do
servers = Fog::Compute[:ovirt].servers
server = servers.last
tests('The server model should') do
tests('have the action') do
test('reload') { server.respond_to? 'reload' }
%w{ start stop destroy reboot suspend }.each do |action|
test(action) { server.respond_to? action }
end
%w{ start reboot suspend stop }.each do |action|
test("#{action} returns successfully") {
begin
server.send(action.to_sym) ? true : false
rescue OVIRT::OvirtException
#ovirt exceptions are acceptable for the above actions.
true
end
}
end
end
tests('have attributes') do
model_attribute_hash = server.attributes
attributes = [ :id,
:name,
:description,
:profile,
:display,
:creation_time,
:os,
:status,
:cores,
:memory,
:cluster,
:template]
tests("The server model should respond to") do
attributes.each do |attribute|
test("#{attribute}") { server.respond_to? attribute }
end
end
tests("The attributes hash should have key") do
attributes.each do |attribute|
test("#{attribute}") { model_attribute_hash.key? attribute }
end
end
end
test('be a kind of Fog::Compute::Ovirt::Server') { server.kind_of? Fog::Compute::Ovirt::Server }
end
end

View File

@ -1,14 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | servers collection', ['ovirt']) do
servers = Fog::Compute[:ovirt].servers
tests('The servers collection') do
test('should not be empty') { not servers.empty? }
test('should be a kind of Fog::Compute::Ovirt::Servers') { servers.kind_of? Fog::Compute::Ovirt::Servers }
tests('should be able to reload itself').succeeds { servers.reload }
tests('should be able to get a model') do
tests('by instance uuid').succeeds { servers.get servers.first.id }
end
end
end

View File

@ -1,28 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | template model', ['ovirt']) do
templates = Fog::Compute[:ovirt].templates
template = templates.last
tests('The template model should') do
tests('have the action') do
test('reload') { template.respond_to? 'reload' }
end
tests('have attributes') do
model_attribute_hash = template.attributes
attributes = [ :id,
:name]
tests("The template model should respond to") do
attributes.each do |attribute|
test("#{attribute}") { template.respond_to? attribute }
end
end
tests("The attributes hash should have key") do
attributes.each do |attribute|
test("#{attribute}") { model_attribute_hash.key? attribute }
end
end
end
test('be a kind of Fog::Compute::Ovirt::Template') { template.kind_of? Fog::Compute::Ovirt::Template }
end
end

View File

@ -1,9 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | templates collection', ['ovirt']) do
templates = Fog::Compute[:ovirt].templates
tests('The templates collection') do
test('should be a kind of Fog::Compute::Ovirt::Templates') { templates.kind_of? Fog::Compute::Ovirt::Templates }
end
end

View File

@ -1,26 +0,0 @@
Shindo.tests("Fog::Compute[:ovirt] | vm_create request", 'ovirt') do
compute = Fog::Compute[:ovirt]
name_base = Time.now.to_i
tests("Create VM") do
response = compute.create_vm(:name => 'fog-'+name_base.to_s, :cluster_name => 'Default')
test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM}
end
tests("Create VM from template (clone)") do
response = compute.create_vm(:name => 'fog-'+(name_base+ 1).to_s, :template_name => 'hwp_small', :cluster_name => 'Default')
test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM}
end
tests("Fail Creating VM") do
begin
response = compute.create_vm(:name => 'fog-'+name_base.to_s, :cluster_name => 'Default')
test("should be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM} #mock never raise exceptions
rescue => e
#should raise vm name already exist exception.
test("error should be a kind of OVIRT::OvirtException") { e.kind_of? OVIRT::OvirtException}
end
end
end

View File

@ -1,18 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | vm_destroy request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
if compute.servers.all(:search => 'fog-*').empty?
compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default')
end
vm_id = compute.servers.all(:search => 'fog-*').last.id
tests('The response should') do
response = compute.destroy_vm(:id => vm_id)
test('be a success') { response ? true: false }
end
tests('The expected options') do
raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.destroy_vm }
end
end

View File

@ -1,13 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | datacenters request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
tests("When listing all datacenters") do
response = compute.datacenters
tests("The response data format ...") do
test("it should be a kind of Array") { response.kind_of? Array }
test("be a kind of Hash") { response.first.kind_of? Hash }
end
end
end

View File

@ -1,12 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | quotas request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
tests("When listing all quotas") do
response = compute.quotas
tests("The response data format ...") do
test("it should be a kind of Array") { response.kind_of? Array }
end
end
end

View File

@ -1,13 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | storage_domains request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
tests("When listing all storage_domains") do
response = compute.storage_domains
tests("The response data format ...") do
test("it should be a kind of Array") { response.kind_of? Array }
test("be a kind of OVIRT::StorageDomain") { response.first.kind_of? OVIRT::StorageDomain }
end
end
end

View File

@ -1,18 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | vm_update request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
if compute.servers.all(:search => 'fog-*').empty?
compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default')
end
vm = compute.servers.all(:search => 'fog-*').last
tests('The response should') do
response = compute.update_vm(:id => vm.id, :name => vm.name + 'updated')
test("be a kind of OVIRT::VM") { response.kind_of? OVIRT::VM}
end
tests('The expected options') do
raises(ArgumentError, 'raises ArgumentError when id option is missing') { compute.update_vm }
end
end

View File

@ -1,20 +0,0 @@
Shindo.tests('Fog::Compute[:ovirt] | update_volume request', ['ovirt']) do
compute = Fog::Compute[:ovirt]
if compute.servers.all(:search => 'fog-*').empty?
compute.create_vm(:name => 'fog-'+Time.now.to_i.to_s, :cluster_name => 'Default')
end
vm_id = compute.servers.all(:search => 'fog-*').last
tests('The expected options') do
raises(ArgumentError, 'raises ArgumentError when vm id is missing') { compute.update_volume(nil, {:id => 1}) }
raises(ArgumentError, 'raises ArgumentError when disk_id option is missing') { compute.update_volume(1, {:any => 1}) }
end
tests('The response should') do
response = compute.update_volume(vm_id, :id => 1)
test('be a success') { response ? true: false }
end
end