Skip to content

Commit

Permalink
Delete swap VDI if not used
Browse files Browse the repository at this point in the history
Fixes bug 889196

Change-Id: I08f4484310c5a35e62ca761193790a464ad15ac9
  • Loading branch information
Johannes Erdfelt committed Feb 3, 2012
1 parent 8ac1b20 commit 8f50396
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions nova/virt/xenapi/vmops.py
Expand Up @@ -418,10 +418,14 @@ def _attach_disks(self, instance, disk_image_type, vm_ref, first_vdi_ref,

# Attach any other disks
for vdi in vdis[1:]:
if generate_swap and vdi['vdi_type'] == 'swap':
continue
vdi_ref = self._session.call_xenapi('VDI.get_by_uuid',
vdi['vdi_uuid'])

if generate_swap and vdi['vdi_type'] == 'swap':
# We won't be using it, so don't let it leak
VMHelper.destroy_vdi(self._session, vdi_ref)
continue

VolumeHelper.create_vbd(session=self._session, vm_ref=vm_ref,
vdi_ref=vdi_ref, userdevice=userdevice,
bootable=False)
Expand Down

0 comments on commit 8f50396

Please sign in to comment.