-
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
Backup/Restore references incorrect shares for Scheduled Tasks #2355
Comments
@mattyvau Thanks for opening this issue. I'm pretty sure this has failed since we changed our shares api towards the end of 3.9, so it's good we have an issue open on this now. |
@phillxnet, I just had a better look at this issue. It actually seems to be related to the fact that we are indeed looking for a share ID in the API call to create a scheduled task: rockstor-core/src/rockstor/smart_manager/views/task_scheduler.py Lines 55 to 61 in ac664dc
Of course, these share IDs can and most likely will vary in a re-install scenario so that is why it will most likely be problematic in such situations. It should be fine when restoring a config backup on the same system used as during the creation of the config backup. While we could maybe alter what info we originally gather and expect for this API call, this seems rather cumbersome and heavy-handed. I personally would vote for the second approach. |
Agreed, plus it changes the format of our config save file which is something it would be good to avoid. Given folks will have some going back in time. Plus we then have to account for older and newer formats etc. So if the info is in there and we have to do just a little one-off work to retrieve the names that should do it. Complicated by the changing of share names, but we don't support that yet anyway. And when we do we may have to advertise this side-effect unless we can address it at that time.
Agreed; and as you say, we (you as it goes) wrote similar code to do this back when the Rock-ons restore capability was added.
Agreed also. |
After a brief look, it seems that Pool-related scheduled tasks (Scrub) would suffer from the same issue. It may be better to deal with that in its own separate issue, though. |
Following #2365 , we also have a failure to restore any scheduled tasks as the API endpoint has changed (an extra trailing slash needs to be removed). This simple fix will be included in the coming PR. |
We previously recreated a scheduled task of type snapshot literally from the config backup file. As share IDs are highly likely to differ between system installations, this resulted in scheduled tasks of type snapshot being re-created upon config backup restore against the wrong share. This commit fixes this by: - fetching the share name from the ID from the config backup file (source) - fetch the corresponding share ID in the new (target) system - update the restore API call accordingly This commit also update the API endpoint for scheduled tasks following rockstor#2365.
I now have a simple share ID conversion logic that replaces the corresponding json_meta in the config backup:
with the update share ID (was
We now need to write a few unit tests to cover the scheduled tasks restore as that isn't currently covered. |
Currently, a failed validation will fail the entire restore_scheduled_tasks() process. This commit instead catches any Exception during this process and logs it as INFO before moving on to the next task definition to be restored.
Currently, the `restore_scheduled_tasks()` logic does both the preparation and parsing of the API payload, and the API call. This makes it difficult to test the former. This commit thus refactors this to split into: - parsing/preparation: `validate_task_definitions()` - API call: `restore_scheduled_tasks()` Accordingly, a new unit test is added for the first one.
We previously recreated a scheduled task of type snapshot literally from the config backup file. As share IDs are highly likely to differ between system installations, this resulted in scheduled tasks of type snapshot being re-created upon config backup restore against the wrong share. This commit fixes this by: 1. fetching the share name from the ID in the backup file (source) 2. fetching the corresponding share ID in the new (target) system 3. updating the restore API call accordingly This commit also fixes some related issues by: - updating the API endpoint for scheduled tasks following rockstor#2365 - continuing restore process if a taskdef fails to be validated rockstor#2355 Moreover, the current `restore_scheduled_tasks()` logic does both the preparation/parsing of the API payload, and the API call. This makes it difficult to test the former. This commit thus refactors this part to split into: - parsing/preparation: `validate_task_definitions()` - API call: `restore_scheduled_tasks()` Accordingly two new unit tests are included.
…_incorrect_shares Convert share ID during snapshot task restore #2355
Closing as fixed by #2507. |
Creating a backup from rockstor 3.9 and restoring in 4.1 incorrectly restores scheduled tasks by pointing them to the wrong shares. Example as per the screenshot below, a task for a photos share now points to a music share.
As discussed in forum thread 8249, this likely stems from the backup referencing shares numerically rather than by name. Relevant extract from backup JSON below.
The text was updated successfully, but these errors were encountered: