fog-vsphere 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/fog/vsphere/models/compute/scsicontroller.rb +6 -1
- data/lib/fog/vsphere/models/compute/volume.rb +14 -2
- data/lib/fog/vsphere/requests/compute/create_vm.rb +3 -9
- data/lib/fog/vsphere/requests/compute/modify_vm_volume.rb +3 -3
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb0cd00d29fa95192e3d5a70f3f08d72c9a1221
|
4
|
+
data.tar.gz: f296c0b6fad69fb59c581c225af17398087a377d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0954d0617378088536af6d5099f39ff26097ed09069e8abf9eec1386c12aea659bf72847e05679064a9938a487f8e69c21bb8f1ec0164f62e7b526c26d471bde
|
7
|
+
data.tar.gz: 02cfbb0004d8e8cfec927052b0615eac8aefe2a24e4142495e2e3a256cfd05af05d6be642a67e606be213213321a4a03151da4d5b79a40b61b01ad21fa7fd774
|
data/CHANGELOG.md
CHANGED
@@ -5,9 +5,14 @@ module Fog
|
|
5
5
|
attribute :shared_bus
|
6
6
|
attribute :type
|
7
7
|
attribute :unit_number
|
8
|
-
attribute :key
|
8
|
+
attribute :key, :type => :integer
|
9
9
|
attribute :server_id
|
10
10
|
|
11
|
+
def initialize(attributes = {})
|
12
|
+
super
|
13
|
+
self.key ||= 1000
|
14
|
+
end
|
15
|
+
|
11
16
|
def to_s
|
12
17
|
"#{type} ##{key}: shared: #{shared_bus}, unit_number: #{unit_number}"
|
13
18
|
end
|
@@ -17,7 +17,7 @@ module Fog
|
|
17
17
|
attribute :size_gb
|
18
18
|
attribute :key
|
19
19
|
attribute :unit_number
|
20
|
-
attribute :controller_key, :type => :integer
|
20
|
+
attribute :controller_key, :type => :integer
|
21
21
|
|
22
22
|
def initialize(attributes={})
|
23
23
|
super defaults.merge(attributes)
|
@@ -87,13 +87,25 @@ module Fog
|
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
90
|
+
def set_key
|
91
|
+
requires :controller_key, :unit_number
|
92
|
+
|
93
|
+
return unless key.nil?
|
94
|
+
|
95
|
+
# controller key is based on 1000 + controller bus
|
96
|
+
# disk key is based on 2000 + the SCSI ID + the controller bus * 16
|
97
|
+
controller_bus = controller_key - 1000
|
98
|
+
self.key = 2000 + (controller_bus * 16) + unit_number
|
99
|
+
end
|
100
|
+
|
90
101
|
private
|
91
102
|
|
92
103
|
def defaults
|
93
104
|
{
|
94
105
|
:thin => true,
|
95
106
|
:name => "Hard disk",
|
96
|
-
:mode => "persistent"
|
107
|
+
:mode => "persistent",
|
108
|
+
:controller_key => 1000
|
97
109
|
}
|
98
110
|
end
|
99
111
|
|
@@ -149,7 +149,7 @@ module Fog
|
|
149
149
|
disks.each do |disk|
|
150
150
|
# we allow booting from all harddisks, the first disk has the highest priority
|
151
151
|
boot_order << RbVmomi::VIM::VirtualMachineBootOptionsBootableDiskDevice.new(
|
152
|
-
:deviceKey =>
|
152
|
+
:deviceKey => disk.key
|
153
153
|
)
|
154
154
|
end
|
155
155
|
when 'cdrom'
|
@@ -163,13 +163,6 @@ module Fog
|
|
163
163
|
boot_order
|
164
164
|
end
|
165
165
|
|
166
|
-
def get_disk_device_key(controller_key, unit_number)
|
167
|
-
# controller key is based on 1000 + controller bus
|
168
|
-
# disk key is based on 2000 + the SCSI ID + the controller bus * 16
|
169
|
-
controller_bus = controller_key - 1000
|
170
|
-
2000 + (controller_bus * 16) + unit_number
|
171
|
-
end
|
172
|
-
|
173
166
|
def create_nic_backing nic, attributes
|
174
167
|
raw_network = get_raw_network(nic.network, attributes[:datacenter], if nic.virtualswitch then nic.virtualswitch end)
|
175
168
|
|
@@ -246,12 +239,13 @@ module Fog
|
|
246
239
|
end
|
247
240
|
|
248
241
|
disk.set_unit_number
|
242
|
+
disk.set_key
|
249
243
|
|
250
244
|
payload = {
|
251
245
|
:operation => operation,
|
252
246
|
:fileOperation => operation == :add ? :create : :destroy,
|
253
247
|
:device => RbVmomi::VIM.VirtualDisk(
|
254
|
-
:key =>
|
248
|
+
:key => disk.key,
|
255
249
|
:backing => RbVmomi::VIM.VirtualDiskFlatVer2BackingInfo(
|
256
250
|
:fileName => datastore,
|
257
251
|
:diskMode => disk.mode.to_sym,
|
@@ -3,17 +3,17 @@ module Fog
|
|
3
3
|
class Vsphere
|
4
4
|
class Real
|
5
5
|
def add_vm_volume(volume)
|
6
|
-
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume,
|
6
|
+
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume, :add)]})
|
7
7
|
end
|
8
8
|
|
9
9
|
def destroy_vm_volume(volume)
|
10
|
-
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume,
|
10
|
+
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_disk(volume, :remove)]})
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
14
|
class Mock
|
15
15
|
def add_vm_volume(volume)
|
16
|
-
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_cdrom(volume,
|
16
|
+
vm_reconfig_hardware('instance_uuid' => volume.server_id, 'hardware_spec' => {'deviceChange'=>[create_cdrom(volume, :add)]})
|
17
17
|
end
|
18
18
|
|
19
19
|
def destroy_vm_volume(volume)
|
data/lib/fog/vsphere/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fog-vsphere
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- J.R. Garcia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|