示例#1
0
    def DeleteVolume(self, request, context):
        start_time = time.time()

        if not request.volume_id:
            errmsg = "Volume ID is empty and must be provided"
            logging.error(errmsg)
            context.set_details(errmsg)
            context.set_code(grpc.StatusCode.INVALID_ARGUMENT)
            return csi_pb2.DeleteVolumeResponse()

        delete_volume(request.volume_id)
        logging.info(
            logf("Delete Volume response completed",
                 name=request.volume_id,
                 duration_seconds=time.time() - start_time))
        return csi_pb2.DeleteVolumeResponse()
示例#2
0
 def DeleteVolume(self, request, context):
     start_time = time.time()
     delete_volume(request.volume_id)
     logging.info(
         logf("Volume deleted",
              name=request.volume_id,
              duration_seconds=time.time() - start_time))
     return csi_pb2.DeleteVolumeResponse()
示例#3
0
    def DeleteVolume(self, request, context):
        hostvol = request.volume_context.get("hostvol", "")
        mntdir = os.path.join(HOSTVOL_MOUNTDIR, hostvol)

        # Try to mount the Host Volume, handle
        # failure if already mounted
        mount_glusterfs(hostvol, mntdir)

        # TODO: get pvtype from storage class
        pvtype = request.volume_context.get("pvtype", "")
        volpath = os.path.join(mntdir, pvtype, request.name)
        if pvtype == PV_TYPE_VIRTBLOCK:
            os.remove(volpath)
        else:
            os.removedirs(volpath)

        return csi_pb2.DeleteVolumeResponse()