feat(storage): add search conditions#2338
feat(storage): add search conditions#2338joseivanlopez merged 12 commits intoagama-project:masterfrom
Conversation
de72de3 to
7d83831
Compare
e9ec340 to
cc2d33b
Compare
|
Changelogs will be updated once the PR is approved to avoid fixing conflicts with master. |
| new.tap { |c| c.if_not_found = :skip } | ||
| end | ||
|
|
||
| # Search by name. |
There was a problem hiding this comment.
This design of Configs::Search with separate explicit attributes for name, size and partition_number doesn't look too flexible for the future. How will it work in the future to combine conditions? I mean stuff like this (not sure about the syntax yet):
{
"partitions": [
{
"search": {
"if_not_found": "create",
"condition": {
{ "or": [
{ "number": 2 },
{ "and": [
{ "size": { "greater": "1 MiB" } },
{ "size": { "less": "10 MiB" } }
]
}
]
}
}
}
}
]
}There was a problem hiding this comment.
I did the minimal changes to Configs::Search to support the current needs. It will evolve according to what we want to offer. I think in the fututure we will have somehing like Configs::Search#condition and Configs::SearchCondition, or something similar.
| # | ||
| # @return [Array<Y2Storage::Drive, Y2Storage::StrayBlkDevice>] | ||
| def candidate_drives | ||
| disk_analyzer = Y2Storage::DiskAnalyzer.new(devicegraph) |
There was a problem hiding this comment.
One of the main features/goals of DiskAnalyzer is to cache all the intermediate and final results that are expensive (eg. need to lookup into the system, to mount something, etc.).
In other words, disk analyzers are more designed to be shared together with its devicegraph than to be created over and over.
I feel kind of uncomfortable creating instances of DiskAnalyzer for every search (or for every kind of search). Have we checked it's not a potential performance problem?
There was a problem hiding this comment.
I haven't checked the performance. I will pass the disk analyzer to avoid some potential penalty. Anyway, it would be nice to have DiskAnalyzer#devicegraph as a public method. So we don't have to pass a devicegraph-analyzer pair.
7e6522f to
8ef3c6e
Compare
ancorgs
left a comment
There was a problem hiding this comment.
LGTM (except, of course, the lack of a changelog).
ee59958 to
55f9856
Compare
|
Now that I realize, should we update the dependency on yast2-storage-ng? |
Yes, it is updated, see https://github.com/agama-project/agama/pull/2338/files#diff-ceee56f39d11b19309aec78a4c4b31b91f100062d85d7548a3d1cba14972cfa2. |
Prepare to release Agama 15: * #2258 * #2270 * #2277 * #2279 * #2283 * #2284 * #2285 * #2286 * #2287 * #2288 * #2291 * #2292 * #2293 * #2295 * #2297 * #2299 * #2300 * #2301 * #2302 * #2303 * #2305 * #2306 * #2307 * #2308 * #2309 * #2313 * #2314 * #2315 * #2317 * #2318 * #2319 * #2320 * #2321 * #2322 * #2323 * #2324 * #2325 * #2328 * #2329 * #2330 * #2331 * #2335 * #2336 * #2337 * #2338 * #2339 * #2340 * #2342 * #2345 * #2346 * #2348 * #2349 * #2350 * #2351 * #2352 * #2353 * #2354 * #2355 * #2357 * #2358 * #2359 * #2360 * #2361 * #2362 * #2363 * #2364 * #2365 * #2366 * #2368 * #2369 * #2370 * #2371 * #2372 * #2374 * #2377 * #2378 * #2379 * #2380 * #2381 * #2382 * #2384 * #2385 * #2386 * #2388 * #2389 * #2390 * #2391 * #2392 * #2394 * #2397 * #2398 * #2401 * #2403
Extend storage schema with more search conditions:
Requires yast/yast-storage-ng#1410.