//RemoveVolume : Remove a Volume from existence func (h *StorageHandlersImpl) RemoveVolume(params storage.RemoveVolumeParams) middleware.Responder { defer trace.End(trace.Begin("storage_handlers.RemoveVolume")) op := trace.NewOperation(context.Background(), fmt.Sprintf("VolumeDestroy(%s)", params.Name)) err := h.volumeCache.VolumeDestroy(op, params.Name) if err != nil { switch { case os.IsNotExist(err): return storage.NewRemoveVolumeNotFound().WithPayload(&models.Error{ Message: err.Error(), }) case spl.IsErrVolumeInUse(err): return storage.NewRemoveVolumeConflict().WithPayload(&models.Error{ Message: err.Error(), }) default: return storage.NewRemoveVolumeInternalServerError().WithPayload(&models.Error{ Message: err.Error(), }) } } return storage.NewRemoveVolumeOK() }
//RemoveVolume : Remove a Volume from existence func (handler *StorageHandlersImpl) RemoveVolume(params storage.RemoveVolumeParams) middleware.Responder { defer trace.End(trace.Begin("storage_handlers.RemoveVolume")) err := storageVolumeLayer.VolumeDestroy(context.TODO(), params.Name) if err != nil { switch err := err.(type) { default: return storage.NewRemoveVolumeInternalServerError().WithPayload(&models.Error{ Message: err.Error(), }) } } return storage.NewRemoveVolumeOK() }