Skip to content

ni_provisioning: target disk from answers file#986

Merged
chaitu236 merged 2 commits intoni:nilrt/master/nextfrom
erickshepherdNI:ershephe/provisioning-disk-answers
Apr 17, 2026
Merged

ni_provisioning: target disk from answers file#986
chaitu236 merged 2 commits intoni:nilrt/master/nextfrom
erickshepherdNI:ershephe/provisioning-disk-answers

Conversation

@erickshepherdNI
Copy link
Copy Markdown
Contributor

@erickshepherdNI erickshepherdNI commented Apr 8, 2026

Summary of Changes

There are two primary changes:

  • Make disk selection possible using the answers file
    • This was done by adding a new PROVISION_TARGET_DISK that can be added to the answers file and will overwrite the current TARGET_DISK variable when present.
    • I also added some slight refactoring to read the answers file immediately after reading the script arguments instead of doing it in each branch of the following if-block.
  • Add a interactive disk selection mode
    • This can be enablede by using a new -i argument for the ni_provisioning script when running it manually.
    • When enabled, a list of valid provisioning targets will be gathered using the same method we currently use to automatically select a target and each option will be printed followed by a prompt to select one.
      • There is a slight change to which block devices are valid, which is that removable devices are displayed in the interactive option.

The default behavior is unchanged, which is to say that if the default provisioning option is selected and no answer file is present, then the first valid block device that is found will be selected for provisioning.

Justification

These changes will help support the upcoming Kinabalu devices that have multiple internal disks and require a way to select which one should be provisioned.

AB#3813755

Testing

For all of the testing I set up a cRIO-9033 and added an SD card that could be provisioned.

  • Tested that the behavior if PROVISION_TARGET_DISK is undefined or if the interactive case is not used matches our current default behavior. This is that the first valid disk is selected and any removable disks are skipped.
  • Tested that PROVISION_TARGET_DISK can be added to an answer file and the disk specified there is selected.
  • Tested that using the -i script argument provides a list of valid targets and allows the user to select one.
    • Confirmed that removable disks are displayed as options.
    • Checked that the user prompt does not accept any inputs besides the displayed numbers.
    • provisioning 1
    • provisioning 2
  • I have built the core package feed with this PR in place. (bitbake packagefeed-ni-core)

Procedure

@erickshepherdNI erickshepherdNI force-pushed the ershephe/provisioning-disk-answers branch from 0f482fb to 746a0cc Compare April 13, 2026 21:54
@erickshepherdNI erickshepherdNI requested a review from a team April 13, 2026 22:06
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for explicitly selecting the provisioning target disk via an answers file and introduces an interactive (-i) disk selection mode for devices with multiple internal disks.

Changes:

  • Introduces set_target_from_answer_file() to override TARGET_DISK from an answers-file value.
  • Adds -i argument and select_target_block_device() for interactive disk selection.
  • Refactors ni_provisioning to source the user answers file once near startup.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
recipes-core/initrdscripts/files/ni_provisioning.common Adds answer-file target override helper, interactive disk selection, and -i flag parsing/behavior.
recipes-core/initrdscripts/files/ni_provisioning Moves user answer-file sourcing earlier and applies the answer-file disk override.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread recipes-core/initrdscripts/files/ni_provisioning.common Outdated
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Comment thread recipes-core/initrdscripts/files/ni_provisioning Outdated
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common Outdated
Comment thread recipes-core/initrdscripts/files/ni_provisioning.common
@erickshepherdNI erickshepherdNI force-pushed the ershephe/provisioning-disk-answers branch from 746a0cc to 0fee7ae Compare April 14, 2026 19:53
@erickshepherdNI erickshepherdNI marked this pull request as ready for review April 14, 2026 20:09
@erickshepherdNI erickshepherdNI requested a review from gratian April 14, 2026 21:45
Update the ni_provisioning script to be able to select the target disk
through the answers file by adding the PROVISION_TARGET_DISK variable.
Adding this variable to the answers file will overwrite the
TARGET_DISK variable set by the -t script argument.

Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
@erickshepherdNI erickshepherdNI force-pushed the ershephe/provisioning-disk-answers branch from 0fee7ae to b1cd363 Compare April 16, 2026 18:30
Copy link
Copy Markdown
Contributor

@gratian gratian left a comment

Choose a reason for hiding this comment

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

LGTM, just a small nitpick on the location for sourcing the answer file.

Comment thread recipes-core/initrdscripts/files/ni_provisioning Outdated
@erickshepherdNI erickshepherdNI force-pushed the ershephe/provisioning-disk-answers branch from b1cd363 to 856736a Compare April 16, 2026 20:48
Add a new -i script argument to ni_provisioning that enables
interactive disk selection. When used, the provisioning script will
list each block device that is a valid provisioning target and prompt
the user to select one.

Signed-off-by: Erick Shepherd <erick.shepherd@ni.com>
@erickshepherdNI erickshepherdNI force-pushed the ershephe/provisioning-disk-answers branch from 856736a to 7643d97 Compare April 16, 2026 21:03
@chaitu236 chaitu236 merged commit 566e1c7 into ni:nilrt/master/next Apr 17, 2026
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.

4 participants