Class: Fog::Proxmox::Compute::Disk

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/proxmox/compute/models/disk.rb

Overview

class Disk model: pve.proxmox.com/pve-docs/api-viewer/index.html#/nodes/node/qemu|lxc/vmid/config size is in Gb

Instance Method Summary collapse

Instance Method Details

#cdrom?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/fog/proxmox/compute/models/disk.rb', line 52

def cdrom?
  id == 'ide2' && media == 'cdrom'
end

#cloud_init?Boolean

Returns:

  • (Boolean)


68
69
70
# File 'lib/fog/proxmox/compute/models/disk.rb', line 68

def cloud_init?
  id != 'ide2' && media == 'cdrom'
end

#controllerObject



44
45
46
# File 'lib/fog/proxmox/compute/models/disk.rb', line 44

def controller
  Fog::Proxmox::DiskHelper.extract_controller(id)
end

#controller?Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/fog/proxmox/compute/models/disk.rb', line 64

def controller?
  Fog::Proxmox::DiskHelper.server_disk?(id)
end

#deviceObject



48
49
50
# File 'lib/fog/proxmox/compute/models/disk.rb', line 48

def device
  Fog::Proxmox::DiskHelper.extract_device(id)
end

#flattenObject



80
81
82
# File 'lib/fog/proxmox/compute/models/disk.rb', line 80

def flatten
  Fog::Proxmox::DiskHelper.flatten(attributes)
end

#hard_disk?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/fog/proxmox/compute/models/disk.rb', line 72

def hard_disk?
  controller? && !cdrom? && !cloud_init?
end

#has_volume?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/fog/proxmox/compute/models/disk.rb', line 88

def has_volume?
  !volid.empty?
end

#mount_point?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/fog/proxmox/compute/models/disk.rb', line 60

def mount_point?
  Fog::Proxmox::DiskHelper.mount_point?(id)
end

#rootfs?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/fog/proxmox/compute/models/disk.rb', line 56

def rootfs?
  id == 'rootfs'
end

#template?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/fog/proxmox/compute/models/disk.rb', line 76

def template?
  Fog::Proxmox::DiskHelper.template?(volid)
end

#to_sObject



84
85
86
# File 'lib/fog/proxmox/compute/models/disk.rb', line 84

def to_s
  Fog::Proxmox::Hash.flatten(flatten)
end