Class: Kubevirt::V1MigrationConfiguration

Inherits:
ApiModelBase show all
Defined in:
lib/kubevirt/models/v1_migration_configuration.rb

Overview

MigrationConfiguration holds migration options. Can be overridden for specific groups of VMs though migration policies. Visit https://kubevirt.io/user-guide/operations/migration_policies/ for more information.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ V1MigrationConfiguration

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 124

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1MigrationConfiguration` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Kubevirt::V1MigrationConfiguration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'allow_auto_converge')
    self.allow_auto_converge = attributes[:'allow_auto_converge']
  end

  if attributes.key?(:'allow_post_copy')
    self.allow_post_copy = attributes[:'allow_post_copy']
  end

  if attributes.key?(:'allow_workload_disruption')
    self.allow_workload_disruption = attributes[:'allow_workload_disruption']
  end

  if attributes.key?(:'bandwidth_per_migration')
    self.bandwidth_per_migration = attributes[:'bandwidth_per_migration']
  end

  if attributes.key?(:'completion_timeout_per_gi_b')
    self.completion_timeout_per_gi_b = attributes[:'completion_timeout_per_gi_b']
  end

  if attributes.key?(:'disable_tls')
    self.disable_tls = attributes[:'disable_tls']
  end

  if attributes.key?(:'match_se_linux_level_on_migration')
    self.match_se_linux_level_on_migration = attributes[:'match_se_linux_level_on_migration']
  end

  if attributes.key?(:'max_downtime_ms')
    self.max_downtime_ms = attributes[:'max_downtime_ms']
  end

  if attributes.key?(:'network')
    self.network = attributes[:'network']
  end

  if attributes.key?(:'node_drain_taint_key')
    self.node_drain_taint_key = attributes[:'node_drain_taint_key']
  end

  if attributes.key?(:'parallel_migrations_per_cluster')
    self.parallel_migrations_per_cluster = attributes[:'parallel_migrations_per_cluster']
  end

  if attributes.key?(:'parallel_outbound_migrations_per_node')
    self.parallel_outbound_migrations_per_node = attributes[:'parallel_outbound_migrations_per_node']
  end

  if attributes.key?(:'progress_timeout')
    self.progress_timeout = attributes[:'progress_timeout']
  end

  if attributes.key?(:'unsafe_migration_override')
    self.unsafe_migration_override = attributes[:'unsafe_migration_override']
  end

  if attributes.key?(:'utility_volumes_timeout')
    self.utility_volumes_timeout = attributes[:'utility_volumes_timeout']
  end
end

Instance Attribute Details

#allow_auto_convergeObject

AllowAutoConverge allows the platform to compromise performance/availability of VMIs to guarantee successful VMI live migrations. Defaults to false



20
21
22
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 20

def allow_auto_converge
  @allow_auto_converge
end

#allow_post_copyObject

AllowPostCopy enables post-copy live migrations. Such migrations allow even the busiest VMIs to successfully live-migrate. However, events like a network failure can cause a VMI crash. If set to true, migrations will still start in pre-copy, but switch to post-copy when CompletionTimeoutPerGiB triggers. Defaults to false



23
24
25
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 23

def allow_post_copy
  @allow_post_copy
end

#allow_workload_disruptionObject

AllowWorkloadDisruption indicates that the migration shouldn't be canceled after acceptableCompletionTime is exceeded. Instead, if permitted, migration will be switched to post-copy or the VMI will be paused to allow the migration to complete



26
27
28
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 26

def allow_workload_disruption
  @allow_workload_disruption
end

#bandwidth_per_migrationObject

Quantity is a fixed-point representation of a number. It provides convenient marshaling/unmarshaling in JSON and YAML, in addition to String() and AsInt64() accessors. The serialization format is: <quantity> ::= <signedNumber><suffix> (Note that <suffix> may be empty, from the \"\" case in <decimalSI>.) <digit> ::= 0 | 1 | ... | 9 <digits> ::= <digit> | <digit><digits> <number> ::= <digits> | <digits>.<digits> | <digits>. | .<digits> <sign> ::= \"+\" | \"-\" <signedNumber> ::= <number> | <sign><number> <suffix> ::= <binarySI> | <decimalExponent> | <decimalSI> <binarySI> ::= Ki | Mi | Gi | Ti | Pi | Ei (International System of units; See: http://physics.nist.gov/cuu/Units/binary.html) <decimalSI> ::= m | \"\" | k | M | G | T | P | E (Note that 1024 = 1Ki but 1000 = 1k; I didn't choose the capitalization.) <decimalExponent> ::= \"e\" <signedNumber> | \"E\" <signedNumber> No matter which of the three exponent forms is used, no quantity may represent a number greater than 2^63-1 in magnitude, nor may it have more than 3 decimal places. Numbers larger or more precise will be capped or rounded up. (E.g.: 0.1m will rounded up to 1m.) This may be extended in the future if we require larger or smaller quantities. When a Quantity is parsed from a string, it will remember the type of suffix it had, and will use the same type again when it is serialized. Before serializing, Quantity will be put in "canonical form". This means that Exponent/suffix will be adjusted up or down (with a corresponding increase or decrease in Mantissa) such that: - No precision is lost - No fractional digits will be emitted - The exponent (or suffix) is as large as possible. The sign will be omitted unless the number is negative. Examples: - 1.5 will be serialized as "1500m" - 1.5Gi will be serialized as "1536Mi" Note that the quantity will NEVER be internally represented by a floating point number. That is the whole point of this exercise. Non-canonical values will still parse as long as they are well formed, but will be re-emitted in their canonical form. (So always use canonical form, or don't diff.) This format is intended to make it difficult to use these numbers without writing some sort of special handling code in the hopes that that will cause implementors to also use a fixed point implementation.



29
30
31
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 29

def bandwidth_per_migration
  @bandwidth_per_migration
end

#completion_timeout_per_gi_bObject

CompletionTimeoutPerGiB is the maximum number of seconds per GiB a migration is allowed to take. If the timeout is reached, the migration will be either paused, switched to post-copy or cancelled depending on other settings. Defaults to 150



32
33
34
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 32

def completion_timeout_per_gi_b
  @completion_timeout_per_gi_b
end

#disable_tlsObject

When set to true, DisableTLS will disable the additional layer of live migration encryption provided by KubeVirt. This is usually a bad idea. Defaults to false



35
36
37
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 35

def disable_tls
  @disable_tls
end

#match_se_linux_level_on_migrationObject

By default, the SELinux level of target virt-launcher pods is forced to the level of the source virt-launcher. When set to true, MatchSELinuxLevelOnMigration lets the CRI auto-assign a random level to the target. That will ensure the target virt-launcher doesn't share categories with another pod on the node. However, migrations will fail when using RWX volumes that don't automatically deal with SELinux levels.



38
39
40
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 38

def match_se_linux_level_on_migration
  @match_se_linux_level_on_migration
end

#max_downtime_msObject

MaxDowntimeMs specifies the maximum tolerable downtime (in milliseconds) during switchover. Defaults to 900



41
42
43
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 41

def max_downtime_ms
  @max_downtime_ms
end

#networkObject

Network is the name of the CNI network to use for live migrations. By default, migrations go through the pod network.



44
45
46
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 44

def network
  @network
end

#node_drain_taint_keyObject

NodeDrainTaintKey defines the taint key that indicates a node should be drained. Note: this option relies on the deprecated node taint feature. Default: kubevirt.io/drain



47
48
49
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 47

def node_drain_taint_key
  @node_drain_taint_key
end

#parallel_migrations_per_clusterObject

ParallelMigrationsPerCluster is the total number of concurrent live migrations allowed cluster-wide. Defaults to 5



50
51
52
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 50

def parallel_migrations_per_cluster
  @parallel_migrations_per_cluster
end

#parallel_outbound_migrations_per_nodeObject

ParallelOutboundMigrationsPerNode is the maximum number of concurrent outgoing live migrations allowed per node. Defaults to 2



53
54
55
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 53

def parallel_outbound_migrations_per_node
  @parallel_outbound_migrations_per_node
end

#progress_timeoutObject

ProgressTimeout is the maximum number of seconds a live migration is allowed to make no progress. Hitting this timeout means a migration transferred 0 data for that many seconds. The migration is then considered stuck and therefore cancelled. Defaults to 150



56
57
58
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 56

def progress_timeout
  @progress_timeout
end

#unsafe_migration_overrideObject

UnsafeMigrationOverride allows live migrations to occur even if the compatibility check indicates the migration will be unsafe to the guest. Defaults to false



59
60
61
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 59

def unsafe_migration_override
  @unsafe_migration_override
end

#utility_volumes_timeoutObject

UtilityVolumesTimeout is the maximum number of seconds a migration can wait in Pending state for utility volumes to be detached. If utility volumes are still present after this timeout, the migration will be marked as Failed. Defaults to 150



62
63
64
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 62

def utility_volumes_timeout
  @utility_volumes_timeout
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



86
87
88
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 86

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



91
92
93
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 91

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 65

def self.attribute_map
  {
    :'allow_auto_converge' => :'allowAutoConverge',
    :'allow_post_copy' => :'allowPostCopy',
    :'allow_workload_disruption' => :'allowWorkloadDisruption',
    :'bandwidth_per_migration' => :'bandwidthPerMigration',
    :'completion_timeout_per_gi_b' => :'completionTimeoutPerGiB',
    :'disable_tls' => :'disableTLS',
    :'match_se_linux_level_on_migration' => :'matchSELinuxLevelOnMigration',
    :'max_downtime_ms' => :'maxDowntimeMs',
    :'network' => :'network',
    :'node_drain_taint_key' => :'nodeDrainTaintKey',
    :'parallel_migrations_per_cluster' => :'parallelMigrationsPerCluster',
    :'parallel_outbound_migrations_per_node' => :'parallelOutboundMigrationsPerNode',
    :'progress_timeout' => :'progressTimeout',
    :'unsafe_migration_override' => :'unsafeMigrationOverride',
    :'utility_volumes_timeout' => :'utilityVolumesTimeout'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 251

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



117
118
119
120
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 117

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 96

def self.openapi_types
  {
    :'allow_auto_converge' => :'Boolean',
    :'allow_post_copy' => :'Boolean',
    :'allow_workload_disruption' => :'Boolean',
    :'bandwidth_per_migration' => :'Object',
    :'completion_timeout_per_gi_b' => :'Integer',
    :'disable_tls' => :'Boolean',
    :'match_se_linux_level_on_migration' => :'Boolean',
    :'max_downtime_ms' => :'Integer',
    :'network' => :'String',
    :'node_drain_taint_key' => :'String',
    :'parallel_migrations_per_cluster' => :'Integer',
    :'parallel_outbound_migrations_per_node' => :'Integer',
    :'progress_timeout' => :'Integer',
    :'unsafe_migration_override' => :'Boolean',
    :'utility_volumes_timeout' => :'Integer'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 216

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      allow_auto_converge == o.allow_auto_converge &&
      allow_post_copy == o.allow_post_copy &&
      allow_workload_disruption == o.allow_workload_disruption &&
      bandwidth_per_migration == o.bandwidth_per_migration &&
      completion_timeout_per_gi_b == o.completion_timeout_per_gi_b &&
      disable_tls == o.disable_tls &&
      match_se_linux_level_on_migration == o.match_se_linux_level_on_migration &&
      max_downtime_ms == o.max_downtime_ms &&
      network == o.network &&
      node_drain_taint_key == o.node_drain_taint_key &&
      parallel_migrations_per_cluster == o.parallel_migrations_per_cluster &&
      parallel_outbound_migrations_per_node == o.parallel_outbound_migrations_per_node &&
      progress_timeout == o.progress_timeout &&
      unsafe_migration_override == o.unsafe_migration_override &&
      utility_volumes_timeout == o.utility_volumes_timeout
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


238
239
240
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 238

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



244
245
246
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 244

def hash
  [allow_auto_converge, allow_post_copy, allow_workload_disruption, bandwidth_per_migration, completion_timeout_per_gi_b, disable_tls, match_se_linux_level_on_migration, max_downtime_ms, network, node_drain_taint_key, parallel_migrations_per_cluster, parallel_outbound_migrations_per_node, progress_timeout, unsafe_migration_override, utility_volumes_timeout].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



201
202
203
204
205
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 201

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 273

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



209
210
211
212
# File 'lib/kubevirt/models/v1_migration_configuration.rb', line 209

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end