fog 1.41.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/stale.yml +17 -0
- data/.travis.yml +1 -8
- data/CHANGELOG.md +78 -0
- data/README.md +4 -5
- data/Rakefile +0 -3
- data/fog.gemspec +13 -13
- data/lib/fog/bin/brightbox.rb +2 -2
- data/lib/fog/bin.rb +0 -2
- data/lib/fog/cloudstack/models/compute/server.rb +2 -0
- data/lib/fog/linode/requests/compute/avail_datacenters.rb +1 -0
- data/lib/fog/opennebula/compute.rb +6 -1
- data/lib/fog/opennebula/requests/compute/OpenNebulaVNC.rb +5 -1
- data/lib/fog/vcloud_director/compute.rb +3 -2
- data/lib/fog/vcloud_director/generators/compute/edge_gateway_service_configuration.rb +2 -2
- data/lib/fog/vcloud_director/generators/compute/network_config_section.rb +68 -0
- data/lib/fog/vcloud_director/requests/compute/get_vapp.rb +0 -4
- data/lib/fog/vcloud_director/requests/compute/instantiate_vapp_template.rb +11 -11
- data/lib/fog/vcloud_director/requests/compute/post_power_on_vapp.rb +1 -1
- data/lib/fog/vcloud_director/requests/compute/put_config_network_section_vapp.rb +26 -0
- data/lib/fog/version.rb +1 -1
- data/lib/fog.rb +0 -2
- data/lib/tasks/changelog_task.rb +4 -1
- data/lib/tasks/github_release_task.rb +1 -1
- data/spec/fog/bin/atmos_spec.rb +0 -10
- data/spec/fog/bin/aws_spec.rb +0 -18
- data/spec/fog/bin/baremetalcloud_spec.rb +0 -10
- data/spec/fog/bin/brightbox_spec.rb +2 -2
- data/spec/fog/bin_spec.rb +0 -6
- data/tests/cloudsigma/models/snapshot_tests.rb +2 -0
- data/tests/cloudsigma/models/snapshots_tests.rb +1 -0
- data/tests/cloudsigma/requests/snapshots_tests.rb +1 -0
- data/tests/cloudsigma/requests/volumes_tests.rb +1 -1
- data/tests/cloudstack/compute/models/volume_tests.rb +1 -1
- data/tests/compute/helper.rb +0 -9
- data/tests/dns/helper.rb +0 -9
- data/tests/helpers/collection_helper.rb +0 -6
- data/tests/helpers/mock_helper.rb +0 -7
- data/tests/opennebula/compute_tests.rb +5 -2
- data/tests/opennebula/models/compute/flavor_tests.rb +5 -1
- data/tests/opennebula/models/compute/flavors_tests.rb +5 -2
- data/tests/opennebula/models/compute/group_tests.rb +5 -2
- data/tests/opennebula/models/compute/groups_tests.rb +5 -2
- data/tests/opennebula/models/compute/network_tests.rb +5 -1
- data/tests/opennebula/models/compute/networks_tests.rb +5 -2
- data/tests/opennebula/requests/compute/vm_allocate_tests.rb +5 -1
- data/tests/opennebula/requests/compute/vm_suspend_resume_tests.rb +5 -2
- metadata +37 -546
- data/gemfiles/Gemfile-1.9 +0 -16
- data/gemfiles/Gemfile-edge-1.9 +0 -20
- data/lib/fog/bin/bluebox.rb +0 -36
- data/lib/fog/bin/ovirt.rb +0 -28
- data/lib/fog/bin/zerigo.rb +0 -29
- data/lib/fog/bluebox/blb.rb +0 -82
- data/lib/fog/bluebox/compute.rb +0 -98
- data/lib/fog/bluebox/core.rb +0 -12
- data/lib/fog/bluebox/dns.rb +0 -101
- data/lib/fog/bluebox/models/blb/lb_application.rb +0 -29
- data/lib/fog/bluebox/models/blb/lb_applications.rb +0 -24
- data/lib/fog/bluebox/models/blb/lb_backend.rb +0 -19
- data/lib/fog/bluebox/models/blb/lb_backends.rb +0 -27
- data/lib/fog/bluebox/models/blb/lb_service.rb +0 -32
- data/lib/fog/bluebox/models/blb/lb_services.rb +0 -27
- data/lib/fog/bluebox/models/compute/flavor.rb +0 -41
- data/lib/fog/bluebox/models/compute/flavors.rb +0 -24
- data/lib/fog/bluebox/models/compute/image.rb +0 -30
- data/lib/fog/bluebox/models/compute/images.rb +0 -24
- data/lib/fog/bluebox/models/compute/location.rb +0 -13
- data/lib/fog/bluebox/models/compute/locations.rb +0 -24
- data/lib/fog/bluebox/models/compute/server.rb +0 -121
- data/lib/fog/bluebox/models/compute/servers.rb +0 -32
- data/lib/fog/bluebox/models/dns/record.rb +0 -52
- data/lib/fog/bluebox/models/dns/records.rb +0 -32
- data/lib/fog/bluebox/models/dns/zone.rb +0 -62
- data/lib/fog/bluebox/models/dns/zones.rb +0 -24
- data/lib/fog/bluebox/parsers/dns/create_record.rb +0 -22
- data/lib/fog/bluebox/parsers/dns/create_zone.rb +0 -22
- data/lib/fog/bluebox/parsers/dns/get_record.rb +0 -17
- data/lib/fog/bluebox/parsers/dns/get_records.rb +0 -24
- data/lib/fog/bluebox/parsers/dns/get_zone.rb +0 -22
- data/lib/fog/bluebox/parsers/dns/get_zones.rb +0 -26
- data/lib/fog/bluebox/requests/blb/add_machine_to_lb_application.rb +0 -33
- data/lib/fog/bluebox/requests/blb/add_machine_to_lb_backend.rb +0 -31
- data/lib/fog/bluebox/requests/blb/get_lb_application.rb +0 -32
- data/lib/fog/bluebox/requests/blb/get_lb_applications.rb +0 -30
- data/lib/fog/bluebox/requests/blb/get_lb_backend.rb +0 -35
- data/lib/fog/bluebox/requests/blb/get_lb_backends.rb +0 -35
- data/lib/fog/bluebox/requests/blb/get_lb_machine.rb +0 -34
- data/lib/fog/bluebox/requests/blb/get_lb_machines.rb +0 -34
- data/lib/fog/bluebox/requests/blb/get_lb_service.rb +0 -35
- data/lib/fog/bluebox/requests/blb/get_lb_services.rb +0 -35
- data/lib/fog/bluebox/requests/blb/remove_machine_from_lb_backend.rb +0 -28
- data/lib/fog/bluebox/requests/blb/update_lb_backend_machine.rb +0 -29
- data/lib/fog/bluebox/requests/compute/create_block.rb +0 -44
- data/lib/fog/bluebox/requests/compute/create_template.rb +0 -25
- data/lib/fog/bluebox/requests/compute/destroy_block.rb +0 -24
- data/lib/fog/bluebox/requests/compute/destroy_template.rb +0 -24
- data/lib/fog/bluebox/requests/compute/get_block.rb +0 -24
- data/lib/fog/bluebox/requests/compute/get_blocks.rb +0 -26
- data/lib/fog/bluebox/requests/compute/get_location.rb +0 -24
- data/lib/fog/bluebox/requests/compute/get_locations.rb +0 -22
- data/lib/fog/bluebox/requests/compute/get_product.rb +0 -24
- data/lib/fog/bluebox/requests/compute/get_products.rb +0 -23
- data/lib/fog/bluebox/requests/compute/get_template.rb +0 -24
- data/lib/fog/bluebox/requests/compute/get_templates.rb +0 -24
- data/lib/fog/bluebox/requests/compute/reboot_block.rb +0 -25
- data/lib/fog/bluebox/requests/dns/create_record.rb +0 -44
- data/lib/fog/bluebox/requests/dns/create_zone.rb +0 -48
- data/lib/fog/bluebox/requests/dns/delete_record.rb +0 -27
- data/lib/fog/bluebox/requests/dns/delete_zone.rb +0 -27
- data/lib/fog/bluebox/requests/dns/get_record.rb +0 -36
- data/lib/fog/bluebox/requests/dns/get_records.rb +0 -37
- data/lib/fog/bluebox/requests/dns/get_zone.rb +0 -40
- data/lib/fog/bluebox/requests/dns/get_zones.rb +0 -39
- data/lib/fog/bluebox/requests/dns/update_record.rb +0 -30
- data/lib/fog/bluebox/requests/dns/update_zone.rb +0 -26
- data/lib/fog/bluebox.rb +0 -3
- data/lib/fog/ovirt/compute.rb +0 -155
- data/lib/fog/ovirt/core.rb +0 -16
- data/lib/fog/ovirt/models/compute/affinity_group.rb +0 -25
- data/lib/fog/ovirt/models/compute/affinity_groups.rb +0 -20
- data/lib/fog/ovirt/models/compute/cluster.rb +0 -20
- data/lib/fog/ovirt/models/compute/clusters.rb +0 -20
- data/lib/fog/ovirt/models/compute/instance_type.rb +0 -39
- data/lib/fog/ovirt/models/compute/instance_types.rb +0 -20
- data/lib/fog/ovirt/models/compute/interface.rb +0 -19
- data/lib/fog/ovirt/models/compute/interfaces.rb +0 -29
- data/lib/fog/ovirt/models/compute/quota.rb +0 -16
- data/lib/fog/ovirt/models/compute/quotas.rb +0 -20
- data/lib/fog/ovirt/models/compute/server.rb +0 -175
- data/lib/fog/ovirt/models/compute/servers.rb +0 -27
- data/lib/fog/ovirt/models/compute/template.rb +0 -58
- data/lib/fog/ovirt/models/compute/templates.rb +0 -20
- data/lib/fog/ovirt/models/compute/volume.rb +0 -36
- data/lib/fog/ovirt/models/compute/volumes.rb +0 -28
- data/lib/fog/ovirt/requests/compute/activate_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/add_interface.rb +0 -20
- data/lib/fog/ovirt/requests/compute/add_to_affinity_group.rb +0 -21
- data/lib/fog/ovirt/requests/compute/add_volume.rb +0 -21
- data/lib/fog/ovirt/requests/compute/attach_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/create_affinity_group.rb +0 -18
- data/lib/fog/ovirt/requests/compute/create_vm.rb +0 -18
- data/lib/fog/ovirt/requests/compute/datacenters.rb +0 -20
- data/lib/fog/ovirt/requests/compute/deactivate_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/destroy_affinity_group.rb +0 -19
- data/lib/fog/ovirt/requests/compute/destroy_interface.rb +0 -22
- data/lib/fog/ovirt/requests/compute/destroy_vm.rb +0 -19
- data/lib/fog/ovirt/requests/compute/destroy_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/detach_volume.rb +0 -22
- data/lib/fog/ovirt/requests/compute/get_affinity_group.rb +0 -18
- data/lib/fog/ovirt/requests/compute/get_api_version.rb +0 -16
- data/lib/fog/ovirt/requests/compute/get_cluster.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_instance_type.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_quota.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_template.rb +0 -17
- data/lib/fog/ovirt/requests/compute/get_virtual_machine.rb +0 -17
- data/lib/fog/ovirt/requests/compute/list_affinity_group_vms.rb +0 -22
- data/lib/fog/ovirt/requests/compute/list_affinity_groups.rb +0 -20
- data/lib/fog/ovirt/requests/compute/list_clusters.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_instance_types.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_networks.rb +0 -16
- data/lib/fog/ovirt/requests/compute/list_quotas.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_template_interfaces.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_template_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_templates.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_virtual_machines.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_vm_interfaces.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_vm_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/list_volumes.rb +0 -19
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup.xml +0 -8
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroup_vms.xml +0 -9
- data/lib/fog/ovirt/requests/compute/mock_files/affinitygroups.xml +0 -17
- data/lib/fog/ovirt/requests/compute/mock_files/cluster.xml +0 -20
- data/lib/fog/ovirt/requests/compute/mock_files/clusters.xml +0 -39
- data/lib/fog/ovirt/requests/compute/mock_files/data_centers.xml +0 -17
- data/lib/fog/ovirt/requests/compute/mock_files/disks.xml +0 -58
- data/lib/fog/ovirt/requests/compute/mock_files/instance_type.xml +0 -42
- data/lib/fog/ovirt/requests/compute/mock_files/instance_types.xml +0 -197
- data/lib/fog/ovirt/requests/compute/mock_files/nics.xml +0 -10
- data/lib/fog/ovirt/requests/compute/mock_files/quotas.xml +0 -7
- data/lib/fog/ovirt/requests/compute/mock_files/storage_domains.xml +0 -36
- data/lib/fog/ovirt/requests/compute/mock_files/template.xml +0 -39
- data/lib/fog/ovirt/requests/compute/mock_files/templates.xml +0 -110
- data/lib/fog/ovirt/requests/compute/mock_files/vm.xml +0 -52
- data/lib/fog/ovirt/requests/compute/mock_files/vms.xml +0 -152
- data/lib/fog/ovirt/requests/compute/mock_files/volumes.xml +0 -40
- data/lib/fog/ovirt/requests/compute/remove_from_affinity_group.rb +0 -21
- data/lib/fog/ovirt/requests/compute/storage_domains.rb +0 -20
- data/lib/fog/ovirt/requests/compute/update_interface.rb +0 -35
- data/lib/fog/ovirt/requests/compute/update_vm.rb +0 -18
- data/lib/fog/ovirt/requests/compute/update_volume.rb +0 -39
- data/lib/fog/ovirt/requests/compute/vm_action.rb +0 -22
- data/lib/fog/ovirt/requests/compute/vm_start_with_cloudinit.rb +0 -19
- data/lib/fog/ovirt/requests/compute/vm_ticket.rb +0 -17
- data/lib/fog/ovirt.rb +0 -1
- data/lib/fog/zerigo/core.rb +0 -10
- data/lib/fog/zerigo/dns.rb +0 -114
- data/lib/fog/zerigo/models/dns/record.rb +0 -66
- data/lib/fog/zerigo/models/dns/records.rb +0 -45
- data/lib/fog/zerigo/models/dns/zone.rb +0 -84
- data/lib/fog/zerigo/models/dns/zones.rb +0 -26
- data/lib/fog/zerigo/parsers/dns/count_hosts.rb +0 -20
- data/lib/fog/zerigo/parsers/dns/count_zones.rb +0 -20
- data/lib/fog/zerigo/parsers/dns/create_host.rb +0 -24
- data/lib/fog/zerigo/parsers/dns/create_zone.rb +0 -22
- data/lib/fog/zerigo/parsers/dns/find_hosts.rb +0 -28
- data/lib/fog/zerigo/parsers/dns/get_host.rb +0 -24
- data/lib/fog/zerigo/parsers/dns/get_zone.rb +0 -53
- data/lib/fog/zerigo/parsers/dns/get_zone_stats.rb +0 -22
- data/lib/fog/zerigo/parsers/dns/list_hosts.rb +0 -28
- data/lib/fog/zerigo/parsers/dns/list_zones.rb +0 -26
- data/lib/fog/zerigo/requests/dns/count_hosts.rb +0 -45
- data/lib/fog/zerigo/requests/dns/count_zones.rb +0 -37
- data/lib/fog/zerigo/requests/dns/create_host.rb +0 -125
- data/lib/fog/zerigo/requests/dns/create_zone.rb +0 -128
- data/lib/fog/zerigo/requests/dns/delete_host.rb +0 -41
- data/lib/fog/zerigo/requests/dns/delete_zone.rb +0 -40
- data/lib/fog/zerigo/requests/dns/find_hosts.rb +0 -74
- data/lib/fog/zerigo/requests/dns/get_host.rb +0 -54
- data/lib/fog/zerigo/requests/dns/get_zone.rb +0 -64
- data/lib/fog/zerigo/requests/dns/get_zone_stats.rb +0 -57
- data/lib/fog/zerigo/requests/dns/list_hosts.rb +0 -73
- data/lib/fog/zerigo/requests/dns/list_zones.rb +0 -62
- data/lib/fog/zerigo/requests/dns/update_host.rb +0 -68
- data/lib/fog/zerigo/requests/dns/update_zone.rb +0 -86
- data/lib/fog/zerigo.rb +0 -1
- data/spec/fog/bin/bluebox_spec.rb +0 -55
- data/spec/fog/bin/ovirt_spec.rb +0 -10
- data/spec/fog/bin/zerigo_spec.rb +0 -10
- data/spec/fog/compute_spec.rb +0 -19
- data/spec/fog/dns_spec.rb +0 -19
- data/tests/bluebox/requests/blb/helper.rb +0 -64
- data/tests/bluebox/requests/blb/lb_tests.rb +0 -75
- data/tests/bluebox/requests/compute/block_tests.rb +0 -83
- data/tests/bluebox/requests/compute/helper.rb +0 -16
- data/tests/bluebox/requests/compute/location_tests.rb +0 -32
- data/tests/bluebox/requests/compute/product_tests.rb +0 -34
- data/tests/bluebox/requests/compute/template_tests.rb +0 -37
- data/tests/bluebox/requests/dns/dns_tests.rb +0 -258
- data/tests/ovirt/compute_tests.rb +0 -25
- data/tests/ovirt/models/compute/cluster_tests.rb +0 -31
- data/tests/ovirt/models/compute/clusters_tests.rb +0 -9
- data/tests/ovirt/models/compute/interface_tests.rb +0 -27
- data/tests/ovirt/models/compute/interfaces_tests.rb +0 -9
- data/tests/ovirt/models/compute/server_tests.rb +0 -51
- data/tests/ovirt/models/compute/servers_tests.rb +0 -14
- data/tests/ovirt/models/compute/template_tests.rb +0 -28
- data/tests/ovirt/models/compute/templates_tests.rb +0 -9
- data/tests/ovirt/requests/compute/create_vm_tests.rb +0 -26
- data/tests/ovirt/requests/compute/destroy_vm_tests.rb +0 -18
- data/tests/ovirt/requests/compute/list_datacenters_tests.rb +0 -13
- data/tests/ovirt/requests/compute/list_quotas_tests.rb +0 -12
- data/tests/ovirt/requests/compute/list_storage_domains_tests.rb +0 -13
- data/tests/ovirt/requests/compute/update_vm_tests.rb +0 -18
- data/tests/ovirt/requests/compute/update_volume_tests.rb +0 -20
- data/tests/zerigo/requests/dns/dns_tests.rb +0 -440
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ovirt/models/compute/interface'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Ovirt
|
7
|
-
class Interfaces < Fog::Collection
|
8
|
-
model Fog::Compute::Ovirt::Interface
|
9
|
-
|
10
|
-
attr_accessor :vm
|
11
|
-
|
12
|
-
def all(filters = {})
|
13
|
-
requires :vm
|
14
|
-
if vm.is_a? Fog::Compute::Ovirt::Server
|
15
|
-
load service.list_vm_interfaces(vm.id)
|
16
|
-
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
17
|
-
load service.list_template_interfaces(vm.id)
|
18
|
-
else
|
19
|
-
raise 'interfaces should have vm or template'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def get(id)
|
24
|
-
new service.get_interface(id)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ovirt/models/compute/quota'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Ovirt
|
7
|
-
class Quotas < Fog::Collection
|
8
|
-
model Fog::Compute::Ovirt::Quota
|
9
|
-
|
10
|
-
def all(filters = {})
|
11
|
-
load service.list_quotas(filters)
|
12
|
-
end
|
13
|
-
|
14
|
-
def get(id)
|
15
|
-
new service.get_quota(id)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,175 +0,0 @@
|
|
1
|
-
require 'fog/compute/models/server'
|
2
|
-
|
3
|
-
module Fog
|
4
|
-
module Compute
|
5
|
-
class Ovirt
|
6
|
-
class Server < Fog::Compute::Server
|
7
|
-
# This will be the instance uuid which is globally unique across
|
8
|
-
# a oVirt deployment.
|
9
|
-
identity :id
|
10
|
-
|
11
|
-
attribute :name
|
12
|
-
attribute :comment
|
13
|
-
attribute :description
|
14
|
-
attribute :profile
|
15
|
-
attribute :display
|
16
|
-
attribute :storage, :aliases => 'disk_size'
|
17
|
-
attribute :creation_time
|
18
|
-
attribute :os
|
19
|
-
attribute :ip
|
20
|
-
attribute :status
|
21
|
-
attribute :cores, :aliases => 'cpus'
|
22
|
-
attribute :memory
|
23
|
-
attribute :host
|
24
|
-
attribute :cluster
|
25
|
-
attribute :template
|
26
|
-
attribute :instance_type
|
27
|
-
attribute :interfaces
|
28
|
-
attribute :volumes
|
29
|
-
attribute :raw
|
30
|
-
attribute :quota
|
31
|
-
attribute :ips
|
32
|
-
attribute :ha
|
33
|
-
attribute :ha_priority
|
34
|
-
attribute :clone
|
35
|
-
attribute :disks
|
36
|
-
|
37
|
-
def ready?
|
38
|
-
!(status =~ /down/i)
|
39
|
-
end
|
40
|
-
|
41
|
-
def locked?
|
42
|
-
@volumes = nil # force reload volumes
|
43
|
-
!!(status =~ /locked/i) || (attributes[:volumes]=nil) || volumes.any?{|v| !!(v.status =~ /locked/i)}
|
44
|
-
end
|
45
|
-
|
46
|
-
def stopped?
|
47
|
-
status.downcase == 'down'
|
48
|
-
end
|
49
|
-
|
50
|
-
def mac
|
51
|
-
interfaces.first.mac unless interfaces.empty?
|
52
|
-
end
|
53
|
-
|
54
|
-
def interfaces
|
55
|
-
@interfaces ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
56
|
-
:service => service,
|
57
|
-
:vm => self
|
58
|
-
)
|
59
|
-
end
|
60
|
-
|
61
|
-
def add_interface attrs
|
62
|
-
wait_for { stopped? } if attrs[:blocking]
|
63
|
-
service.add_interface(id, attrs)
|
64
|
-
end
|
65
|
-
|
66
|
-
def update_interface attrs
|
67
|
-
wait_for { stopped? } if attrs[:blocking]
|
68
|
-
service.update_interface(id, attrs)
|
69
|
-
end
|
70
|
-
|
71
|
-
def destroy_interface attrs
|
72
|
-
wait_for { stopped? } if attrs[:blocking]
|
73
|
-
service.destroy_interface(id, attrs)
|
74
|
-
end
|
75
|
-
|
76
|
-
def volumes
|
77
|
-
@volumes ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
78
|
-
:service => service,
|
79
|
-
:vm => self
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
def add_volume attrs
|
84
|
-
wait_for { stopped? } if attrs[:blocking]
|
85
|
-
service.add_volume(id, attrs)
|
86
|
-
end
|
87
|
-
|
88
|
-
def destroy_volume attrs
|
89
|
-
wait_for { stopped? } if attrs[:blocking]
|
90
|
-
service.destroy_volume(id, attrs)
|
91
|
-
end
|
92
|
-
|
93
|
-
def update_volume attrs
|
94
|
-
wait_for { stopped? } if attrs[:blocking]
|
95
|
-
service.update_volume(id, attrs)
|
96
|
-
end
|
97
|
-
|
98
|
-
def attach_volume(attrs)
|
99
|
-
wait_for { stopped? } if attrs[:blocking]
|
100
|
-
service.attach_volume(id, attrs)
|
101
|
-
end
|
102
|
-
|
103
|
-
def detach_volume(attrs)
|
104
|
-
wait_for { stopped? } if attrs[:blocking]
|
105
|
-
service.detach_volume(id, attrs)
|
106
|
-
end
|
107
|
-
|
108
|
-
def add_to_affinity_group(attrs)
|
109
|
-
wait_for { stopped? } if attrs[:blocking]
|
110
|
-
service.add_to_affinity_group(id, attrs)
|
111
|
-
end
|
112
|
-
|
113
|
-
def remove_from_affinity_group(attrs)
|
114
|
-
wait_for { stopped? } if attrs[:blocking]
|
115
|
-
service.remove_from_affinity_group(id, attrs)
|
116
|
-
end
|
117
|
-
|
118
|
-
def start(options = {})
|
119
|
-
wait_for { !locked? } if options[:blocking]
|
120
|
-
service.vm_action(:id =>id, :action => :start)
|
121
|
-
reload
|
122
|
-
end
|
123
|
-
|
124
|
-
def start_with_cloudinit(options = {})
|
125
|
-
wait_for { !locked? } if options[:blocking]
|
126
|
-
user_data = Hash[YAML.load(options[:user_data]).map{|a| [a.first.to_sym, a.last]}]
|
127
|
-
service.vm_start_with_cloudinit(:id =>id, :user_data =>user_data)
|
128
|
-
reload
|
129
|
-
end
|
130
|
-
|
131
|
-
def stop(options = {})
|
132
|
-
service.vm_action(:id =>id, :action => :stop)
|
133
|
-
reload
|
134
|
-
end
|
135
|
-
|
136
|
-
def reboot(options = {})
|
137
|
-
unless stopped?
|
138
|
-
stop
|
139
|
-
wait_for { stopped? }
|
140
|
-
end
|
141
|
-
start options.merge(:blocking => true)
|
142
|
-
end
|
143
|
-
|
144
|
-
def suspend(options = {})
|
145
|
-
service.vm_action(:id =>id, :action => :suspend)
|
146
|
-
reload
|
147
|
-
end
|
148
|
-
|
149
|
-
def destroy(options = {})
|
150
|
-
(stop unless stopped?) rescue nil #ignore failure, destroy the machine anyway.
|
151
|
-
wait_for { stopped? }
|
152
|
-
service.destroy_vm(:id => id)
|
153
|
-
end
|
154
|
-
|
155
|
-
def ticket(options = {})
|
156
|
-
raise "Can not set console ticket, Server is not ready. Server status: #{status}" unless ready?
|
157
|
-
service.vm_ticket(id, options)
|
158
|
-
end
|
159
|
-
|
160
|
-
def save
|
161
|
-
if persisted?
|
162
|
-
service.update_vm(attributes)
|
163
|
-
else
|
164
|
-
self.id = service.create_vm(attributes).id
|
165
|
-
end
|
166
|
-
reload
|
167
|
-
end
|
168
|
-
|
169
|
-
def to_s
|
170
|
-
name
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ovirt/models/compute/server'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Ovirt
|
7
|
-
class Servers < Fog::Collection
|
8
|
-
model Fog::Compute::Ovirt::Server
|
9
|
-
|
10
|
-
def all(filters = {})
|
11
|
-
load service.list_virtual_machines(filters)
|
12
|
-
end
|
13
|
-
|
14
|
-
def get(id)
|
15
|
-
new service.get_virtual_machine(id)
|
16
|
-
end
|
17
|
-
|
18
|
-
def bootstrap(new_attributes = {})
|
19
|
-
server = create(new_attributes)
|
20
|
-
server.wait_for { stopped? }
|
21
|
-
server.start
|
22
|
-
server
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Template < Fog::Model
|
5
|
-
identity :id
|
6
|
-
|
7
|
-
attr_accessor :raw
|
8
|
-
|
9
|
-
attribute :name
|
10
|
-
attribute :comment
|
11
|
-
attribute :description
|
12
|
-
attribute :profile
|
13
|
-
attribute :display
|
14
|
-
attribute :storage, :aliases => 'disk_size'
|
15
|
-
attribute :creation_time
|
16
|
-
attribute :os
|
17
|
-
attribute :status
|
18
|
-
attribute :cores, :aliases => 'cpus'
|
19
|
-
attribute :memory
|
20
|
-
attribute :cluster
|
21
|
-
attribute :interfaces
|
22
|
-
attribute :volumes
|
23
|
-
attribute :version
|
24
|
-
|
25
|
-
def interfaces
|
26
|
-
attributes[:interfaces] ||= id.nil? ? [] : Fog::Compute::Ovirt::Interfaces.new(
|
27
|
-
:service => service,
|
28
|
-
:vm => self
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
def volumes
|
33
|
-
attributes[:volumes] ||= id.nil? ? [] : Fog::Compute::Ovirt::Volumes.new(
|
34
|
-
:service => service,
|
35
|
-
:vm => self
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
def ready?
|
40
|
-
!(status =~ /down/i)
|
41
|
-
end
|
42
|
-
|
43
|
-
def destroy(options = {})
|
44
|
-
service.client.destroy_template(id)
|
45
|
-
end
|
46
|
-
|
47
|
-
def save
|
48
|
-
raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if persisted?
|
49
|
-
service.client.create_template(attributes)
|
50
|
-
end
|
51
|
-
|
52
|
-
def to_s
|
53
|
-
name
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ovirt/models/compute/template'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Ovirt
|
7
|
-
class Templates < Fog::Collection
|
8
|
-
model Fog::Compute::Ovirt::Template
|
9
|
-
|
10
|
-
def all(filters = {})
|
11
|
-
load service.list_templates(filters)
|
12
|
-
end
|
13
|
-
|
14
|
-
def get(id)
|
15
|
-
new service.get_template(id)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Volume < Fog::Model
|
5
|
-
attr_accessor :raw
|
6
|
-
DISK_SIZE_TO_GB = 1073741824
|
7
|
-
identity :id
|
8
|
-
|
9
|
-
attribute :storage_domain
|
10
|
-
attribute :size
|
11
|
-
attribute :disk_type
|
12
|
-
attribute :bootable
|
13
|
-
attribute :interface
|
14
|
-
attribute :format
|
15
|
-
attribute :sparse
|
16
|
-
attribute :size_gb
|
17
|
-
attribute :status
|
18
|
-
attribute :quota
|
19
|
-
attribute :alias
|
20
|
-
attribute :wipe_after_delete
|
21
|
-
|
22
|
-
def size_gb
|
23
|
-
attributes[:size_gb] ||= attributes[:size].to_i / DISK_SIZE_TO_GB if attributes[:size]
|
24
|
-
end
|
25
|
-
|
26
|
-
def size_gb= s
|
27
|
-
attributes[:size] = s.to_i * DISK_SIZE_TO_GB if s
|
28
|
-
end
|
29
|
-
|
30
|
-
def to_s
|
31
|
-
id
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'fog/core/collection'
|
2
|
-
require 'fog/ovirt/models/compute/volume'
|
3
|
-
|
4
|
-
module Fog
|
5
|
-
module Compute
|
6
|
-
class Ovirt
|
7
|
-
class Volumes < Fog::Collection
|
8
|
-
model Fog::Compute::Ovirt::Volume
|
9
|
-
|
10
|
-
attr_accessor :vm
|
11
|
-
|
12
|
-
def all(filters = {})
|
13
|
-
if vm.is_a? Fog::Compute::Ovirt::Server
|
14
|
-
load service.list_vm_volumes(vm.id)
|
15
|
-
elsif vm.is_a? Fog::Compute::Ovirt::Template
|
16
|
-
load service.list_template_volumes(vm.id)
|
17
|
-
else
|
18
|
-
load service.list_volumes
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
def get(id)
|
23
|
-
new service.get_volume(id)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def activate_volume(id, options)
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
raise ArgumentError, "volume id is a required parameter for activate-volume" unless options.key? :id
|
8
|
-
|
9
|
-
client.activate_volume(id, options[:id])
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
def activate_volume(id, options)
|
15
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
16
|
-
raise ArgumentError, "volume id is a required parameter for activate-volume" unless options.key? :id
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def add_interface(id, options = {})
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
|
8
|
-
client.add_interface(id, options)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Mock
|
13
|
-
def add_interface(id, options = {})
|
14
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
15
|
-
true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def add_to_affinity_group(id, options = {})
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
|
8
|
-
client.add_vm_to_affinity_group(options[:id], id)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class Mock
|
13
|
-
def add_to_affinity_group(id, options = {})
|
14
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
15
|
-
raise ArgumentError, "affinity group id is a required parameter for add-to-affinity-group" unless options.key? :id
|
16
|
-
true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
DISK_SIZE_TO_GB = 1073741824
|
6
|
-
def add_volume(id, options = {})
|
7
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
8
|
-
options[:size]=options[:size_gb].to_i*DISK_SIZE_TO_GB if options[:size_gb]
|
9
|
-
client.add_volume(id, options)
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
def add_volume(id, options = {})
|
15
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
16
|
-
true
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def attach_volume(id, options)
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
|
8
|
-
|
9
|
-
client.attach_volume(id, options[:id])
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
def attach_volume(id, options)
|
15
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
16
|
-
raise ArgumentError, "volume id is a required parameter for attach-volume" unless options.key? :id
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def create_affinity_group(attrs)
|
6
|
-
client.create_affinity_group(attrs)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class Mock
|
11
|
-
def create_affinity_group(attrs)
|
12
|
-
xml = read_xml('affinitygroup.xml')
|
13
|
-
OVIRT::AffinityGroup::new(self, Nokogiri::XML(xml).root)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,18 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def create_vm(attrs)
|
6
|
-
client.create_vm(attrs)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class Mock
|
11
|
-
def create_vm(attrs)
|
12
|
-
xml = read_xml('vm.xml')
|
13
|
-
OVIRT::VM::new(self, Nokogiri::XML(xml).root)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def datacenters filter={}
|
6
|
-
client.datacenters(filter).map {|ovirt_obj| ovirt_attrs ovirt_obj}
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
class Mock
|
11
|
-
def datacenters(filters = {})
|
12
|
-
xml = read_xml 'data_centers.xml'
|
13
|
-
Nokogiri::XML(xml).xpath('/data_centers/data_center').map do |dc|
|
14
|
-
ovirt_attrs OVIRT::DataCenter::new(self, dc)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def deactivate_volume(id, options)
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
raise ArgumentError, "volume id is a required parameter for deactivate-volume" unless options.key? :id
|
8
|
-
|
9
|
-
client.deactivate_volume(id, options[:id])
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
def deactivate_volume(id, options)
|
15
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
16
|
-
raise ArgumentError, "volume id is a required parameter for deactivate-volume" unless options.key? :id
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def destroy_affinity_group(id)
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
client.destroy_affinity_group(id)
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
def destroy_affinity_group(id)
|
13
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
14
|
-
true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def destroy_interface(id, options)
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
7
|
-
raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
|
8
|
-
|
9
|
-
client.destroy_interface(id, options[:id])
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
class Mock
|
14
|
-
def destroy_interface(id, options)
|
15
|
-
raise ArgumentError, "instance id is a required parameter" unless id
|
16
|
-
raise ArgumentError, "interface id is a required parameter for destroy-interface" unless options.key? :id
|
17
|
-
true
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
module Fog
|
2
|
-
module Compute
|
3
|
-
class Ovirt
|
4
|
-
class Real
|
5
|
-
def destroy_vm(options = {})
|
6
|
-
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
7
|
-
client.destroy_vm(options[:id])
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
class Mock
|
12
|
-
def destroy_vm(options = {})
|
13
|
-
raise ArgumentError, "instance id is a required parameter" unless options.key? :id
|
14
|
-
true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|