Class: Dcmgr::Tags::NetworkPool

Inherits:
Models::Tag show all
Defined in:
lib/dcmgr/tags.rb

Constant Summary

Constants inherited from Models::BaseNew

Models::BaseNew::LOCK_TABLES_KEY

Instance Method Summary collapse

Methods inherited from Models::Tag

#before_destroy, find_tag_class, #label, #labeled?, #lable_ifnot, lock!, #to_api_document, #unlabel

Methods inherited from Models::AccountResource

#account

Methods inherited from Models::BaseNew

Proxy, dataset, default_row_lock_mode=, install_data, install_data_hooks, lock!, #to_hash, unlock!, #with_timestamps?

Instance Method Details

#accept_mapping?(to) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/dcmgr/tags.rb', line 20

def accept_mapping?(to)
  to.is_a?(Dcmgr::Models::Network)
end

#pickObject



24
25
26
27
28
29
30
# File 'lib/dcmgr/tags.rb', line 24

def pick()
  lst = mapped_uuids.map { |t|
    Dcmgr::Models::Network[t.uuid]
  }.sort_by{ |n|
    n.available_ip_nums
  }.reverse.first
end