aboutsummaryrefslogtreecommitdiff
path: root/bbot
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-04-22 14:49:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-04-22 14:49:37 +0200
commit239f17cd66b8e9480373274f2a9784b61fc49b47 (patch)
tree3d1fda77f98939a70743353a530a03b782298af3 /bbot
parent32a8fa8ffba89eb0d52227ae352b6d48ad97f287 (diff)
Add support for ifname=? and mac=? in kvm options
Diffstat (limited to 'bbot')
-rw-r--r--bbot/machine.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/bbot/machine.cxx b/bbot/machine.cxx
index de394b6..0bd2e86 100644
--- a/bbot/machine.cxx
+++ b/bbot/machine.cxx
@@ -205,7 +205,29 @@ namespace bbot
strings os;
if (mm.options)
+ {
os = mm.unquoted_options ();
+
+ // Pre-process ifname=? and mac=?.
+ //
+ auto sub = [] (string& o, const char* s, const string& r)
+ {
+ size_t p (o.find (s));
+
+ if (p != string::npos)
+ {
+ p = o.find ('?', p + 1);
+ assert (p != string::npos);
+ o.replace (p, 1, r);
+ }
+ };
+
+ for (string& o: os)
+ {
+ sub (o, "ifname=?", tap);
+ sub (o, "mac=?", mac);
+ }
+ }
else
{
auto add = [&os] (string o, string v)