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

NC | generate_entropy Using lsblk Command When No Candidates Were Found #8777

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

shirady
Copy link
Contributor

@shirady shirady commented Feb 9, 2025

Explain the changes

  1. In case there was not disk found according to the hard-coded array of disk names, we will call the lsblk command and rerun the the same steps as before.
  2. Refactoring:
  • Change the condition if (entropy_avail < 512) to if (entropy_avail >= 512) return; to avoid additional nested layer.
  • Separate functions.
  • Add JSDoc to the new separated functions.

Issues: Fixed #8598

  1. Currently there is an array of hard-coded disk names. In PR NC | Related to Issue 8598 | generate_entropy() - Add Disks (Temporary and Partial Fix) #8734 we added a partial solution and added 2 disk names to the array. Still, it is not enough as there might be a disk that was not in the array, and there might be a situation where the NVMe disk changes its namespace (from 1 to 2 for example), and then it is not in the array of the disk names (we have /dev/nvme0n1).

Testing Instructions:

Manual Test

  1. Create a script copy the function that we created and run it on a GPFS machine, with the following changes:
  • Add the following modules:
const util = require('util');
const fs = require('fs');
const child_process = require('child_process');
const async_exec = util.promisify(child_process.exec);
const chance = require('chance')();

const async_delay = util.promisify(setTimeout);
  • Add the following main:
async function main() {
    console.log('SDSD in main');
    let still_reading = true;
    const promise = generate_entropy(() => still_reading);
}
  • Call the main in the end of the script
exports.main = main;
if (require.main === module) main();
  • Add the while (loop_cond()) { to comment to run it once.

  • (first run) Add the script in the path: /usr/local/noobaa-core/ and run it with: node <path to the script>

  • (secodn run) Change the condition (first appearance) if (disk_details.disk_size) { to if (false) { so we will get to the "else" clause we created, and rerun the script: node <path to the script>

  • Doc added/updated

  • Tests added

@shirady shirady self-assigned this Feb 9, 2025
@shirady
Copy link
Contributor Author

shirady commented Feb 13, 2025

Updates:

  • Currently, I'm waiting for an answer as to whether adding all the disk names is fine.
  • If it is not, I would filter the array of disk names I get according to what I will be required to (from what I have in mind now - filter the array by names that start with "nvme").
  • I will share that I plan to merge it for version 4.18.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant