def cgsnapshot_context(self, cg, name):
     from cinderclient.v2.cgsnapshots import CgsnapshotManager
     cgsm = CgsnapshotManager(get_cinder_v2_client())
     cgs = cgsm.create(consistencygroup_id=cg.id, name=name)
     self.wait_for_object_creation(cgs, timeout=30)
     try:
         yield cgs
     finally:
         cgs.delete()
         self.wait_for_object_deletion(cgs, timeout=30)
 def cleanup_cgsnaps():
     from cinderclient.v2.cgsnapshots import CgsnapshotManager
     cgsm = CgsnapshotManager(get_cinder_v2_client())
     for snap in cgsm.list():
         snap.delete()