Skip to content

tests/storage/linstor: Add test for forgetting and introducing Linstor SR #279

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

rushikeshjadhav
Copy link
Contributor

@rushikeshjadhav rushikeshjadhav commented Feb 27, 2025

Added test_forget_and_introduce_sr in test_linstor_sr.py to validate forgetting and reintroducing an SR, ensuring correct PBD restoration and proper exception handling.
Updated SR class in sr.py with methods for retrieving parameters, getting type, forgetting, and introducing SR.

@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-611 branch from 221d797 to 988e81e Compare March 6, 2025 13:35
@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-611 branch from 988e81e to 3c19d5a Compare April 21, 2025 16:26
@rushikeshjadhav rushikeshjadhav marked this pull request as ready for review April 21, 2025 16:33
@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-611 branch 2 times, most recently from 7e8b277 to 75e8a4e Compare April 22, 2025 13:38
@stormi stormi removed their request for review April 22, 2025 17:03
@stormi
Copy link
Member

stormi commented Apr 22, 2025

I had a look, nothing I'd need to comment on I think, so I leave it to the other reviewers.

lib/host.py Outdated
Comment on lines 136 to 139
if isinstance(args, dict):
command += [stringify(key, value) for key, value in args.items()]
elif isinstance(args, list):
command += [stringify(key, value) for key, value in args]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if isinstance(args, dict):
command += [stringify(key, value) for key, value in args.items()]
elif isinstance(args, list):
command += [stringify(key, value) for key, value in args]
resolved_args = None
if isinstance(args, list):
resolved_args = args
else:
resolved_args = args.items()
command += [stringify(key, value) for key, value in resolved_args]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

lib/sr.py Outdated
return self.pool.master.xe('sr-param-get', {'uuid': self.uuid, 'param-name': param})

def type(self):
return self.pool.master.xe('sr-param-get', {'uuid': self.uuid, 'param-name': 'type'})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return self.pool.master.xe('sr-param-get', {'uuid': self.uuid, 'param-name': 'type'})
return self.param_get('type')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

lib/sr.py Outdated
@@ -147,6 +148,17 @@ def main_host(self):
def content_type(self):
return self.pool.master.xe('sr-param-get', {'uuid': self.uuid, 'param-name': 'content-type'})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return self.pool.master.xe('sr-param-get', {'uuid': self.uuid, 'param-name': 'content-type'})
return self.param_get('content-type')

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

- Added support for handling both dictionary and list-based arguments.
- Fixed command formatting for `config:key=value` scenarios.

Signed-off-by: Rushikesh Jadhav <[email protected]>
- `param_get()`: Fetch a specific SR parameter.
- `type()`: Retrieve SR type.
- `introduce()`: Introduce SR.

Signed-off-by: Rushikesh Jadhav <[email protected]>
…_introduce_sr`

- Validates the ability to forget an SR and properly reintroduce it.
- Ensures all PBD configurations are stored and restored correctly.
- Checks that exceptions are raised when querying a forgotten SR.
- Restores the SR and verifies successful reattachment of PBDs.

Signed-off-by: Rushikesh Jadhav <[email protected]>
@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor-611 branch from 75e8a4e to 1b97717 Compare May 21, 2025 10:59
@rushikeshjadhav rushikeshjadhav requested a review from Wescoeur May 21, 2025 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants