From 4a91d8a6a5518f3d88f0d09bdbf24cbc309dff32 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 26 Apr 2016 15:06:22 -0600 Subject: [PATCH] Prevent non linked cloned hard disks to be detached when using VirtualBox linked cloned VMs. Fixes #1184. --- gns3server/modules/virtualbox/virtualbox_vm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gns3server/modules/virtualbox/virtualbox_vm.py b/gns3server/modules/virtualbox/virtualbox_vm.py index a3748414..7e5174d0 100644 --- a/gns3server/modules/virtualbox/virtualbox_vm.py +++ b/gns3server/modules/virtualbox/virtualbox_vm.py @@ -368,12 +368,12 @@ class VirtualBoxVM(BaseVM): hdd_files = yield from self._get_all_hdd_files() vm_info = yield from self._get_vm_info() for entry, value in vm_info.items(): - match = re.search("^([\s\w]+)\-(\d)\-(\d)$", entry) + match = re.search("^([\s\w]+)\-(\d)\-(\d)$", entry) # match Controller-PortNumber-DeviceNumber entry if match: controller = match.group(1) port = match.group(2) device = match.group(3) - if value in hdd_files: + if value in hdd_files and os.path.exists(os.path.join(self.working_dir, self._vmname, "Snapshots", os.path.basename(value))): log.info("VirtualBox VM '{name}' [{id}] detaching HDD {controller} {port} {device}".format(name=self.name, id=self.id, controller=controller,