fog-vsphere 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/CONTRIBUTORS.md +1 -0
- data/fog-vsphere.gemspec +1 -1
- data/lib/fog/vsphere/compute.rb +2 -0
- data/lib/fog/vsphere/models/compute/snapshot.rb +9 -0
- data/lib/fog/vsphere/models/compute/snapshots.rb +5 -1
- data/lib/fog/vsphere/requests/compute/list_child_snapshots.rb +2 -1
- data/lib/fog/vsphere/requests/compute/list_resource_pools.rb +23 -3
- data/lib/fog/vsphere/requests/compute/list_vm_snapshots.rb +2 -1
- data/lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb +29 -0
- data/lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb +29 -0
- data/lib/fog/vsphere/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce99898828f010893cf231e4848df2e606ca70c8
|
4
|
+
data.tar.gz: ddab6c8da05931d2c347d96c7f6f3b4490577780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f45ddf72f15fc715f45cfbfa3ee2091817cadeaca315b281febd7b41ab0690a4d7844781a18ed26d0d95fbbdf09e07ae51fbb919686b61c65c03b920a049223c
|
7
|
+
data.tar.gz: a796b42151696961fb6c2f743f6a860b3ff221aff22715eaad57cc14a660e0d67042b292c2550c366a5986b9bdafd0de4110589189f810af93567e7e02666638
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## v1.11.0
|
2
|
+
|
3
|
+
* Add ability to query subresource pools
|
4
|
+
* Fix `snapshots.get(id)` when no snapshot is found
|
5
|
+
* Add `vm_remove_snapshot` request, use in `snapshot.destroy`
|
6
|
+
* Fix `snapshots.get` for non-root snapshot
|
7
|
+
* Add `vm_revert_snapshot` request and `revert` method to `snapshot`
|
8
|
+
|
1
9
|
## v1.10.0
|
2
10
|
|
3
11
|
* Add request to rename VM
|
data/CONTRIBUTORS.md
CHANGED
data/fog-vsphere.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'fog-vsphere'
|
8
8
|
spec.version = Fog::Vsphere::VERSION
|
9
9
|
spec.authors = ['J.R. Garcia']
|
10
|
-
spec.email = ['
|
10
|
+
spec.email = ['jr@garciaole.com']
|
11
11
|
|
12
12
|
spec.summary = "Module for the 'fog' gem to support VMware vSphere."
|
13
13
|
spec.description = 'This library can be used as a module for `fog` or as standalone provider to use vSphere in applications.'
|
data/lib/fog/vsphere/compute.rb
CHANGED
@@ -29,6 +29,15 @@ module Fog
|
|
29
29
|
return self if ref == snapshot_ref
|
30
30
|
child_snapshots().get(snapshot_ref)
|
31
31
|
end
|
32
|
+
|
33
|
+
def revert
|
34
|
+
service.vm_revert_snapshot server_id, ref
|
35
|
+
end
|
36
|
+
|
37
|
+
def destroy(remove_children = false)
|
38
|
+
requires :server_id, :ref
|
39
|
+
service.vm_remove_snapshot(server_id, ref, remove_children)
|
40
|
+
end
|
32
41
|
end
|
33
42
|
end
|
34
43
|
end
|
@@ -32,7 +32,8 @@ module Fog
|
|
32
32
|
:snapshot_name_chain =>
|
33
33
|
"#{parent_snap.snapshot_name_chain}/#{snap_tree.name}",
|
34
34
|
:ref_chain =>
|
35
|
-
"#{parent_snap.ref_chain}/#{snap_tree.snapshot._ref}"
|
35
|
+
"#{parent_snap.ref_chain}/#{snap_tree.snapshot._ref}",
|
36
|
+
:server_id => parent_snap.server_id
|
36
37
|
}
|
37
38
|
end
|
38
39
|
end
|
@@ -15,13 +15,32 @@ module Fog
|
|
15
15
|
|
16
16
|
# root ResourcePool + Children if they exists
|
17
17
|
def list_raw_resource_pools(cluster)
|
18
|
-
[
|
18
|
+
pools = []
|
19
|
+
traverse_raw_resource_pools(pools, cluster.resourcePool)
|
20
|
+
pools.uniq
|
19
21
|
end
|
20
22
|
|
21
|
-
def
|
23
|
+
def traverse_raw_resource_pools(pools, rp)
|
24
|
+
if rp
|
25
|
+
if rp.respond_to? :resourcePool
|
26
|
+
traverse_raw_resource_pools(pools, rp.resourcePool)
|
27
|
+
end
|
28
|
+
if rp.respond_to? :each
|
29
|
+
rp.each do |resourcePool|
|
30
|
+
traverse_raw_resource_pools(pools, resourcePool)
|
31
|
+
end
|
32
|
+
else
|
33
|
+
pools << rp
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def resource_pool_attributes(resource_pool, cluster, datacenter)
|
39
|
+
name = folder_path(resource_pool).gsub(/^.*Resources(\/|)/,'')
|
40
|
+
name = 'Resources' if name.empty?
|
22
41
|
{
|
23
42
|
:id => managed_obj_id(resource_pool),
|
24
|
-
:name =>
|
43
|
+
:name => name,
|
25
44
|
:configured_memory_mb => resource_pool.summary.configuredMemoryMB,
|
26
45
|
:overall_status => resource_pool.overallStatus,
|
27
46
|
:cluster => cluster,
|
@@ -29,6 +48,7 @@ module Fog
|
|
29
48
|
}
|
30
49
|
end
|
31
50
|
end
|
51
|
+
|
32
52
|
class Mock
|
33
53
|
def list_resource_pools(filters = { })
|
34
54
|
end
|
@@ -31,7 +31,8 @@ module Fog
|
|
31
31
|
:mo_ref => snap_tree.snapshot,
|
32
32
|
:tree_node => snap_tree,
|
33
33
|
:ref_chain => "#{vm_id}/#{snap_tree.snapshot._ref}",
|
34
|
-
:snapshot_name_chain => "#{vm_id}/#{snap_tree.name}"
|
34
|
+
:snapshot_name_chain => "#{vm_id}/#{snap_tree.name}",
|
35
|
+
:server_id => vm_id
|
35
36
|
}
|
36
37
|
end
|
37
38
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def vm_remove_snapshot(vm_id, snapshot_id, remove_children = false)
|
6
|
+
vm = servers.get(vm_id)
|
7
|
+
snapshot = vm.snapshots.get(snapshot_id).mo_ref
|
8
|
+
task = snapshot.RemoveSnapshot_Task(:removeChildren => remove_children)
|
9
|
+
|
10
|
+
task.wait_for_completion
|
11
|
+
|
12
|
+
{
|
13
|
+
'task_state' => task.info.state,
|
14
|
+
'was_cancelled' => task.info.cancelled
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
def vm_remove_snapshot(vm_id, snapshot_id)
|
21
|
+
{
|
22
|
+
'task_state' => 'success',
|
23
|
+
'was_cancelled' => false
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Fog
|
2
|
+
module Compute
|
3
|
+
class Vsphere
|
4
|
+
class Real
|
5
|
+
def vm_revert_snapshot(vm_id, snapshot_id)
|
6
|
+
vm = servers.get(vm_id)
|
7
|
+
snapshot = vm.snapshots.get(snapshot_id).mo_ref
|
8
|
+
task = snapshot.RevertToSnapshot_Task
|
9
|
+
|
10
|
+
task.wait_for_completion
|
11
|
+
|
12
|
+
{
|
13
|
+
'task_state' => task.info.state,
|
14
|
+
'was_cancelled' => task.info.cancelled
|
15
|
+
}
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Mock
|
20
|
+
def vm_revert_snapshot(vm_id, snapshot_id)
|
21
|
+
{
|
22
|
+
'task_state' => 'success',
|
23
|
+
'was_cancelled' => false
|
24
|
+
}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
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.
|
4
|
+
version: 1.11.0
|
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: 2017-
|
11
|
+
date: 2017-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog-core
|
@@ -125,7 +125,7 @@ dependencies:
|
|
125
125
|
description: This library can be used as a module for `fog` or as standalone provider
|
126
126
|
to use vSphere in applications.
|
127
127
|
email:
|
128
|
-
-
|
128
|
+
- jr@garciaole.com
|
129
129
|
executables: []
|
130
130
|
extensions: []
|
131
131
|
extra_rdoc_files: []
|
@@ -251,7 +251,9 @@ files:
|
|
251
251
|
- lib/fog/vsphere/requests/compute/vm_reconfig_hardware.rb
|
252
252
|
- lib/fog/vsphere/requests/compute/vm_reconfig_memory.rb
|
253
253
|
- lib/fog/vsphere/requests/compute/vm_reconfig_volumes.rb
|
254
|
+
- lib/fog/vsphere/requests/compute/vm_remove_snapshot.rb
|
254
255
|
- lib/fog/vsphere/requests/compute/vm_rename.rb
|
256
|
+
- lib/fog/vsphere/requests/compute/vm_revert_snapshot.rb
|
255
257
|
- lib/fog/vsphere/requests/compute/vm_suspend.rb
|
256
258
|
- lib/fog/vsphere/requests/compute/vm_take_snapshot.rb
|
257
259
|
- lib/fog/vsphere/version.rb
|