rbd.py: create_cloned_volume will crash when depth greater than rbd_max_clone_depth

Bug #1834983 reported by liao junwei
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cinder
Incomplete
Undecided
Unassigned

Bug Description

I found rbd.py: create_cloned_volume have a bug when creating clone volume. if clone depth greater than rbd_max_clone_depth, it will create a tmp snap for cloning new volume, and delete it after new volume flattened.But the handle of parent volume have be closed after clone in the master branch code.When it want to delete tmp snap after new volume flatten, the process will throw exception.

        # Otherwise do COW clone.
        with RADOSClient(self) as client:
            src_volume = self.rbd.Image(client.ioctx, src_name)
            LOG.debug("creating snapshot='%s'", clone_snap)
            try:
                # Create new snapshot of source volume
                src_volume.create_snap(clone_snap)
                src_volume.protect_snap(clone_snap)
                # Now clone source volume snapshot
                LOG.debug("cloning '%(src_vol)s@%(src_snap)s' to "
                          "'%(dest)s'",
                          {'src_vol': src_name, 'src_snap': clone_snap,
                           'dest': dest_name})
                self.RBDProxy().clone(client.ioctx, src_name, clone_snap,
                                      client.ioctx, dest_name,
                                      features=client.features)
            except Exception as e:
                src_volume.unprotect_snap(clone_snap)
                src_volume.remove_snap(clone_snap)
                msg = (_("Failed to clone '%(src_vol)s@%(src_snap)s' to "
                         "'%(dest)s', error: %(error)s") %
                       {'src_vol': src_name,
                        'src_snap': clone_snap,
                        'dest': dest_name,
                        'error': e})
                LOG.exception(msg)
                raise exception.VolumeBackendAPIException(data=msg)
            finally:
                src_volume.close() ##here will close parent volume!!

In my test, it will work successfully when remove this code.

Revision history for this message
Eric Harney (eharney) wrote :

Can you provide info on the "crash"?

Changed in cinder:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.