-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vagrant snapshot restore - should not provision #6752
Comments
I also was surprised to see the provisioning happen. I use Virtualbox, and when I restore a snapshot with the GUI (which btw, seems to only be available as an option in the shutdown confirmation dialog box!?), it simply resets the state of the machine. Then "vagrant up" restarts the machine. No provisioning. Please provide a way to restore snapshots without provisioning. |
@mitchellh This is also what I just found. I was looking forward to removing the sahara plugin for this native plugin but it appears that snapshot isn't quite ready for wider use yet?
|
@jstortz perhaps update the title to something more like |
@ferventcoder - agreed this is two issues in one. I was just getting a conversation about the new functionality going to see what "intended" functionality was and see if anyone wants to weigh in. Once we get some discussion going perhaps we can create all new issues based on some agreed upon direction from the collective hive. |
Makes sense. |
I've created PR #6879 which will allow the |
I think the PR should be the opposite - the default behavior should be NOT to provision. |
Whilst I agree, a PR to do that would be backward-incompatible with the current released behaviour and thus probably wouldn't see the light of day until Vagrant 1.9. (The implementation would also be more complex, since the behaviour of |
That is a completely fair assessment and I agree with the semver boundary. |
Too bad it wasn't released as a preview - then it would not have been subject to the boundary. |
Perhaps we can create a choice? We could have an environment variable control the default behavior. So for example, I could set:
This would be very similar to the variable we set for using VMWare Fusion instead of VirtualBox:
The variable could default to "true", thereby maintaining the current functionality, but allow us to set it to false getting a new default behavior similar to that described by @ferventcoder. |
vagrant suspend and then vagrant resume also run provision |
I was evaluating the snapshot feature for our project and I agree with others that vm should not be booted not provisioned. @yoke88 vagrant suspend/resume does not run provision, at least not on the VM I am running |
#6879 got merged this week, so you should be able to use To @yoke88's point, #7059 looks to add a change to check the provisioning sentinel file when running a Should we ultimately be doing the same on snapshot restore/pop for the sake of consistency? |
Consistency is good. |
@jtopper I've just installed your plugin again as |
@jtopper I have a follow up question, using the Ideally we should have the same behavior as |
Just a reminder here that the changes added by #6879 aren't yet live - there hasn't been a vagrant release since December. @fhenri: That's correct, if |
@jtopper so vagrant had new release including this fix, but regarding provisioning its either all or nothing. I have use case where I have one-time initial provisioning (set up db, import db, set up app server ...) and then I have provisioning that are run with I think the expected scenario using the snapshot feature is:
|
@fhenri so if I'm understanding correctly, you'd like another provisioning option on |
@jtopper actually I am not sure at first place why all provisioning needs to be run when we pop the snapshot, but I understand this is the way it works initially. could we keep the same consistency as
|
@chrisroberts has there been an update on 1.9 finally ? looking at the changelog it does not seem, I did some tries on 1.9 but it seems it still the same behaviour |
Is this issue still being used to consider the "booted" part of the initial comment? I find it annoying that restoring a snapshot made of a halted VM results in the VM being booted. Is that issue still being considered? |
I'm curious about this same issue as well. Any changes? |
This seems still unfixed in Vagrant 1.9.5. Very annoying issue, because one has to manually edit Vagrantfile each time when restoring a snapshot, to prevent re-running provisioning which may be very costly and not intended to be repeated. |
imho this has nothing to do with semver. The behaviour is a bug, it has never (AFAIK) been documented that Vagrant runs provisioners in this situation, so it's not backward-compatibility breaking to change it without a major version bump. |
When I make a snapshot (vagrant snapshot push) it is to preserve the current state. When I revert back to the previous state (vagrant snapshot pop) I do that to go back to how it was. When I now use I do not have to think about disabling provisioning when I restart the vagrant so I agree with @fhenri and others it is currently not consistent, very confusing and annoying. I just broke my box by going back to the previous state and now all provisioning is running again. This was not the reason to go back and now my snapshot is gone. Everything else is great ;-) |
I expect a restore snapshot operation to restore the exact state of the snapshot, not apply additional changes. This is based on my general experience across many tools and platforms. Automatic provisioning was a surprise to me. It looks like there is generally agreement in this thread, but some hesitation about implementing a change. If the hesitation is due to breaking behavior that vagrant experts expect, perhaps we need to emit a warning message that the behavior will change in the future, paving the way for fixing this "bug". Thoughts? |
Paging @briancain - I thought this was set to be flipped to the default for v2. Did that not happen? |
Hi @ferventcoder - Doesn't look like it did. I'll put it in the 2.0.4 milestone, which is the next release we're working on. Thanks! |
Perhaps more exciting to me was attempting to use the snapshot functionality with Virtualbox 5.1 on Ubuntu 16.04 and Vagrant 1.9.7 caused crashes in Vboxmanage and after attempting a couple |
With Vagrant 2.1.1 I can save a snapshot with |
Hi @dragon788 - thanks, but please open a new issue if you're experiencing problems with the snapshot command. |
So I don't understand why the default behavior is to run provision and now we have to explicitely specify the --no-provision option when restoring a snapshot. I've been following this issue for a while now and was excited to see it was finally fixed, only to discover it doesn't behave consistently with vagrant up. That command detects that the machine is already provisioned and appropriately skips provisioning. In fact, you have to specify --provision option to force provisioning. Why is this not the same case for the snapshot restore command? I can't think of any common use case where I would want to re-provision after restoring a snapshot. If anything, this would be the exception case, which would be handled by specify the --provision option, consistent with the behavior of vagrant up. |
It looks like this was slated for 2.0.4 and then 2.1 but missed both of those boats - was there an issue with the patch? |
@zofrex the issue is described in detail in my comment above. Basically, the patch fix is inconsistent. Not provisioning on snapshot restoration should be default behavior, rather than having to specify --no-provision flag each time. |
Preparing to party for the 3 years anniversary ! |
Both of these commands failed to default the options disabling the provisioning from ignoring the sentinel file. This resulted in different behavior than what was seen with the `up` and `resume` commands which would only provision items with run set to "always". This defaults the options to proper match the behavior of `up` and `resume` to be consistent. This also adds an extra `--no-start` flag to allow users to restore a snapshot but not start the restored guest immediately. Fixes hashicorp#6752
Thanks @chrisroberts! looking forward to the next release 🎉 |
Both of these commands failed to default the options disabling the provisioning from ignoring the sentinel file. This resulted in different behavior than what was seen with the `up` and `resume` commands which would only provision items with run set to "always". This defaults the options to proper match the behavior of `up` and `resume` to be consistent. This also adds an extra `--no-start` flag to allow users to restore a snapshot but not start the restored guest immediately. Fixes hashicorp#6752
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I currently have two issues with the snapshot restore functionality. They may both be simple lack of education, improper workflow, etc., I don't know. I'm looking, but cannot find the answers so far.
The Setup
vagrant up
vagrant halt machineName
vagrant snapshot save machineName snapshotName
and that works great too.Expectations
When I use
vagrant snapshot restore machineName snapshotName
there are two things that happen that I did not expect/want:So I expect I may have different/unusual expectations or lack knowledge of a command line switch to use etc. Anyway, let he debate begin.
Thanks,
Jason
The text was updated successfully, but these errors were encountered: