diff --git a/virttest/env_process.py b/virttest/env_process.py index 0c46a51b04..64089f6ab6 100644 --- a/virttest/env_process.py +++ b/virttest/env_process.py @@ -296,6 +296,8 @@ def preprocess_vm(test, params, env, name): vm.update_vm_id() vm.virtnet = utils_net.VirtNet(params, name, vm.instance) # Start the VM (or restart it if it's already up) + if vm.is_alive(): + vm.destroy(free_mac_addresses=False) if params.get("reuse_previous_config", "no") == "no": vm.create(name, params, test.bindir, timeout=int(params.get("vm_create_timeout", 90)), diff --git a/virttest/qemu_vm.py b/virttest/qemu_vm.py index 4d20c0eb00..52e583aba5 100644 --- a/virttest/qemu_vm.py +++ b/virttest/qemu_vm.py @@ -2943,7 +2943,6 @@ def create(self, name=None, params=None, root_dir=None, :raise PrivateBridgeError: If fail to bring the private bridge """ error_context.context("creating '%s'" % self.name) - self.destroy(free_mac_addresses=False) if name is not None: self.name = name @@ -4934,6 +4933,7 @@ def restore_from_file(self, path): """ if self.is_alive(): self.verify_status('paused') # Throws exception if not + self.destroy(gracefully=False, free_mac_addresses=False) LOG.debug("Restoring VM %s from %s" % (self.name, path)) # Rely on create() in incoming migration mode to do the 'right thing' self.create(name=self.name, params=self.params, root_dir=self.root_dir,