Skip to content

Commit 7c47839

Browse files
authored
Merge pull request #46 from timohl/master
Added pscom-hook-procs option to swap-with option in migrate task.
2 parents 6406902 + a119916 commit 7c47839

File tree

2 files changed

+73
-1
lines changed

2 files changed

+73
-1
lines changed

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,22 @@ struct Stop :
149149
Optional<bool> undefine;
150150
};
151151

152+
/**
153+
* \brief Used for the swap-with option of the migrate task.
154+
*/
155+
struct Swap_with :
156+
public fast::Serializable
157+
{
158+
Swap_with();
159+
160+
YAML::Node emit() const override;
161+
void load(const YAML::Node &node) override;
162+
163+
std::string vm_name;
164+
Optional<std::string> pscom_hook_procs;
165+
};
166+
167+
152168
/**
153169
* \brief Task to migrate a virtual machine.
154170
*/
@@ -190,7 +206,7 @@ struct Migrate :
190206
Optional<bool> rdma_migration;
191207
Optional<std::string> pscom_hook_procs;
192208
Optional<std::string> transport;
193-
Optional<std::string> swap_with;
209+
Optional<Swap_with> swap_with;
194210
Optional<std::vector<std::vector<unsigned int>>> vcpu_map;
195211
};
196212

@@ -271,6 +287,7 @@ YAML_CONVERT_IMPL(fast::msg::migfra::Task)
271287
YAML_CONVERT_IMPL(fast::msg::migfra::Task_container)
272288
YAML_CONVERT_IMPL(fast::msg::migfra::Start)
273289
YAML_CONVERT_IMPL(fast::msg::migfra::Stop)
290+
YAML_CONVERT_IMPL(fast::msg::migfra::Swap_with)
274291
YAML_CONVERT_IMPL(fast::msg::migfra::Migrate)
275292
YAML_CONVERT_IMPL(fast::msg::migfra::Repin)
276293
YAML_CONVERT_IMPL(fast::msg::migfra::Suspend)

src/message/migfra/task.cpp

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ namespace fast {
1717
namespace msg {
1818
namespace migfra {
1919

20+
//
21+
// Task implementation
22+
//
23+
2024
Task::Task() :
2125
concurrent_execution("concurrent-execution"),
2226
time_measurement("time-measurement"),
@@ -47,6 +51,10 @@ void Task::load(const YAML::Node &node)
4751
driver.load(node);
4852
}
4953

54+
//
55+
// Task_container implementation
56+
//
57+
5058
Task_container::Task_container() :
5159
concurrent_execution("concurrent-execution"),
5260
id("id")
@@ -192,6 +200,10 @@ void Task_container::load(const YAML::Node &node)
192200
id.load(node);
193201
}
194202

203+
//
204+
// Start implementation
205+
//
206+
195207
Start::Start() :
196208
vm_name("vm-name"),
197209
vcpus("vcpus"),
@@ -252,6 +264,10 @@ void Start::load(const YAML::Node &node)
252264
transient.load(node);
253265
}
254266

267+
//
268+
// Stop implementation
269+
//
270+
255271
Stop::Stop() :
256272
force("force"),
257273
undefine("undefine")
@@ -283,6 +299,33 @@ void Stop::load(const YAML::Node &node)
283299
undefine.load(node);
284300
}
285301

302+
//
303+
// Swap_with implementation
304+
//
305+
306+
Swap_with::Swap_with() :
307+
pscom_hook_procs("pscom-hook-procs")
308+
{
309+
}
310+
311+
YAML::Node Swap_with::emit() const
312+
{
313+
YAML::Node node;
314+
node["vm-name"] = vm_name;
315+
merge_node(node, pscom_hook_procs.emit());
316+
return node;
317+
}
318+
319+
void Swap_with::load(const YAML::Node &node)
320+
{
321+
fast::load(vm_name, node["vm-name"]);
322+
pscom_hook_procs.load(node);
323+
}
324+
325+
//
326+
// Migrate implementation
327+
//
328+
286329
Migrate::Migrate() :
287330
migration_type("migration-type"),
288331
rdma_migration("rdma-migration"),
@@ -351,6 +394,10 @@ void Migrate::load(const YAML::Node &node)
351394
}
352395
}
353396

397+
//
398+
// Repin implementation
399+
//
400+
354401
Repin::Repin()
355402
{
356403
}
@@ -378,6 +425,10 @@ void Repin::load(const YAML::Node &node)
378425
fast::load(vcpu_map, node["vcpu-map"]);
379426
}
380427

428+
//
429+
// Suspend implementation
430+
//
431+
381432
Suspend::Suspend()
382433
{
383434
}
@@ -401,6 +452,10 @@ void Suspend::load(const YAML::Node &node)
401452
fast::load(vm_name, node["vm-name"]);
402453
}
403454

455+
//
456+
// Resume implementation
457+
//
458+
404459
Resume::Resume()
405460
{
406461
}

0 commit comments

Comments
 (0)