From bb0ea0d6d5d68ed2061f3ab3be863b83e9199c73 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Fri, 29 May 2020 08:45:11 +0200 Subject: [PATCH] vm: clone mac address via xml Fixes: https://pagure.io/koji/issue/2289 --- vm/kojivmd | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vm/kojivmd b/vm/kojivmd index d3ca2c2b..3366d0b3 100755 --- a/vm/kojivmd +++ b/vm/kojivmd @@ -492,6 +492,10 @@ class VMExecTask(BaseTaskHandler): curr_mem_node = ctx.xpathEval('/domain/currentMemory')[0] if str(mem) != curr_mem_node.getContent(): curr_mem_node.setContent(str(mem)) + if opts.get('static_mac'): + mac = opts['static_mac'] + mac_node = ctx.xpathEval('/domain/devices/interface/mac')[0] + mac_node.setProp('address', mac) fixed_xml = str(doc) ctx.xpathFreeContext() doc.freeDoc() @@ -517,7 +521,9 @@ class VMExecTask(BaseTaskHandler): if opts.get('static_mac'): orig_mac = self.macAddr(orig_vm) - cmd += ["--mac", orig_mac] + #doesn't work anymore, needs to place mac address inside the xml + #cmd += ["--mac", orig_mac] + opts['static_mac'] = orig_mac proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)