Skip to content
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

utils_libvirt/libvirt_disk: add function to get disk by serial #3814

Closed

Conversation

smitterl
Copy link
Contributor

@smitterl smitterl commented Dec 12, 2023

Use the SERIAL to identify a disk and return its path.

Suggested-by: Chunfu Wen [email protected]
Signed-off-by: Sebastian Mitterle [email protected]

@smitterl smitterl force-pushed the get_disk_by_serial branch 2 times, most recently from a9bf763 to ae230b5 Compare December 12, 2023 18:54
@smitterl
Copy link
Contributor Author

@chunfuwen Please help review. As mentioned on #3811 (comment) unfortunately we can't set serial on LUNs but its implementation might be useful on other occasions.

Use the SERIAL that can be set via libvirt, to select
its disk path under /dev/.

Suggested-by: Chunfu Wen <[email protected]>
Signed-off-by: Sebastian Mitterle <[email protected]>
@smitterl smitterl force-pushed the get_disk_by_serial branch from ae230b5 to 51863db Compare January 2, 2024 11:22
Copy link
Contributor

@chunfuwen chunfuwen left a comment

Choose a reason for hiding this comment

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

lgtm

@chunfuwen
Copy link
Contributor

@smitterl ,could you upload one simple test result?

@@ -102,6 +102,31 @@ def get_non_root_disk_name(session):
return name.strip(), mpoint.strip()


def get_disk_by_serial(session, serial):
Copy link
Contributor

Choose a reason for hiding this comment

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

We already have same function in utils_disk.py.

def get_disk_by_serial(serial_str, session=None):

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 for the pointer. I'll close this one.

@smitterl
Copy link
Contributor Author

Closing this as there is already another implementation with the same API.

@smitterl smitterl closed this Mar 19, 2024
@smitterl smitterl deleted the get_disk_by_serial branch March 19, 2024 15:14
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.

3 participants