Class: HammerCLIForeman::ComputeResources::VMware

Inherits:
Base
  • Object
show all
Defined in:
lib/hammer_cli_foreman/compute_resource/vmware.rb

Constant Summary collapse

INTERFACE_TYPES =
%w[VirtualVmxnet3 VirtualE1000]

Instance Method Summary collapse

Methods inherited from Base

#interfaces_attrs_name

Instance Method Details

#compute_attributesObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 10

def compute_attributes
  [
    ['cluster',              _('Cluster ID from VMware'), { bold: true }],
    ['corespersocket',       _('Number of cores per socket (applicable to hardware versions < 10 only)'), { bold: true }],
    ['cpus',                 _('CPU count'), { bold: true }],
    ['memory_mb',            _('Integer number, amount of memory in MB'), { bold: true }],
    ['path',                 _('Path to folder'), { bold: true }],
    ['resource_pool',        _('Resource Pool ID from VMware'), { bold: true }],
    ['firmware',             'automatic/bios/efi'],
    ['guest_id',             _('Guest OS ID form VMware')],
    ['hardware_version',     _('Hardware version ID from VMware')],
    ['memoryHotAddEnabled',  _('Must be a 1 or 0, lets you add memory resources while the machine is on')],
    ['cpuHotAddEnabled',     _('Must be a 1 or 0, lets you add CPU resources while the machine is on')],
    ['add_cdrom',            _('Must be a 1 or 0, Add a CD-ROM drive to the virtual machine')],
    ['annotation',           _('Annotation Notes')],
    ['scsi_controllers',     [_('List with SCSI controllers definitions'),
                              '  type - ' + _('ID of the controller from VMware'),
                              '  key  - ' + _('Key of the controller (e.g. 1000)')
                              ].flatten(1).join("\n")],
    ['boot_order',            _('Device names to specify the boot order')]
  ]
end

#host_attributesObject



33
34
35
36
37
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 33

def host_attributes
  [
    ['start', _('Must be a 1 or 0, whether to start the machine or not')]
  ]
end

#interface_attributesObject



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 52

def interface_attributes
  [
    ['compute_type', [
      _('Type of the network adapter, for example one of:'),
      INTERFACE_TYPES.map { |it| '  ' + it },
      _('See documentation center for your version of vSphere to find more details about available adapter types:'),
      '  https://www.vmware.com/support/pubs/'
    ].flatten(1).join("\n")],
    ['compute_network', _('Network ID or Network Name from VMware')]
  ]
end

#mandatory_resource_optionsObject



88
89
90
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 88

def mandatory_resource_options
  super + %i[user password datacenter server]
end

#nameObject



6
7
8
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 6

def name
  'VMware'
end

#provider_specific_fieldsObject



64
65
66
67
68
69
70
71
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 64

def provider_specific_fields
  super + [
    Fields::Field.new(:label => _('Datacenter'), :path => [:datacenter]),
    Fields::Field.new(:label => _('Server'), :path => [:server]),
    Fields::Boolean.new(:label => _('Console password set'), :path => [:set_console_password]),
    Fields::Boolean.new(:label => _('Caching enabled'), :path => [:caching_enabled])
  ]
end

#provider_vm_specific_fieldsObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 73

def provider_vm_specific_fields
  [
      Fields::Field.new(:label => _('CPUs'), :path => [:cpus]),
      Fields::Field.new(:label => _('Memory'), :path => [:memory_mb]),
      Fields::Field.new(:label => _('Power Status'), :path => [:power_state]),
      Fields::Field.new(:label => _('Host Name'), :path => [:hostname]),
      Fields::Field.new(:label => _('Connection Status'), :path => [:connection_status]),
      Fields::Field.new(:label => _('Hardware Version'), :path => [:hardware_version]),
      Fields::Field.new(:label => _('Path'), :path => [:path]),
      Fields::Field.new(:label => _('Operating System'), :path => [:operatingsystem]),
      Fields::Field.new(:label => _('Mac'), :path => [:mac]),
      Fields::List.new(:label => _('Boot order'), :path => [:boot_order])
  ]
end

#volume_attributesObject



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/hammer_cli_foreman/compute_resource/vmware.rb', line 39

def volume_attributes
  [
    ['name'],
    ['storage_pod',    _('Storage Pod ID from VMware')],
    ['datastore',      _('Datastore ID from VMware')],
    ['mode',           'persistent/independent_persistent/independent_nonpersistent'],
    ['size_gb',        _('Integer number, volume size in GB')],
    ['thin',           'true/false'],
    ['eager_zero',     'true/false'],
    ['controller_key', 'Associated SCSI controller key']
  ]
end