Fix: Wait for libvirt to shutdown the domain
This commit is contained in:
parent
03f94d022d
commit
0fc948cf01
37
vagrant-libvirt-fix-halting.patch
Normal file
37
vagrant-libvirt-fix-halting.patch
Normal file
@ -0,0 +1,37 @@
|
||||
From cc8aadc9de397441b7e2a10eecc76feb6143b4c7 Mon Sep 17 00:00:00 2001
|
||||
From: Josef Stribny <jstribny@redhat.com>
|
||||
Date: Tue, 21 Apr 2015 09:04:53 +0200
|
||||
Subject: [PATCH] Wait for libvirt to shutdown the domain
|
||||
|
||||
Fixes #293
|
||||
---
|
||||
lib/vagrant-libvirt/action/read_state.rb | 11 +++++++++--
|
||||
1 file changed, 9 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lib/vagrant-libvirt/action/read_state.rb b/lib/vagrant-libvirt/action/read_state.rb
|
||||
index ad552a1..1848de4 100644
|
||||
--- a/lib/vagrant-libvirt/action/read_state.rb
|
||||
+++ b/lib/vagrant-libvirt/action/read_state.rb
|
||||
@@ -27,10 +27,17 @@ module VagrantPlugins
|
||||
end
|
||||
# Find the machine
|
||||
begin
|
||||
+ # Wait for libvirt to shutdown the domain
|
||||
+ while libvirt.servers.get(machine.id).state.to_sym == :'shutting-down' do
|
||||
+ @logger.info('Waiting on the machine to shut down...')
|
||||
+ sleep 1
|
||||
+ end
|
||||
+
|
||||
server = libvirt.servers.get(machine.id)
|
||||
- if server.nil? || [:'shutting-down', :terminated].include?(server.state.to_sym)
|
||||
+
|
||||
+ if server.nil? || server.state.to_sym == :terminated
|
||||
# The machine can't be found
|
||||
- @logger.info('Machine shutting down or terminated, assuming it got destroyed.')
|
||||
+ @logger.info('Machine terminated, assuming it got destroyed.')
|
||||
machine.id = nil
|
||||
return :not_created
|
||||
end
|
||||
--
|
||||
2.1.0
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
Name: %{vagrant_plugin_name}
|
||||
Version: 0.0.26
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: libvirt provider for Vagrant
|
||||
Group: Development/Languages
|
||||
License: MIT
|
||||
@ -11,6 +11,9 @@ Source0: https://rubygems.org/gems/%{vagrant_plugin_name}-%{version}.gem
|
||||
Source1: 10-vagrant-libvirt.rules
|
||||
# Adjust Vagrant's dependencies.
|
||||
Patch0: vagrant-libvirt-fix-dependencies.patch
|
||||
# Wait for libvirt to shutdown the domain
|
||||
# https://github.com/pradels/vagrant-libvirt/pull/347
|
||||
Patch1: vagrant-libvirt-fix-halting.patch
|
||||
Requires(pre): shadow-utils
|
||||
Requires(posttrans): vagrant
|
||||
Requires(preun): vagrant
|
||||
@ -57,6 +60,7 @@ gem unpack %{SOURCE0}
|
||||
gem spec %{SOURCE0} -l --ruby > %{vagrant_plugin_name}.gemspec
|
||||
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
|
||||
%build
|
||||
gem build %{vagrant_plugin_name}.gemspec
|
||||
@ -116,6 +120,9 @@ getent group vagrant >/dev/null || groupadd -r vagrant
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Apr 21 2015 Josef Stribny <jstribny@redhat.com> - 0.0.26-2
|
||||
- Fix: Wait for libvirt to shutdown the domain
|
||||
|
||||
* Mon Apr 20 2015 Josef Stribny <jstribny@redhat.com> - 0.0.26-1
|
||||
- Update to 0.0.26
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user