One (hidden) feaure of snooze is the ability to pass an hostId parameter in you submission request :
"virtualMachineTemplates"=><a href='http://snooze.inria.fr/static-scheduling-in-snooze/out-54_r/' rel='attachment wp-att-2025'>out-54_r</a>
[
{
"name" => "vm1",
"hostId" => "parapluie-25",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 2,
"memory" => 2097152,
}
]
In the above code (ruby style) will tell snooze that we want the vm1 on host parapluie-25.
Originaly the id was an uuid randomly generated at start time of each node. With a recent fix, different way (determined in the config file) can be used to generate the id. This make the feature more practical to use.
Example of description :
#!/usr/bin/env ruby
require 'json'
$templates = {
"virtualMachineTemplates"=>
[
{
"name" => "vm1",
"hostId" => "parapluie-25",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 2,
"memory" => 2097152,
},
{
"name" => "vm2",
"hostId" => "parapluie-25",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 4,
"memory" => 2097152,
},
{
"name" => "vm3",
"hostId" => "parapide-2",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 4,
"memory" => 1048576,
},
{
"name" => "vm4",
"hostId" => "parapide-2",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 2,
"memory" => 2097152,
},
{
"name" => "vm5",
"hostId" => "parapide-2",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 2,
"memory" => 2097152,
},
{
"name" => "vm6",
"hostId" => "parapluie-8",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 8,
"memory" => 1048576,
},
{
"name" => "vm7",
"hostId" => "parapluie-21",
"imageId" => "debian-hadoop-context-big.qcow2",
"vcpus" => 12,
"memory" => 2097152,
}
]
}
`curl
-X 'POST'
-H 'Content-type: application/json'
-d '#{JSON.dump($templates)}' http://localhost:5000/bootstrap?startVirtualCluster`
You can then sucessively destroy and restart in the same conditions :
for i in {1..8}
do
curl \
-d "vm$i"\
-X 'POST'\
localhost:5000/bootstrap?destroyVirtualMachine
done