Revision 40df7dfb
Added by Daniel Lobato Garcia about 11 years ago
- ID 40df7dfbfcde38f06d133fea97f0d30904155916
app/models/host/managed.rb | ||
---|---|---|
new
|
||
end
|
||
|
||
def bmc_nic
|
||
interfaces.bmc.first
|
||
end
|
||
|
||
def sp_ip
|
||
bmc_nic.try(:ip)
|
||
end
|
||
... | ... | |
tax_organization.import_missing_ids if organization
|
||
end
|
||
|
||
def bmc_proxy
|
||
@bmc_proxy ||= bmc_nic.proxy
|
||
end
|
||
|
||
def bmc_available?
|
||
ipmi = bmc_nic
|
||
return false if ipmi.nil?
|
||
ipmi.password.present? && ipmi.username.present? && ipmi.provider == 'IPMI'
|
||
end
|
||
|
||
def power
|
||
opts = {:host => self}
|
||
if compute_resource_id && uuid
|
||
VirtPowerManager.new(opts)
|
||
elsif bmc_available?
|
||
BMCPowerManager.new(opts)
|
||
else
|
||
raise ::Foreman::Exception.new(N_("Unknown power management support - can't continue"))
|
||
end
|
||
end
|
||
|
||
|
||
def ipmi_boot(booting_device)
|
||
bmc_proxy.boot({:function => 'bootdevice', :device => booting_device})
|
||
end
|
||
|
||
private
|
||
|
||
def lookup_keys_params
|
||
... | ... | |
Classification.new(:host => self).enc
|
||
end
|
||
|
||
def bmc_nic
|
||
interfaces.bmc.first
|
||
end
|
||
|
||
# ensure that host name is fqdn
|
||
# if the user inputted short name, the domain name will be appended
|
||
# this is done to ensure compatibility with puppet storeconfigs
|
Also available in: Unified diff
fixes #426 expose BMC information in foreman UI
Signed-off-by: Ohad Levy <ohadlevy@gmail.com>
This patch also adds an abstracted power management class for both VM
and BM