diff --git a/tests/data/cli/compare/virt-clone-clone-nvram.xml b/tests/data/cli/compare/virt-clone-clone-nvram.xml index d3bf29b38..13f164be1 100644 --- a/tests/data/cli/compare/virt-clone-clone-nvram.xml +++ b/tests/data/cli/compare/virt-clone-clone-nvram.xml @@ -8,7 +8,7 @@ hvm /usr/share/ovmf/ovmf-efi.fd - /nvram/clone-orig-clone_VARS.fd + /nvram/clone-orig-clone_VARS.fakeext diff --git a/tests/data/cli/virtclone/clone-nvram-auto.xml b/tests/data/cli/virtclone/clone-nvram-auto.xml index dc95f6acf..4c3b372be 100644 --- a/tests/data/cli/virtclone/clone-nvram-auto.xml +++ b/tests/data/cli/virtclone/clone-nvram-auto.xml @@ -8,7 +8,7 @@ hvm /usr/share/ovmf/ovmf-efi.fd - /nvram/clone-orig_VARS.fd + /nvram/clone-orig_VARS.fakeext diff --git a/virtinst/cloner.py b/virtinst/cloner.py index 556bfdbbd..adc0dc9bb 100644 --- a/virtinst/cloner.py +++ b/virtinst/cloner.py @@ -476,17 +476,21 @@ class Cloner(object): if not self._nvram_diskinfo: return + diskinfo = self._nvram_diskinfo + old_nvram = DeviceDisk(self.conn) + old_nvram_path = diskinfo.disk.get_source_path() + old_nvram.set_source_path(old_nvram_path) + new_nvram_path = self._new_nvram_path if new_nvram_path is None: - nvram_dir = os.path.dirname(self._new_guest.os.nvram) + ext = os.path.splitext(old_nvram_path)[1] + nvram_dir = os.path.dirname(old_nvram_path) new_nvram_path = os.path.join( - nvram_dir, "%s_VARS.fd" % self._new_guest.name) + nvram_dir, "%s_VARS%s" % + (os.path.basename(self._new_guest.name), ext or ".fd")) - diskinfo = self._nvram_diskinfo new_nvram = DeviceDisk(self.conn) new_nvram.set_source_path(new_nvram_path) - old_nvram = DeviceDisk(self.conn) - old_nvram.set_source_path(diskinfo.disk.get_source_path()) if (diskinfo.is_clone_requested() and new_nvram.wants_storage_creation() and