boxgrinder-build 0.6.1 → 0.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG
CHANGED
data/boxgrinder-build.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{boxgrinder-build}
|
5
|
-
s.version = "0.6.
|
5
|
+
s.version = "0.6.2"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Marek Goldmann"]
|
9
|
-
s.date = %q{2010-11-
|
9
|
+
s.date = %q{2010-11-04}
|
10
10
|
s.default_executable = %q{boxgrinder-build}
|
11
11
|
s.description = %q{A tool for creating appliances from simple plain text files for various virtual environments.}
|
12
12
|
s.email = %q{info@boxgrinder.org}
|
@@ -19,6 +19,8 @@
|
|
19
19
|
require 'boxgrinder-build/helpers/augeas-helper'
|
20
20
|
require 'guestfs'
|
21
21
|
require 'logger'
|
22
|
+
require 'open-uri'
|
23
|
+
require 'rbconfig'
|
22
24
|
|
23
25
|
module BoxGrinder
|
24
26
|
class SilencerProxy
|
@@ -87,6 +89,26 @@ module BoxGrinder
|
|
87
89
|
|
88
90
|
attr_reader :guestfs
|
89
91
|
|
92
|
+
def hw_virtualization_available?
|
93
|
+
@log.trace "Checking if HW virtualization is available..."
|
94
|
+
|
95
|
+
begin
|
96
|
+
open('http://169.254.169.254/1.0/meta-data/local-ipv4')
|
97
|
+
ec2 = true
|
98
|
+
rescue
|
99
|
+
ec2 = false
|
100
|
+
end
|
101
|
+
|
102
|
+
if `cat /proc/cpuinfo | grep flags | grep vmx | wc -l`.chomp.strip.to_i > 0 and !ec2
|
103
|
+
@log.trace "HW acceleration available."
|
104
|
+
return true
|
105
|
+
end
|
106
|
+
|
107
|
+
@log.trace "HW acceleration not available."
|
108
|
+
|
109
|
+
false
|
110
|
+
end
|
111
|
+
|
90
112
|
def customize
|
91
113
|
read_pipe, write_pipe = IO.pipe
|
92
114
|
|
@@ -116,21 +138,21 @@ module BoxGrinder
|
|
116
138
|
|
117
139
|
@guestfs = pipe.nil? ? Guestfs::create : Guestfs::create.redirect(pipe)
|
118
140
|
|
119
|
-
#
|
141
|
+
# https://bugzilla.redhat.com/show_bug.cgi?id=502058
|
120
142
|
@guestfs.set_append("noapic")
|
121
143
|
|
122
144
|
@log.trace "Setting debug + trace..."
|
123
145
|
@guestfs.set_verbose(1)
|
124
146
|
@guestfs.set_trace(1)
|
125
147
|
|
126
|
-
|
127
|
-
|
128
|
-
# TODO wait for stable qemu and remove this
|
129
|
-
# Looks like in F13 (qemu-img-0.12.3-8.fc13.i686) this is fixed
|
130
|
-
qemu_wrapper = "/usr/share/qemu-stable/bin/qemu.wrapper"
|
148
|
+
unless hw_virtualization_available?
|
149
|
+
qemu_wrapper = (RbConfig::CONFIG['host_cpu'].eql?('x86_64') ? "/usr/bin/qemu-system-x86_64" : "/usr/bin/qemu")
|
131
150
|
|
132
|
-
|
133
|
-
|
151
|
+
if File.exists?(qemu_wrapper)
|
152
|
+
@log.trace "Setting QEMU wrapper to #{qemu_wrapper}..."
|
153
|
+
@guestfs.set_qemu(qemu_wrapper)
|
154
|
+
@log.trace "QEMU wrapper set."
|
155
|
+
end
|
134
156
|
end
|
135
157
|
|
136
158
|
@log.trace "Adding drive '#{@raw_disk}'..."
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Summary: A tool for creating appliances from simple plain text files
|
7
7
|
Name: rubygem-%{gemname}
|
8
|
-
Version: 0.6.
|
8
|
+
Version: 0.6.2
|
9
9
|
Release: 1%{?dist}
|
10
10
|
Group: Development/Languages
|
11
11
|
License: LGPL
|
@@ -17,7 +17,7 @@ Requires: rubygems >= 1.2
|
|
17
17
|
Requires: ruby >= 0
|
18
18
|
Requires: rubygem(commander) => 4.0.3
|
19
19
|
Requires: rubygem(commander) < 4.1
|
20
|
-
Requires: rubygem(boxgrinder-core) => 0.1.
|
20
|
+
Requires: rubygem(boxgrinder-core) => 0.1.1
|
21
21
|
Requires: rubygem(boxgrinder-core) < 0.2
|
22
22
|
BuildRequires: rubygems >= 1.2
|
23
23
|
BuildRequires: ruby >= 0
|
@@ -65,5 +65,8 @@ rm -rf %{buildroot}
|
|
65
65
|
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
|
66
66
|
|
67
67
|
%changelog
|
68
|
+
* Wed Nov 03 2010 <mgoldman@redhat.com> - 0.6.2-1
|
69
|
+
- [BGBUILD-84] Don't use in libguestfs qemu-kvm where hardware accleration isn't available
|
70
|
+
|
68
71
|
* Mon Oct 18 2010 <mgoldman@redhat.com> - 0.6.1-1
|
69
72
|
- Initial package
|
@@ -30,15 +30,15 @@ module BoxGrinder
|
|
30
30
|
@helper = GuestFSHelper.new('a/raw/disk', :log => @log)
|
31
31
|
end
|
32
32
|
|
33
|
-
def prepare_and_launch(partitions)
|
33
|
+
def prepare_and_launch(partitions, wrapper = nil)
|
34
34
|
guetfs = mock('Guestfs')
|
35
35
|
guetfs.should_receive(:set_append).with('noapic')
|
36
36
|
guetfs.should_receive(:set_verbose)
|
37
37
|
guetfs.should_receive(:set_trace)
|
38
38
|
|
39
|
-
|
39
|
+
@helper.should_receive(:hw_virtualization_available?).and_return(true)
|
40
40
|
|
41
|
-
guetfs.should_receive(:set_qemu).with(
|
41
|
+
guetfs.should_receive(:set_qemu).with(wrapper) unless wrapper.nil?
|
42
42
|
guetfs.should_receive(:add_drive).with('a/raw/disk')
|
43
43
|
guetfs.should_receive(:set_network).with(1)
|
44
44
|
guetfs.should_receive(:launch)
|
@@ -165,5 +165,24 @@ module BoxGrinder
|
|
165
165
|
|
166
166
|
@helper.sh("command", :arch => 'arch')
|
167
167
|
end
|
168
|
+
|
169
|
+
describe ".hw_virtualization_available?" do
|
170
|
+
it "should return true if HW acceleration is available" do
|
171
|
+
@helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_raise("blah")
|
172
|
+
@helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("2")
|
173
|
+
@helper.hw_virtualization_available?.should == true
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should return false if no vmx flag is present" do
|
177
|
+
@helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_raise("blah")
|
178
|
+
@helper.should_receive(:`).with('cat /proc/cpuinfo | grep flags | grep vmx | wc -l').and_return("0")
|
179
|
+
@helper.hw_virtualization_available?.should == false
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should return false if we're on EC2" do
|
183
|
+
@helper.should_receive(:open).with('http://169.254.169.254/1.0/meta-data/local-ipv4').and_return("IP")
|
184
|
+
@helper.hw_virtualization_available?.should == false
|
185
|
+
end
|
186
|
+
end
|
168
187
|
end
|
169
188
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boxgrinder-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 6
|
9
|
-
-
|
10
|
-
version: 0.6.
|
9
|
+
- 2
|
10
|
+
version: 0.6.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Marek Goldmann
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-04 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|