Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
Signed-off-by: yaroslavborbat <[email protected]>
  • Loading branch information
yaroslavborbat committed Jan 18, 2025
1 parent e548ada commit 5c7d214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ func NewAttachmentService(client Client, virtClient kubeclient.Client, controlle
}

var (
ErrVolumeStatusNotReady = errors.New("hotplug is not ready")
ErrBlockDeviceIsSpecAttached = errors.New("block device is already attached to the virtual machine spec")
ErrHotPlugRequestAlreadySent = errors.New("attachment request is already sent")
ErrVirtualMachineWaitsForRestartApproval = errors.New("virtual machine waits for restart approval")
ErrVolumeStatusNotReady = errors.New("hotplug is not ready")
ErrBlockDeviceIsSpecAttached = errors.New("block device is already attached to the virtual machine spec")
ErrHotPlugRequestAlreadySent = errors.New("attachment request is already sent")
)

func (s AttachmentService) IsHotPlugged(ad *AttachmentDisk, vm *virtv2.VirtualMachine, kvvmi *virtv1.VirtualMachineInstance) (bool, error) {
Expand Down Expand Up @@ -125,10 +124,6 @@ func (s AttachmentService) CanHotPlug(ad *AttachmentDisk, vm *virtv2.VirtualMach
}
}

if len(vm.Status.RestartAwaitingChanges) > 0 {
return false, ErrVirtualMachineWaitsForRestartApproval
}

return true, nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,15 +254,6 @@ func (h LifeCycleHandler) Handle(ctx context.Context, vmbda *virtv2.VirtualMachi
Reason(vmbdacondition.AttachmentRequestSent).
Message("Attachment request sent: attachment is in progress.")
return reconcile.Result{}, nil
case errors.Is(err, service.ErrVirtualMachineWaitsForRestartApproval):
log.Info("Virtual machine waits for restart approval")

vmbda.Status.Phase = virtv2.BlockDeviceAttachmentPhasePending
cb.
Status(metav1.ConditionFalse).
Reason(vmbdacondition.NotAttached).
Message(service.CapitalizeFirstLetter(err.Error()))
return reconcile.Result{}, nil
case blockDeviceLimitCondition.Status != metav1.ConditionTrue:
log.Info("Virtual machine block device capacity reached")

Expand Down

0 comments on commit 5c7d214

Please sign in to comment.