Things shouldn't be derived from Error, that is for sure. Can you verify that it actually works as expected with the change? Vish On Nov 16, 2011, at 6:46 AM, Ollie Leahy wrote: > I've tracked down the source of the problem deleting volumes that are > referenced by snapshots using nova.volume.ISCSIDriver. > > When the driver detects that the volume is busy then the delete_volume() > method in the VolumeDriver class in nova/volume/driver.py raises a > VolumeIsBusy exception with a keyword arg. However, the VolumeIsBusy > exception is derived from Error in nova/exception.py and neither > VolumeIsBusy nor Error accept keyword parameters. This means that an > unexpected keyword exception is raised, which the driver doesn't expect so > it sets the status of the volume to 'error-deleting' and stops. See the log > fragment below. > > > Deleting volumes works if I change nova/exception.py so that the > exception VolumeIsBusy derives from NovaException instead of Error. > NovaException can handle keyword arguments, so VolumeDrive.delete_volume() > sees the exception is expects (VolumeIsBusy) and it can handle the > situation correctly. > > Any opinions on whether this is the 'correct' way to fix this > problem? > > regards, > Ollie > > > > > > 2011-11-16 11:06:46,211 DEBUG nova.utils [-] Running cmd (subprocess): sudo lvdisplay --noheading -C -o Attr nova-volumes/volume-000000a4 from (pid=6234) execute /usr/lib/python2.7/dist-packages/nova/utils.py:165 > 2011-11-16 11:06:46,271 ERROR nova.volume.manager [-] driver raised exception <__init__() got an unexpected keyword argument 'volume_name'> > 2011-11-16 11:06:46,296 ERROR nova.rpc [-] Exception during message handling > (nova.rpc): TRACE: Traceback (most recent call last): > (nova.rpc): TRACE: File "/usr/lib/python2.7/dist-packages/nova/rpc/impl_kombu.py", line 620, in _process_data > (nova.rpc): TRACE: rval = node_func(context=ctxt, **node_args) > (nova.rpc): TRACE: File "/usr/lib/python2.7/dist-packages/nova/volume/manager.py", line 189, in delete_volume > (nova.rpc): TRACE: raise > (nova.rpc): TRACE: TypeError: exceptions must be old-style classes or derived from BaseException, not NoneType > (nova.rpc): TRACE: > > > # diff -c /usr/share/pyshared/nova/exception.py{,.backup} > *** /usr/share/pyshared/nova/exception.py 2011-11-16 11:46:31.000000000 +0000 > --- /usr/share/pyshared/nova/exception.py.backup 2011-11-16 11:39:04.000000000 +0000 > *************** > *** 370,376 **** > message = _("Snapshot %(snapshot_id)s could not be found.") > > > ! class VolumeIsBusy(NovaException): > message = _("deleting volume %(volume_name)s that has snapshot") > > > --- 370,376 ---- > message = _("Snapshot %(snapshot_id)s could not be found.") > > > ! class VolumeIsBusy(Error): > message = _("deleting volume %(volume_name)s that has snapshot") > > > > -----Original Message----- > From: Leahy, Oliver > Sent: 15 November 2011 14:35 > To: 'Bug 888649' > Subject: RE: [Bug 888649] [NEW] Snapshots left in undeletable state > > On my installation I can delete a volume that is referenced by a > snapshot. I will try to understand why this is so and get back to > you. > > Though as I said in my previous message the behavior of the LVM based > driver is different to the behavior I described in my original bug > report. > > > Regards, > Ollie > > -----Original Message----- > From: