harvest mode setting not honoured by destroy-model

Bug #1671733 reported by Frode Nordahl
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Triaged
Low
Unassigned

Bug Description

$ juju --version
2.2-alpha1-xenial-amd64

Steps to reproduce:
1) juju add-model test
2) juju add-machine
3) juju model-config provisioner-harvest-mode=none
4) juju remove-machine 0
5) Verify that machine has been removed from model
6) Verify that machine has NOT been harvested on the provider
7) juju destroy-model test
8) Watch that regardless of model-config provisioner-harvest-mode setting being set to none the machine has indeed been harvested on the provider

Frode Nordahl (fnordahl)
tags: added: sts
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1671733] Re: harvest mode setting not honoured by destroy-model

The lifetimes of machines deployed by Juju are intentionally tied to the
lifetime of the model. We don't support identifying already running
machines which means that those machines would just become orphaned and it
would not be possible to control them under Juju again.

Harvest mode was never intended to support this. Is there a concrete reason
why you want to deploy but never operate those machines afterward?

Tempted to flag this as invalid/won't fix

John
=:->

On Mar 10, 2017 09:55, "Frode Nordahl" <email address hidden> wrote:

> ** Tags added: sts
>
> --
> You received this bug notification because you are subscribed to juju-
> core.
> https://bugs.launchpad.net/bugs/1671733
>
> Title:
> harvest mode setting not honoured by destroy-model
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1671733/+subscriptions
>

Revision history for this message
Felipe Reyes (freyes) wrote :

Hi John,

On Fri, Mar 10, 2017 at 05:00:21PM -0000, John A Meinel wrote:
> The lifetimes of machines deployed by Juju are intentionally tied to the
> lifetime of the model. We don't support identifying already running
> machines which means that those machines would just become orphaned and it
> would not be possible to control them under Juju again.

Something that I found strange on this behavior is that after you ran
"juju remove-machine X" that machine won't be displayed to the user in
"juju status" which it's consistent with the operation remove-machine, so
if remove-machine did release the resource, why later (could be minutes,
days, months) juju will release the machine in maas during
destroy-model?.

> Harvest mode was never intended to support this. Is there a concrete reason
> why you want to deploy but never operate those machines afterward?

Frode found this during the exploration of possible workarounds for the
bug https://bugs.launchpad.net/juju/+bug/1671588

Best,

Revision history for this message
Anastasia (anastasia-macmood) wrote :

I am removing this from "juju-core" as we do not track Juju 2.x bugs there. Also, this is not a bug but is an intended behavior. So, I am marking this as Invalid for "juju" in agreement with comment # 1.

no longer affects: juju-core
Changed in juju:
status: New → Invalid
Revision history for this message
John A Meinel (jameinel) wrote :

I'm not as sure. If "juju remove-machine" really does leave the machine
running, then I would expect "juju destroy-model" to not touch the machine.

John
=:->

On Mon, Mar 13, 2017 at 5:00 PM, Anastasia <email address hidden>
wrote:

> I am removing this from "juju-core" as we do not track Juju 2.x bugs
> there. Also, this is not a bug but is an intended behavior. So, I am
> marking this as Invalid for "juju" in agreement with comment # 1.
>
> ** No longer affects: juju-core
>
> ** Changed in: juju
> Status: New => Invalid
>
> --
> You received this bug notification because you are subscribed to juju-
> core.
> https://bugs.launchpad.net/bugs/1671733
>
> Title:
> harvest mode setting not honoured by destroy-model
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1671733/+subscriptions
>

Revision history for this message
Frode Nordahl (fnordahl) wrote :

Anastasia, thank you for removing juju-core from the bug. Adding that was my mistake.

John, thank you for your supporting comment. juju remove-machine does indeed leave the machine running when provisioner-harvest-mode is set to none.

I think the current behaviour is problematic. If an operator, for whatever reason, at some point decides to use that setting to remove a machine from a juju model without having it destroyed, and then juju later decides to destroy it anyway without any visibility to the operator is going to cause harm.

Changed in juju:
status: Invalid → New
Revision history for this message
Felipe Reyes (freyes) wrote :

On Mon, Mar 13, 2017 at 10:00:45PM -0000, Anastasia wrote:
> I am removing this from "juju-core" as we do not track Juju 2.x bugs
> there. Also, this is not a bug but is an intended behavior. So, I am
> marking this as Invalid for "juju" in agreement with comment # 1.

From the docs[0]:

"""
Juju can be in one of several harvesting modes, in order of most
conservative to most aggressive:

* none: Machines will never be harvested. This is a good choice if
  machines are managed via a process outside of Juju.
...
"""

I understand from this that if it's set to 'none', then it's up to the
user to release the resources, probably (haven't checked) the only thing
that juju should do is remove itself from the machine (uninstall the
agent, remove /var/lib/juju)

[0] https://jujucharms.com/docs/stable/models-config#juju-lifecycle-and-harvesting

Revision history for this message
John A Meinel (jameinel) wrote :

I have a feeling that implementation wise we need to remove whatever tag on the machine that indicates it is in the model which is evaluated during model tearsown.

Changed in juju:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Frode Nordahl (fnordahl) wrote :

Yes, that or just remove it from the database altogether.

From a operational perspective orphaned machines is not a critical problem, erroneously killed ones is.

tags: added: destroy-machine destroy-model harvest
Ian Booth (wallyworld)
tags: added: teardown
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Unfortunately, with 2.6 this is still the case. I'll add it to 2.6.1 milestone.

Changed in juju:
milestone: none → 2.6.1
Revision history for this message
Anastasia (anastasia-macmood) wrote :

This is a very interesting case and is highlighting a few issues with the implementation.

For one, when removing machines 'destroy-model' actually force removes them (unless the machines are manual). This, in itself, may cause all sort of undesirable issues since the machines and their units (and consequently relations, applications, etc) are not given a chance to terminate properly.

The fix here has 2 parts.

Part 1:
Now that we do have --force option for 'destroy-model', we should only force remove non-manual machines when --force is desired for the model. Manual machine treatment will remain the same. The implications of this change would be a bit of a double-edged sword: on one hand, the machines will be given a chance to be terminated properly and harvest mode will be respected; on the other hand, this will definitely impact on how quickly models will be destroyed.

Part 2:
This all implies that force removal of machines does not respect harvest mode. We should rectify that.

Changed in juju:
assignee: nobody → Anastasia (anastasia-macmood)
status: Triaged → In Progress
Revision history for this message
Anastasia (anastasia-macmood) wrote :

After some discussions, we'll keep the model destruction to always force remove non-manual machines - there is no benefit in going through a normal, lengthy removal if we are destroying a model anyway. However, we will ensure that force removing a machine respects harvest mode.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

Actually, I am seeing the same behavior with 'remove-machine --force'.. At least from the command line, when the removal is forced, the machine on the model with provisioner-harvest-mode=none is untouched on the cloud but is terminated when its model is destroyed. I'll dig into model destruction exclusively.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

I think the problem is that the models cloud machines are terminated by the undertaker when a model is destroyed, not a provisioner unlike in remove-machine case. And the undertaker is not harvest-mode savvy.

Revision history for this message
Anastasia (anastasia-macmood) wrote :

The same would apply to if a controller has models with harvest mode set to leave cloud instances alone. When Juju destroys it, harvest mode will not be respected... Need to fix this too.

Changed in juju:
milestone: 2.6.1 → 2.6.2
Changed in juju:
milestone: 2.6.2 → 2.6.3
Changed in juju:
milestone: 2.6.3 → 2.6.4
Changed in juju:
status: In Progress → Triaged
milestone: 2.6.4 → 2.7-beta1
Changed in juju:
milestone: 2.7-beta1 → 2.7-rc1
Changed in juju:
milestone: 2.7-rc1 → none
Revision history for this message
Anastasia (anastasia-macmood) wrote :

Due to current priorities, I am not currently working on this bug, so I am un-assigning myself from it.

Changed in juju:
assignee: Anastasia (anastasia-macmood) → nobody
Revision history for this message
Canonical Juju QA Bot (juju-qa-bot) wrote :

This bug has not been updated in 2 years, so we're marking it Low importance. If you believe this is incorrect, please update the importance.

Changed in juju:
importance: Medium → Low
tags: added: expirebugs-bot
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.