Project

General

Profile

« Previous | Next » 

Revision 6afdddf1

Added by Marek Hulán about 9 years ago

Fixes #9434 - managed alias accepts only static boot mode subnet

(cherry picked from commit a45253c2b7c747b15506dddc4efa86396c6ef53f)

View differences:

app/models/nic/interface.rb
# aliases and vlans require identifiers so we can differentiate and properly configure them
validates :identifier, :presence => true, :if => Proc.new { |o| o.virtual? && o.managed? && o.instance_of?(Nic::Managed) }
validate :alias_subnet
delegate :network, :to => :subnet
def vlanid
......
attrs[:bridge]
end
def alias?
self.virtual? && self.identifier.present? && self.identifier.include?(':')
end
def fqdn_changed?
name_changed? || domain_id_changed?
end
......
protected
def alias_subnet
if self.managed? && self.alias? && self.subnet && self.subnet.boot_mode != Subnet::BOOT_MODES[:static]
errors.add(:subnet_id, _('subnet boot mode is not %s' % _(Subnet::BOOT_MODES[:static])))
end
end
def uniq_fields_with_hosts
super + (self.virtual? ? [] : [:ip])
end

Also available in: Unified diff