Skip to content

Commit

Permalink
issue when manually detached fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugome committed Jun 21, 2023
1 parent 95a6a53 commit 07686ea
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions internal/provider/csi/controller/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,18 @@ func (c *Controller) ControllerUnpublishVolume(ctx context.Context, request *csi
c.Logger.Info("volume gonna be unpublished", zap.String("nodeId", request.NodeId), zap.String("pool", poolName), zap.String("name", name), zap.String("key", key))
domain, err := lv.DomainLookupByUUID(nodeUuid)
if err != nil {
return nil, status.Error(codes.Unknown, fmt.Sprintf("unable to get domain: %s", err.Error()))
c.Logger.Warn("unable to get domain", zap.String("domain", request.NodeId), zap.String("pool", poolName), zap.String("name", name), zap.String("key", key), zap.Error(err))
return &csi.ControllerUnpublishVolumeResponse{}, nil
}
domainXml, err := lv.DomainGetXMLDesc(domain, 0)
if err != nil {
return nil, status.Error(codes.Unknown, fmt.Sprintf("unable to get domain: %s", err.Error()))
c.Logger.Warn("unable to get domain", zap.String("domain", request.NodeId), zap.String("pool", poolName), zap.String("name", name), zap.String("key", key), zap.Error(err))
return &csi.ControllerUnpublishVolumeResponse{}, nil
}
// TODO: check domain attached ?
if err := c.Driver.DettachDisk(lv, domainXml, serial); err != nil {
return nil, status.Error(codes.Unknown, fmt.Sprintf("unable to dettached disk to domain: %s", err.Error()))
c.Logger.Warn("unable to dettached disk to domain", zap.String("domain", request.NodeId), zap.String("pool", poolName), zap.String("name", name), zap.String("key", key), zap.Error(err))
return &csi.ControllerUnpublishVolumeResponse{}, nil
}
c.Logger.Info("volume dettached from domain", zap.String("nodeId", request.NodeId), zap.String("volId", request.VolumeId), zap.String("domain", domain.Name))
return &csi.ControllerUnpublishVolumeResponse{}, nil
Expand Down

0 comments on commit 07686ea

Please sign in to comment.