fog-vsphere 2.5.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +4 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +9 -0
- data/README.md +7 -1
- data/fog-vsphere.gemspec +2 -1
- data/lib/fog-vsphere.rb +1 -0
- data/lib/fog/bin/vsphere.rb +1 -1
- data/lib/fog/vsphere.rb +2 -4
- data/lib/fog/vsphere/compute.rb +23 -6
- data/lib/fog/vsphere/models/compute/cdrom.rb +2 -2
- data/lib/fog/vsphere/models/compute/cdroms.rb +3 -3
- data/lib/fog/vsphere/models/compute/cluster.rb +2 -2
- data/lib/fog/vsphere/models/compute/clusters.rb +3 -3
- data/lib/fog/vsphere/models/compute/customfield.rb +2 -2
- data/lib/fog/vsphere/models/compute/customfields.rb +3 -3
- data/lib/fog/vsphere/models/compute/customvalue.rb +2 -2
- data/lib/fog/vsphere/models/compute/customvalues.rb +5 -5
- data/lib/fog/vsphere/models/compute/datacenter.rb +2 -2
- data/lib/fog/vsphere/models/compute/datacenters.rb +3 -3
- data/lib/fog/vsphere/models/compute/datastore.rb +2 -2
- data/lib/fog/vsphere/models/compute/datastores.rb +3 -3
- data/lib/fog/vsphere/models/compute/folder.rb +2 -2
- data/lib/fog/vsphere/models/compute/folders.rb +3 -3
- data/lib/fog/vsphere/models/compute/host.rb +2 -2
- data/lib/fog/vsphere/models/compute/hosts.rb +4 -4
- data/lib/fog/vsphere/models/compute/interface.rb +2 -2
- data/lib/fog/vsphere/models/compute/interfaces.rb +8 -8
- data/lib/fog/vsphere/models/compute/interfacetype.rb +2 -2
- data/lib/fog/vsphere/models/compute/interfacetypes.rb +5 -5
- data/lib/fog/vsphere/models/compute/network.rb +2 -2
- data/lib/fog/vsphere/models/compute/networks.rb +3 -3
- data/lib/fog/vsphere/models/compute/process.rb +2 -2
- data/lib/fog/vsphere/models/compute/resource_pool.rb +2 -2
- data/lib/fog/vsphere/models/compute/resource_pools.rb +3 -3
- data/lib/fog/vsphere/models/compute/rule.rb +2 -2
- data/lib/fog/vsphere/models/compute/rules.rb +4 -4
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +2 -2
- data/lib/fog/vsphere/models/compute/server.rb +6 -6
- data/lib/fog/vsphere/models/compute/servers.rb +4 -4
- data/lib/fog/vsphere/models/compute/servertype.rb +2 -2
- data/lib/fog/vsphere/models/compute/servertypes.rb +4 -4
- data/lib/fog/vsphere/models/compute/snapshot.rb +2 -2
- data/lib/fog/vsphere/models/compute/snapshots.rb +3 -3
- data/lib/fog/vsphere/models/compute/storage_pod.rb +2 -2
- data/lib/fog/vsphere/models/compute/storage_pods.rb +3 -3
- data/lib/fog/vsphere/models/compute/template.rb +2 -2
- data/lib/fog/vsphere/models/compute/templates.rb +3 -3
- data/lib/fog/vsphere/models/compute/ticket.rb +2 -2
- data/lib/fog/vsphere/models/compute/tickets.rb +4 -4
- data/lib/fog/vsphere/models/compute/volume.rb +3 -3
- data/lib/fog/vsphere/models/compute/volumes.rb +5 -5
- data/lib/fog/vsphere/requests/compute/cloudinit_to_customspec.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_folder.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_group.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_rule.rb +2 -2
- data/lib/fog/vsphere/requests/compute/create_vm.rb +2 -2
- data/lib/fog/vsphere/requests/compute/current_time.rb +2 -2
- data/lib/fog/vsphere/requests/compute/destroy_group.rb +2 -2
- data/lib/fog/vsphere/requests/compute/destroy_rule.rb +2 -2
- data/lib/fog/vsphere/requests/compute/folder_destroy.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_cluster.rb +5 -4
- data/lib/fog/vsphere/requests/compute/get_compute_resource.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_datacenter.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_datastore.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_folder.rb +6 -6
- data/lib/fog/vsphere/requests/compute/get_host.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_interface_type.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_network.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_resource_pool.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_server_type.rb +5 -5
- data/lib/fog/vsphere/requests/compute/get_storage_pod.rb +3 -3
- data/lib/fog/vsphere/requests/compute/get_template.rb +2 -2
- data/lib/fog/vsphere/requests/compute/get_virtual_machine.rb +4 -4
- data/lib/fog/vsphere/requests/compute/get_vm_first_scsi_controller.rb +3 -3
- data/lib/fog/vsphere/requests/compute/host_finish_maintenance.rb +2 -2
- data/lib/fog/vsphere/requests/compute/host_shutdown.rb +2 -2
- data/lib/fog/vsphere/requests/compute/host_start_maintenance.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_clusters.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_compute_resources.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_customfields.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_datacenters.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_datastores.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_folders.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_groups.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_hosts.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_interface_types.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_networks.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_processes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_rules.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_server_types.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_storage_pods.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_templates.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_virtual_machines.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_cdroms.rb +3 -3
- data/lib/fog/vsphere/requests/compute/list_vm_customvalues.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_interfaces.rb +3 -3
- data/lib/fog/vsphere/requests/compute/list_vm_scsi_controllers.rb +4 -4
- data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +2 -2
- data/lib/fog/vsphere/requests/compute/list_vm_volumes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_cdrom.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_controller.rb +2 -2
- data/lib/fog/vsphere/requests/compute/modify_vm_interface.rb +4 -4
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +2 -2
- data/lib/fog/vsphere/requests/compute/revert_to_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/set_vm_customvalue.rb +2 -2
- data/lib/fog/vsphere/requests/compute/update_vm.rb +2 -2
- data/lib/fog/vsphere/requests/compute/upload_iso.rb +4 -4
- data/lib/fog/vsphere/requests/compute/vm_acquire_ticket.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_clone.rb +11 -8
- data/lib/fog/vsphere/requests/compute/vm_config_vnc.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_destroy.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_execute.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_migrate.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_power_off.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_power_on.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reboot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cdrom.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_cpus.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_relocate.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_rename.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_suspend.rb +2 -2
- data/lib/fog/vsphere/requests/compute/vm_take_snapshot.rb +2 -2
- data/lib/fog/vsphere/version.rb +1 -1
- data/tests/helper.rb +3 -0
- data/tests/models/compute/cluster_tests.rb +3 -3
- data/tests/models/compute/hosts_tests.rb +1 -1
- data/tests/models/compute/rules_tests.rb +1 -1
- data/tests/models/compute/server_tests.rb +4 -4
- data/tests/models/compute/server_unit_tests.rb +1 -1
- data/tests/models/compute/servers_tests.rb +1 -1
- data/tests/models/compute/tickets_tests.rb +1 -1
- data/tests/requests/compute/get_network_tests.rb +23 -15
- data/tests/requests/compute/revert_to_snapshot_tests.rb +1 -1
- data/tests/requests/compute/update_vm_tests.rb +1 -1
- data/tests/requests/compute/vm_clone_tests.rb +10 -5
- metadata +26 -5
@@ -1,17 +1,17 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Interfacetypes < Fog::Collection
|
5
5
|
autoload :Interfacetype, File.expand_path('../interfacetype', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Interfacetype
|
8
8
|
attr_accessor :datacenter
|
9
9
|
attr_accessor :servertype
|
10
10
|
|
11
11
|
def all(filters = {})
|
12
12
|
requires :servertype
|
13
13
|
case servertype
|
14
|
-
when Fog::Compute::
|
14
|
+
when Fog::Vsphere::Compute::Servertype
|
15
15
|
load service.list_interface_types(filters.merge(datacenter: datacenter,
|
16
16
|
servertype: servertype.id))
|
17
17
|
else
|
@@ -23,7 +23,7 @@ module Fog
|
|
23
23
|
requires :servertype
|
24
24
|
requires :datacenter
|
25
25
|
new service.get_interface_type id, servertype, datacenter
|
26
|
-
rescue Fog::Compute::
|
26
|
+
rescue Fog::Vsphere::Compute::NotFound
|
27
27
|
nil
|
28
28
|
end
|
29
29
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Networks < Fog::Collection
|
5
5
|
autoload :Network, File.expand_path('../network', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Network
|
8
8
|
attr_accessor :datacenter, :cluster
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class ResourcePools < Fog::Collection
|
5
5
|
autoload :ResourcePool, File.expand_path('../resource_pool', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::ResourcePool
|
8
8
|
attr_accessor :datacenter, :cluster
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Rules < Fog::Collection
|
5
5
|
autoload :Rule, File.expand_path('../rule', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Rule
|
8
8
|
attribute :datacenter
|
9
9
|
attribute :cluster
|
10
10
|
|
@@ -15,7 +15,7 @@ module Fog
|
|
15
15
|
|
16
16
|
def get(key_or_name)
|
17
17
|
all.find { |rule| [rule.key, rule.name].include? key_or_name } ||
|
18
|
-
raise(Fog::Compute::
|
18
|
+
raise(Fog::Vsphere::Compute::NotFound, "no such rule #{key_or_name}")
|
19
19
|
end
|
20
20
|
|
21
21
|
# Pass datacenter/cluster to every new rule
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'fog/compute/models/server'
|
2
2
|
|
3
3
|
module Fog
|
4
|
-
module
|
5
|
-
class
|
4
|
+
module Vsphere
|
5
|
+
class Compute
|
6
6
|
class Server < Fog::Compute::Server
|
7
7
|
extend Fog::Deprecation
|
8
8
|
deprecate(:ipaddress, :public_ip_address)
|
@@ -219,7 +219,7 @@ module Fog
|
|
219
219
|
end
|
220
220
|
|
221
221
|
def interface_ready?(attrs)
|
222
|
-
(attrs.is_a?(Hash) && attrs[:blocking]) || attrs.is_a?(Fog::Compute::
|
222
|
+
(attrs.is_a?(Hash) && attrs[:blocking]) || attrs.is_a?(Fog::Vsphere::Compute::Interface)
|
223
223
|
end
|
224
224
|
|
225
225
|
def add_interface(attrs)
|
@@ -365,16 +365,16 @@ module Fog
|
|
365
365
|
def initialize_scsi_controllers
|
366
366
|
if attributes[:scsi_controllers] && attributes[:scsi_controllers].is_a?(Array)
|
367
367
|
attributes[:scsi_controllers].map! do |controller|
|
368
|
-
controller.is_a?(Hash) ? Fog::Compute::
|
368
|
+
controller.is_a?(Hash) ? Fog::Vsphere::Compute::SCSIController.new(controller) : controller
|
369
369
|
end
|
370
370
|
elsif attributes[:scsi_controller] && attributes[:scsi_controller].is_a?(Hash)
|
371
371
|
attributes[:scsi_controllers] = [
|
372
|
-
Fog::Compute::
|
372
|
+
Fog::Vsphere::Compute::SCSIController.new(attributes[:scsi_controller])
|
373
373
|
]
|
374
374
|
elsif attributes[:volumes] && attributes[:volumes].is_a?(Array) && !attributes[:volumes].empty?
|
375
375
|
# Create a default scsi controller if there are any disks but no controller defined
|
376
376
|
attributes[:scsi_controllers] = [
|
377
|
-
Fog::Compute::
|
377
|
+
Fog::Vsphere::Compute::SCSIController.new
|
378
378
|
]
|
379
379
|
end
|
380
380
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Servers < Fog::Collection
|
5
5
|
autoload :Server, File.expand_path('../server', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Server
|
8
8
|
attr_accessor :datacenter
|
9
9
|
attr_accessor :network
|
10
10
|
attr_accessor :cluster
|
@@ -29,7 +29,7 @@ module Fog
|
|
29
29
|
|
30
30
|
def get(id, datacenter = nil)
|
31
31
|
new service.get_virtual_machine id, datacenter, folder, recursive
|
32
|
-
rescue Fog::Compute::
|
32
|
+
rescue Fog::Vsphere::Compute::NotFound
|
33
33
|
nil
|
34
34
|
end
|
35
35
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Servertypes < Fog::Collection
|
5
5
|
autoload :Servertype, File.expand_path('../servertype', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Servertype
|
8
8
|
attr_accessor :datacenter, :id, :fullname
|
9
9
|
|
10
10
|
def all(filters = {})
|
@@ -14,7 +14,7 @@ module Fog
|
|
14
14
|
def get(id)
|
15
15
|
requires :datacenter
|
16
16
|
new service.get_server_type(id, datacenter)
|
17
|
-
rescue Fog::Compute::
|
17
|
+
rescue Fog::Vsphere::Compute::NotFound
|
18
18
|
nil
|
19
19
|
end
|
20
20
|
end
|
@@ -2,12 +2,12 @@ require 'fog/core/collection'
|
|
2
2
|
require 'fog/vsphere/models/compute/snapshot'
|
3
3
|
|
4
4
|
module Fog
|
5
|
-
module
|
6
|
-
class
|
5
|
+
module Vsphere
|
6
|
+
class Compute
|
7
7
|
class Snapshots < Fog::Collection
|
8
8
|
attribute :server_id, alias: :instance_uuid
|
9
9
|
attribute :parent_snapshot
|
10
|
-
model Fog::Compute::
|
10
|
+
model Fog::Vsphere::Compute::Snapshot
|
11
11
|
|
12
12
|
def all(filters = {})
|
13
13
|
if parent_snapshot
|
@@ -2,10 +2,10 @@ require 'fog/core/collection'
|
|
2
2
|
require 'fog/vsphere/models/compute/storage_pod'
|
3
3
|
|
4
4
|
module Fog
|
5
|
-
module
|
6
|
-
class
|
5
|
+
module Vsphere
|
6
|
+
class Compute
|
7
7
|
class StoragePods < Fog::Collection
|
8
|
-
model Fog::Compute::
|
8
|
+
model Fog::Vsphere::Compute::StoragePod
|
9
9
|
attribute :datacenter
|
10
10
|
|
11
11
|
def all(filters = {})
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Templates < Fog::Collection
|
5
5
|
autoload :Template, File.expand_path('../template', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Template
|
8
8
|
|
9
9
|
def all(filters = {})
|
10
10
|
load service.list_templates(filters)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Tickets < Fog::Collection
|
5
5
|
autoload :Ticket, File.expand_path('../ticket', __FILE__)
|
6
6
|
|
7
|
-
model Fog::Compute::
|
7
|
+
model Fog::Vsphere::Compute::Ticket
|
8
8
|
|
9
9
|
attr_accessor :server
|
10
10
|
|
11
11
|
def create(opts = {})
|
12
12
|
requires :server
|
13
|
-
raise 'server must be a Fog::Compute::
|
13
|
+
raise 'server must be a Fog::Vsphere::Compute::Server' unless server.is_a?(Fog::Vsphere::Compute::Server)
|
14
14
|
new(
|
15
15
|
service.vm_acquire_ticket(
|
16
16
|
opts.merge(
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Volume < Fog::Model
|
5
5
|
DISK_SIZE_TO_GB = 1_048_576
|
6
6
|
identity :id
|
@@ -64,7 +64,7 @@ module Fog
|
|
64
64
|
created = server.volumes.all.find { |volume| volume.unit_number == self.unit_number }
|
65
65
|
|
66
66
|
# example of "created" =>
|
67
|
-
# <Fog::Compute::
|
67
|
+
# <Fog::Vsphere::Compute::Volume
|
68
68
|
# id="6000C295-576f-0e2d-5b70-c778cd108b3a",
|
69
69
|
# datastore="datastore1",
|
70
70
|
# storage_pod=nil,
|
@@ -1,20 +1,20 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module Vsphere
|
3
|
+
class Compute
|
4
4
|
class Volumes < Fog::Collection
|
5
5
|
autoload :Volume, File.expand_path('../volume', __FILE__)
|
6
6
|
|
7
7
|
attribute :server_id
|
8
8
|
|
9
|
-
model Fog::Compute::
|
9
|
+
model Fog::Vsphere::Compute::Volume
|
10
10
|
|
11
11
|
def all(_filters = {})
|
12
12
|
requires :server_id
|
13
13
|
|
14
14
|
case server
|
15
|
-
when Fog::Compute::
|
15
|
+
when Fog::Vsphere::Compute::Server
|
16
16
|
load service.list_vm_volumes(server.id)
|
17
|
-
when Fog::Compute::
|
17
|
+
when Fog::Vsphere::Compute::Template
|
18
18
|
load service.list_template_volumes(server.id)
|
19
19
|
else
|
20
20
|
raise 'volumes should have vm or template'
|