Commit cc831d8
committed
lxd: update the
Now the `instancesShutdown` is being able to query the state of instances (busy or not).
If the instance to be shutdown in a worker is detected as busy, we send it back to the shutdown channel with a bounded exponential backoff.
Backoff strategy:
It starts with an initial retry delay of 5 seconds. Subsequent retries increase exponentially, multiplying the previous delay by 1.5, with a jitter factor of 0.2 to avoid synchronized retries. The delay is capped at a maximum of 60 seconds to prevent excessively long waits. The entire retry process continues for a maximum of 15 minutes (MaxElapsedTime), after which it terminates regardless of success, ensuring the task doesn't run indefinitely.
Example:
Retry 1: 5 seconds
Retry 2: 7.5 seconds (5 * 1.5)
Retry 3: 11.25 seconds (7.5 * 1.5)
Retry 4: 16.875 seconds (11.25 * 1.5)
Retry 5: 25.3125 seconds (16.875 * 1.5)
Retry 6: 37.96875 seconds (25.312 * 1.5)
Retry 7: 56.953 seconds
Retry 8: 60 seconds, because MaxInterval will prevent from incrementing more so we do 60s from here.
Retry 9: 60s
Retry 10: 60s
Retry 11: 60s
<Instance operation finishes before the 15min max elapsed time!>
Signed-off-by: Gabriel Mougard <gabriel.mougard@canonical.com>instancesShutdown function to work with a usedResourcesMap1 parent a458c0b commit cc831d8
2 files changed
+68
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1527 | 1527 | | |
1528 | 1528 | | |
1529 | 1529 | | |
1530 | | - | |
| 1530 | + | |
1531 | 1531 | | |
1532 | 1532 | | |
1533 | 1533 | | |
| |||
2102 | 2102 | | |
2103 | 2103 | | |
2104 | 2104 | | |
2105 | | - | |
| 2105 | + | |
2106 | 2106 | | |
2107 | 2107 | | |
2108 | 2108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
455 | 456 | | |
456 | 457 | | |
457 | 458 | | |
458 | | - | |
| 459 | + | |
459 | 460 | | |
460 | 461 | | |
461 | 462 | | |
462 | 463 | | |
463 | 464 | | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
464 | 468 | | |
465 | 469 | | |
466 | 470 | | |
467 | 471 | | |
468 | 472 | | |
469 | 473 | | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
470 | 482 | | |
471 | | - | |
| 483 | + | |
472 | 484 | | |
473 | 485 | | |
474 | 486 | | |
| |||
477 | 489 | | |
478 | 490 | | |
479 | 491 | | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
480 | 537 | | |
481 | 538 | | |
482 | 539 | | |
| |||
486 | 543 | | |
487 | 544 | | |
488 | 545 | | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
489 | 553 | | |
490 | 554 | | |
491 | 555 | | |
| |||
0 commit comments