1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-15 12:59:06 +00:00

Prevent non linked cloned hard disks to be detached when using VirtualBox linked cloned VMs. Fixes #1184.

This commit is contained in:
grossmj 2016-04-26 15:06:22 -06:00
parent b408f29726
commit 4a91d8a6a5

View File

@ -368,12 +368,12 @@ class VirtualBoxVM(BaseVM):
hdd_files = yield from self._get_all_hdd_files() hdd_files = yield from self._get_all_hdd_files()
vm_info = yield from self._get_vm_info() vm_info = yield from self._get_vm_info()
for entry, value in vm_info.items(): 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: if match:
controller = match.group(1) controller = match.group(1)
port = match.group(2) port = match.group(2)
device = match.group(3) 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, log.info("VirtualBox VM '{name}' [{id}] detaching HDD {controller} {port} {device}".format(name=self.name,
id=self.id, id=self.id,
controller=controller, controller=controller,