Class: Dcmgr::Scheduler::Network::FlatSingle

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

Overview

Simple network scheduler assign IP address from first found network 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



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

def schedule(instance)
  # add single interface and set network
  network = Models::Network.first
  vif_template = instance.spec.vifs[instance.spec.vifs.keys.first] ||
    {:index=>0, :bandwidth=>100000}
  
  vnic = instance.add_nic(vif_template)
  vnic.network = network
  vnic.save
end