-
Notifications
You must be signed in to change notification settings - Fork 8
fix(linstorvolumemanager): don't allow InUse volumes to be deleted #106
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
base: 3.2.12-8.3
Are you sure you want to change the base?
Conversation
2e28b7a to
a86786c
Compare
a86786c to
e7af4ae
Compare
| :param: volume_uuid | ||
| :rtype: dict | ||
| """ | ||
| for volume in self.get_resources_info().values(): |
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.
The cost can be really important. I guess we can extract a few logic of get_resources_info to reduce this expense.
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.
I've introduced some caching mechanism to mitigate this issue :)
drivers/linstorvolumemanager.py
Outdated
|
|
||
| raise LinstorVolumeManagerError( | ||
| f"Could not find info about volume `{volume_uuid}`", | ||
| LinstorVolumeManagerError.ERR_VOLUME_DESTROY |
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.
| LinstorVolumeManagerError.ERR_VOLUME_DESTROY | |
| LinstorVolumeManagerError.ERR_VOLUME_NOT_EXISTS |
drivers/linstorvolumemanager.py
Outdated
|
|
||
| return resources | ||
|
|
||
| def get_resource_info(self, volume_uuid: str) -> Dict: |
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.
| def get_resource_info(self, volume_uuid: str) -> Dict: | |
| def get_resource_info(self, volume_uuid: str) -> Dict[str, Any]: |
Not the best suggestion but meh. :p I think we should try to be explicit even when it's not simple. Of course, within the limits of readability!
e7af4ae to
91916fe
Compare
ae8c064 to
91916fe
Compare
Fix some typo in docstring Signed-off-by: Antoine Bartuccio <antoine.bartuccio@vates.tech>
91916fe to
a90db03
Compare
Millefeuille42
left a comment
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.
Not blocking. Other than that, LGTM.
drivers/linstorvolumemanager.py
Outdated
| Give all resources info with provided uuid on current group name. | ||
| :param volume_uuid str: volume uuid to search for | ||
| :rtype: dict |
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.
| Give all resources info with provided uuid on current group name. | |
| :param volume_uuid str: volume uuid to search for | |
| :rtype: dict | |
| Give all resource info related to provided UUID in the current group. | |
| :param volume_uuid str: volume uuid to search for | |
| :rtype: dict |
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.
Done :)
I've also matched the rtype to the type hint ;)
Check for usage status before deleting a linstor volume and raise an appropriate error if this happens Signed-off-by: Antoine Bartuccio <antoine.bartuccio@vates.tech>
a90db03 to
e85e3e9
Compare
Check for usage status before deleting a linstor volume and raise an appropriate error if this happens