Class: Kubevirt::V1Devices

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

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 = {}) ⇒ V1Devices

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
# File 'lib/kubevirt/models/v1_devices.rb', line 168

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1Devices` 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::V1Devices`. 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?(:'autoattach_graphics_device')
    self.autoattach_graphics_device = attributes[:'autoattach_graphics_device']
  end

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

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

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

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

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

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

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

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

  if attributes.key?(:'disks')
    if (value = attributes[:'disks']).is_a?(Array)
      self.disks = value
    end
  end

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

  if attributes.key?(:'filesystems')
    if (value = attributes[:'filesystems']).is_a?(Array)
      self.filesystems = value
    end
  end

  if attributes.key?(:'gpus')
    if (value = attributes[:'gpus']).is_a?(Array)
      self.gpus = value
    end
  end

  if attributes.key?(:'host_devices')
    if (value = attributes[:'host_devices']).is_a?(Array)
      self.host_devices = value
    end
  end

  if attributes.key?(:'inputs')
    if (value = attributes[:'inputs']).is_a?(Array)
      self.inputs = value
    end
  end

  if attributes.key?(:'interfaces')
    if (value = attributes[:'interfaces']).is_a?(Array)
      self.interfaces = value
    end
  end

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

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

  if attributes.key?(:'panic_devices')
    if (value = attributes[:'panic_devices']).is_a?(Array)
      self.panic_devices = value
    end
  end

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

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

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

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

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

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

Instance Attribute Details

#autoattach_graphics_deviceObject

Whether to attach the default graphics device or not. VNC will not be available if set to false. Defaults to true.



19
20
21
# File 'lib/kubevirt/models/v1_devices.rb', line 19

def autoattach_graphics_device
  @autoattach_graphics_device
end

#autoattach_input_deviceObject

Whether to attach an Input Device. Defaults to false.



22
23
24
# File 'lib/kubevirt/models/v1_devices.rb', line 22

def autoattach_input_device
  @autoattach_input_device
end

#autoattach_mem_balloonObject

Whether to attach the Memory balloon device with default period. Period can be adjusted in virt-config. Defaults to true.



25
26
27
# File 'lib/kubevirt/models/v1_devices.rb', line 25

def autoattach_mem_balloon
  @autoattach_mem_balloon
end

#autoattach_pod_interfaceObject

Whether to attach a pod network interface. Defaults to true.



28
29
30
# File 'lib/kubevirt/models/v1_devices.rb', line 28

def autoattach_pod_interface
  @autoattach_pod_interface
end

#autoattach_serial_consoleObject

Whether to attach the default virtio-serial console or not. Serial console access will not be available if set to false. Defaults to true.



31
32
33
# File 'lib/kubevirt/models/v1_devices.rb', line 31

def autoattach_serial_console
  @autoattach_serial_console
end

#autoattach_vsockObject

Whether to attach the VSOCK CID to the VM or not. VSOCK access will be available if set to true. Defaults to false.



34
35
36
# File 'lib/kubevirt/models/v1_devices.rb', line 34

def autoattach_vsock
  @autoattach_vsock
end

#block_multi_queueObject

Whether or not to enable virtio multi-queue for block devices. Defaults to false.



37
38
39
# File 'lib/kubevirt/models/v1_devices.rb', line 37

def block_multi_queue
  @block_multi_queue
end

#client_passthroughObject

Represent a subset of client devices that can be accessed by VMI. At the moment only, USB devices using Usbredir's library and tooling. Another fit would be a smartcard with libcacard. The struct is currently empty as there is no immediate request for user-facing APIs. This structure simply turns on USB redirection of UsbClientPassthroughMaxNumberOf devices.



40
41
42
# File 'lib/kubevirt/models/v1_devices.rb', line 40

def client_passthrough
  @client_passthrough
end

#disable_hotplugObject

DisableHotplug disabled the ability to hotplug disks.



43
44
45
# File 'lib/kubevirt/models/v1_devices.rb', line 43

def disable_hotplug
  @disable_hotplug
end

#disksObject

Disks describes disks, cdroms and luns which are connected to the vmi.



46
47
48
# File 'lib/kubevirt/models/v1_devices.rb', line 46

def disks
  @disks
end

#downward_metricsObject

Returns the value of attribute downward_metrics.



48
49
50
# File 'lib/kubevirt/models/v1_devices.rb', line 48

def downward_metrics
  @downward_metrics
end

#filesystemsObject

Filesystems describes filesystem which is connected to the vmi.



51
52
53
# File 'lib/kubevirt/models/v1_devices.rb', line 51

def filesystems
  @filesystems
end

#gpusObject

Whether to attach a GPU device to the vmi.



54
55
56
# File 'lib/kubevirt/models/v1_devices.rb', line 54

def gpus
  @gpus
end

#host_devicesObject

Whether to attach a host device to the vmi.



57
58
59
# File 'lib/kubevirt/models/v1_devices.rb', line 57

def host_devices
  @host_devices
end

#inputsObject

Inputs describe input devices



60
61
62
# File 'lib/kubevirt/models/v1_devices.rb', line 60

def inputs
  @inputs
end

#interfacesObject

Interfaces describe network interfaces which are added to the vmi.



63
64
65
# File 'lib/kubevirt/models/v1_devices.rb', line 63

def interfaces
  @interfaces
end

#log_serial_consoleObject

Whether to log the auto-attached default serial console or not. Serial console logs will be collect to a file and then streamed from a named guest-console-log. Not relevant if autoattachSerialConsole is disabled. Defaults to cluster wide setting on VirtualMachineOptions.



66
67
68
# File 'lib/kubevirt/models/v1_devices.rb', line 66

def log_serial_console
  @log_serial_console
end

#network_interface_multiqueueObject

If specified, virtual network interfaces configured with a virtio bus will also enable the vhost multiqueue feature for network devices. The number of queues created depends on additional factors of the VirtualMachineInstance, like the number of guest CPUs.



69
70
71
# File 'lib/kubevirt/models/v1_devices.rb', line 69

def network_interface_multiqueue
  @network_interface_multiqueue
end

#panic_devicesObject

PanicDevices provides additional crash information when a guest crashes.



72
73
74
# File 'lib/kubevirt/models/v1_devices.rb', line 72

def panic_devices
  @panic_devices
end

#rngObject

Rng represents the random device passed from host



75
76
77
# File 'lib/kubevirt/models/v1_devices.rb', line 75

def rng
  @rng
end

#soundObject

Returns the value of attribute sound.



77
78
79
# File 'lib/kubevirt/models/v1_devices.rb', line 77

def sound
  @sound
end

#tpmObject

Returns the value of attribute tpm.



79
80
81
# File 'lib/kubevirt/models/v1_devices.rb', line 79

def tpm
  @tpm
end

#use_virtio_transitionalObject

Fall back to legacy virtio 0.9 support if virtio bus is selected on devices. This is helpful for old machines like CentOS6 or RHEL6 which do not understand virtio_non_transitional (virtio 1.0).



82
83
84
# File 'lib/kubevirt/models/v1_devices.rb', line 82

def use_virtio_transitional
  @use_virtio_transitional
end

#videoObject

Returns the value of attribute video.



84
85
86
# File 'lib/kubevirt/models/v1_devices.rb', line 84

def video
  @video
end

#watchdogObject

Returns the value of attribute watchdog.



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

def watchdog
  @watchdog
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



120
121
122
# File 'lib/kubevirt/models/v1_devices.rb', line 120

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



125
126
127
# File 'lib/kubevirt/models/v1_devices.rb', line 125

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/kubevirt/models/v1_devices.rb', line 89

def self.attribute_map
  {
    :'autoattach_graphics_device' => :'autoattachGraphicsDevice',
    :'autoattach_input_device' => :'autoattachInputDevice',
    :'autoattach_mem_balloon' => :'autoattachMemBalloon',
    :'autoattach_pod_interface' => :'autoattachPodInterface',
    :'autoattach_serial_console' => :'autoattachSerialConsole',
    :'autoattach_vsock' => :'autoattachVSOCK',
    :'block_multi_queue' => :'blockMultiQueue',
    :'client_passthrough' => :'clientPassthrough',
    :'disable_hotplug' => :'disableHotplug',
    :'disks' => :'disks',
    :'downward_metrics' => :'downwardMetrics',
    :'filesystems' => :'filesystems',
    :'gpus' => :'gpus',
    :'host_devices' => :'hostDevices',
    :'inputs' => :'inputs',
    :'interfaces' => :'interfaces',
    :'log_serial_console' => :'logSerialConsole',
    :'network_interface_multiqueue' => :'networkInterfaceMultiqueue',
    :'panic_devices' => :'panicDevices',
    :'rng' => :'rng',
    :'sound' => :'sound',
    :'tpm' => :'tpm',
    :'use_virtio_transitional' => :'useVirtioTransitional',
    :'video' => :'video',
    :'watchdog' => :'watchdog'
  }
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



359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/kubevirt/models/v1_devices.rb', line 359

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



161
162
163
164
# File 'lib/kubevirt/models/v1_devices.rb', line 161

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

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/kubevirt/models/v1_devices.rb', line 130

def self.openapi_types
  {
    :'autoattach_graphics_device' => :'Boolean',
    :'autoattach_input_device' => :'Boolean',
    :'autoattach_mem_balloon' => :'Boolean',
    :'autoattach_pod_interface' => :'Boolean',
    :'autoattach_serial_console' => :'Boolean',
    :'autoattach_vsock' => :'Boolean',
    :'block_multi_queue' => :'Boolean',
    :'client_passthrough' => :'Object',
    :'disable_hotplug' => :'Boolean',
    :'disks' => :'Array<V1Disk>',
    :'downward_metrics' => :'Object',
    :'filesystems' => :'Array<V1Filesystem>',
    :'gpus' => :'Array<V1GPU>',
    :'host_devices' => :'Array<V1HostDevice>',
    :'inputs' => :'Array<V1Input>',
    :'interfaces' => :'Array<V1Interface>',
    :'log_serial_console' => :'Boolean',
    :'network_interface_multiqueue' => :'Boolean',
    :'panic_devices' => :'Array<V1PanicDevice>',
    :'rng' => :'Object',
    :'sound' => :'V1SoundDevice',
    :'tpm' => :'V1TPMDevice',
    :'use_virtio_transitional' => :'Boolean',
    :'video' => :'V1VideoDevice',
    :'watchdog' => :'V1Watchdog'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/kubevirt/models/v1_devices.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      autoattach_graphics_device == o.autoattach_graphics_device &&
      autoattach_input_device == o.autoattach_input_device &&
      autoattach_mem_balloon == o.autoattach_mem_balloon &&
      autoattach_pod_interface == o.autoattach_pod_interface &&
      autoattach_serial_console == o.autoattach_serial_console &&
      autoattach_vsock == o.autoattach_vsock &&
      block_multi_queue == o.block_multi_queue &&
      client_passthrough == o.client_passthrough &&
      disable_hotplug == o.disable_hotplug &&
      disks == o.disks &&
      downward_metrics == o.downward_metrics &&
      filesystems == o.filesystems &&
      gpus == o.gpus &&
      host_devices == o.host_devices &&
      inputs == o.inputs &&
      interfaces == o.interfaces &&
      log_serial_console == o.log_serial_console &&
      network_interface_multiqueue == o.network_interface_multiqueue &&
      panic_devices == o.panic_devices &&
      rng == o.rng &&
      sound == o.sound &&
      tpm == o.tpm &&
      use_virtio_transitional == o.use_virtio_transitional &&
      video == o.video &&
      watchdog == o.watchdog
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


346
347
348
# File 'lib/kubevirt/models/v1_devices.rb', line 346

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



352
353
354
# File 'lib/kubevirt/models/v1_devices.rb', line 352

def hash
  [autoattach_graphics_device, autoattach_input_device, autoattach_mem_balloon, autoattach_pod_interface, autoattach_serial_console, autoattach_vsock, block_multi_queue, client_passthrough, disable_hotplug, disks, downward_metrics, filesystems, gpus, host_devices, inputs, interfaces, log_serial_console, network_interface_multiqueue, panic_devices, rng, sound, tpm, use_virtio_transitional, video, watchdog].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



299
300
301
302
303
# File 'lib/kubevirt/models/v1_devices.rb', line 299

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



381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/kubevirt/models/v1_devices.rb', line 381

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



307
308
309
310
# File 'lib/kubevirt/models/v1_devices.rb', line 307

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