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

[IMP] In some case, we might want to keep some lvm active #420

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

Conversation

cvinh
Copy link

@cvinh cvinh commented Jun 25, 2024

No description provided.

@cvinh cvinh force-pushed the imp-keep_active_lvm branch 2 times, most recently from c2c2109 to 8acac94 Compare June 25, 2024 01:18
Copy link
Member

@aesteve-rh aesteve-rh left a comment

Choose a reason for hiding this comment

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

Thanks! The patch looks generally fine (minus a few comments), but there are at least a couple missing points:

  • Please add a some text/explanation in the body of the commit.
  • Add a test (potentially at lmv_test.py) covering the new config option and new the deactivate unused LVs logic.

lib/vdsm/storage/lvm.py Outdated Show resolved Hide resolved
lib/vdsm/common/config.py.in Outdated Show resolved Hide resolved
@@ -1162,8 +1165,10 @@ def deactivateUnusedLVs(vgname, skiplvs=()):
# List prepared images LVs if any
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't doing something like this achieve the same thing if we use lv names instead of full paths?

def deactivateUnusedLVs(vgname, skiplvs=KEEPACTIVE):

I mean, technically, skipping LVs is already part of the API.

Copy link
Author

Choose a reason for hiding this comment

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

Humm, we have the same lv name in different vg, that's why we prefer using complete path
ie : /dev/vg1/lv1, /dev/vg2/lv1

Copy link
Member

Choose a reason for hiding this comment

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

Certainly skiplvs=KEEPACTIVE was not the best example here, as it mixes different vgs.

But my point was that there is already a logic for skiplvs in place, so I think it would be nice to consolidate the list before we get to the if lv.name in skiplvs: condition, filtering all lvs that pertain to vgname.

Something like (not tested):

skiplvs = skiplvs + tuple(lvm.split('/')[-1] for lvm in KEEPACTIVE if vgname == lvm.split('/')[-2])

In this solution maybe worth using different than the complete path to ease the parsing.

Or even convert the KEEPACTIVE list into a dictionary, where the VG is the key and the value is a list of lvs that we can directly append to skiplvs based on vgname.

In some special configuration, we might need not to deactivate some lvm.
This commit allows to define some lvm paths that will not be deactivated
by vdsm.
The list of the lvm paths can be configured in
/etc/vdsm/vdsm.conf.d/keep_alive_lvm.conf:

[lvm]
keep_active = /dev/vg1/lv1,/dev/vg1/lv2,/dev/vg2/lv1

Signed-off-by: Cyril VINH-TUNG <cyril@invitu.com>
@cvinh
Copy link
Author

cvinh commented Jun 27, 2024

  • Add a test (potentially at lmv_test.py) covering the new config option and new the deactivate unused LVs logic.

I'm sorry, I don't know how to add Tests, I would make some bad copy-paste ... 👎

@cvinh
Copy link
Author

cvinh commented Jun 27, 2024

Can you please point me out where I could add the information in the documentation ?

@aesteve-rh
Copy link
Member

aesteve-rh commented Jun 27, 2024

I'm sorry, I don't know how to add Tests, I would make some bad copy-paste ... 👎

It's ok, start with something simple, and I can help you refine it. I think something similar to test_bootstrap would do. Just make sure you monkeypatch the KEEPACTIVE list.

You can see how to run the tests here:
https://github.com/oVirt/vdsm/blob/master/doc/development.md#running-the-tests

$ tox -e storage

Check pytest documentation if you are unfamiliar: https://docs.pytest.org/en/8.2.x/getting-started.html
You can also check for other tests within the project.

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.

None yet

2 participants