Class: Fog::Compute::Ovirt::Mock
- Inherits:
-
Object
- Object
- Fog::Compute::Ovirt::Mock
show all
- Extended by:
- Shared
- Includes:
- Shared
- Defined in:
- lib/fog/ovirt/compute.rb,
lib/fog/ovirt/requests/compute/create_vm.rb,
lib/fog/ovirt/requests/compute/get_quota.rb,
lib/fog/ovirt/requests/compute/update_vm.rb,
lib/fog/ovirt/requests/compute/vm_action.rb,
lib/fog/ovirt/requests/compute/vm_ticket.rb,
lib/fog/ovirt/requests/compute/add_volume.rb,
lib/fog/ovirt/requests/compute/destroy_vm.rb,
lib/fog/ovirt/requests/compute/datacenters.rb,
lib/fog/ovirt/requests/compute/get_cluster.rb,
lib/fog/ovirt/requests/compute/list_quotas.rb,
lib/fog/ovirt/requests/compute/get_template.rb,
lib/fog/ovirt/requests/compute/add_interface.rb,
lib/fog/ovirt/requests/compute/list_clusters.rb,
lib/fog/ovirt/requests/compute/list_networks.rb,
lib/fog/ovirt/requests/compute/update_volume.rb,
lib/fog/ovirt/requests/compute/destroy_volume.rb,
lib/fog/ovirt/requests/compute/list_templates.rb,
lib/fog/ovirt/requests/compute/get_api_version.rb,
lib/fog/ovirt/requests/compute/list_vm_volumes.rb,
lib/fog/ovirt/requests/compute/storage_domains.rb,
lib/fog/ovirt/requests/compute/update_interface.rb,
lib/fog/ovirt/requests/compute/destroy_interface.rb,
lib/fog/ovirt/requests/compute/list_vm_interfaces.rb,
lib/fog/ovirt/requests/compute/get_virtual_machine.rb,
lib/fog/ovirt/requests/compute/list_template_volumes.rb,
lib/fog/ovirt/requests/compute/list_virtual_machines.rb,
lib/fog/ovirt/requests/compute/list_template_interfaces.rb
Instance Method Summary
collapse
Methods included from Shared
check_arguments, ovirt_attrs
Constructor Details
#initialize(options = {}) ⇒ Mock
Returns a new instance of Mock.
82
83
84
|
# File 'lib/fog/ovirt/compute.rb', line 82
def initialize(options={})
require 'rbovirt'
end
|
Instance Method Details
#add_interface(id, options = {}) ⇒ Object
13
14
15
16
|
# File 'lib/fog/ovirt/requests/compute/add_interface.rb', line 13
def add_interface(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
true
end
|
#add_volume(id, options = {}) ⇒ Object
14
15
16
17
|
# File 'lib/fog/ovirt/requests/compute/add_volume.rb', line 14
def add_volume(id, options = {})
raise ArgumentError, "instance id is a required parameter" unless id
true
end
|
#api_version ⇒ Object
10
11
12
|
# File 'lib/fog/ovirt/requests/compute/get_api_version.rb', line 10
def api_version
"3.1"
end
|
#create_vm(attrs) ⇒ Object
11
12
13
14
|
# File 'lib/fog/ovirt/requests/compute/create_vm.rb', line 11
def create_vm(attrs)
xml = read_xml('vm.xml')
OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
|
#datacenters(filters = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/fog/ovirt/requests/compute/datacenters.rb', line 11
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
|
#destroy_interface(id, options) ⇒ Object
14
15
16
17
18
|
# File 'lib/fog/ovirt/requests/compute/destroy_interface.rb', line 14
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
|
#destroy_vm(options = {}) ⇒ Object
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/destroy_vm.rb', line 12
def destroy_vm(options = {})
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
true
end
|
#destroy_volume(id, options) ⇒ Object
14
15
16
17
18
|
# File 'lib/fog/ovirt/requests/compute/destroy_volume.rb', line 14
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
|
#get_cluster(id) ⇒ Object
10
11
12
13
|
# File 'lib/fog/ovirt/requests/compute/get_cluster.rb', line 10
def get_cluster(id)
xml = read_xml('cluster.xml')
ovirt_attrs OVIRT::Cluster::new(self, Nokogiri::XML(xml).root)
end
|
#get_quota(id) ⇒ Object
10
11
12
13
|
# File 'lib/fog/ovirt/requests/compute/get_quota.rb', line 10
def get_quota(id)
xml = read_xml('quota.xml')
ovirt_attrs OVIRT::Quota::new(self, Nokogiri::XML(xml).root)
end
|
#get_template(id) ⇒ Object
10
11
12
13
|
# File 'lib/fog/ovirt/requests/compute/get_template.rb', line 10
def get_template(id)
xml = read_xml 'template.xml'
ovirt_attrs OVIRT::Template::new(self, Nokogiri::XML(xml).root)
end
|
#get_virtual_machine(id) ⇒ Object
10
11
12
13
|
# File 'lib/fog/ovirt/requests/compute/get_virtual_machine.rb', line 10
def get_virtual_machine(id)
xml = read_xml 'vm.xml'
ovirt_attrs OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
|
#list_clusters(filters = {}) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_clusters.rb', line 10
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
|
#list_networks(cluster_id) ⇒ Object
10
11
12
|
# File 'lib/fog/ovirt/requests/compute/list_networks.rb', line 10
def list_networks(cluster_id)
[]
end
|
#list_quotas(filters = {}) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_quotas.rb', line 10
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
|
#list_template_interfaces(vm_id) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_template_interfaces.rb', line 10
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
|
#list_template_volumes(template_id) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_template_volumes.rb', line 10
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
|
#list_templates(filters = {}) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_templates.rb', line 10
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
|
#list_virtual_machines(filters = {}) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_virtual_machines.rb', line 10
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
|
#list_vm_interfaces(vm_id) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_vm_interfaces.rb', line 10
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
|
#list_vm_volumes(vm_id) ⇒ Object
10
11
12
13
14
15
|
# File 'lib/fog/ovirt/requests/compute/list_vm_volumes.rb', line 10
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
|
#storage_domains(filters = {}) ⇒ Object
11
12
13
14
15
16
|
# File 'lib/fog/ovirt/requests/compute/storage_domains.rb', line 11
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
|
#update_interface(id, options) ⇒ Object
14
15
16
17
18
|
# File 'lib/fog/ovirt/requests/compute/update_interface.rb', line 14
def update_interface(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
true
end
|
#update_vm(attrs) ⇒ Object
11
12
13
14
|
# File 'lib/fog/ovirt/requests/compute/update_vm.rb', line 11
def update_vm(attrs)
xml = read_xml('vm.xml')
OVIRT::VM::new(self, Nokogiri::XML(xml).root)
end
|
#update_volume(id, options) ⇒ Object
31
32
33
34
|
# File 'lib/fog/ovirt/requests/compute/update_volume.rb', line 31
def update_volume(id, options)
check_arguments(id, options)
true
end
|
#vm_action(options = {}) ⇒ Object
14
15
16
17
18
|
# File 'lib/fog/ovirt/requests/compute/vm_action.rb', line 14
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
|
#vm_ticket(id, options = {}) ⇒ Object
11
12
13
|
# File 'lib/fog/ovirt/requests/compute/vm_ticket.rb', line 11
def vm_ticket(id, options = {})
"Secret"
end
|