Skip to content

Commit

Permalink
Clean QoS on virtio-blk deletion.
Browse files Browse the repository at this point in the history
Signed-off-by: Artsiom Koltun <[email protected]>
  • Loading branch information
artek-koltun committed Jun 2, 2023
1 parent 5bfe3ef commit 9ce2048
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/frontend/blk.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (s *Server) CreateVirtioBlk(ctx context.Context, in *pb.CreateVirtioBlkRequ
}

// DeleteVirtioBlk deletes a Virtio block device
func (s *Server) DeleteVirtioBlk(_ context.Context, in *pb.DeleteVirtioBlkRequest) (*emptypb.Empty, error) {
func (s *Server) DeleteVirtioBlk(ctx context.Context, in *pb.DeleteVirtioBlkRequest) (*emptypb.Empty, error) {
log.Printf("DeleteVirtioBlk: Received from client: %v", in)
controller, ok := s.Virt.BlkCtrls[in.Name]
if !ok {
Expand All @@ -120,6 +120,16 @@ func (s *Server) DeleteVirtioBlk(_ context.Context, in *pb.DeleteVirtioBlkReques
log.Printf("Could not delete: %v", in)
return nil, spdk.ErrUnexpectedSpdkCallResult
}

if s.needToSetVirtioBlkQos(controller) {
if _, err := s.Virt.qosProvider.DeleteQosVolume(ctx,
&pb.DeleteQosVolumeRequest{
Name: s.qosVolumeIDFromVirtioBlkName(controller.Name),
}); err != nil {
log.Printf("error: %v", err)
return nil, err
}
}
delete(s.Virt.BlkCtrls, controller.Name)
return &emptypb.Empty{}, nil
}
Expand Down

0 comments on commit 9ce2048

Please sign in to comment.