Skip to content

Commit 8bba865

Browse files
authored
Merge pull request #62 from timohl/master
Added Evacuate task and retry_counter.
2 parents 8bffee7 + 9037549 commit 8bba865

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

include/fast-lib/message/migfra/task.hpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct Migrate :
208208

209209
std::string vm_name;
210210
std::string dest_hostname;
211+
Optional<unsigned int> retry_counter;
211212
Optional<std::string> migration_type;
212213
Optional<bool> rdma_migration;
213214
Optional<std::string> pscom_hook_procs;
@@ -216,6 +217,40 @@ struct Migrate :
216217
Optional<std::vector<std::vector<unsigned int>>> vcpu_map;
217218
};
218219

220+
/**
221+
* \brief Task to evacuate all domains from a node.
222+
*/
223+
struct Evacuate :
224+
public Task
225+
{
226+
Evacuate();
227+
/**
228+
* \brief Constructor for Evacuate task.
229+
*
230+
* \param destinations List of hosts to migrate to.
231+
* \param mode Evacuation mode (auto/compact/scatter).
232+
* \param overbooking Allows overbooking of destination nodes.
233+
* \param migration_type Option to enable live migration.
234+
* \param rdma_migration Option to enable rdma migration.
235+
* \param concurrent_execution Execute this Task in dedicated thread.
236+
* \param pscom_hook_procs Number of processes to suspend during migration as string or "auto" for auto detection.
237+
* \param time_measurement Measure execution time and send in Result.
238+
*/
239+
Evacuate(std::vector<std::string> destinations, std::string mode, bool overbooking, std::string migration_type, bool rdma_migration, bool concurrent_execution, std::string pscom_hook_procs, bool time_measurement);
240+
241+
YAML::Node emit() const override;
242+
void load(const YAML::Node &node) override;
243+
244+
std::vector<std::string> destinations;
245+
Optional<std::string> mode;
246+
Optional<bool> overbooking;
247+
Optional<unsigned int> retry_counter;
248+
Optional<std::string> migration_type;
249+
Optional<bool> rdma_migration;
250+
Optional<std::string> pscom_hook_procs;
251+
Optional<std::string> transport;
252+
};
253+
219254
/**
220255
* \brief Task to repin vcpus of a virtual machine.
221256
*/
@@ -295,6 +330,7 @@ YAML_CONVERT_IMPL(fast::msg::migfra::Start)
295330
YAML_CONVERT_IMPL(fast::msg::migfra::Stop)
296331
YAML_CONVERT_IMPL(fast::msg::migfra::Swap_with)
297332
YAML_CONVERT_IMPL(fast::msg::migfra::Migrate)
333+
YAML_CONVERT_IMPL(fast::msg::migfra::Evacuate)
298334
YAML_CONVERT_IMPL(fast::msg::migfra::Repin)
299335
YAML_CONVERT_IMPL(fast::msg::migfra::Suspend)
300336
YAML_CONVERT_IMPL(fast::msg::migfra::Resume)

src/message/migfra/task.cpp

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ void Swap_with::load(const YAML::Node &node)
361361
//
362362

363363
Migrate::Migrate() :
364+
retry_counter("retry_counter"),
364365
migration_type("migration-type"),
365366
rdma_migration("rdma-migration"),
366367
pscom_hook_procs("pscom-hook-procs"),
@@ -374,6 +375,7 @@ Migrate::Migrate(std::string vm_name, std::string dest_hostname, std::string mig
374375
Task::Task(concurrent_execution, time_measurement),
375376
vm_name(std::move(vm_name)),
376377
dest_hostname(std::move(dest_hostname)),
378+
retry_counter("retry_counter"),
377379
migration_type("migration-type", std::move(migration_type)),
378380
rdma_migration("rdma-migration", rdma_migration),
379381
pscom_hook_procs("pscom-hook-procs", std::to_string(pscom_hook_procs)),
@@ -387,6 +389,7 @@ Migrate::Migrate(std::string vm_name, std::string dest_hostname, std::string mig
387389
Task::Task(concurrent_execution, time_measurement),
388390
vm_name(std::move(vm_name)),
389391
dest_hostname(std::move(dest_hostname)),
392+
retry_counter("retry_counter"),
390393
migration_type("migration-type", std::move(migration_type)),
391394
rdma_migration("rdma-migration", rdma_migration),
392395
pscom_hook_procs("pscom-hook-procs", std::move(pscom_hook_procs)),
@@ -402,6 +405,7 @@ YAML::Node Migrate::emit() const
402405
node["vm-name"] = vm_name;
403406
node["destination"] = dest_hostname;
404407
YAML::Node params = node["parameter"];
408+
merge_node(params, retry_counter.emit());
405409
merge_node(params, migration_type.emit());
406410
merge_node(params, rdma_migration.emit());
407411
merge_node(params, pscom_hook_procs.emit());
@@ -419,6 +423,7 @@ void Migrate::load(const YAML::Node &node)
419423
fast::load(vm_name, node["vm-name"]);
420424
fast::load(dest_hostname, node["destination"]);
421425
if (node["parameter"]) {
426+
retry_counter.load(node["parameter"]);
422427
migration_type.load(node["parameter"]);
423428
rdma_migration.load(node["parameter"]);
424429
pscom_hook_procs.load(node["parameter"]);
@@ -428,6 +433,65 @@ void Migrate::load(const YAML::Node &node)
428433
}
429434
}
430435

436+
//
437+
// Evacuate implementation
438+
//
439+
440+
Evacuate::Evacuate() :
441+
mode("mode"),
442+
overbooking("overbooking"),
443+
retry_counter("retry_counter"),
444+
migration_type("migration-type"),
445+
rdma_migration("rdma-migration"),
446+
pscom_hook_procs("pscom-hook-procs"),
447+
transport("transport")
448+
{
449+
}
450+
451+
Evacuate::Evacuate(std::vector<std::string> destinations, std::string mode, bool overbooking, std::string migration_type, bool rdma_migration, bool concurrent_execution, std::string pscom_hook_procs, bool time_measurement) :
452+
Task::Task(concurrent_execution, time_measurement),
453+
destinations(std::move(destinations)),
454+
mode("mode", std::move(mode)),
455+
overbooking("overbooking", overbooking),
456+
retry_counter("retry_counter"),
457+
migration_type("migration-type", std::move(migration_type)),
458+
rdma_migration("rdma-migration", rdma_migration),
459+
pscom_hook_procs("pscom-hook-procs", std::move(pscom_hook_procs)),
460+
transport("transport")
461+
{
462+
}
463+
464+
YAML::Node Evacuate::emit() const
465+
{
466+
YAML::Node node = Task::emit();
467+
node["destinations"] = destinations;
468+
YAML::Node params = node["parameter"];
469+
merge_node(params, mode.emit());
470+
merge_node(params, overbooking.emit());
471+
merge_node(params, retry_counter.emit());
472+
merge_node(params, migration_type.emit());
473+
merge_node(params, rdma_migration.emit());
474+
merge_node(params, pscom_hook_procs.emit());
475+
merge_node(params, transport.emit());
476+
return node;
477+
}
478+
479+
void Evacuate::load(const YAML::Node &node)
480+
{
481+
Task::load(node);
482+
fast::load(destinations, node["destinations"]);
483+
if (node["parameter"]) {
484+
mode.load(node["parameter"]);
485+
overbooking.load(node["parameter"]);
486+
retry_counter.load(node["parameter"]);
487+
migration_type.load(node["parameter"]);
488+
rdma_migration.load(node["parameter"]);
489+
pscom_hook_procs.load(node["parameter"]);
490+
transport.load(node["parameter"]);
491+
}
492+
}
493+
494+
431495
//
432496
// Repin implementation
433497
//

0 commit comments

Comments
 (0)