diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-22 14:49:37 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-04-22 14:49:37 +0200 |
commit | 239f17cd66b8e9480373274f2a9784b61fc49b47 (patch) | |
tree | 3d1fda77f98939a70743353a530a03b782298af3 | |
parent | 32a8fa8ffba89eb0d52227ae352b6d48ad97f287 (diff) |
Add support for ifname=? and mac=? in kvm options
-rw-r--r-- | bbot/machine.cxx | 22 | ||||
-rw-r--r-- | doc/manual.cli | 6 |
2 files changed, 25 insertions, 3 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) diff --git a/doc/manual.cli b/doc/manual.cli index a851008..f26f350 100644 --- a/doc/manual.cli +++ b/doc/manual.cli @@ -244,9 +244,9 @@ the header values must appear before any non-header values. For \c{kvm} machines, if this value is present, then it replaces the default network and disk configuration when starting the QEMU/KVM - hypervisor. - -|| + hypervisor The options are pre-processed by replacing the question + mark in \c{ifname=?} and \c{mac=?} strings with the network interface + and MAC address, respectively.|| \h#arch-task-manifest|Task Manifest| |