-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(vm): remove disk attachement capacity available #633
base: main
Are you sure you want to change the base?
feat(vm): remove disk attachement capacity available #633
Conversation
a54e04d
to
08f2c5b
Compare
Signed-off-by: Valeriy Khorunzhin <[email protected]>
Signed-off-by: Valeriy Khorunzhin <[email protected]>
08f2c5b
to
6d1ee4b
Compare
@@ -95,6 +97,20 @@ func (h *BlockDeviceHandler) Handle(ctx context.Context, s state.VirtualMachineS | |||
return reconcile.Result{}, fmt.Errorf("unable to add block devices finalizers: %w", err) | |||
} | |||
|
|||
// Get number of connected block devices | |||
// If it greater limit then set condition to false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is greater
cb. | ||
Status(metav1.ConditionFalse). | ||
Reason(vmcondition.ReasonBlockDeviceCapacityReached). | ||
Message(fmt.Sprintf("Can not attach %d block devices (%d is maximum) to `VirtualMachine` %q", blockDeviceAttachedCount, common.VmBlockDeviceAttachedLimit, changed.Name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to return here?
@@ -102,8 +101,7 @@ const ( | |||
ReasonVirtualMachineClassTerminating Reason = "VirtualMachineClassTerminating" | |||
ReasonVirtualMachineClassNotExists Reason = "VirtalMachineClassNotExists" | |||
|
|||
ReasonBlockDeviceCapacityAvailable Reason = "BlockDeviceCapacityAvailable" | |||
ReasonBlockDeviceCapacityReached Reason = "BlockDeviceCapacityReached" | |||
ReasonBlockDeviceCapacityReached Reason = "BlockDeviceCapacityReached" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be BlockDeviceLimitExceeded ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Describe what this reason means, when it occurs. It's important to add docs for new reasons/types here.
@@ -57,6 +58,7 @@ func NewBlockDeviceHandler(cl client.Client, recorder eventrecord.EventRecorderL | |||
type BlockDeviceHandler struct { | |||
client client.Client | |||
recorder eventrecord.EventRecorderLogger | |||
service IBlockDeviceService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of service?
Need to rename
|
||
type EventRecorder = record.EventRecorder | ||
|
||
type IBlockDeviceService interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just BlockDeviceService ?
Description
Remove
DiskAttachementCapacityAvailable
condition, move it's logic toBlockDevicesReady
new reason.Why do we need it, and what problem does it solve?
What is the expected result?
Checklist