fog-kubevirt 1.2.3 → 1.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e1ad47434b4be227ffa7e32f9435021980784c0
4
- data.tar.gz: 78189c5ee24ea2f3a3314c1c32e242a2dc66a764
3
+ metadata.gz: e1f90a753f99bae70fdb0f9ef3a560b939a25472
4
+ data.tar.gz: 693cd23e1eb336c338fcbe2440f7de92a9e2cce3
5
5
  SHA512:
6
- metadata.gz: 6d128816adb81bb5e438348537003b6893305cf3df4c9ebac3a611db2ebb974bfbfa360fb6937e0ccaff0292ca68d2f410107fd3d02b440842d61619d2a064d3
7
- data.tar.gz: 34b7f11414b8dec2720386485e25e2d0746579566828d5e2cebf85f75d2d27de9b9dce2774122b4674f7e65c9319b4c135ca5ef3affebd7e8ac0ed3a4f15f06d
6
+ metadata.gz: fca88f74721f9ff8d272a522fb44edb4366c6763ec510c9f20e01bf9c309c5d6a34885b9e8fa26d19d8afa84539f565ad04d89da36a9b07bb227d5bda7c03858
7
+ data.tar.gz: '068448c16b963a7c9df4814733cb80ccd03494ce007a2c4c78c1b963b99fc483cf112cb4494e32ae9d3676829720857b6f857e1fa64155e83bbf14bb38e2cef2'
@@ -21,6 +21,15 @@ module Fog
21
21
  new service.get_server(id)
22
22
  end
23
23
 
24
+ def new(attributes = {})
25
+ server = super
26
+ server.disks = [] unless server.disks
27
+ server.volumes = [] unless server.volumes
28
+ server.interfaces = [] unless server.interfaces
29
+ server.networks = [] unless server.networks
30
+ server
31
+ end
32
+
24
33
  def bootstrap(new_attributes = {})
25
34
  server = create(new_attributes)
26
35
  server.wait_for { stopped? }
@@ -17,11 +17,11 @@ module Fog
17
17
  attribute :annotations, :aliases => 'metadata_annotations'
18
18
  attribute :cpu_cores, :aliases => 'spec_cpu_cores'
19
19
  attribute :memory, :aliases => 'spec_memory'
20
- attribute :disks, :aliases => 'spec_disks', :default => []
21
- attribute :volumes, :aliases => 'spec_volumes', :default => []
20
+ attribute :disks, :aliases => 'spec_disks'
21
+ attribute :volumes, :aliases => 'spec_volumes'
22
22
  attribute :status, :aliases => 'spec_running'
23
- attribute :interfaces, :aliases => 'spec_interfaces', :default => []
24
- attribute :networks, :aliases => 'spec_networks', :default => []
23
+ attribute :interfaces, :aliases => 'spec_interfaces'
24
+ attribute :networks, :aliases => 'spec_networks'
25
25
  attribute :machine_type, :aliases => 'spec_machine_type'
26
26
  end
27
27
 
@@ -13,7 +13,7 @@ module Fog
13
13
  # @param object [Hash] A hash with raw interfaces data.
14
14
  #
15
15
  def parse_interfaces(object, object_status, networks)
16
- return {} if object.nil?
16
+ return [] if object.nil?
17
17
  nics = []
18
18
  object.each do |iface|
19
19
  nic = VmNic.new
@@ -42,7 +42,7 @@ module Fog
42
42
  # @param object [Hash] A hash with raw networks data.
43
43
  #
44
44
  def parse_networks(object)
45
- return {} if object.nil?
45
+ return [] if object.nil?
46
46
  networks = []
47
47
  object.each do |net|
48
48
  network = VmData::VmNetwork.new
@@ -65,7 +65,7 @@ module Fog
65
65
  # @param object [Hash] A hash with raw disks data.
66
66
  #
67
67
  def parse_disks(object)
68
- return {} if object.nil?
68
+ return [] if object.nil?
69
69
  disks = []
70
70
  object.each do |d|
71
71
  disk = VmData::VmDisk.new
@@ -100,7 +100,7 @@ module Fog
100
100
  # @param disks [Array] the disks of the vm associated to the volumes
101
101
  #
102
102
  def parse_volumes(object, disks)
103
- return {} if object.nil?
103
+ return [] if object.nil?
104
104
  volumes = []
105
105
  object.each do |v|
106
106
  volume = Volume.new
@@ -23,6 +23,15 @@ module Fog
23
23
  load vms
24
24
  end
25
25
 
26
+ def new(attributes = {})
27
+ vm = super
28
+ vm.disks = [] unless vm.disks
29
+ vm.volumes = [] unless vm.volumes
30
+ vm.interfaces = [] unless vm.interfaces
31
+ vm.networks = [] unless vm.networks
32
+ vm
33
+ end
34
+
26
35
  def get(name)
27
36
  new service.get_vm(name)
28
37
  end
@@ -26,6 +26,12 @@ module Fog
26
26
  # holds the pvc entity if its type is persistentVolumeClaim
27
27
  attribute :pvc
28
28
 
29
+ # the capacity of the volume, when supported
30
+ attribute :capacity
31
+
32
+ # the storage class used for the volume, i.e. when type is persistentVolumeClaim
33
+ attribute :storage_class
34
+
29
35
  # Hash that holds volume type specific configurations, used for adding volume for a vm
30
36
  # The set of config properties may change from type to type, see documentation for the supported
31
37
  # keys of each volume type:
@@ -44,12 +50,6 @@ module Fog
44
50
  def persisted?
45
51
  !name.nil?
46
52
  end
47
-
48
- def self.parse(object, disk)
49
- volume = parse_object(object)
50
- volume[:boot_order] = object[:bootOrder]
51
- volume
52
- end
53
53
  end
54
54
  end
55
55
  end
@@ -10,12 +10,24 @@ module Fog
10
10
 
11
11
  def populate_pvcs_for_vm(vm)
12
12
  vm[:volumes].each do |vol|
13
+ set_volume_pvc_attributes(vol)
14
+ end
15
+ end
16
+
17
+ def set_volume_pvc_attributes(volume, pvc = nil)
18
+ return unless volume.type == 'persistentVolumeClaim'
19
+ if pvc.nil?
13
20
  begin
14
- vol.pvc = pvcs.get(vol.info) if vol.type == 'persistentVolumeClaim'
21
+ pvc = pvcs.get(volume.info)
15
22
  rescue
16
23
  # there is an option that the PVC does not exist
24
+ return
17
25
  end
18
26
  end
27
+
28
+ volume.pvc = pvc
29
+ volume.capacity = pvc&.requests[:storage]
30
+ volume.storage_class = pvc.storage_class
19
31
  end
20
32
 
21
33
  def get_raw_vm(name)
@@ -10,7 +10,7 @@ module Fog
10
10
  volume = Volume.new
11
11
  volume.name = pvc.name
12
12
  volume.type = 'persistentVolumeClaim'
13
- volume.pvc = pvc
13
+ set_volume_pvc_attributes(volume, pvc)
14
14
  volume
15
15
  end
16
16
  EntityCollection.new('Volume', pvcs.resource_version, entities)
@@ -1,5 +1,5 @@
1
1
  module Fog
2
2
  module Kubevirt
3
- VERSION = '1.2.3'
3
+ VERSION = '1.2.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fog-kubevirt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Kliczewski
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-04-15 00:00:00.000000000 Z
17
+ date: 2019-04-18 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: minitest