Class: Dcmgr::Scheduler::Network::NatOneToOne

Inherits:
Dcmgr::Scheduler::NetworkScheduler show all
Defined in:
lib/dcmgr/scheduler/network/nat_one_to_one.rb

Overview

One internal address + NAT external address to single interface.

Instance Method Summary collapse

Methods inherited from Dcmgr::Scheduler::NetworkScheduler

#initialize

Constructor Details

This class inherits a constructor from Dcmgr::Scheduler::NetworkScheduler

Instance Method Details

#schedule(instance) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/dcmgr/scheduler/network/nat_one_to_one.rb', line 9

def schedule(instance)
  network = Models::Network[@options.network_id]
  nat_network = Models::Network[@options.nat_network_id]

  vif_template = instance.spec.vifs.find{ |name,v| v[:index] == 0 }.last

  vnic = instance.add_nic(vif_template)
  vnic.network = network
  vnic.nat_network = nat_network
  vnic.save
end