migration: subordinate with multiple principals imports incorrectly

Bug #1715794 reported by Christian Muirhead
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Critical
Christian Muirhead

Bug Description

Deploy two principal applications and relate them both to one subordinate:

ubuntu/0
  telegraf/0
mysql/0
  telegraf/1

Migrate that model to another controller.

Then run the following commands (waiting for the status to settle after each):
1. juju remove-relation ubuntu telegraf
2. juju relate ubuntu telegraf
3. juju remove-relation mysql telegraf

After step 3 the agent status for telegraf/1 will become `failed` and these messages will be in the model debug log:

unit-telegraf-1: 09:43:40 INFO unit.telegraf/1.juju-log server.go:281 juju-info:8: Invoking reactive handler: hooks/relations/juju-info/requires.py:31:broken
unit-telegraf-1: 09:43:40 INFO unit.telegraf/1.juju-log server.go:281 juju-info:8: Invoking reactive handler: reactive/telegraf.py:299:configure_extra_plugins
unit-telegraf-1: 09:43:40 INFO unit.telegraf/1.juju-log server.go:281 juju-info:8: Invoking reactive handler: reactive/apt.py:47:ensure_package_status
unit-telegraf-1: 09:43:40 ERROR juju.worker.uniter agent.go:28 resolver loop error: committing operation "run relation-broken (8) hook": permission denied
unit-telegraf-1: 09:43:40 ERROR juju.worker.dependency engine.go:546 "uniter" manifold worker returned unexpected error: committing operation "run relation-broken (8) hook": permission denied
unit-telegraf-1: 09:43:44 ERROR juju.worker.uniter agent.go:28 resolver loop error: committing operation "skip run relation-broken (8) hook": unknown relation: 8
unit-telegraf-1: 09:43:44 ERROR juju.worker.dependency engine.go:546 "uniter" manifold worker returned unexpected error: committing operation "skip run relation-broken (8) hook": unknown relation: 8
unit-telegraf-1: 09:43:47 ERROR juju.worker.uniter agent.go:28 resolver loop error: committing operation "skip run relation-broken (8) hook": unknown relation: 8

(and more of the same from then on.)

Revision history for this message
Christian Muirhead (2-xtian) wrote :

I'm not totally sure that step 2 is required.

The problem is caused by invalid relationscopes being created when the model is imported - so for the example above, after the import telegraf/1 is recorded as being in scope for the ubuntu-telegraf relation, and similarly telegraf/0 is in scope for mysql-telegraf. Those relationscopes aren't in the source DB or in the model, but they're created by the code at https://github.com/juju/juju/blob/2.2/state/migration_import.go#L1090 which doesn't check whether the relation unit is valid.

Changed in juju:
assignee: nobody → Christian Muirhead (2-xtian)
status: Triaged → In Progress
Revision history for this message
Christian Muirhead (2-xtian) wrote :
Revision history for this message
Christian Muirhead (2-xtian) wrote :

After review from wallyworld, changed the approach slightly. Rather than fixing the "every unit in the application is valid for this endpoint" assumption, have the code import the serialised model (which is correct - it doesn't include spurious units) more faithfully.

That needs a change to juju/description: https://github.com/juju/description/pull/23

Changed in juju:
status: In Progress → Fix Committed
milestone: none → 2.2.4
Changed in juju:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.