-
Notifications
You must be signed in to change notification settings - Fork 138
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
failure in share import prep re duplicate name and usage #1828
Comments
Since there isn't a way to mount duplicates in /mnt2 due to naming, is there a way to mount the reported subvolid in rockstor or even just pick the first one and once a dupe is detected just not mount it (spit an error out in the logs and move on)? |
I am currently working on this issue and have established it's root cause as related to incomplete changes relating to issue #930. I am currently in the process of refactoring the relevant code to help clarify further development and a pending fix re the side effects indicated. |
@magicalyak Good point but can you please remove it from this issue and open a new feature request or better still a design discussion via a forum thread with the same as it is way over broad for this issue as defined and referenced. Thanks. |
@magicalyak I have now corrected my omission re the indicated referenced forum thread. |
A previous refactor failed to update the comments re the passed parameter: update accordingly.
By distinguishing the temp var indices and their source we improve readability and help with diagnosis going forward.
The core cause of this issue is a legacy parameter type used when calling share_info but as this call is within a large try clause there are several potential effects that may result as the intended code has not been in effect for a couple of years. I am about to update the erroneous call and begin testing prior to submitting a pull request. |
Replicating @magicalyak original trigger (that of multiple shares by the same name on different pools):
after the 'second' pool containing the duplicate (by name) share is re-attached and a
is executed. N.B. we do not see the intended Exception to catch this situation during import, although one does exist and works within the Web-UI. The intended exception is thought to be blocked by the prior legacy call to share_info() which itself causes the above exception which in turn bypasses the intended: "Another pool(%s) has a Share with this same name(%s) as this pool(%s). This configuration is not supported. You can delete one of them manually with this command: ..." |
Previously we called shares_info() with a pool mount point but we now pass the pool object. This avoids masking future exceptions within this try block as this command pre-commit would always fail.
Correcting the legacy call to share_info() from within the try clause of import_shares() gives the following, intended, log entry to identify the issue found:
|
Moved to .format and added warning re data loss.
Log error message updated to reflect the data loss component of the suggested command: "Another pool (pool-on-luks-dev) has a Share with this same name (luks-share) as this pool (luks-pool-on-bcache). This configuration is not supported. You can delete one of them manually with the following command: "btrfs subvol delete /mnt2/[pool name]/luks-share" WARNING this will remove the entire contents of that subvolume." |
Attempting to improve readability re var names to indicate origin ie pool db related, db generally, or pool actual.
As we now have a debug log switch we can leave these in place to help with diagnosing future share import issues. Plus comment review.
Rarely executed code: if a share was moved from one pool to another between db updates, and the db retrieval order of pools was appropriate. An existing db share entry from a prior pool to that under share import would be updated. However this 'intended' update would fail due to a code formatting issue resulting in the following error: "ValueError: too many values to unpack".
Previously we established an existing db share entry associated with our pool under share import but did not ensure that our retrieved db share belonged to that pool. In a circumstance where an as yet un- scanned pool contains a share by the same name we could inadvertently update the wrong db share entry.
…#1828 The specific mount command, when run not directly after the Share.DoesNotExist exception block execution, would have a pool variable out of scope / undefined.
Previously misleading re return type /content and executed commands. Improve to help future maintenance.
We have duplicate code and an expectation to use the same code in other locations. Abstract and explain in dedicated docstring.
Previously we neglected to update (on import) prior unknown and moved, from one pool to another, shares. N.B. also update new share with rusage, eusage, pqgroup_rusage and pqgroup_eusage on initial create.
I have a little more testing to do on the code / commits as associated and then I'll prepare the pull request. |
Thanks to forum member @magicalyak for reporting and helping to diagnose this issue. Under certain circumstances when a share on disk is not currently reflected in the db an attempt is made to import and mount each share. This effort includes a check to establish if there are duplicate share names which is unfortunately circumvented due to a bug which causes this check to never be executed, along with various share calculations that would otherwise also be executed.
Please see the following forum thread for reference of this issues origin:
https://forum.rockstor.com/t/subvolumes-not-mounted-but-pools-mount/3797
The text was updated successfully, but these errors were encountered: