stored: add AccessMode SD->Device directive to reserve devices exclusively for reading or writing#1464
Conversation
|
Hi! I guess we'll have some more-or-less picky change requests though :) |
Hi Arogge! That's great to hear. In that case I'll continue working on this some more! |
e458820 to
c275f70
Compare
core/src/stored/stored_conf.cc
Outdated
| {"ReadOnly", CFG_TYPE_BOOL, ITEM(res_dev, read_only), 0, CFG_ITEM_DEFAULT, "false", NULL, NULL}, | ||
| {"WriteOnly", CFG_TYPE_BOOL, ITEM(res_dev, write_only), 0, CFG_ITEM_DEFAULT, "false", NULL, NULL}, |
There was a problem hiding this comment.
I totally understand that you didn't want to add a new type to the configuration parser, but right now with the two booleans we can have four states:
(ReadOnly == false && WriteOnly == false)the old default behaviour(ReadOnly == true && WriteOnly == false)only use this device for reading(ReadOnly == false && WriteOnly == true)only use this device for writing(ReadOnly == true && WriteOnly == true)what does this mean?
So I would argue that we should use one parameter of type IO_DIRECTION to configure this behaviour.
However, I have no thorough idea how to actually name that parameter.
In the process it would probably a good idea to refactor IO_DIRECTION to use "read" and "write" instead of "in" and "out" while retaining backwards compatibility.
There was a problem hiding this comment.
You're right, that makes much more sense. I'll look into it.
How about calling it "Access Mode"?
There was a problem hiding this comment.
That sounds promising! Maybe then IO_DIRECTION should accept "readonly", "writeonly" and "readwrite", so we would end up with something like:
Access Mode = readonly
in the configuration.
There was a problem hiding this comment.
I've made it use IO_DIRECTION now and changed IO_DIRECTION to also accept read(only)/write(only) and readwrite. Next I'd rename AutoXflateMode and its values since it's no longer specific to the AutoXflate plugin. Am I on the right track with this?
There was a problem hiding this comment.
Yes, it's definitely a good idea to rename that.
Also, please note that you should rebase your branch onto the latest master.
a8ca576 to
9c414f6
Compare
|
I've tried updating the docs but I'm unable to get it to include the new AccessMode directive. Building the docs works fine, it just doesn't include AccessMode for some reason. |
|
Again, sorry for keeping you waiting so long. Concerning the PR as a whole, I really like the changes. However, I probably won't be able to review/discuss/merge it before my holiday, so it will be waiting till beginning of August. Sorry for that. |
|
No problem. My Bareos setup is currently running fine as is, so it's not urgent. But anyways, do you think this can be backported to 22 too, because I'm assuming version 23 would not release until around the end of this/beginning of next year? Ah I see. I had tried Now it works, but I'm getting the following diffs which seems a bit odd. Should those paths really change? Or should I just commit the AccessMode entry? |
|
It may be possible to Backport this to 22. However, our plan is to release 23.0.0 earlier than at the end of the year. Concerning the schema files: now you know why recreating them is not enabled by default. I think you can just |
|
Okay, thanks! |
d9835df to
f9377b6
Compare
core/src/stored/dev.h
Outdated
| int oflags{}; /**< Read/write flags */ | ||
| DeviceMode open_mode{DeviceMode::kUndefined}; | ||
| std::string device_type{}; | ||
| IODirection access_mode{}; /**< Allowed access mode(s) for reservation */ |
There was a problem hiding this comment.
this should probably be inizialized to READ_WRITE
There was a problem hiding this comment.
That makes sense.
Done.
a6d5b0a to
b01e08f
Compare
|
We discussed the backporting internally. Sadly we won't backport this feature to Bareos 22. You'll have to stick with a patched version or run Bareos Next until the release of Bareos 23 (which shouldn't take too long from now) |
Thanks - that's ok, I understand. Looking forward to Bareos 23. |
This directive allows to reserve devices for either read or write jobs.
8b8047d to
7fe96ea
Compare
Thank you for contributing to the Bareos Project!
Hello, I'm proposing to add a new config directive to SD->Device: AccessMode. The purpose of this directives is to make it possible to reserve devices exclusively for read or write jobs.
My use case is the following: I would like to have a pool which can both be written to (e.g. via virtualfull) and migrated/copied from to another pool at the same time. By reserving at least one device for write jobs only and others for read jobs only, I can ensure that the virtualfull jobs and migration/copy jobs can always run concurrently and don't block each other (unless they want to use same volume).
As far as I can tell, this is currently not possible. Simply adding more devices to the pool would not ensure that there is always a device free for the migration or copy jobs.
Is there interest for such a feature? If so I'd also look into adding tests, updating the relevant docs and diagrams if necessary.
Please check
If you have any questions or problems, please give a comment in the PR.
Helpful documentation and best practices
Checklist for the reviewer of the PR (will be processed by the Bareos team)
Make sure you check/merge the PR using
devtools/pr-toolto have some simple automated checks run and a proper changelog record added.General
Source code quality
Tests