diff --git a/tests/data/cli/compare/virt-xml-update-nodefine-succeed.xml b/tests/data/cli/compare/virt-xml-update-nodefine-succeed.xml
index b8c4063a..82bb6cdd 100644
--- a/tests/data/cli/compare/virt-xml-update-nodefine-succeed.xml
+++ b/tests/data/cli/compare/virt-xml-update-nodefine-succeed.xml
@@ -5,14 +5,14 @@
destroy
+
-+
++
+
+
-
+
diff --git a/tests/data/cli/compare/virt-xml-update-succeed.xml b/tests/data/cli/compare/virt-xml-update-succeed.xml
index 6d5070fb..165b64f1 100644
--- a/tests/data/cli/compare/virt-xml-update-succeed.xml
+++ b/tests/data/cli/compare/virt-xml-update-succeed.xml
@@ -26,7 +26,7 @@ Hotplug this device to the guest 'test'? (y/n): Device hotplug successful.
destroy
+
-+
++
+
+
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 430b25b5..3d41e357 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -1267,7 +1267,7 @@ c.add_compare("--edit --print-diff --qemu-commandline clearxml=yes", "edit-clear
c.add_compare("--print-diff --remove-device --serial 1", "remove-console-dup", input_file=(_VIRTXMLDIR + "virtxml-console-dup.xml"))
c.add_compare("--connect %(URI-KVM)s test-hyperv-uefi --edit --boot uefi", "hyperv-uefi-collision")
c.add_compare("--connect %(URI-KVM)s test-many-devices --edit --cpu host-copy", "edit-cpu-host-copy")
-c.add_compare("test --add-device --network default --update --confirm", "update-succeed", env={"VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL": "1"}, input_text="yes\nyes\n") # test hotplug success
+c.add_compare("test --add-device --network default --update --confirm", "update-succeed", env={"VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL": "1", "VIRTINST_TEST_SUITE_INCREMENT_MACADDR": "1"}, input_text="yes\nyes\n") # test hotplug success
c.add_compare("test --add-device --network default --update --confirm --no-define", "update-nodefine-succeed", env={"VIRTXML_TESTSUITE_UPDATE_IGNORE_FAIL": "1"}, input_text="yes\n") # test hotplug success without define
diff --git a/virtinst/devices/interface.py b/virtinst/devices/interface.py
index e5539d6d..f0e2341f 100644
--- a/virtinst/devices/interface.py
+++ b/virtinst/devices/interface.py
@@ -110,6 +110,25 @@ def _default_bridge(conn):
return ret
+_MAC_COUNTER = 0
+
+
+def _testsuite_mac():
+ # Generate predictable mac addresses for the test suite
+ # For some tests, we need to make sure that different mac addresses
+ # would _not_ be generated in normal operations, so we add some magic
+ # here to increment the generated address with a special env variable
+ global _MAC_COUNTER
+
+ base = "00:11:22:33:44:55"
+ ret = base[:-1] + str(int(base[-1]) + _MAC_COUNTER)
+ _MAC_COUNTER += 1
+
+ if "VIRTINST_TEST_SUITE_INCREMENT_MACADDR" not in os.environ:
+ _MAC_COUNTER = 0
+ return ret
+
+
class _VirtualPort(XMLBuilder):
XML_NAME = "virtualport"
@@ -139,8 +158,7 @@ class DeviceInterface(Device):
the connection.
"""
if conn.fake_conn_predictable():
- # Testing hack
- return "00:11:22:33:44:55"
+ return _testsuite_mac()
for ignore in range(256):
mac = _random_mac(conn)