Class: Kubevirt::V1Disk
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Kubevirt::V1Disk
- Defined in:
- lib/kubevirt/models/v1_disk.rb
Instance Attribute Summary collapse
-
#block_size ⇒ Object
Returns the value of attribute block_size.
-
#boot_order ⇒ Object
BootOrder is an integer value > 0, used to determine ordering of boot devices.
-
#cache ⇒ Object
Cache specifies which kvm disk cache mode should be used.
-
#cdrom ⇒ Object
Returns the value of attribute cdrom.
-
#changed_block_tracking ⇒ Object
ChangedBlockTracking indicates this disk should have CBT option Defaults to false.
-
#dedicated_io_thread ⇒ Object
dedicatedIOThread indicates this disk should have an exclusive IO Thread.
-
#disk ⇒ Object
Returns the value of attribute disk.
-
#error_policy ⇒ Object
If specified, it can change the default error policy (stop) for the disk.
-
#io ⇒ Object
IO specifies which QEMU disk IO mode should be used.
-
#lun ⇒ Object
Returns the value of attribute lun.
-
#name ⇒ Object
Name is the device name.
-
#serial ⇒ Object
Serial provides the ability to specify a serial number for the disk device.
-
#shareable ⇒ Object
If specified the disk is made sharable and multiple write from different VMs are permitted.
-
#tag ⇒ Object
If specified, disk address and its tag will be provided to the guest via config drive metadata.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ V1Disk
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ V1Disk
Initializes the object
114 115 116 117 118 119 120 121 122 123 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 |
# File 'lib/kubevirt/models/v1_disk.rb', line 114 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Kubevirt::V1Disk` 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::V1Disk`. 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?(:'block_size') self.block_size = attributes[:'block_size'] end if attributes.key?(:'boot_order') self.boot_order = attributes[:'boot_order'] end if attributes.key?(:'cache') self.cache = attributes[:'cache'] end if attributes.key?(:'cdrom') self.cdrom = attributes[:'cdrom'] end if attributes.key?(:'changed_block_tracking') self.changed_block_tracking = attributes[:'changed_block_tracking'] end if attributes.key?(:'dedicated_io_thread') self.dedicated_io_thread = attributes[:'dedicated_io_thread'] end if attributes.key?(:'disk') self.disk = attributes[:'disk'] end if attributes.key?(:'error_policy') self.error_policy = attributes[:'error_policy'] end if attributes.key?(:'io') self.io = attributes[:'io'] end if attributes.key?(:'lun') self.lun = attributes[:'lun'] end if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = '' end if attributes.key?(:'serial') self.serial = attributes[:'serial'] end if attributes.key?(:'shareable') self.shareable = attributes[:'shareable'] end if attributes.key?(:'tag') self.tag = attributes[:'tag'] end end |
Instance Attribute Details
#block_size ⇒ Object
Returns the value of attribute block_size.
18 19 20 |
# File 'lib/kubevirt/models/v1_disk.rb', line 18 def block_size @block_size end |
#boot_order ⇒ Object
BootOrder is an integer value > 0, used to determine ordering of boot devices. Lower values take precedence. Each disk or interface that has a boot order must have a unique value. Disks without a boot order are not tried if a disk with a boot order exists.
21 22 23 |
# File 'lib/kubevirt/models/v1_disk.rb', line 21 def boot_order @boot_order end |
#cache ⇒ Object
Cache specifies which kvm disk cache mode should be used. Supported values are: none: Guest I/O not cached on the host, but may be kept in a disk cache. writethrough: Guest I/O cached on the host but written through to the physical medium. Slowest but with most guarantees. writeback: Guest I/O cached on the host. Defaults to none if the storage supports O_DIRECT, otherwise writethrough.
24 25 26 |
# File 'lib/kubevirt/models/v1_disk.rb', line 24 def cache @cache end |
#cdrom ⇒ Object
Returns the value of attribute cdrom.
26 27 28 |
# File 'lib/kubevirt/models/v1_disk.rb', line 26 def cdrom @cdrom end |
#changed_block_tracking ⇒ Object
ChangedBlockTracking indicates this disk should have CBT option Defaults to false.
29 30 31 |
# File 'lib/kubevirt/models/v1_disk.rb', line 29 def changed_block_tracking @changed_block_tracking end |
#dedicated_io_thread ⇒ Object
dedicatedIOThread indicates this disk should have an exclusive IO Thread. Enabling this implies useIOThreads = true. Defaults to false.
32 33 34 |
# File 'lib/kubevirt/models/v1_disk.rb', line 32 def dedicated_io_thread @dedicated_io_thread end |
#disk ⇒ Object
Returns the value of attribute disk.
34 35 36 |
# File 'lib/kubevirt/models/v1_disk.rb', line 34 def disk @disk end |
#error_policy ⇒ Object
If specified, it can change the default error policy (stop) for the disk
37 38 39 |
# File 'lib/kubevirt/models/v1_disk.rb', line 37 def error_policy @error_policy end |
#io ⇒ Object
IO specifies which QEMU disk IO mode should be used. Supported values are: native, default, threads.
40 41 42 |
# File 'lib/kubevirt/models/v1_disk.rb', line 40 def io @io end |
#lun ⇒ Object
Returns the value of attribute lun.
42 43 44 |
# File 'lib/kubevirt/models/v1_disk.rb', line 42 def lun @lun end |
#name ⇒ Object
Name is the device name
45 46 47 |
# File 'lib/kubevirt/models/v1_disk.rb', line 45 def name @name end |
#serial ⇒ Object
Serial provides the ability to specify a serial number for the disk device.
48 49 50 |
# File 'lib/kubevirt/models/v1_disk.rb', line 48 def serial @serial end |
#shareable ⇒ Object
If specified the disk is made sharable and multiple write from different VMs are permitted
51 52 53 |
# File 'lib/kubevirt/models/v1_disk.rb', line 51 def shareable @shareable end |
#tag ⇒ Object
If specified, disk address and its tag will be provided to the guest via config drive metadata
54 55 56 |
# File 'lib/kubevirt/models/v1_disk.rb', line 54 def tag @tag end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
77 78 79 |
# File 'lib/kubevirt/models/v1_disk.rb', line 77 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
82 83 84 |
# File 'lib/kubevirt/models/v1_disk.rb', line 82 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/kubevirt/models/v1_disk.rb', line 57 def self.attribute_map { :'block_size' => :'blockSize', :'boot_order' => :'bootOrder', :'cache' => :'cache', :'cdrom' => :'cdrom', :'changed_block_tracking' => :'changedBlockTracking', :'dedicated_io_thread' => :'dedicatedIOThread', :'disk' => :'disk', :'error_policy' => :'errorPolicy', :'io' => :'io', :'lun' => :'lun', :'name' => :'name', :'serial' => :'serial', :'shareable' => :'shareable', :'tag' => :'tag' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
# File 'lib/kubevirt/models/v1_disk.rb', line 253 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_nullable ⇒ Object
List of attributes with nullable: true
107 108 109 110 |
# File 'lib/kubevirt/models/v1_disk.rb', line 107 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/kubevirt/models/v1_disk.rb', line 87 def self.openapi_types { :'block_size' => :'V1BlockSize', :'boot_order' => :'Integer', :'cache' => :'String', :'cdrom' => :'V1CDRomTarget', :'changed_block_tracking' => :'Boolean', :'dedicated_io_thread' => :'Boolean', :'disk' => :'V1DiskTarget', :'error_policy' => :'String', :'io' => :'String', :'lun' => :'V1LunTarget', :'name' => :'String', :'serial' => :'String', :'shareable' => :'Boolean', :'tag' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/kubevirt/models/v1_disk.rb', line 219 def ==(o) return true if self.equal?(o) self.class == o.class && block_size == o.block_size && boot_order == o.boot_order && cache == o.cache && cdrom == o.cdrom && changed_block_tracking == o.changed_block_tracking && dedicated_io_thread == o.dedicated_io_thread && disk == o.disk && error_policy == o.error_policy && io == o.io && lun == o.lun && name == o.name && serial == o.serial && shareable == o.shareable && tag == o.tag end |
#eql?(o) ⇒ Boolean
240 241 242 |
# File 'lib/kubevirt/models/v1_disk.rb', line 240 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
246 247 248 |
# File 'lib/kubevirt/models/v1_disk.rb', line 246 def hash [block_size, boot_order, cache, cdrom, changed_block_tracking, dedicated_io_thread, disk, error_policy, io, lun, name, serial, shareable, tag].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
189 190 191 192 193 194 195 196 197 |
# File 'lib/kubevirt/models/v1_disk.rb', line 189 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
275 276 277 278 279 280 281 282 283 284 285 286 287 |
# File 'lib/kubevirt/models/v1_disk.rb', line 275 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
201 202 203 204 205 |
# File 'lib/kubevirt/models/v1_disk.rb', line 201 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? true end |