Displaying 3 results from an estimated 3 matches for "boot_type_id".
2009 Jul 23
0
[PATCH server] Add network QMF apis.
...roto']])
+ raise "Unknown boot protocol #{args['proto']}." if not boot_type
+ puts "in create_vlan_network, boot_type id is #{boot_type.id}"
+ hash = { :name => args['name'], :number => args['number'], :type => 'Vlan', :boot_type_id => boot_type.id }
+
+ svc_create(hash)
+
+ args['network'] = @agent.encode_id(NetworkController.schema_class.id, @network.id)
+ end
+
+ def create_physical_network
+ extend NetworkService
+
+ boot_type = BootType.find(:first, :conditions => ["proto = ?&q...
2009 May 15
0
[PATCH server] use service layer for Network controller.
...arams)
+ else
+ return nil
+ end
+ end
end
diff --git a/src/app/models/network.rb b/src/app/models/network.rb
index 0ad38bb..1c6fe97 100644
--- a/src/app/models/network.rb
+++ b/src/app/models/network.rb
@@ -31,4 +31,16 @@ class Network < ActiveRecord::Base
validates_presence_of :boot_type_id,
:message => 'A boot type must be specified.'
+ def self.factory(params = {})
+ case params[:type]
+ when 'PhysicalNetwork'
+ return PhysicalNetwork.new(params)
+ when 'Vlan'
+ return Vlan.new(params)
+ else
+ return nil
+ end
+ end...
2009 Jun 30
0
[PATCH server] permit many-to-many vms / networks relationship
...estCase
- # Replace this with your real tests.
- def test_truth
- assert true
+ fixtures :networks
+ fixtures :vms
+ fixtures :hosts
+ fixtures :nics
+ fixtures :boot_types
+
+ def setup
+ end
+
+ def test_vlan_invalid_without_number
+ vl = Vlan.new({:name => 'testvlan', :boot_type_id => 2})
+ flunk "Vlan without number should not be valid" if vl.valid?
+ vl.number = 1
+ flunk "Vlan with number should be valid" unless vl.valid?
+ end
+
+ def test_vlan_nics_only_associated_with_vm
+ vl = Vlan.create({:name => 'testvlan',
+...