cord-in-a-box enhancements to support more than one compute node
Change-Id: Ic8fa77ead0ab474af7758015c8732d04acdbd76f
diff --git a/Vagrantfile b/Vagrantfile
index ac96263..ffa826e 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -9,6 +9,14 @@
config.vm.synced_folder "..", "/cord"
end
+ #By default, this variable is set to 2, such that Vagrantfile allows creation
+ #of compute nodes up to 2. If the number of compute nodes to be supported more
+ #than 2, set the environment variable NUM_COMPUTE_NODES to the desired value
+ #before executing this Vagrantfile.
+ num_compute_nodes = (ENV['NUM_COMPUTE_NODES'] || 2).to_i
+ compute_ip_base = "10.6.1."
+ compute_ips = num_compute_nodes.times.collect { |n| compute_ip_base + "#{n+2}" }
+
config.vm.define "corddev" do |d|
d.ssh.forward_agent = true
d.vm.box = "ubuntu/trusty64"
@@ -91,30 +99,34 @@
end
end
- # Libvirt compute node
- # Not able to merge with virtualbox config for compute nodes above
- # Issue is that here no box and no private network are specified
- config.vm.define "compute_node" do |c|
- c.vm.synced_folder '.', '/vagrant', disabled: true
- c.vm.communicator = "none"
- c.vm.hostname = "computenode"
- c.vm.network "public_network",
- adapter: 1,
- auto_config: false,
- dev: "mgmtbr",
- mode: "bridge",
- type: "bridge"
- c.vm.network "private_network",
- adapter: 2,
- ip: "10.6.1.2"
- c.vm.provider :libvirt do |domain|
- domain.memory = 8192
- domain.cpus = 4
- domain.machine_virtual_size = 100
- domain.storage :file, :size => '100G', :type => 'qcow2'
- domain.boot 'network'
- domain.boot 'hd'
- domain.nested = true
+ num_compute_nodes.times do |n|
+ # Libvirt compute node
+ # Not able to merge with virtualbox config for compute nodes above
+ # Issue is that here no box and no private network are specified
+ config.vm.define "compute_node-#{n+1}" do |c|
+ compute_ip = compute_ips[n]
+ compute_index = n+1
+ c.vm.synced_folder '.', '/vagrant', disabled: true
+ c.vm.communicator = "none"
+ c.vm.hostname = "computenode-#{compute_index}"
+ c.vm.network "public_network",
+ adapter: 1,
+ auto_config: false,
+ dev: "mgmtbr",
+ mode: "bridge",
+ type: "bridge"
+ c.vm.network "private_network",
+ adapter: 2,
+ ip: "#{compute_ip}"
+ c.vm.provider :libvirt do |domain|
+ domain.memory = 8192
+ domain.cpus = 4
+ domain.machine_virtual_size = 100
+ domain.storage :file, :size => '100G', :type => 'qcow2'
+ domain.boot 'network'
+ domain.boot 'hd'
+ domain.nested = true
+ end
end
end