Check if jail is running before destroying it and if, don't attempt t… #831
Conversation
565acf2
to
d4e92b5
Compare
Hi thanks for the PR! I have a few issues with it, but before I review it properly, what issue did you stumble over? iocage should have stopped the jail and then removed it.
|
I tried to destroy a jail which had (nullfs) mounts. I have to admit that we are not on 1.0 yet. The destruction failed with the message that zfs do datasets could not be destroyed l, but not that the jail was still running, so I thought I'd suggest the output of a hint that it is still running. |
@pmhausen You haven't used 1.0 yet? :O Well 1.0/1.1 prompt that they are stopping the jail (including those with nullfs mounts) and also destroys as shown in my example. Would you prefer it doesn't destroy the jail and instead tells you the jail is running and exits? We could perhaps change the behavior that happens in my example to only occur with the force flag. |
Hi Brandon,
Am 29.01.2019 um 22:57 schrieb Brandon Schneider ***@***.***>:
@pmhausen You haven't used 1.0 yet? :O Well 1.0/1.1 prompt that they are stopping the jail (including those with nullfs mounts) and also destroys as shown in my example.
Would you prefer it doesn't destroy the jail and instead tells you the jail is running and exits? We could perhaps change the behavior that happens in my example to only occur with the force flag.
wrong person - I don’t have a clue what you are talking about.
Please contact Lars, who sent the pull request.
Kind regards
Patrick
—
punkt.de GmbH Internet - Dienstleistungen - Beratung
Kaiserallee 13a Tel.: 0721 9109-0 Fax: -100
76133 Karlsruhe info@punkt.de http://punkt.de
AG Mannheim 108285 Gf: Juergen Egeling
|
@skarekrow We are in the transition phase of going to 1.0/1.1 but in this case it was not 1.0 yet. I for myself would prefer being notified that the jail is still running and not have the jail destroyed. But if you have another opinion on that, I am not against the way it is now. Then I'd like to suggest "just" to get an additional warning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have some performance implications, I think we should handle this in iocage_lib/iocage.py instead to avoid those pitfalls
@pmhausen Sorry I saw punkt.de and I assumed you were also involved with this :P @Corvan I think that's a good idea, I left a request changes so that we can tackle that in the lib instead. I think an exception that the jail is running unless force is supplied is reasonable default behavior. Thanks for the PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
@skarekrow thanks for considering my idea |
@Corvan No problem, I'm fine if you want to tackle that still in this PR! After all, it was your idea :) |
What can I do to finish it off? |
Well the changes I suggested should be addressed first, and then you can check for the force flag in the lib and refuse to destroy if that's the case. Instantiating the iocage lib for each of those could be slightly costly, so I think we should move this into the lib in general, help get more logic out of the cli |
OK, I'll try. Maybe I might have some more questions, so be prepared ;-) |
Sounds good!
On Sat, Feb 2, 2019 at 6:13 AM Lars Liedtke ***@***.***> wrote:
OK, I'll try. Maybe I might have some more questions, so be prepared ;-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#831 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABg_NyGAZkPr4rQw74TeLQ4gkcC-Hgg_ks5vJYECgaJpZM4aVcZk>
.
--
-Brandon
|
So, After some hassle setting up a development environment in a VM, I moved the stuff into the lib (see https://github.com/Corvan/iocage/tree/features/destroy), But I have got a problem with the release, because destroying a release with --recursive is not using the destroy_jail-method. I could not find a way to check in the destroy_release-method to check if a jail is still running. Am I right here, or did I miss something? |
@Corvan Correct, in this case we should check if there are any dependents in destroy_release and stop them there or just call destroy_jail for each and then finally end by calling destroy_release. |
If it would be feasible to call destroy_jail from destroy_release if there are dependent jails, I would go this way. I just was not sure if there is a reason why destroy_jail is not called. |
@Corvan That would be fine too, my memory says I didn't do that to avoid unnecessary calls/exceptions since most of the time RELEASEs are just being destroyed bare. If a user forces a release destruction, it makes sense that jails are forcefully torn down instead of stopping them in my book. But since we're adding the rest of what you suggested, it makes sense to have it do the right thing there as well. |
I'll look into it and will try to do it in a nice way, but this might take some days until my head is free enough again to work on this |
No rush :) Appreciate the PR |
Hey guys, minor remark: similarly to this, iocage should IMHO not silently start a jail that is offline when I issue Kind regards, |
@pmhausen Can you open a ticket for that and exec. Perhaps it shouldn't. My line of thinking was if you're asking iocage to console into a jail, it must start. Otherwise, not much a console ;) |
This will call destroy_jail per child of the release and with it the check if the child is still running, so that the child only gets destroyed if it is not running. While this introduces some effect on performance, it will only occurr when a release has got dependent jails. When destroy_release is called with --recursive and -f the children will be stopped and destroyed afterwards, so that the release can be destroyed anyways.
So, now I got to work on this. I am aware that this way might not be the most performant but it was the least intrusive. So I'd be interested, what you think about it. |
Thanks! |
Thank you! |
#831) * destroy a jail only if it is not running * destroy a jail only if it is not running * call destroy_jail to destroy_release This will call destroy_jail per child of the release and with it the check if the child is still running, so that the child only gets destroyed if it is not running. While this introduces some effect on performance, it will only occurr when a release has got dependent jails. When destroy_release is called with --recursive and -f the children will be stopped and destroyed afterwards, so that the release can be destroyed anyways. * fix indentation * remove unnecessary return * add callback
I stumbled over the issue, that I tried to destroy a running Jail and did not realize that the error is due to it still running, so this Pull Request is a suggestion to deal with that.