Skip to content

Use serial instead of SCSI ID for USB devices#784

Open
Wescoeur wants to merge 1 commit intoxapi-project:masterfrom
xcp-ng:ran-usb-sr-support
Open

Use serial instead of SCSI ID for USB devices#784
Wescoeur wants to merge 1 commit intoxapi-project:masterfrom
xcp-ng:ran-usb-sr-support

Conversation

@Wescoeur
Copy link
Contributor

@Wescoeur Wescoeur commented Dec 9, 2025

Adding SRs on multiple usb devices may fail because /usr/lib/udev/scsi_id returns the same device id for all the usb devices.

This change fixes this by checking the drive type and using the device serial number if correctly read.

Adding SRs on multiple usb devices may fail because /usr/lib/udev/scsi_id returns the same device id for all the usb devices.

This change fixes this by checking the drive type and using the device serial number if correctly read.

Signed-off-by: Frederic Bor <frederic.bor@wanadoo.fr>
Signed-off-by: Ronan Abhamon <ronan.abhamon@vates.tech>
Copy link
Contributor

@MarkSymsCtx MarkSymsCtx left a comment

Choose a reason for hiding this comment

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

There should be some unit test coverage of this code , both positive and ngative, to ensure that it remains working in the future. This is a use case more likely to be important to xcp-ng and so the system testing performed by XenServer may not detect regressions here.



def is_usb_device(device):
cmd = ["udevadm", "info", "-q", "path", "-n", device]
Copy link
Contributor

Choose a reason for hiding this comment

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

It is preferred to use absolute paths to system commands.

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