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

feat(storage/linstor): Enhance multi-disk support and provisioning flexibility in Linstor SR tests #270

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

Conversation

rushikeshjadhav
Copy link
Contributor

@rushikeshjadhav rushikeshjadhav commented Feb 5, 2025

  • Added sr_disks_for_all_hosts fixture to support multiple disks, ensuring availability across all hosts and handling "auto" selection dynamically.
  • Updated lvm_disk fixture to provision multiple disks collectively, refining vgcreate and pvcreate logic.
  • Introduced provisioning_type and storage_pool_name fixtures to dynamically configure storage provisioning (thin or thick).
  • Refactored Linstor SR test cases to use the new fixtures, improving test coverage across provisioning types.
  • Optimized Linstor installation and cleanup using concurrent execution, reducing setup time.
  • Enhanced validation and logging for disk selection.

@stormi
Copy link
Member

stormi commented Feb 6, 2025

Adding a new CLI parameter such as --provisioning is a last resort change, because it moves the responsibility for defining it to the caller, when we probably want that our tests, by default, provide both testing for thick and thin provisioning, as their definition.

Couldn't we have test definitions that do both thick and thin, instead?

@rushikeshjadhav
Copy link
Contributor Author

Couldn't we have test definitions that do both thick and thin, instead?

We can do that. Since this is XOSTOR level, one full cycle (create-test-destroy) with thin and then another full cycle with thick can be added.

Can we retain the CLI option for those callers who want to selectively run in one of the mode?

@stormi
Copy link
Member

stormi commented Feb 10, 2025

Can we retain the CLI option for those callers who want to selectively run in one of the mode?

In theory pytest already offers enough selectors to execute a set of tests and not others.

@rushikeshjadhav rushikeshjadhav changed the title feat(storage/linstor): Add provisioning type support and multi-disk enhancements for Linstor SR tests feat(storage/linstor): Enhance multi-disk support and provisioning flexibility in Linstor SR tests Feb 12, 2025
@rushikeshjadhav rushikeshjadhav force-pushed the feat-storage-linstor branch 3 times, most recently from 989afea to 5b0e1b7 Compare February 12, 2025 13:47
@rushikeshjadhav rushikeshjadhav marked this pull request as ready for review February 12, 2025 13:47
'redundancy': '1',
'provisioning': 'thin'
'group-name': storage_pool_name,
'redundancy': '2',
Copy link
Member

Choose a reason for hiding this comment

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

Is there a specific reason to set 2 in your tests?

Copy link
Contributor Author

@rushikeshjadhav rushikeshjadhav Feb 18, 2025

Choose a reason for hiding this comment

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

There is a strange issue with thick SR and redundancy set as 1. The error looks like below upon trying to create a VM (VDI). So, keeping it as 2 for now, so that other tests on thick SR can pass.

***** LINSTOR resources on XCP-ng: EXCEPTION <class 'xs_errors.SROSError'>, VDI Creation failed [opterr=error cmd: `['/usr/bin/vhd-util', 'create', '--debug', '-n', '/dev/drbd/by-res/xcp-volume-d21c6a82-ed29-4106-ace6-7542c334254c/0', '-s', '2048', '-S', '2097152']`, code: `30`, reason: `/dev/drbd/by-res/xcp-volume-d21c6a82-ed29-4106-ace6-7542c334254c/0: failed to create: -30` (openers: {'xcp-ng-xs1': {}})]
Feb 18 19:02:59 xcp-ng-xs1 SM: [46577]   File "/opt/xensource/sm/LinstorSR", line 1743, in create

Copy link
Member

Choose a reason for hiding this comment

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

I think we must handle this error in the driver itself. In theory a simple busy loop should fix that.

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, will keep it as 1.

@stormi
Copy link
Member

stormi commented Feb 19, 2025

Will this PR involve changes in linstor job definitions in jobs.py for the extended test coverage to be effective in Jenkins once this is merged?

@rushikeshjadhav
Copy link
Contributor Author

Will this PR involve changes in linstor job definitions in jobs.py for the extended test coverage to be effective in Jenkins once this is merged?

After review of jobs.py it seems no changes are needed. Including a snippet for reference on "params" below.

Earlier we had --provisioning but that was removed and now the tests will run for both thin and thick as both should be tested.

    "linstor-main": {
        "description": "tests the linstor storage driver, but avoids migrations and reboots",
        "requirements": [
            "A pool with at least 3 hosts.",
            "An additional free disk on every host.",
            "A small VM that can be imported on the SR.",
        ],
        "nb_pools": 1,
        "params": {
            "--vm": "single/small_vm",
            "--sr-disk": "auto",
        },
        "paths": ["tests/storage/linstor"],
        "markers": "(small_vm or no_vm) and not reboot and not quicktest",
        "name_filter": "not migration",
    },
    "linstor-migrations": {
        "description": "tests migrations with the linstor storage driver",
        "requirements": [
            "A pool with at least 3 hosts.",
            "An additional free disk on every host.",
            "A second pool with at least 1 host and a SR to receive VMs.",
            "A small VM that can be imported on the SRs.",
        ],
        "nb_pools": 2,
        "params": {
            "--vm": "single/small_vm",
            "--sr-disk": "auto",
        },
        "paths": ["tests/storage/linstor"],
        "markers": "",
        "name_filter": "migration",
    },
    "linstor-reboots": {
        "description": "linstor storage driver tests that involve rebooting hosts",
        "requirements": [
            "A pool with at least 3 hosts, whose master host can be rebooted (best if reboots fast).",
            "An additional free disk on every host.",
            "A small VM that can be imported on the SRs.",
        ],
        "nb_pools": 1,
        "params": {
            "--vm": "single/small_vm",
            "--sr-disk": "auto",
        },
        "paths": ["tests/storage/linstor"],
        "markers": "reboot",
    },
    "linstor-quicktest": {
        "description": "runs `quicktest` on the linstor storage driver`",
        "requirements": [
            "A pool with at least 3 hosts.",
            "An additional free disk on every host.",
        ],
        "nb_pools": 1,
        "params": {
            "--sr-disk": "auto",
        },
        "paths": ["tests/storage/linstor"],
        "markers": "quicktest",
    },


if "auto" not in disks:
# Validate that all specified disks exist on the master host
for disk in disks:
Copy link
Contributor

Choose a reason for hiding this comment

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

You use disks as a list (which it is) but it only give multiple members when called independently.
Meaning --sr-disk=nvme1n1 --sr-disk=nvme2n1 result in ["nvme1n1", "nvme2n1"].
But a call like --sr-disk=nvme1n1,nvme2n1 result in ["nvme1n1,nvme2n1"].
We expect the list on the command line to be given in the latter way, you will need to split the member of disks.
You can look at the hosts fixture that do the same things with its input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can update code and handle disks for --sr-disk=nvme1n1,nvme2n1 scenario.

However, it seemed sr-disk is used in other places as well and did not want to break/alter that for compatibility.
Also, if we are handling multiple disks in one option then the option will become --sr-disks instead of --sr-disk on same line as hosts. And this will cause ripple effect at other places.. The current code will gracefully handle both cases, so can I put a different PR for this (--sr-disks) or you prefer to change in current one?

In jobs.py, "--sr-disk": "auto" is used which lets the current code pick multiple available disks and stay intact.

Copy link
Contributor

@Nambrok Nambrok Feb 27, 2025

Choose a reason for hiding this comment

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

It's mostly used in auto, it's just that if we are expected to give multiple disks to a test, using --sr-disk with comma separated value make more sense.
If we use multiple value, we expect the test to be run multiple time using the values one after the other like it is doing with --vm.
For this case, we don't have to go further than having comma-separated value working on sr-disk for your new fixture and (maybe) ignore the other value after the first disk for the already existing fixtures using sr-disk expecting only one disk.
For renaming the parameter completely, I'm summoning @Wescoeur and @stormi to give their idea on the matter.

Copy link
Contributor

Choose a reason for hiding this comment

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

What's the benefit of parsing a comma-separated list, whereas pytest already gives us a way to specify --sr-disk=nvme1n1 --sr-disk=nvme2n1 ?

…exibility in Linstor SR tests

- Added `sr_disks_for_all_hosts` fixture to support multiple disks, ensuring availability across all hosts and handling "auto" selection dynamically.
- Updated `lvm_disks` (`lvm_disk`) fixture to provision multiple disks collectively, refining vgcreate and pvcreate logic.
- Introduced `provisioning_type` and `storage_pool_name` fixtures to dynamically configure storage provisioning (thin or thick).
- Refactored Linstor SR test cases to use the new fixtures, improving test coverage across provisioning types.
- Optimized Linstor installation and cleanup using concurrent execution, reducing setup time.
- Enhanced validation and logging for disk selection.

Signed-off-by: Rushikesh Jadhav <[email protected]>
Copy link
Contributor

@ydirson ydirson left a comment

Choose a reason for hiding this comment

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

The lvm_disks part looks like a good candidate to move into a separate first commit

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.

5 participants