Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request juju#13084 from manadart/2.8-uniter-graceful-lock-…
…cancellation juju#13084 The linked bug describes a scenario where: - At least one hook execution is mid-flight. - The executor is waiting to acquire a machine lock. - A model migration is commenced, causing the migration-inactive flag to drop. - The lock acquisition is cancelled, which is represented as an error that flows up and out of the resolver loop. - The unit goes briefly into an error state. - This error state causes the migration validation to fail. Here, we change the resolver loop so that if the cause of the error from `executor.Run` is `mutex.ErrCancelled` then we return `ErrRestart`. This should be the safest thing to do in the general case. In the specific case this results in the same behaviour as translating a fortress lockdown anyway (see `TranslateFortressErrors`). This should mean a clean shutdown, successful validation (the initial migration phase), and then migration progression. ## QA steps - Bootstrap 2 controllers. - On the first, deploy several applications to a single machine. - I used `juju run <unit> "sleep 10"` on multiple units at once. - Concurrently, migrate the model to the second controller. - We want to see in the logs that the lock acquisition is cancelled, but that migration progresses: ``` unit-mongodb-0: 15:58:14 INFO juju.worker.migrationminion migration phase is now: QUIESCE unit-telegraf-4: 15:58:14 INFO juju.worker.migrationminion migration phase is now: QUIESCE unit-cassandra-0: 15:58:14 INFO juju.worker.logger logger worker stopped unit-telegraf-4: 15:58:14 INFO juju.worker.logger logger worker stopped unit-telegraf-4: 15:58:14 WARNING juju.worker.uniter.resolver executor lock acquisition cancelled <-- HERE unit-ubuntu-0: 15:58:14 INFO juju.worker.migrationminion migration phase is now: QUIESCE unit-postgresql-0: 15:58:14 INFO juju.worker.migrationminion migration phase is now: QUIESCE unit-cassandra-0: 15:58:14 INFO juju.worker.migrationminion migration phase is now: QUIESCE ``` ## Documentation changes None. ## Bug reference https://bugs.launchpad.net/juju/+bug/1918680
- Loading branch information