Skip to content

Commit 46bcc96

Browse files
author
Mehmet Aydoğdu
committed
qemu-img fix
1 parent 24051c1 commit 46bcc96

File tree

3 files changed

+68
-2
lines changed

3 files changed

+68
-2
lines changed

Gemfile.lock

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
debug (1.9.2)
5+
irb (~> 1.10)
6+
reline (>= 0.3.8)
7+
diff-lcs (1.5.1)
8+
docile (1.4.1)
9+
io-console (0.7.2)
10+
irb (1.14.1)
11+
rdoc (>= 4.0.0)
12+
reline (>= 0.4.2)
13+
psych (5.1.2)
14+
stringio
15+
rake (13.2.1)
16+
rdoc (6.7.0)
17+
psych (>= 4.0.0)
18+
reline (0.5.10)
19+
io-console (~> 0.5)
20+
rspec (3.13.0)
21+
rspec-core (~> 3.13.0)
22+
rspec-expectations (~> 3.13.0)
23+
rspec-mocks (~> 3.13.0)
24+
rspec-core (3.13.1)
25+
rspec-support (~> 3.13.0)
26+
rspec-debug (0.2.0)
27+
debug (>= 1.3.3)
28+
rspec-expectations (3.13.3)
29+
diff-lcs (>= 1.2.0, < 2.0)
30+
rspec-support (~> 3.13.0)
31+
rspec-mocks (3.13.1)
32+
diff-lcs (>= 1.2.0, < 2.0)
33+
rspec-support (~> 3.13.0)
34+
rspec-support (3.13.1)
35+
simplecov (0.22.0)
36+
docile (~> 1.1)
37+
simplecov-html (~> 0.11)
38+
simplecov_json_formatter (~> 0.1)
39+
simplecov-html (0.13.1)
40+
simplecov_json_formatter (0.1.4)
41+
stringio (3.1.1)
42+
systemu (2.6.5)
43+
thor (1.3.2)
44+
45+
PLATFORMS
46+
ruby
47+
x86_64-linux
48+
49+
DEPENDENCIES
50+
rake
51+
rspec
52+
rspec-debug
53+
simplecov
54+
systemu
55+
thor
56+
57+
BUNDLED WITH
58+
2.5.16

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,12 @@ NAME SIZE DAYS_AGO
342342
remote:ubuntu1404 270.4 Mb 88.1
343343
```
344344
345+
## Testing
346+
347+
```
348+
sudo env PATH=$PATH rake
349+
```
350+
345351
## License
346352
347353
Cangallo is licensed under the Apache License, Version 2.0.

lib/cangallo/qcow2.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,12 @@ def self.create_from_base(origin, destination, size=nil)
160160

161161
def self.create(image, parent=nil, size=nil)
162162
cmd = [:create, '-f qcow2']
163-
cmd << "-o backing_file=#{parent}" if parent
163+
if parent
164+
backing_fmt = File.extname(File.basename(parent)).delete_prefix('.')
165+
cmd << "-o backing_file=#{parent},backing_fmt=#{backing_fmt}"
166+
end
164167
cmd << image
165168
cmd << size if size
166-
167169
execute(*cmd)
168170
end
169171
end

0 commit comments

Comments
 (0)