From 8f5039615826539dca4e5532185d6c03e386dd87 Mon Sep 17 00:00:00 2001 From: Johannes Erdfelt Date: Fri, 3 Feb 2012 18:03:39 +0000 Subject: Delete swap VDI if not used Fixes bug 889196 Change-Id: I08f4484310c5a35e62ca761193790a464ad15ac9 --- nova/virt/xenapi/vmops.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nova/virt/xenapi/vmops.py b/nova/virt/xenapi/vmops.py index c7f713ea2..139eb3262 100644 --- a/nova/virt/xenapi/vmops.py +++ b/nova/virt/xenapi/vmops.py @@ -418,10 +418,14 @@ class VMOps(object): # 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) -- cgit