Skip to content

Improve the logic and data structure for SCSI ID management in Web UI#893

Merged
rdmark merged 6 commits intodevelopfrom
rdmark-improve-scsi-id-logic
Oct 6, 2022
Merged

Improve the logic and data structure for SCSI ID management in Web UI#893
rdmark merged 6 commits intodevelopfrom
rdmark-improve-scsi-id-logic

Conversation

@rdmark
Copy link
Copy Markdown
Member

@rdmark rdmark commented Oct 5, 2022

  • Have the get_scsi_ids() utility method return a dict, while adding occupied_ids. Leverage this to improve the logic for detecting which IDs are available to be reserved in the Web UI. (Which fixes a recent regression bug that's causing no IDs to be detected as available to be reserved.)
  • Improve /scsi/attach endpoint logic to capture dynamic parameter fields now prefixed with "param_" (previous it scanned for any arbitrary field, which wasn't very accurate or secure)
  • Added Product string to the block_size:512 CD-ROM device, so that it's obvious when it's being used.
  • Tweaked test data for attach_device tests

@rdmark rdmark requested a review from nucleogenic October 5, 2022 06:28
@rdmark rdmark marked this pull request as draft October 5, 2022 06:32
@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 5, 2022

Several tests are failing. Will fix tomorrow.

@rdmark rdmark marked this pull request as ready for review October 5, 2022 15:59
@rdmark
Copy link
Copy Markdown
Member Author

rdmark commented Oct 5, 2022

Nothing wrong with the tests. They revealed bugs in the code. :)

Copy link
Copy Markdown
Member

@nucleogenic nucleogenic left a comment

Choose a reason for hiding this comment

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

Approved, but please see comment about the test. These changes definitely improve readability, so very happy to see these!

Comment on lines +76 to +77
("Host Bridge", {"type": "SCBR", "inet": "192.168.0.1/24"}),
("Ethernet Adapter", {"type": "SCDP", "inet": "192.168.0.1/24"}),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this dict include param_interface and param_inet, so the test models the form payload?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Updated with the param_* prefixes!

The reason param_interface are excluded is that there's no guarantee that eth0 exist in all environments where you may want to run these tests, such as a Zero W, or a system where the dynamic interface name thing has been enabled. Added TODOs to explore dynamically detect available (and viable) interfaces.

@rdmark rdmark merged commit 52ebb3a into develop Oct 6, 2022
@rdmark rdmark deleted the rdmark-improve-scsi-id-logic branch October 6, 2022 17:01
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Oct 6, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot E 2 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

uweseimet pushed a commit that referenced this pull request Oct 6, 2022
…#893)

- Have the get_scsi_ids() utility method return a dict, while adding occupied_ids. Leverage this to improve the logic for detecting which IDs are available to be reserved in the Web UI. (Which fixes a recent regression bug that's causing no IDs to be detected as available to be reserved.)
- Improve /scsi/attach endpoint logic to capture dynamic parameter fields now prefixed with "param_" (previous it scanned for any arbitrary field, which wasn't very accurate or secure)
- Added Product string to the block_size:512 CD-ROM device, so that it's obvious when it's being used.
- Tweaked test data for attach_device tests
rdmark added a commit that referenced this pull request Oct 7, 2022
…#893)

- Have the get_scsi_ids() utility method return a dict, while adding occupied_ids. Leverage this to improve the logic for detecting which IDs are available to be reserved in the Web UI. (Which fixes a recent regression bug that's causing no IDs to be detected as available to be reserved.)
- Improve /scsi/attach endpoint logic to capture dynamic parameter fields now prefixed with "param_" (previous it scanned for any arbitrary field, which wasn't very accurate or secure)
- Added Product string to the block_size:512 CD-ROM device, so that it's obvious when it's being used.
- Tweaked test data for attach_device tests
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.

2 participants