Skip to content
This repository has been archived by the owner on Jun 10, 2023. It is now read-only.

Commit

Permalink
qemu-img: create: rename preexisting image files
Browse files Browse the repository at this point in the history
  • Loading branch information
gderosa committed Jun 4, 2012
1 parent 6caeeda commit d4b17f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/qemu/lib/onboard/virtualization/qemu/img.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def create(h)
fmt = h[:http_params]['qemu-img']['fmt']
FileUtils.mkdir_p File.join ROOTDIR, name
filepath = "#{ROOTDIR}/#{name}/#{name}.#{fmt}"
if File.exists? filepath
FileUtils.mv_f filepath, "#{filepath}.old"
end
System::Command.run(
"qemu-img create -f #{fmt} '#{filepath}' #{size_str}", :raise_BadRequest)
return filepath
Expand Down

0 comments on commit d4b17f2

Please sign in to comment.